• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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-clocking
            • Parse-strengths
            • Vl-parse-genvar-declaration
            • Vl-parse
            • Parse-netdecls
            • Parse-asserts
              • Vl-parse-0+-assertion-variable-declarations
                • Vl-parse-property-formal-type-and-id
                • Vl-parse-assertion-item
                • Vl-parse-sequence-declaration
                • Vl-parse-property-declaration
                • Vl-parse-sequence-port-item
                • Vl-parse-property-port-item
                • Vl-parse-1+-sequence-port-items
                • Vl-parse-1+-property-port-items
                • Vl-make-assertion-vardecls
                • Vl-plausible-start-of-assertion-item-p
                • Vl-parse-assertion-item-looks-concurrent-p
              • 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-asserts

    Vl-parse-0+-assertion-variable-declarations

    Parse { assertion_variable_declaration } .

    Signature
    (vl-parse-0+-assertion-variable-declarations 
         &key (tokstream 'tokstream) 
         (config 'config)) 
     
      → 
    (mv errmsg? value new-tokstream)
    Arguments
    config — Guard (vl-loadconfig-p config).

    In sequence_declaration and property_declaration we need to match however many assertion_variable_declarations there are, followed by a sequence expression or property expression. It's not very easy to tell if we're looking at a user-defined type or the start of a sequence/property expression, so we use backtracking.

    assertion_variable_declaration ::= var_data_type list_of_variable_decl_assignments ';'
    
    var_data_type ::= data_type
                    | 'var' data_type_or_implicit

    Definitions and Theorems

    Function: vl-parse-0+-assertion-variable-declarations-fn

    (defun vl-parse-0+-assertion-variable-declarations-fn
           (tokstream config)
     (declare (xargs :stobjs (tokstream)))
     (declare (xargs :guard (vl-loadconfig-p config)))
     (declare (ignorable config))
     (let ((__function__ 'vl-parse-0+-assertion-variable-declarations))
      (declare (ignorable __function__))
      (b*
       ((loc (if (consp (vl-tokstream->tokens))
                 (vl-token->loc (car (vl-tokstream->tokens)))
               *vl-fakeloc*))
        ((when (vl-is-token? :vl-kwd-var))
         (seq
          tokstream (:= (vl-match))
          (type := (vl-parse-datatype-or-implicit))
          (vars
            :=
            (vl-parse-1+-variable-decl-assignments-separated-by-commas))
          (:= (vl-match-token :vl-semi))
          (rest := (vl-parse-0+-assertion-variable-declarations))
          (return (append (vl-make-assertion-vardecls type vars loc)
                          rest))))
        (backup (vl-tokstream-save))
        ((mv err type tokstream)
         (vl-parse-datatype))
        ((when (and (not err)
                    (vl-is-token? :vl-idtoken)))
         (seq
          tokstream
          (vars
            :=
            (vl-parse-1+-variable-decl-assignments-separated-by-commas))
          (:= (vl-match-token :vl-semi))
          (return (vl-make-assertion-vardecls type vars loc))))
        (tokstream (vl-tokstream-restore backup)))
       (mv nil nil tokstream))))

    Theorem: vl-parse-0+-assertion-variable-declarations-fails-gracefully

    (defthm vl-parse-0+-assertion-variable-declarations-fails-gracefully
     (implies
          (mv-nth 0
                  (vl-parse-0+-assertion-variable-declarations))
          (not (mv-nth 1
                       (vl-parse-0+-assertion-variable-declarations)))))

    Theorem: vl-warning-p-of-vl-parse-0+-assertion-variable-declarations

    (defthm vl-warning-p-of-vl-parse-0+-assertion-variable-declarations
      (iff (vl-warning-p
                (mv-nth 0
                        (vl-parse-0+-assertion-variable-declarations)))
           (mv-nth 0
                   (vl-parse-0+-assertion-variable-declarations))))

    Theorem: vl-parse-0+-assertion-variable-declarations-result

    (defthm vl-parse-0+-assertion-variable-declarations-result
     (implies
          (and t)
          (vl-vardecllist-p
               (mv-nth 1
                       (vl-parse-0+-assertion-variable-declarations)))))

    Theorem: vl-parse-0+-assertion-variable-declarations-true-listp

    (defthm vl-parse-0+-assertion-variable-declarations-true-listp
     (true-listp (mv-nth 1
                         (vl-parse-0+-assertion-variable-declarations)))
     :rule-classes :type-prescription)

    Theorem: vl-parse-0+-assertion-variable-declarations-count-weak

    (defthm vl-parse-0+-assertion-variable-declarations-count-weak
      (<= (vl-tokstream-measure
               :tokstream
               (mv-nth 2
                       (vl-parse-0+-assertion-variable-declarations)))
          (vl-tokstream-measure))
      :rule-classes ((:rewrite) (:linear)))