• 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-edgesynth-make-data-inputs
              • Vl-edgesynth-make-clock-inputs
              • Vl-edgesynth-stmt-clklift
              • Vl-edgesynth-blockelim
                • Vl-edgesynth-stmt-blockelim
                • Vl-edgesynth-stmtlist-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-blockelim

Eliminate begin/end blocks and leave us with just an IF structure.

Assumptions:

  • All assignments are to the same register (call it Q).
  • At least one assignment writes to Q.
  • All assignments have compatible delays.

Our goal is to eliminate any begin/end blocks and end up with just assignments, if statements, and null statements. For instance, we might rewrite:

begin                      if (clk1)
  q <= d3;       ----->       q <= d1;
  if (clk2)                else if (clk2)
     q <= d2;                 q <= d2;
  if (clk1)                else
     q <= d1;                 q <= d3;
end

Definitions and Theorems

Function: vl-edgesynth-stmt-blockelim

(defun vl-edgesynth-stmt-blockelim (x curr)
 (declare (xargs :guard (and (and (vl-stmt-p x)
                                  (vl-edgesynth-stmt-p x))
                             (and (vl-stmt-p curr)
                                  (vl-edgesynth-stmt-p curr)))))
 (let ((__function__ 'vl-edgesynth-stmt-blockelim))
   (declare (ignorable __function__))
   (b*
    (((when (vl-nullstmt-p x)) curr)
     ((when (vl-assignstmt-p x)) x)
     ((when (vl-ifstmt-p x))
      (b* (((vl-ifstmt x) x)
           (true (vl-edgesynth-stmt-blockelim x.truebranch curr))
           (false (vl-edgesynth-stmt-blockelim x.falsebranch curr)))
        (change-vl-ifstmt x
                          :truebranch true
                          :falsebranch false)))
     ((when (vl-blockstmt-p x))
      (b* (((vl-blockstmt x) x))
        (vl-edgesynth-stmtlist-blockelim x.stmts curr))))
    curr)))

Function: vl-edgesynth-stmtlist-blockelim

(defun vl-edgesynth-stmtlist-blockelim (x curr)
  (declare (xargs :guard (and (and (vl-stmtlist-p x)
                                   (vl-edgesynth-stmtlist-p x))
                              (and (vl-stmt-p curr)
                                   (vl-edgesynth-stmt-p curr)))))
  (let ((__function__ 'vl-edgesynth-stmtlist-blockelim))
    (declare (ignorable __function__))
    (b* (((when (atom x)) curr)
         (curr (vl-edgesynth-stmt-blockelim (car x)
                                            curr)))
      (vl-edgesynth-stmtlist-blockelim (cdr x)
                                       curr))))

Theorem: return-type-of-vl-edgesynth-stmt-blockelim.new-stmt

(defthm return-type-of-vl-edgesynth-stmt-blockelim.new-stmt
  (implies (and (force (if (vl-stmt-p x)
                           (vl-edgesynth-stmt-p x)
                         'nil))
                (force (vl-stmt-p curr))
                (force (vl-edgesynth-stmt-p curr)))
           (b* ((?new-stmt (vl-edgesynth-stmt-blockelim x curr)))
             (vl-edgesynth-stmt-p new-stmt)))
  :rule-classes :rewrite)

Theorem: return-type-of-vl-edgesynth-stmtlist-blockelim.stmts

(defthm return-type-of-vl-edgesynth-stmtlist-blockelim.stmts
  (implies (and (force (if (vl-stmtlist-p x)
                           (vl-edgesynth-stmtlist-p x)
                         'nil))
                (force (vl-stmt-p curr))
                (force (vl-edgesynth-stmt-p curr)))
           (b* ((?stmts (vl-edgesynth-stmtlist-blockelim x curr)))
             (vl-edgesynth-stmt-p stmts)))
  :rule-classes :rewrite)

Subtopics

Vl-edgesynth-stmt-blockelim
Vl-edgesynth-stmtlist-blockelim