• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Lexer
            • Lex-strings
            • Lex-identifiers
            • Vl-typo-uppercase-p
            • Vl-typo-number-p
            • Vl-typo-lowercase-p
            • Lex-numbers
              • Vl-z-digit-p
              • Vl-x-digit-p
              • Vl-underscore-or-octal-digit-p
              • Vl-underscore-or-hex-digit-p
              • Vl-underscore-or-decimal-digit-p
              • Vl-underscore-or-binary-digit-p
              • Vl-octal-digit-p
              • Vl-non-zero-decimal-digit-p
              • Vl-hex-digit-p
              • Vl-decimal-digit-p
              • Vl-binary-digit-p
              • Vl-lex-integer
              • Vl-correct-bitlist
              • Vl-lex-time-or-real-number
              • Vl-read-decimal-value
                • Vl-read-decimal-value-prefix/remainder-thms
              • Vl-lex-unbased-unsized-literal
              • Vl-lex-number
              • Vl-read-non-zero-unsigned-number
              • Vl-read-any-base
              • Vl-read-unsigned-number
              • Vl-read-time-unit
              • Vl-read-binary-value
              • Vl-read-real-tail
              • Vl-read-octal-value
              • Vl-read-hex-value
              • Vl-read-decimal-base
              • Vl-read-octal-base
              • Vl-read-hex-base
              • Vl-read-binary-base
              • Vl-hex-digits-to-bitlist
              • Vl-octal-digits-to-bitlist
              • Vl-decimal-digits-to-bitlist
              • Vl-binary-digits-to-bitlist
              • Vl-underscore-or-octal-digit-list-p
              • Vl-underscore-or-hex-digit-list-p
              • Vl-underscore-or-decimal-digit-list-p
              • Vl-underscore-or-binary-digit-list-p
              • Vl-non-zero-decimal-digit-list-p
              • Vl-decimal-digit-list-p
              • Vl-binary-digit-list-p
              • Vl-z-digit-list-p
              • Vl-x-digit-list-p
              • Vl-octal-digit-list-p
              • Vl-hex-digit-list-p
              • Vl-timeunit-lookup
            • Chartypes
            • Vl-lex
            • Defchar
            • Tokens
            • Lex-keywords
            • Lexstate
            • Make-test-tokens
            • Lexer-utils
            • Lex-comments
            • Vl-typo-uppercase-list-p
            • Vl-typo-lowercase-list-p
            • Vl-typo-number-list-p
          • Vl-loadstate
          • Parser
          • Vl-load-merge-descriptions
          • Scope-of-defines
          • Vl-load-file
          • Vl-flush-out-descriptions
          • Vl-description
          • Vl-loadresult
          • Vl-read-file
          • Vl-find-basename/extension
          • Vl-find-file
          • Vl-read-files
          • Extended-characters
          • Vl-load
          • Vl-load-main
          • Vl-load-description
          • Vl-descriptions-left-to-load
          • Inject-warnings
          • Vl-load-descriptions
          • Vl-load-files
          • Vl-load-summary
          • Vl-collect-modules-from-descriptions
          • Vl-descriptionlist
        • Transforms
        • Lint
        • Mlib
        • Server
        • Kit
        • Printer
        • Esim-vl
        • Well-formedness
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Lex-numbers

Vl-read-decimal-value

Matches unsigned_number | x_digit { _ } | z_digit { _ }.

Signature
(vl-read-decimal-value echars) → (mv prefix remainder)
Arguments
echars — Guard (vl-echarlist-p echars).

This doesn't correspond to a named production in the Verilog grammars, but captures everything that's legal after the decimal_base part of a decimal_number. That is, we're basically refactoring decimal_number as follows:

decimal-number ::= unsigned_number
                 | [size] decimal_base decimal_value

decimal_value ::= unsigned_number
                | x_digit { _ }
                | z_digit { _ }

Neither Verilog-2005 and SystemVerilog-2012 explicitly rules out spaces in the x_digit and z_digit cases here, so arguably the spec allows for syntax like 10 'd x__ __ __. However, this seems crazy and none of Verilog-XL, NCVerilog, or VCS accepts such syntax, so we think this is just a minor oversight in the standards.

Definitions and Theorems

Function: vl-read-decimal-value

(defun vl-read-decimal-value (echars)
  (declare (xargs :guard (vl-echarlist-p echars)))
  (let ((__function__ 'vl-read-decimal-value))
    (declare (ignorable __function__))
    (b* (((when (atom echars)) (mv nil echars))
         ((unless (or (vl-x-digit-echar-p (car echars))
                      (vl-z-digit-echar-p (car echars))))
          (vl-read-unsigned-number echars))
         ((mv prefix remainder)
          (vl-read-while-underscore (cdr echars))))
      (mv (cons (car echars) prefix)
          remainder))))

Theorem: prefix-of-vl-read-decimal-value

(defthm prefix-of-vl-read-decimal-value
 (and
   (true-listp (mv-nth 0 (vl-read-decimal-value echars)))
   (implies
        (force (vl-echarlist-p echars))
        (vl-echarlist-p (mv-nth 0 (vl-read-decimal-value echars)))))
 :rule-classes
 ((:rewrite)
  (:type-prescription
       :corollary
       (true-listp (mv-nth 0 (vl-read-decimal-value echars))))))

Theorem: remainder-of-vl-read-decimal-value

(defthm remainder-of-vl-read-decimal-value
 (and
   (equal (true-listp (mv-nth 1 (vl-read-decimal-value echars)))
          (true-listp echars))
   (implies
        (force (vl-echarlist-p echars))
        (vl-echarlist-p (mv-nth 1 (vl-read-decimal-value echars)))))
 :rule-classes
 ((:rewrite)
  (:type-prescription
     :corollary
     (implies
          (true-listp echars)
          (true-listp (mv-nth 1 (vl-read-decimal-value echars)))))))

Theorem: append-of-vl-read-decimal-value

(defthm append-of-vl-read-decimal-value
  (equal (append (mv-nth 0 (vl-read-decimal-value echars))
                 (mv-nth 1 (vl-read-decimal-value echars)))
         echars))

Theorem: no-change-loser-of-vl-read-decimal-value

(defthm no-change-loser-of-vl-read-decimal-value
  (implies (not (mv-nth 0 (vl-read-decimal-value echars)))
           (equal (mv-nth 1 (vl-read-decimal-value echars))
                  echars)))

Theorem: acl2-count-of-vl-read-decimal-value-weak

(defthm acl2-count-of-vl-read-decimal-value-weak
  (<= (acl2-count (mv-nth 1 (vl-read-decimal-value echars)))
      (acl2-count echars))
  :rule-classes ((:rewrite) (:linear)))

Theorem: acl2-count-of-vl-read-decimal-value-strong

(defthm acl2-count-of-vl-read-decimal-value-strong
  (implies (mv-nth 0 (vl-read-decimal-value echars))
           (< (acl2-count (mv-nth 1 (vl-read-decimal-value echars)))
              (acl2-count echars)))
  :rule-classes ((:rewrite) (:linear)))

Subtopics

Vl-read-decimal-value-prefix/remainder-thms
Prefix and remainder theorems for vl-read-decimal-value, automatically generated by def-prefix/remainder-thms.