• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Vwsim
      • Fgl
      • Vl
        • Syntax
        • Loader
        • Warnings
        • Getting-started
        • Utilities
        • Printer
        • Kit
        • Mlib
          • Scopestack
          • Hid-tools
          • Filtering-by-name
          • Vl-interface-mocktype
          • Stripping-functions
          • Genblob
          • Expr-tools
          • Hierarchy
          • Extract-vl-types
          • Range-tools
          • Finding-by-name
          • Stmt-tools
          • Modnamespace
          • Flat-warnings
          • Reordering-by-name
          • Datatype-tools
            • Vl-dimensionlist-total-size
            • Vl-maybe-usertype-resolve
            • Vl-dimensionlist-resolved-p
            • Vl-datatype-packedp
            • Vl-datatype-select-ok
              • Vl-dimension-size
              • Vl-datatype-size
              • Vl-maybe-dimension-size
              • Vl-hidexpr-name1
              • Maybe-nat-list
            • Syscalls
            • Allexprs
            • Lvalues
            • Port-tools
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • Datatype-tools

    Vl-datatype-select-ok

    Determines whether this datatype can be selected.

    Signature
    (vl-datatype-select-ok x) → ok
    Arguments
    x — Guard (vl-datatype-p x).

    The input datatype should not have packed or unpacked dimensions; if it does, then it's definitely OK to index into it (though it's only a select if it's the last packed dimension). The input datatype should have usertypes resolved.

    Definitions and Theorems

    Function: vl-datatype-select-ok

    (defun
     vl-datatype-select-ok (x)
     (declare (xargs :guard (vl-datatype-p x)))
     (declare (xargs :guard (vl-datatype-resolved-p x)))
     (let
      ((__function__ 'vl-datatype-select-ok))
      (declare (ignorable __function__))
      (b*
       ((x (vl-maybe-usertype-resolve x)))
       (or
        (consp (vl-datatype->pdims x))
        (consp (vl-datatype->udims x))
        (vl-datatype-case
           x
           (:vl-coretype (b* (((vl-coredatatype-info xinfo)
                               (vl-coretypename->info x.name)))
                             (and xinfo.size (not (eql xinfo.size 1)))))
           (:vl-struct x.packedp)
           (:vl-union x.packedp)
           (:vl-enum t)
           (:vl-usertype (impossible)))))))

    Theorem: vl-datatype-select-ok-of-vl-datatype-fix-x

    (defthm vl-datatype-select-ok-of-vl-datatype-fix-x
            (equal (vl-datatype-select-ok (vl-datatype-fix x))
                   (vl-datatype-select-ok x)))

    Theorem: vl-datatype-select-ok-vl-datatype-equiv-congruence-on-x

    (defthm vl-datatype-select-ok-vl-datatype-equiv-congruence-on-x
            (implies (vl-datatype-equiv x x-equiv)
                     (equal (vl-datatype-select-ok x)
                            (vl-datatype-select-ok x-equiv)))
            :rule-classes :congruence)