• 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
          • Expression-sizing
            • Expression-sizing-minutia
            • Expression-sizing-intro
            • Vl-keyvalue-pattern-collect-array-replacements
            • Vl-assignpattern-positional-replacement
            • Vl-plainarg-exprsize
            • Vl-assignpattern-keyvalue-replacement
            • Vl-keyvalue-pattern-collect-struct-replacements
            • Vl-modulelist-exprsize
            • Vl-expr-assignpattern-extend/truncate
            • Vl-structmemberlist->types
            • Vl-expr-size
              • Vl-expr-selfsize
              • Vl-expr-typedecide
                • Vl-expr-typedecide-aux
                  • Vl-exprlist-typedecide-aux
                • Vl-atom-typedecide
                • Vl-warn-about-signed-shifts
                • Vl-datatype-exprtype
                • Vl-exprtype-max
              • Vl-expr-expandsizes
              • Vl-exprlist-expandsizes
              • Vl-exprlist-size
            • Vl-expr-selfdetermine-type
            • Vl-assignpattern-multi-replacement
            • Vl-parse-keyval-pattern-struct
            • Vl-plainarglist-exprsize
            • Vl-parse-keyval-pattern-array
            • Vl-warn-about-implicit-extension
            • Vl-assigncontext-size
            • Vl-arguments-exprsize
            • Vl-assignpattern-replacement
            • Vl-packeddimensionlist-exprsize
            • Vl-namedparamvaluelist-exprsize
            • Vl-maybe-delayoreventcontrol-exprsize
            • Vl-repeateventcontrol-exprsize
            • Vl-paramvaluelist-exprsize
            • Vl-maybe-packeddimension-exprsize
            • Vl-delayoreventcontrol-exprsize
            • Vl-namedparamvalue-exprsize
            • Vl-namedarglist-exprsize
            • Vl-enumitemlist-exprsize
            • Vl-packeddimension-exprsize
            • Vl-maybe-paramvalue-exprsize
            • Vl-evatomlist-exprsize
            • Vl-atom-selfdetermine-type
            • Vl-rangelist-exprsize
            • Vl-maybe-gatedelay-exprsize
            • Vl-maybe-datatype-exprsize
            • Vl-gatedelay-exprsize
            • Vl-paramargs-exprsize
            • Vl-namedarg-exprsize
            • Vl-eventcontrol-exprsize
            • Vl-enumbasetype-exprsize
            • Vl-delaycontrol-exprsize
            • Vl-paramvalue-exprsize
            • Vl-maybe-range-exprsize
            • Vl-enumitem-exprsize
            • Vl-range-exprsize
            • Vl-paramdecl-exprsize
            • Vl-paramdecllist-exprsize
            • Vl-maybe-expr-size
            • Vl-evatom-exprsize
            • Vl-vardecllist-exprsize
            • Vl-portdecllist-exprsize
            • Vl-modinstlist-exprsize
            • Vl-initiallist-exprsize
            • Vl-gateinstlist-exprsize
            • Vl-fundecllist-exprsize
            • Vl-assign-exprsize
            • Vl-interfaceport-exprsize
            • Vl-assignlist-exprsize
            • Vl-alwayslist-exprsize
            • Vl-portlist-exprsize
            • Vl-modinst-exprsize
            • Vl-gateinst-exprsize
            • Vl-fundecl-exprsize
            • Vl-vardecl-exprsize
            • Vl-regularport-exprsize
            • Vl-portdecl-exprsize
            • Vl-initial-exprsize
            • Vl-always-exprsize
            • Vl-port-exprsize
            • Vl-lvalue-type
            • Vl-classify-extension-warning-hook
            • Welltyped
            • Vl-castexpr->datatype
            • Vl-expr-size-assigncontext
            • Vl-type-expr-pairs-sum-datatype-sizes
            • Vl-basictype->datatype
            • Vl-expr-replace-assignpatterns
            • Vl-design-exprsize
            • Vl-op-simple-vector-p
            • Vl-expr-val-alist-max-count
            • Vl-expr-has-patterns
            • Vl-exprlist-max-count
            • Vl-unsigned-when-size-zero-lst
            • Vl-type-expr-pairs
            • Append-n
            • Vl-expr-val-alist
            • Vl-datatypelist
          • 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
          • 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
  • Vl-expr-typedecide

Vl-expr-typedecide-aux

Core of computing expression signedness.

Signature
(vl-expr-typedecide-aux x ss ctx warnings mode) 
  → 
(mv warnings type)
Arguments
x — Guard (vl-expr-p x).
ss — Guard (vl-scopestack-p ss).
ctx — Guard (vl-context-p ctx).
warnings — Guard (vl-warninglist-p warnings).
mode — Guard (or (eq mode :probably-wrong) (eq mode :probably-right)).
Returns
warnings — Type (vl-warninglist-p warnings).
type — Type (and (vl-maybe-exprtype-p type) (equal (vl-exprtype-p type) (if type t nil))) .

Warning: this function should typically only be called by the expression-sizing transform.

These are the same arguments as vl-expr-typedecide except for mode. You should probably read expression-sizing-minutia to understand the valid modes:

  • In :probably-wrong mode, we treat reduction/logical operations as if they produce signed values when their argument is signed, and we allow the types of self-determined operands in conditional operators, shifts, and so forth to affect the resulting expression type. We do not think this is how sizing is supposed to be done, but a Verilog implementation that was based on a reading of the specification might mistakenly do it this way.
  • In :probably-right mode, we try to behave like other Verilog systems and ignore the type of self-determined operands when computing the resulting types of expressions, and we also treat reduction/logical operations as if they produce unsigned values.

Theorem: return-type-of-vl-expr-typedecide-aux.warnings

(defthm return-type-of-vl-expr-typedecide-aux.warnings
  (b* (((mv ?warnings common-lisp::?type)
        (vl-expr-typedecide-aux x ss ctx warnings mode)))
    (vl-warninglist-p warnings))
  :rule-classes :rewrite)

Theorem: return-type-of-vl-expr-typedecide-aux.type

(defthm return-type-of-vl-expr-typedecide-aux.type
  (b* (((mv ?warnings common-lisp::?type)
        (vl-expr-typedecide-aux x ss ctx warnings mode)))
    (and (vl-maybe-exprtype-p type)
         (equal (vl-exprtype-p type)
                (if type t nil))))
  :rule-classes :rewrite)

Theorem: return-type-of-vl-exprlist-typedecide-aux.warnings

(defthm return-type-of-vl-exprlist-typedecide-aux.warnings
  (b* (((mv ?warnings ?types)
        (vl-exprlist-typedecide-aux x ss ctx warnings mode)))
    (vl-warninglist-p warnings))
  :rule-classes :rewrite)

Theorem: return-type-of-vl-exprlist-typedecide-aux.types

(defthm return-type-of-vl-exprlist-typedecide-aux.types
  (b* (((mv ?warnings ?types)
        (vl-exprlist-typedecide-aux x ss ctx warnings mode)))
    (vl-maybe-exprtype-list-p types))
  :rule-classes :rewrite)

Theorem: vl-exprlist-typedecide-aux-of-cons

(defthm vl-exprlist-typedecide-aux-of-cons
  (equal (vl-exprlist-typedecide-aux (cons a x)
                                     ss ctx warnings mode)
         (b* (((mv warnings car-type)
               (vl-expr-typedecide-aux a ss ctx warnings mode))
              ((mv warnings cdr-type)
               (vl-exprlist-typedecide-aux x ss ctx warnings mode)))
           (mv warnings (cons car-type cdr-type)))))

Theorem: len-of-vl-exprlist-typedecide-aux

(defthm len-of-vl-exprlist-typedecide-aux
 (equal
  (len (mv-nth 1
               (vl-exprlist-typedecide-aux x ss ctx warnings mode)))
  (len x)))

Theorem: true-listp-of-vl-exprlist-typedecide-aux

(defthm true-listp-of-vl-exprlist-typedecide-aux
  (true-listp
       (mv-nth 1
               (vl-exprlist-typedecide-aux x ss ctx warnings mode)))
  :rule-classes :type-prescription)

Theorem: vl-expr-typedecide-aux-of-vl-expr-fix-x

(defthm vl-expr-typedecide-aux-of-vl-expr-fix-x
  (equal (vl-expr-typedecide-aux (vl-expr-fix x)
                                 ss ctx warnings mode)
         (vl-expr-typedecide-aux x ss ctx warnings mode)))

Theorem: vl-expr-typedecide-aux-of-vl-scopestack-fix-ss

(defthm vl-expr-typedecide-aux-of-vl-scopestack-fix-ss
  (equal (vl-expr-typedecide-aux x (vl-scopestack-fix ss)
                                 ctx warnings mode)
         (vl-expr-typedecide-aux x ss ctx warnings mode)))

Theorem: vl-expr-typedecide-aux-of-vl-context-fix-ctx

(defthm vl-expr-typedecide-aux-of-vl-context-fix-ctx
  (equal (vl-expr-typedecide-aux x ss (vl-context-fix ctx)
                                 warnings mode)
         (vl-expr-typedecide-aux x ss ctx warnings mode)))

Theorem: vl-expr-typedecide-aux-of-vl-warninglist-fix-warnings

(defthm vl-expr-typedecide-aux-of-vl-warninglist-fix-warnings
 (equal
      (vl-expr-typedecide-aux x ss ctx (vl-warninglist-fix warnings)
                              mode)
      (vl-expr-typedecide-aux x ss ctx warnings mode)))

Theorem: vl-exprlist-typedecide-aux-of-vl-exprlist-fix-x

(defthm vl-exprlist-typedecide-aux-of-vl-exprlist-fix-x
  (equal (vl-exprlist-typedecide-aux (vl-exprlist-fix x)
                                     ss ctx warnings mode)
         (vl-exprlist-typedecide-aux x ss ctx warnings mode)))

Theorem: vl-exprlist-typedecide-aux-of-vl-scopestack-fix-ss

(defthm vl-exprlist-typedecide-aux-of-vl-scopestack-fix-ss
  (equal (vl-exprlist-typedecide-aux x (vl-scopestack-fix ss)
                                     ctx warnings mode)
         (vl-exprlist-typedecide-aux x ss ctx warnings mode)))

Theorem: vl-exprlist-typedecide-aux-of-vl-context-fix-ctx

(defthm vl-exprlist-typedecide-aux-of-vl-context-fix-ctx
  (equal (vl-exprlist-typedecide-aux x ss (vl-context-fix ctx)
                                     warnings mode)
         (vl-exprlist-typedecide-aux x ss ctx warnings mode)))

Theorem: vl-exprlist-typedecide-aux-of-vl-warninglist-fix-warnings

(defthm vl-exprlist-typedecide-aux-of-vl-warninglist-fix-warnings
 (equal
  (vl-exprlist-typedecide-aux x ss ctx (vl-warninglist-fix warnings)
                              mode)
  (vl-exprlist-typedecide-aux x ss ctx warnings mode)))

Theorem: vl-expr-typedecide-aux-vl-expr-equiv-congruence-on-x

(defthm vl-expr-typedecide-aux-vl-expr-equiv-congruence-on-x
 (implies
      (vl-expr-equiv x x-equiv)
      (equal (vl-expr-typedecide-aux x ss ctx warnings mode)
             (vl-expr-typedecide-aux x-equiv ss ctx warnings mode)))
 :rule-classes :congruence)

Theorem: vl-expr-typedecide-aux-vl-scopestack-equiv-congruence-on-ss

(defthm vl-expr-typedecide-aux-vl-scopestack-equiv-congruence-on-ss
 (implies
      (vl-scopestack-equiv ss ss-equiv)
      (equal (vl-expr-typedecide-aux x ss ctx warnings mode)
             (vl-expr-typedecide-aux x ss-equiv ctx warnings mode)))
 :rule-classes :congruence)

Theorem: vl-expr-typedecide-aux-vl-context-equiv-congruence-on-ctx

(defthm vl-expr-typedecide-aux-vl-context-equiv-congruence-on-ctx
 (implies
      (vl-context-equiv ctx ctx-equiv)
      (equal (vl-expr-typedecide-aux x ss ctx warnings mode)
             (vl-expr-typedecide-aux x ss ctx-equiv warnings mode)))
 :rule-classes :congruence)

Theorem: vl-expr-typedecide-aux-vl-warninglist-equiv-congruence-on-warnings

(defthm
 vl-expr-typedecide-aux-vl-warninglist-equiv-congruence-on-warnings
 (implies
      (vl-warninglist-equiv warnings warnings-equiv)
      (equal (vl-expr-typedecide-aux x ss ctx warnings mode)
             (vl-expr-typedecide-aux x ss ctx warnings-equiv mode)))
 :rule-classes :congruence)

Theorem: vl-exprlist-typedecide-aux-vl-exprlist-equiv-congruence-on-x

(defthm vl-exprlist-typedecide-aux-vl-exprlist-equiv-congruence-on-x
 (implies
  (vl-exprlist-equiv x x-equiv)
  (equal (vl-exprlist-typedecide-aux x ss ctx warnings mode)
         (vl-exprlist-typedecide-aux x-equiv ss ctx warnings mode)))
 :rule-classes :congruence)

Theorem: vl-exprlist-typedecide-aux-vl-scopestack-equiv-congruence-on-ss

(defthm
    vl-exprlist-typedecide-aux-vl-scopestack-equiv-congruence-on-ss
 (implies
  (vl-scopestack-equiv ss ss-equiv)
  (equal (vl-exprlist-typedecide-aux x ss ctx warnings mode)
         (vl-exprlist-typedecide-aux x ss-equiv ctx warnings mode)))
 :rule-classes :congruence)

Theorem: vl-exprlist-typedecide-aux-vl-context-equiv-congruence-on-ctx

(defthm
      vl-exprlist-typedecide-aux-vl-context-equiv-congruence-on-ctx
 (implies
  (vl-context-equiv ctx ctx-equiv)
  (equal (vl-exprlist-typedecide-aux x ss ctx warnings mode)
         (vl-exprlist-typedecide-aux x ss ctx-equiv warnings mode)))
 :rule-classes :congruence)

Theorem: vl-exprlist-typedecide-aux-vl-warninglist-equiv-congruence-on-warnings

(defthm
 vl-exprlist-typedecide-aux-vl-warninglist-equiv-congruence-on-warnings
 (implies
  (vl-warninglist-equiv warnings warnings-equiv)
  (equal (vl-exprlist-typedecide-aux x ss ctx warnings mode)
         (vl-exprlist-typedecide-aux x ss ctx warnings-equiv mode)))
 :rule-classes :congruence)

Theorem: warning-irrelevance-of-vl-expr-typedecide-aux

(defthm warning-irrelevance-of-vl-expr-typedecide-aux
  (let ((ret1 (vl-expr-typedecide-aux x ss ctx warnings mode))
        (ret2 (vl-expr-typedecide-aux x ss nil nil mode)))
    (implies (syntaxp (not (and (equal ctx ''nil)
                                (equal warnings ''nil))))
             (equal (mv-nth 1 ret1)
                    (mv-nth 1 ret2)))))

Theorem: warning-irrelevance-of-vl-exprlist-typedecide-aux

(defthm warning-irrelevance-of-vl-exprlist-typedecide-aux
  (let ((ret1 (vl-exprlist-typedecide-aux x ss ctx warnings mode))
        (ret2 (vl-exprlist-typedecide-aux x ss nil nil mode)))
    (implies (syntaxp (not (and (equal ctx ''nil)
                                (equal warnings ''nil))))
             (equal (mv-nth 1 ret1)
                    (mv-nth 1 ret2)))))

Theorem: symbolp-of-vl-expr-typedecide-aux

(defthm symbolp-of-vl-expr-typedecide-aux
  (symbolp (mv-nth 1
                   (vl-expr-typedecide-aux x ss ctx warnings mode)))
  :rule-classes :type-prescription)

Theorem: vl-exprlist-typedecide-aux-when-atom

(defthm vl-exprlist-typedecide-aux-when-atom
 (implies (atom x)
          (equal (vl-exprlist-typedecide-aux x ss ctx warnings mode)
                 (mv (ok) nil))))

Subtopics

Vl-exprlist-typedecide-aux