• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
        • Syntax
        • Loader
          • Preprocessor
          • Vl-loadconfig
          • Vl-loadstate
          • Lexer
          • Parser
            • Parse-expressions
            • Parse-udps
            • Parse-statements
            • Parse-property
            • Vl-genelements
            • Parse-paramdecls
            • Parse-blockitems
            • Parse-utils
            • Parse-insts
            • Parse-functions
            • Parse-assignments
              • Parse-lvalues-2005
                • Vl-parse-lvalue-2005
                • Vl-parse-1+-lvalues-separated-by-commas-2005
              • Vl-parse-continuous-assign
              • Vl-parse-list-of-variable-assignments
              • Vl-parse-list-of-net-assignments
              • Vl-parse-variable-lvalue-2012-aux
              • Vl-parse-net-lvalue-2012-aux
              • Vl-parse-variable-lvalue-2012
              • Vl-parse-variable-assignment
              • Vl-parse-net-lvalue-2012
              • Vl-parse-net-assignment
              • Vl-build-assignments
              • Vl-parse-variable-lvalue
              • Vl-parse-net-lvalue
            • Parse-clocking
            • Parse-strengths
            • Vl-parse-genvar-declaration
            • Vl-parse
            • Parse-netdecls
            • Parse-asserts
            • Vl-maybe-parse-lifetime
            • Parse-dpi-import-export
            • Parse-ports
            • Parse-timeunits
            • Seq
            • Parse-packages
            • Parse-eventctrl
          • Vl-load-merge-descriptions
          • Vl-find-basename/extension
          • Vl-load-file
          • Vl-loadresult
          • Scope-of-defines
          • Vl-find-file
          • Vl-flush-out-descriptions
          • Vl-description
          • Vl-read-file
          • Vl-includeskips-report-gather
          • Vl-load-main
          • Extended-characters
          • Vl-load
          • Vl-load-description
          • Vl-descriptions-left-to-load
          • Inject-warnings
          • Vl-preprocess-debug
          • Vl-write-preprocessor-debug-file
          • Vl-read-file-report-gather
          • Vl-load-descriptions
          • Vl-load-files
          • Translate-off
          • Vl-load-read-file-hook
          • Vl-read-file-report
          • Vl-loadstate-pad
          • Vl-load-summary
          • Vl-collect-modules-from-descriptions
          • Vl-loadstate->warnings
          • Vl-iskips-report
          • Vl-descriptionlist
        • Warnings
        • Getting-started
        • Utilities
        • Printer
        • Kit
        • Mlib
        • Transforms
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Parse-assignments

Parse-lvalues-2005

Parser for Verilog-2005 net_lvalue or variable_lvalues.

The Verilog-2005 grammar distinguishes between variable_lvalues and net_lvalues, but if we expand away simple aliases such as

hierarchial_net_identifier ::= hierarchial_identifier,

and also account for our treatment of a constant_expression being just an ordinary expression, then we find that both of these are the same thing:

net_lvalue ::=
   hierarchial_identifier [ { '[' expression ']' '[' range_expression ']' } ]
 | '{' net_lvalue { ',' net_lvalue } '}'

variable_lvalue ::=
   hierarchial_identifier [ { '[' expression ']' '[' range_expression ']' } ]
 | '{' variable_lvalue { ',' variable_lvalue } '}'

Definitions and Theorems

Function: vl-parse-lvalue-2005-fn

(defun vl-parse-lvalue-2005-fn (tokstream config)
  (declare (xargs :stobjs (tokstream)))
  (declare (xargs :guard (vl-loadconfig-p config)))
  (declare (ignorable config))
  (let ((__function__ 'vl-parse-lvalue-2005))
    (declare (ignorable __function__))
    (if (not (vl-is-token? :vl-lcurly))
        (vl-parse-indexed-id)
      (seq tokstream
           (:= (vl-match-token :vl-lcurly))
           (args := (vl-parse-1+-lvalues-separated-by-commas-2005))
           (:= (vl-match-token :vl-rcurly))
           (return (make-vl-concat :parts args))))))

Function: vl-parse-1+-lvalues-separated-by-commas-2005-fn

(defun vl-parse-1+-lvalues-separated-by-commas-2005-fn
       (tokstream config)
 (declare (xargs :stobjs (tokstream)))
 (declare (xargs :guard (vl-loadconfig-p config)))
 (declare (ignorable config))
 (let ((__function__ 'vl-parse-1+-lvalues-separated-by-commas-2005))
  (declare (ignorable __function__))
  (seq
     tokstream
     (first :s= (vl-parse-lvalue-2005))
     (when (vl-is-token? :vl-comma)
           (:= (vl-match))
           (rest := (vl-parse-1+-lvalues-separated-by-commas-2005)))
     (return (cons first rest)))))

Theorem: count-strong-vl-parse-lvalue-2005

(defthm count-strong-vl-parse-lvalue-2005
 (and (<= (vl-tokstream-measure
               :tokstream (mv-nth 2 (vl-parse-lvalue-2005)))
          (vl-tokstream-measure))
      (implies (not (mv-nth 0 (vl-parse-lvalue-2005)))
               (< (vl-tokstream-measure
                       :tokstream (mv-nth 2 (vl-parse-lvalue-2005)))
                  (vl-tokstream-measure))))
 :rule-classes ((:rewrite) (:linear)))

Theorem: count-strong-vl-parse-1+-lvalues-separated-by-commas-2005

(defthm count-strong-vl-parse-1+-lvalues-separated-by-commas-2005
 (and
  (<= (vl-tokstream-measure
           :tokstream
           (mv-nth 2
                   (vl-parse-1+-lvalues-separated-by-commas-2005)))
      (vl-tokstream-measure))
  (implies
    (not (mv-nth 0
                 (vl-parse-1+-lvalues-separated-by-commas-2005)))
    (< (vl-tokstream-measure
            :tokstream
            (mv-nth 2
                    (vl-parse-1+-lvalues-separated-by-commas-2005)))
       (vl-tokstream-measure))))
 :rule-classes ((:rewrite) (:linear)))

Theorem: fails-gracefully-vl-parse-lvalue-2005

(defthm fails-gracefully-vl-parse-lvalue-2005
  (and (implies (mv-nth 0 (vl-parse-lvalue-2005))
                (not (mv-nth 1 (vl-parse-lvalue-2005))))
       (iff (vl-warning-p (mv-nth 0 (vl-parse-lvalue-2005)))
            (mv-nth 0 (vl-parse-lvalue-2005)))))

Theorem: fails-gracefully-vl-parse-1+-lvalues-separated-by-commas-2005

(defthm
      fails-gracefully-vl-parse-1+-lvalues-separated-by-commas-2005
 (and
  (implies
      (mv-nth 0
              (vl-parse-1+-lvalues-separated-by-commas-2005))
      (not (mv-nth 1
                   (vl-parse-1+-lvalues-separated-by-commas-2005))))
  (iff (vl-warning-p
            (mv-nth 0
                    (vl-parse-1+-lvalues-separated-by-commas-2005)))
       (mv-nth 0
               (vl-parse-1+-lvalues-separated-by-commas-2005)))))

Theorem: result-vl-parse-lvalue-2005

(defthm result-vl-parse-lvalue-2005
  (equal (vl-expr-p (mv-nth 1 (vl-parse-lvalue-2005)))
         (not (mv-nth 0 (vl-parse-lvalue-2005)))))

Theorem: result-vl-parse-1+-lvalues-separated-by-commas-2005

(defthm result-vl-parse-1+-lvalues-separated-by-commas-2005
  (vl-exprlist-p
       (mv-nth 1
               (vl-parse-1+-lvalues-separated-by-commas-2005))))

Theorem: parse-lvalues-true-listp-vl-parse-lvalue-2005

(defthm parse-lvalues-true-listp-vl-parse-lvalue-2005
  t
  :rule-classes nil)

Theorem: parse-lvalues-true-listp-vl-parse-1+-lvalues-separated-by-commas-2005

(defthm
 parse-lvalues-true-listp-vl-parse-1+-lvalues-separated-by-commas-2005
 (true-listp
      (mv-nth 1
              (vl-parse-1+-lvalues-separated-by-commas-2005)))
 :rule-classes :type-prescription)

Subtopics

Vl-parse-lvalue-2005
Vl-parse-1+-lvalues-separated-by-commas-2005