• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
        • Lint
        • Mlib
          • Scopestack
          • Filtering-by-name
          • Vl-namefactory
          • Substitution
          • Allexprs
          • Hid-tools
            • Following-hids
              • Vl-follow-hidexpr
              • Vl-partselect-type-top-dimension-replacement
              • Vl-hidindex-datatype-resolve-dims
              • Vl-follow-hidexpr-error
              • Vl-follow-hidexpr-dimscheck
                • Vl-follow-hidexpr-dimscheck-aux
              • Vl-index-find-type
              • Vl-follow-hidexpr-dimcheck
              • Vl-partselect-expr-type
              • Vl-ss-find-hidexpr-range!!
              • Vl-hidstep
              • Vl-ss-find-hidexpr-range
              • Vl-genarrayblocklist-find-block
              • Vl-flatten-hidindex
              • Vl-hidexpr-resolved-p
              • Vl-flatten-hidexpr
              • Vl-hidindex-resolved-p
              • Vl-hidtrace
            • Vl-hidexpr-traverse-datatype
            • Abstract-hids
            • Vl-hidexpr-find-type
          • Vl-consteval
          • Range-tools
          • Lvalexprs
          • Hierarchy
          • Finding-by-name
          • Expr-tools
          • Expr-slicing
          • Stripping-functions
          • Stmt-tools
          • Modnamespace
          • Vl-parse-expr-from-str
          • Welltyped
          • Reordering-by-name
          • Flat-warnings
          • Genblob
          • Expr-building
          • Datatype-tools
          • Syscalls
          • Relocate
          • Expr-cleaning
          • Namemangle
          • Caremask
          • Port-tools
          • Lvalues
        • Server
        • Kit
        • Printer
        • Esim-vl
        • Well-formedness
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Following-hids

Vl-follow-hidexpr-dimscheck

Check array indices against the corresponding array bounds.

Signature
(vl-follow-hidexpr-dimscheck name indices dims &key strictp) 
  → 
err
Arguments
name — Guard (stringp name).
indices — Indices from the HID piece we're following. I.e., if we are resolving foo[3][4][5].bar, this would be (3 4 5) as an expression list.
    Guard (vl-exprlist-p indices).
dims — Corresponding dimensions from the declaration, i.e., if foo is declared as a logic [7:0][15:0][3:0], then this would be the list of ([7:0] [15:0] [3:0]).
    Guard (vl-packeddimensionlist-p dims).
strictp — Should we require every index to be resolved?.
    Guard (booleanp strictp).
Returns
err — Type (maybe-stringp err).

Definitions and Theorems

Function: vl-follow-hidexpr-dimscheck-fn

(defun vl-follow-hidexpr-dimscheck-fn (name indices dims strictp)
  (declare (xargs :guard (and (stringp name)
                              (vl-exprlist-p indices)
                              (vl-packeddimensionlist-p dims)
                              (booleanp strictp))))
  (let ((__function__ 'vl-follow-hidexpr-dimscheck))
    (declare (ignorable __function__))
    (b* (((when (atom dims))
          (if (atom indices)
              nil
            (cat "indexing into non-array " name)))
         ((when (atom indices))
          (cat "no indices given for array " name))
         ((when (same-lengthp indices dims))
          (vl-follow-hidexpr-dimscheck-aux name indices dims
                                           :strictp strictp))
         (found (len indices))
         (need (len dims))
         ((when (< found need))
          (cat "too many indices for array " name)))
      (cat "not enough indices for array " name))))

Theorem: maybe-stringp-of-vl-follow-hidexpr-dimscheck

(defthm maybe-stringp-of-vl-follow-hidexpr-dimscheck
 (b*
  ((err (vl-follow-hidexpr-dimscheck-fn name indices dims strictp)))
  (maybe-stringp err))
 :rule-classes :type-prescription)

Theorem: vl-follow-hidexpr-dimscheck-fn-of-str-fix-name

(defthm vl-follow-hidexpr-dimscheck-fn-of-str-fix-name
 (equal (vl-follow-hidexpr-dimscheck-fn (str-fix name)
                                        indices dims strictp)
        (vl-follow-hidexpr-dimscheck-fn name indices dims strictp)))

Theorem: vl-follow-hidexpr-dimscheck-fn-streqv-congruence-on-name

(defthm vl-follow-hidexpr-dimscheck-fn-streqv-congruence-on-name
 (implies
   (streqv name name-equiv)
   (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp)
          (vl-follow-hidexpr-dimscheck-fn
               name-equiv indices dims strictp)))
 :rule-classes :congruence)

Theorem: vl-follow-hidexpr-dimscheck-fn-of-vl-exprlist-fix-indices

(defthm vl-follow-hidexpr-dimscheck-fn-of-vl-exprlist-fix-indices
 (equal
      (vl-follow-hidexpr-dimscheck-fn name (vl-exprlist-fix indices)
                                      dims strictp)
      (vl-follow-hidexpr-dimscheck-fn name indices dims strictp)))

Theorem: vl-follow-hidexpr-dimscheck-fn-vl-exprlist-equiv-congruence-on-indices

(defthm
 vl-follow-hidexpr-dimscheck-fn-vl-exprlist-equiv-congruence-on-indices
 (implies
   (vl-exprlist-equiv indices indices-equiv)
   (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp)
          (vl-follow-hidexpr-dimscheck-fn
               name indices-equiv dims strictp)))
 :rule-classes :congruence)

Theorem: vl-follow-hidexpr-dimscheck-fn-of-vl-packeddimensionlist-fix-dims

(defthm
  vl-follow-hidexpr-dimscheck-fn-of-vl-packeddimensionlist-fix-dims
 (equal
   (vl-follow-hidexpr-dimscheck-fn name indices
                                   (vl-packeddimensionlist-fix dims)
                                   strictp)
   (vl-follow-hidexpr-dimscheck-fn name indices dims strictp)))

Theorem: vl-follow-hidexpr-dimscheck-fn-vl-packeddimensionlist-equiv-congruence-on-dims

(defthm
 vl-follow-hidexpr-dimscheck-fn-vl-packeddimensionlist-equiv-congruence-on-dims
 (implies
   (vl-packeddimensionlist-equiv dims dims-equiv)
   (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp)
          (vl-follow-hidexpr-dimscheck-fn
               name indices dims-equiv strictp)))
 :rule-classes :congruence)

Theorem: vl-follow-hidexpr-dimscheck-fn-of-bool-fix-strictp

(defthm vl-follow-hidexpr-dimscheck-fn-of-bool-fix-strictp
 (equal (vl-follow-hidexpr-dimscheck-fn
             name
             indices dims (acl2::bool-fix strictp))
        (vl-follow-hidexpr-dimscheck-fn name indices dims strictp)))

Theorem: vl-follow-hidexpr-dimscheck-fn-iff-congruence-on-strictp

(defthm vl-follow-hidexpr-dimscheck-fn-iff-congruence-on-strictp
 (implies
   (iff strictp strictp-equiv)
   (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp)
          (vl-follow-hidexpr-dimscheck-fn
               name indices dims strictp-equiv)))
 :rule-classes :congruence)

Subtopics

Vl-follow-hidexpr-dimscheck-aux
Main loop to check each index/dimension pair.