• 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
          • Preprocessor
          • Vl-loadconfig
          • Lexer
          • Vl-loadstate
          • Parser
            • Parse-expressions
            • Parse-udps
            • Vl-genelements
            • Parse-paramdecls
            • Parse-blockitems
              • Vl-parse-main-data-declaration
                • Vl-2005-parse-block-item-declaration-noatts
                • Vl-2012-parse-block-item-declaration-noatts
                • Vl-parse-list-of-event-identifiers
                • Vl-parse-block-item-declaration-noatts
                • Vl-parse-list-of-variable-identifiers
                • Vl-build-vardecls
                • Vl-parse-reg-declaration
                • Vl-parse-realtime-declaration
                • Vl-parse-integer-declaration
                • Vl-parse-time-declaration
                • Vl-parse-real-declaration
                • Vl-parse-0+-block-item-declarations
                • Vl-parse-event-declaration
                • Vl-parse-block-item-declaration
                • Vl-parse-variable-type
                • Vl-maybe-parse-lifetime
              • Parse-utils
              • Parse-insts
              • Parse-datatype
              • Parse-functions
              • Parse-datatypes
              • Parse-strengths
              • Vl-parse-genvar-declaration
              • Vl-parse
              • Parse-ports
              • Seq
              • Parse-packages
            • 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
    • Parse-blockitems

    Vl-parse-main-data-declaration

    Signature
    (vl-parse-main-data-declaration atts &key (tokstream 'tokstream) 
                                    (config 'config)) 
     
      → 
    (mv errmsg? value new-tokstream)
    Arguments
    config — Guard (vl-loadconfig-p config).

    Definitions and Theorems

    Function: vl-parse-main-data-declaration-fn

    (defun vl-parse-main-data-declaration-fn (atts tokstream config)
     (declare (xargs :stobjs (tokstream)))
     (declare (xargs :guard (vl-loadconfig-p config)))
     (declare (ignorable config))
     (declare (xargs :guard (vl-atts-p atts)))
     (let ((__function__ 'vl-parse-main-data-declaration))
      (declare (ignorable __function__))
      (seq
       tokstream (loc := (vl-current-loc))
       (when (vl-is-token? :vl-kwd-const)
             (const := (vl-match)))
       (when (vl-is-token? :vl-kwd-var)
             (var := (vl-match)))
       (lifetime := (vl-maybe-parse-lifetime))
       (return-raw
        (b*
         ((backup (vl-tokstream-save))
          ((mv explicit-err explicit-val tokstream)
           (seq tokstream
                (datatype := (vl-parse-datatype))
                (assigns := (vl-parse-1+-variable-decl-assignments-separated-by-commas))
                (:= (vl-match-token :vl-semi))
                (return (vl-build-vardecls :temps assigns
                                           :constp (if const t nil)
                                           :varp (if var t nil)
                                           :lifetime lifetime
                                           :type datatype
                                           :atts atts
                                           :loc loc))))
          ((unless explicit-err)
           (mv explicit-err explicit-val tokstream))
          ((unless var)
           (mv explicit-err explicit-val tokstream))
          (tokstream (vl-tokstream-restore backup))
          ((mv implicit-err implicit-val tokstream)
           (seq
            tokstream
            (when (vl-is-some-token? '(:vl-kwd-signed :vl-kwd-unsigned))
                  (signing := (vl-match)))
            (when (vl-is-token? :vl-lbrack)
                  (dims := (vl-parse-0+-packed-dimensions)))
            (assigns := (vl-parse-1+-variable-decl-assignments-separated-by-commas))
            (:= (vl-match-token :vl-semi))
            (return
              (vl-build-vardecls
                   :temps assigns
                   :constp (if const t nil)
                   :varp (if var t nil)
                   :lifetime lifetime
                   :type (make-vl-coretype
                              :name :vl-logic
                              :signedp (and signing
                                            (eq (vl-token->type signing)
                                                :vl-kwd-signed))
                              :pdims dims)
                   :atts atts
                   :loc loc))))
          ((unless implicit-err)
           (mv implicit-err implicit-val tokstream))
          (tokstream (vl-tokstream-restore backup)))
         (mv explicit-err
             explicit-val tokstream))))))

    Theorem: vl-parse-main-data-declaration-fails-gracefully

    (defthm vl-parse-main-data-declaration-fails-gracefully
      (implies (mv-nth 0 (vl-parse-main-data-declaration atts))
               (not (mv-nth 1
                            (vl-parse-main-data-declaration atts)))))

    Theorem: vl-warning-p-of-vl-parse-main-data-declaration

    (defthm vl-warning-p-of-vl-parse-main-data-declaration
      (iff (vl-warning-p (mv-nth 0
                                 (vl-parse-main-data-declaration atts)))
           (mv-nth 0
                   (vl-parse-main-data-declaration atts))))

    Theorem: vl-parse-main-data-declaration-result

    (defthm vl-parse-main-data-declaration-result
      (implies (and (force (vl-atts-p atts)))
               (vl-vardecllist-p
                    (mv-nth 1
                            (vl-parse-main-data-declaration atts)))))

    Theorem: vl-parse-main-data-declaration-true-listp

    (defthm vl-parse-main-data-declaration-true-listp
      (true-listp (mv-nth 1
                          (vl-parse-main-data-declaration atts)))
      :rule-classes :type-prescription)

    Theorem: vl-parse-main-data-declaration-count-strong

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