• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • 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
            • Vl-range-resolved-p
            • Vl-maybe-range-size
              • Vl-maybe-range-resolved-p
              • Vl-selwidth
              • Vl-range-size
              • Vl-maybe-range-msbidx
              • Vl-maybe-range-lsbidx
              • Vl-maybe-range-lowidx
              • Vl-range-msbidx
              • Vl-range-lsbidx
              • Vl-range-low-idx
              • Vl-maybe-range-revp
              • Vl-range-revp
            • Finding-by-name
            • Stmt-tools
            • Modnamespace
            • Flat-warnings
            • Reordering-by-name
            • Datatype-tools
            • Syscalls
            • Allexprs
            • Lvalues
            • Port-tools
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Testing-utilities
      • Math
    • Range-tools

    Vl-maybe-range-size

    Usual way to compute the width of a net/reg, given its range.

    Signature
    (vl-maybe-range-size x) → size
    Arguments
    x — Guard (vl-maybe-range-p x).
    Returns
    size — Type (posp size).

    If x is the range of a net declaration or register declaration, this function returns its width. That is, if there is a range then the width of this wire or register is the size of the range. And otherwise, it is a single-bit wide.

    Definitions and Theorems

    Function: vl-maybe-range-size

    (defun vl-maybe-range-size (x)
           (declare (xargs :guard (vl-maybe-range-p x)))
           (declare (xargs :guard (vl-maybe-range-resolved-p x)))
           (let ((__function__ 'vl-maybe-range-size))
                (declare (ignorable __function__))
                (if (not x) 1 (vl-range-size x))))

    Theorem: posp-of-vl-maybe-range-size

    (defthm posp-of-vl-maybe-range-size
            (b* ((size (vl-maybe-range-size x)))
                (posp size))
            :rule-classes :type-prescription)

    Theorem: vl-maybe-range-size-of-vl-maybe-range-fix-x

    (defthm vl-maybe-range-size-of-vl-maybe-range-fix-x
            (equal (vl-maybe-range-size (vl-maybe-range-fix x))
                   (vl-maybe-range-size x)))

    Theorem: vl-maybe-range-size-vl-maybe-range-equiv-congruence-on-x

    (defthm vl-maybe-range-size-vl-maybe-range-equiv-congruence-on-x
            (implies (vl-maybe-range-equiv x x-equiv)
                     (equal (vl-maybe-range-size x)
                            (vl-maybe-range-size x-equiv)))
            :rule-classes :congruence)