• 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
            • Stmtrewrite
              • Vl-modulelist-stmtrewrite
              • Vl-blockstmt-rewrite
              • Vl-repeatstmt-rewrite
              • Vl-flatten-blocks
              • Vl-stmt-rewrite-top
              • Vl-casestmt-rewrite
              • Vl-stmt-rewrite
              • Vl-waitstmt-rewrite
              • Vl-ifstmt-combine-rewrite
              • Vl-forstmt-rewrite
                • Vl-initiallist-stmtrewrite
                • Vl-alwayslist-stmtrewrite
                • Vl-initial-stmtrewrite
                • Vl-foreverstmt-rewrite
                • Vl-always-stmtrewrite
                • Vl-module-stmtrewrite
                • Vl-design-stmtrewrite
                • Vl-remove-null-statements
                • Vl-$vcover-stmt-p
                • Vl-$display-stmt-p
                • Vl-caselist-all-null-p
              • 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
    • Stmtrewrite

    Vl-forstmt-rewrite

    Eliminate purely null vl-forstmts.

    Signature
    (vl-forstmt-rewrite x body warnings) → (mv warnings stmt)
    Arguments
    x — Guard (vl-stmt-p x).
    body — Guard (vl-stmt-p body).
    warnings — Guard (vl-warninglist-p warnings).
    Returns
    warnings — Type (vl-warninglist-p warnings), given the guard.
    stmt — Type (vl-stmt-p stmt), given the guard.

    The basic rewrite this performs is:

    for(initlhs = initrhs; test; nextlhs = nextrhs)
       [null] ;
      -->
    [null];

    We could eventually unroll things. This rewrite is generally meant to allow us to ignore for loops with $display statements and similar.

    Definitions and Theorems

    Function: vl-forstmt-rewrite

    (defun vl-forstmt-rewrite (x body warnings)
      (declare (xargs :guard (and (vl-stmt-p x)
                                  (vl-stmt-p body)
                                  (vl-warninglist-p warnings))))
      (declare (xargs :guard (eq (vl-stmt-kind x) :vl-forstmt)))
      (let ((__function__ 'vl-forstmt-rewrite))
        (declare (ignorable __function__))
        (if (vl-nullstmt-p body)
            (mv warnings body)
          (mv warnings
              (change-vl-forstmt x :body body)))))

    Theorem: vl-warninglist-p-of-vl-forstmt-rewrite.warnings

    (defthm vl-warninglist-p-of-vl-forstmt-rewrite.warnings
      (implies (and (force (vl-stmt-p x))
                    (force (vl-stmt-p body))
                    (force (vl-warninglist-p warnings))
                    (force (eq (vl-stmt-kind$inline x)
                               ':vl-forstmt)))
               (b* (((mv ?warnings ?stmt)
                     (vl-forstmt-rewrite x body warnings)))
                 (vl-warninglist-p warnings)))
      :rule-classes :rewrite)

    Theorem: vl-stmt-p-of-vl-forstmt-rewrite.stmt

    (defthm vl-stmt-p-of-vl-forstmt-rewrite.stmt
      (implies (and (force (vl-stmt-p x))
                    (force (vl-stmt-p body))
                    (force (vl-warninglist-p warnings))
                    (force (eq (vl-stmt-kind$inline x)
                               ':vl-forstmt)))
               (b* (((mv ?warnings ?stmt)
                     (vl-forstmt-rewrite x body warnings)))
                 (vl-stmt-p stmt)))
      :rule-classes :rewrite)