• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
          • Expression-sizing
          • Occform
          • Oprewrite
          • Expand-functions
          • Delayredux
          • Unparameterization
          • Caseelim
          • Split
          • Selresolve
          • Weirdint-elim
          • Vl-delta
          • Replicate-insts
          • Rangeresolve
          • Propagate
          • Clean-selects
          • Clean-params
          • Blankargs
          • Inline-mods
          • Expr-simp
          • Trunc
          • Always-top
            • Edgesynth
              • Vl-edgesynth-stmt-p
              • Vl-edgetable-p
              • Vl-always-edgesynth
              • Vl-edgesynth-merge-data-ifs
              • Vl-assignstmtlist->controls
              • Vl-assignstmtlist->lhses
              • Vl-assignstmtlist->rhses
              • Vl-edgesynth-flatten-data-ifs
              • Vl-edgesynth-pattern-match
              • Nedgeflop
                • Vl-make-same-bitselect-from-each
                • Vl-primitive-mkports
                • Vl-nedgeflop-ifstmt
                  • Vl-make-1-bit-n-edge-flop
                  • Vl-make-nedgeflop-insts
                  • Vl-nedgeflop-always
                  • Vl-nedgeflop-clkedge-assigns
                  • Vl-nedgeflop-update-sexpr
                  • Vl-nedgeflop-e-wires
                  • Vl-make-delay-assigns
                  • Vl-nedgeflop-posedge-clks
                  • Vl-nedgeflop-data-mux
                  • Vl-nedgeflop-some-edge-sexpr
                  • Vl-modinsts-add-atts
                  • Vl-nedgeflop-or-edges
                • Vl-edgesynth-make-data-inputs
                • Vl-edgesynth-make-clock-inputs
                • Vl-edgesynth-stmt-clklift
                • Vl-edgesynth-blockelim
                • Vl-alwayslist-edgesynth
                • Vl-edgesynth-create
                • Vl-edgesynth-classify-iftest
                • Vl-module-edgesynth
                • Vl-edgesynth-normalize-ifs
                • Vl-edgesynth-delays-okp
                • Vl-edgesynth-stmt-assigns
                • Vl-make-edgetable
                • Vl-edgesynth-sort-edges
                • Vl-modulelist-edgesynth
                • Vl-modulelist-edgesynth-aux
                • Vl-assignstmtlist-p
                • Vl-edgesynth-edgelist-p
                • Vl-assigncontrols-p
                • Vl-edgesynth-stmt-conditions
                • Vl-edgesynth-edge-p
                • Vl-design-edgesynth
                • Vl-edgesynth-get-delay
                • Vl-edgesynth-iftype-p
                • Edge-tables
              • Stmtrewrite
              • Cblock
              • Vl-always-convert-regports
              • Vl-always-convert-regs
              • Stmttemps
              • Edgesplit
              • Vl-always-check-reg
              • Vl-convert-regs
              • Latchsynth
              • Vl-always-check-regs
              • Vl-match-always-at-some-edges
              • Unelse
              • Vl-always-convert-reg
              • Vl-design-always-backend
              • Vl-stmt-guts
              • Vl-always-convert-regport
              • Vl-always-scary-regs
              • Eliminitial
              • Ifmerge
              • Vl-edge-control-p
              • Elimalways
            • Gatesplit
            • Gate-elim
            • Expression-optimization
            • Elim-supplies
            • Wildelim
            • Drop-blankports
            • Clean-warnings
            • Addinstnames
            • Custom-transform-hooks
            • Annotate
            • Latchcode
            • Elim-unused-vars
            • Problem-modules
          • Lint
          • Mlib
          • Server
          • Kit
          • Printer
          • Esim-vl
          • Well-formedness
        • Sv
        • Fgl
        • Vwsim
        • Vl
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Nedgeflop

    Vl-nedgeflop-ifstmt

    Build the Verilog if-statement for a primitive n-edge flop.

    Signature
    (vl-nedgeflop-ifstmt q-expr clk-exprs data-exprs) → guts
    Arguments
    q-expr — e.g., q.
        Guard (vl-expr-p q-expr).
    clk-exprs — e.g., (clk0 clk1 clk2).
        Guard (vl-exprlist-p clk-exprs).
    data-exprs — e.g., (d0 d1 d2).
        Guard (vl-exprlist-p data-exprs).
    Returns
    guts — e.g., if (clk0) q <= d0; else if (clk1) q <= d1; else q <= d2;.
        Type (vl-stmt-p guts), given the guard.

    Definitions and Theorems

    Function: vl-nedgeflop-ifstmt

    (defun vl-nedgeflop-ifstmt (q-expr clk-exprs data-exprs)
      (declare (xargs :guard (and (vl-expr-p q-expr)
                                  (vl-exprlist-p clk-exprs)
                                  (vl-exprlist-p data-exprs))))
      (declare (xargs :guard (and (consp clk-exprs)
                                  (same-lengthp clk-exprs data-exprs))))
      (let ((__function__ 'vl-nedgeflop-ifstmt))
        (declare (ignorable __function__))
        (b* (((when (atom clk-exprs))
              (impossible)
              (make-vl-nullstmt))
             (assign1 (make-vl-assignstmt :type :vl-nonblocking
                                          :lvalue q-expr
                                          :expr (car data-exprs)
                                          :loc *vl-fakeloc*))
             ((when (atom (cdr clk-exprs))) assign1))
          (make-vl-ifstmt
               :condition (car clk-exprs)
               :truebranch assign1
               :falsebranch (vl-nedgeflop-ifstmt q-expr (cdr clk-exprs)
                                                 (cdr data-exprs))))))

    Theorem: vl-stmt-p-of-vl-nedgeflop-ifstmt

    (defthm vl-stmt-p-of-vl-nedgeflop-ifstmt
     (implies
          (and (force (vl-expr-p q-expr))
               (force (vl-exprlist-p clk-exprs))
               (force (vl-exprlist-p data-exprs))
               (force (consp clk-exprs))
               (force (same-lengthp clk-exprs data-exprs)))
          (b* ((guts (vl-nedgeflop-ifstmt q-expr clk-exprs data-exprs)))
            (vl-stmt-p guts)))
     :rule-classes :rewrite)