• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
        • Symbolic-test-vectors
        • Esim-primitives
        • E-conversion
          • Vl-ealist-p
          • Modinsts-to-eoccs
          • Vl-module-make-esim
          • Exploding-vectors
          • Resolving-multiple-drivers
            • Vl-res-sigma-p
            • Vl-res-rewrite-occs
              • Vl-res-rewrite-pat
              • Vl-res-rewrite-occ
            • Vl-add-res-modules
            • Vl-make-res-occs
          • Vl-modulelist-make-esims
          • Vl-module-check-e-ok
          • Vl-collect-design-wires
          • Adding-z-drivers
          • Vl-design-to-e
          • Vl-design-to-e-check-ports
          • Vl-design-to-e-main
          • Port-bit-checking
        • Esim-steps
        • Patterns
        • Mod-internal-paths
        • Defmodules
        • Esim-simplify-update-fns
        • Esim-tutorial
        • Esim-vl
      • Vl2014
      • Sv
      • Vwsim
      • Fgl
      • Vl
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Testing-utilities
    • Math
  • Resolving-multiple-drivers

Vl-res-rewrite-occs

Rewrite occurrences to drive new, fresh wires instead of multiply driven wires.

Signature: (vl-res-rewrite-occs occs mds idx sigma) returns (mv occs' idx' sigma').

  • MDS ("multiply drivens") says which wires have multiple drivers. Since we need to be able to quickly look up whether a wire needs to be rewritten, MDS is a fast alist whose keys are the vl-emodwire-ps that are multiply driven. The values are irrelevant. This alist isn't changed during the course of the rewriting.
  • IDX is a name index used for fresh name generation. We expect that it is initially set to the highest index of any emodwire in the module whose basename is vl_res. We increment it whenever we need to create a new, fresh wire.
  • SIGMA is a vl-res-sigma-p that we use to record the names of the new wires that are being driven. It starts empty and eventually should bind every emodwire w in MDS to the list of new names being driven instead of w.

Definitions and Theorems

Function: vl-res-rewrite-occs

(defun
    vl-res-rewrite-occs (occs mds idx sigma)
    "Returns (MV OCCS' IDX' SIGMA')"
    (declare (xargs :guard (and (natp idx)
                                (vl-emodwirelist-p (alist-keys mds))
                                (vl-res-sigma-p sigma))))
    (b* (((when (atom occs))
          (mv nil (lnfix idx) sigma))
         ((mv car idx sigma)
          (vl-res-rewrite-occ (car occs)
                              mds idx sigma))
         ((mv cdr idx sigma)
          (vl-res-rewrite-occs (cdr occs)
                               mds idx sigma)))
        (mv (cons car cdr) idx sigma)))

Theorem: vl-res-rewrite-occs-mvtypes-0

(defthm
     vl-res-rewrite-occs-mvtypes-0
     (true-listp (mv-nth 0
                         (vl-res-rewrite-occs occs mds idx sigma)))
     :rule-classes :type-prescription)

Theorem: vl-res-rewrite-occs-mvtypes-1

(defthm vl-res-rewrite-occs-mvtypes-1
        (natp (mv-nth 1
                      (vl-res-rewrite-occs occs mds idx sigma)))
        :rule-classes :type-prescription)

Theorem: vl-res-sigma-p-of-vl-res-rewrite-occs

(defthm
   vl-res-sigma-p-of-vl-res-rewrite-occs
   (implies (and (vl-emodwirelist-p (alist-keys mds))
                 (vl-res-sigma-p sigma))
            (vl-res-sigma-p
                 (mv-nth 2
                         (vl-res-rewrite-occs occ mds idx sigma)))))

Theorem: good-esim-occsp-of-vl-res-rewrite-occs

(defthm
   good-esim-occsp-of-vl-res-rewrite-occs
   (implies (good-esim-occsp occ)
            (good-esim-occsp
                 (mv-nth 0
                         (vl-res-rewrite-occs occ mds idx sigma)))))

Subtopics

Vl-res-rewrite-pat
Rewrite an output pattern to eliminate multiple drivers.
Vl-res-rewrite-occ
Rewrite an occurrence to eliminate multiple drivers.