• 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
            • Parse-utils
            • Parse-insts
            • Parse-datatype
            • Parse-functions
            • Parse-datatypes
              • Vl-parse-enum-base-type
              • Vl-parse-1+-variable-decl-assignments-separated-by-commas
              • Vl-parse-1+-enum-name-declarations-separated-by-commas
              • Vl-parse-enum-name-declaration
                • Vl-parse-variable-decl-assignment
                • Vl-parse-core-data-type
                • Vl-parse-0+-variable-dimensions
                • Vl-parse-0+-unpacked-dimensions
                • Vl-parse-unpacked-dimension
                • Vl-parse-datatype-or-implicit
                • Vl-parse-0+-packed-dimensions
                • Vl-parse-packeddimension
                • Vl-parse-variable-dimension
                • Vl-make-structmembers
                • Vl-coretypekwd->info
                • Vl-vardeclassignlist-p
              • 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-datatypes

    Vl-parse-enum-name-declaration

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

    Definitions and Theorems

    Function: vl-parse-enum-name-declaration-fn

    (defun vl-parse-enum-name-declaration-fn (tokstream config)
     (declare (xargs :stobjs (tokstream)))
     (declare (xargs :guard (vl-loadconfig-p config)))
     (declare (ignorable config))
     (let ((__function__ 'vl-parse-enum-name-declaration))
      (declare (ignorable __function__))
      (seq
       tokstream
       (name := (vl-match-token :vl-idtoken))
       (when
        (vl-is-token? :vl-lbrack)
        (:= (vl-match))
        (left := (vl-match-token :vl-inttoken))
        (when
           (or (not (vl-inttoken->value left))
               (member #\'
                       (vl-echarlist->chars (vl-inttoken->etext left))))
           (return-raw (vl-parse-error "Illegal enum index")))
        (when
         (vl-is-token? :vl-colon)
         (:= (vl-match))
         (right := (vl-match-token :vl-inttoken))
         (when
          (or (not (vl-inttoken->value right))
              (member #\'
                      (vl-echarlist->chars (vl-inttoken->etext right))))
          (return-raw (vl-parse-error "Illegal enum index"))))
        (:= (vl-match-token :vl-rbrack)))
       (when (vl-is-token? :vl-equalsign)
             (:= (vl-match))
             (value := (vl-parse-expression)))
       (return
        (make-vl-enumitem
         :name (vl-idtoken->name name)
         :range
         (cond
              ((not left) nil)
              ((not right)
               (make-vl-range
                    :msb (vl-make-index (vl-inttoken->value left))
                    :lsb (vl-make-index (vl-inttoken->value left))))
              (t (make-vl-range
                      :msb (vl-make-index (vl-inttoken->value left))
                      :lsb (vl-make-index (vl-inttoken->value right)))))
         :value value)))))

    Theorem: vl-parse-enum-name-declaration-fails-gracefully

    (defthm vl-parse-enum-name-declaration-fails-gracefully
      (implies (mv-nth 0 (vl-parse-enum-name-declaration))
               (not (mv-nth 1 (vl-parse-enum-name-declaration)))))

    Theorem: vl-warning-p-of-vl-parse-enum-name-declaration

    (defthm vl-warning-p-of-vl-parse-enum-name-declaration
      (iff (vl-warning-p (mv-nth 0 (vl-parse-enum-name-declaration)))
           (mv-nth 0 (vl-parse-enum-name-declaration))))

    Theorem: vl-parse-enum-name-declaration-result

    (defthm vl-parse-enum-name-declaration-result
     (implies
      (and t)
      (equal (vl-enumitem-p (mv-nth 1 (vl-parse-enum-name-declaration)))
             (not (mv-nth 0 (vl-parse-enum-name-declaration))))))

    Theorem: vl-parse-enum-name-declaration-count-strong

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