• 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-normalize-ifs

    Try to push data IFs down, pull clock IFs up, and align the polarity of clock-based IFs with the edge declarations.

    Signature
    (vl-edgesynth-normalize-ifs x edgetable) → new-stmt
    Arguments
    x — Guard (and (vl-stmt-p x) (vl-edgesynth-stmt-p x)).
    edgetable — Guard (vl-edgetable-p edgetable).
    Returns
    new-stmt — Type (vl-edgesynth-stmt-p new-stmt), given the guard.

    Definitions and Theorems

    Function: vl-edgesynth-normalize-ifs

    (defun vl-edgesynth-normalize-ifs (x edgetable)
     (declare (xargs :guard (and (and (vl-stmt-p x)
                                      (vl-edgesynth-stmt-p x))
                                 (vl-edgetable-p edgetable))))
     (let ((__function__ 'vl-edgesynth-normalize-ifs))
       (declare (ignorable __function__))
       (b*
        (((when (vl-atomicstmt-p x)) x)
         ((when (vl-ifstmt-p x))
          (b*
           (((vl-ifstmt x) x)
            ((mv type guts)
             (vl-edgesynth-classify-iftest x.condition edgetable))
            (true (vl-edgesynth-normalize-ifs x.truebranch edgetable))
            (false (vl-edgesynth-normalize-ifs x.falsebranch edgetable))
            ((when (eq type :clock))
             (b* ((clockname (vl-idexpr->name guts))
                  (edge (cdr (hons-assoc-equal clockname edgetable)))
                  (posedgep (vl-edgesynth-edge->posedgep edge))
                  ((when posedgep)
                   (make-vl-ifstmt :condition guts
                                   :truebranch true
                                   :falsebranch false)))
               (make-vl-ifstmt :condition (vl-condition-neg guts)
                               :truebranch false
                               :falsebranch true)))
            ((when (eq type :nclock))
             (b* ((clockname (vl-idexpr->name guts))
                  (edge (cdr (hons-assoc-equal clockname edgetable)))
                  (posedgep (vl-edgesynth-edge->posedgep edge))
                  ((when posedgep)
                   (make-vl-ifstmt :condition guts
                                   :truebranch false
                                   :falsebranch true)))
               (make-vl-ifstmt :condition (vl-condition-neg guts)
                               :truebranch true
                               :falsebranch false)))
            ((unless (eq type :data)) x))
           x))
         ((when (vl-blockstmt-p x))
          (raise "Thought we already got rid of block statements!")
          x))
        (raise "Should be impossible.")
        x)))

    Theorem: vl-edgesynth-stmt-p-of-vl-edgesynth-normalize-ifs

    (defthm vl-edgesynth-stmt-p-of-vl-edgesynth-normalize-ifs
      (implies (and (force (if (vl-stmt-p x)
                               (vl-edgesynth-stmt-p x)
                             'nil))
                    (force (vl-edgetable-p edgetable)))
               (b* ((new-stmt (vl-edgesynth-normalize-ifs x edgetable)))
                 (vl-edgesynth-stmt-p new-stmt)))
      :rule-classes :rewrite)