• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • 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-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
    • Edgesynth

    Vl-edgesynth-make-clock-inputs

    Create (if necessary) temporary wires for the clock inputs.

    Signature
    (vl-edgesynth-make-clock-inputs edges loc delta) 
      → 
    (mv clk-exprs delta)
    Arguments
    edges — Priority-ordered edges, may be posedge/negedges.
        Guard (vl-edgesynth-edgelist-p edges).
    loc — Location for new module elements.
        Guard (vl-location-p loc).
    delta — Delta we're extending.
        Guard (vl-delta-p delta).
    Returns
    clk-exprs — New clock expressions in priority order.
        Type (vl-exprlist-p clk-exprs), given the guard.
    delta — Extended delta.
        Type (vl-delta-p delta), given the guard.

    Our primitive n-edge-flop modules are all posedge driven. This is where we convert any negedge signals into posedge signals.

    Definitions and Theorems

    Function: vl-edgesynth-make-clock-inputs

    (defun vl-edgesynth-make-clock-inputs (edges loc delta)
     (declare (xargs :guard (and (vl-edgesynth-edgelist-p edges)
                                 (vl-location-p loc)
                                 (vl-delta-p delta))))
     (let ((__function__ 'vl-edgesynth-make-clock-inputs))
      (declare (ignorable __function__))
      (b*
       (((when (atom edges)) (mv nil delta))
        ((mv rest delta)
         (vl-edgesynth-make-clock-inputs (cdr edges)
                                         loc delta))
        (expr (vl-edgesynth-edge->expr (car edges)))
        (posedgep (vl-edgesynth-edge->posedgep (car edges)))
        ((when posedgep)
         (mv (cons expr rest) delta))
        ((vl-delta delta) delta)
        (name (vl-idexpr->name expr))
        ((mv temp-name nf)
         (vl-namefactory-plain-name (cat name "_bar")
                                    delta.nf))
        ((mv temp-expr temp-decl)
         (vl-occform-mkwire temp-name 1
                            :loc loc))
        (~expr (make-vl-nonatom :op :vl-unary-bitnot
                                :args (list expr)
                                :finalwidth 1
                                :finaltype (vl-expr->finaltype expr)))
        (temp-assign (make-vl-assign :lvalue temp-expr
                                     :expr ~expr
                                     :loc loc))
        (delta
           (change-vl-delta delta
                            :nf nf
                            :vardecls (cons temp-decl delta.vardecls)
                            :assigns (cons temp-assign delta.assigns))))
       (mv (cons temp-expr rest) delta))))

    Theorem: vl-exprlist-p-of-vl-edgesynth-make-clock-inputs.clk-exprs

    (defthm vl-exprlist-p-of-vl-edgesynth-make-clock-inputs.clk-exprs
      (implies (and (vl-edgesynth-edgelist-p edges)
                    (vl-location-p loc)
                    (vl-delta-p delta))
               (b* (((mv ?clk-exprs ?delta)
                     (vl-edgesynth-make-clock-inputs edges loc delta)))
                 (vl-exprlist-p clk-exprs)))
      :rule-classes :rewrite)

    Theorem: vl-delta-p-of-vl-edgesynth-make-clock-inputs.delta

    (defthm vl-delta-p-of-vl-edgesynth-make-clock-inputs.delta
      (implies (and (vl-edgesynth-edgelist-p edges)
                    (vl-location-p loc)
                    (vl-delta-p delta))
               (b* (((mv ?clk-exprs ?delta)
                     (vl-edgesynth-make-clock-inputs edges loc delta)))
                 (vl-delta-p delta)))
      :rule-classes :rewrite)

    Theorem: vl-edgesynth-make-clock-inputs-mvtypes-0

    (defthm vl-edgesynth-make-clock-inputs-mvtypes-0
      (true-listp
           (mv-nth 0
                   (vl-edgesynth-make-clock-inputs edges loc delta)))
      :rule-classes :type-prescription)