• 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
              • Vl-parse-datatype
              • Vl-parse-structmembers
              • Vl-parse-structmember
              • Vl-parse-datatype-or-void
            • 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
  • Parser

Parse-datatype

Parser for SystemVerilog-2012 data types.

Definitions and Theorems

Function: vl-parse-datatype-or-void-fn

(defun vl-parse-datatype-or-void-fn (tokstream config)
  (declare (xargs :stobjs (tokstream)))
  (declare (xargs :guard (vl-loadconfig-p config)))
  (declare (ignorable config))
  (let ((__function__ 'vl-parse-datatype-or-void))
    (declare (ignorable __function__))
    (seq tokstream
         (when (vl-is-token? :vl-kwd-void)
               (:= (vl-match-any))
               (return (make-vl-coretype :name :vl-void)))
         (type :s= (vl-parse-datatype))
         (return type))))

Function: vl-parse-datatype-fn

(defun vl-parse-datatype-fn (tokstream config)
 (declare (xargs :stobjs (tokstream)))
 (declare (xargs :guard (vl-loadconfig-p config)))
 (declare (ignorable config))
 (let ((__function__ 'vl-parse-datatype))
  (declare (ignorable __function__))
  (seq
   tokstream
   (when
    (vl-is-token? :vl-kwd-type)
    (return-raw
       (vl-parse-error "type references are not yet implemented.")))
   (when (vl-is-token? :vl-kwd-virtual)
         (return-raw
              (vl-parse-error
                   "virtual interfaces are not yet implemented.")))
   (when (vl-is-some-token? *vl-core-data-type-keywords*)
         (ret := (vl-parse-core-data-type))
         (return ret))
   (when
    (vl-is-some-token? '(:vl-kwd-struct :vl-kwd-union))
    (kind := (vl-match))
    (when (and (vl-is-token? :vl-kwd-tagged)
               (eq (vl-token->type kind)
                   :vl-kwd-union))
          (tagged := (vl-match)))
    (when
        (vl-is-token? :vl-kwd-packed)
        (packed := (vl-match))
        (when (vl-is-some-token? '(:vl-kwd-signed :vl-kwd-unsigned))
              (signed := (vl-match))))
    (:= (vl-match-token :vl-lcurly))
    (members := (vl-parse-structmembers))
    (:= (vl-match-token :vl-rcurly))
    (dims := (vl-parse-0+-packed-dimensions))
    (return (b* ((packedp (acl2::bool-fix packed))
                 (signedp (and signed
                               (eq (vl-token->type signed)
                                   :vl-kwd-signed)))
                 ((when (eq (vl-token->type kind)
                            :vl-kwd-struct))
                  (make-vl-struct :packedp packedp
                                  :signedp signedp
                                  :members members
                                  :pdims dims)))
              (make-vl-union :packedp packedp
                             :signedp signedp
                             :taggedp (acl2::bool-fix tagged)
                             :members members
                             :pdims dims))))
   (when
    (vl-is-token? :vl-kwd-enum)
    (:= (vl-match))
    (unless (vl-is-token? :vl-lcurly)
            (basetype := (vl-parse-enum-base-type)))
    (:= (vl-match-token :vl-lcurly))
    (items
        := (vl-parse-1+-enum-name-declarations-separated-by-commas))
    (:= (vl-match-token :vl-rcurly))
    (dims := (vl-parse-0+-packed-dimensions))
    (return
     (make-vl-enum :basetype (or basetype
                                 (make-vl-enumbasetype :kind :vl-int
                                                       :signedp t
                                                       :dim nil))
                   :items items
                   :pdims dims)))
   (expr := (vl-parse-simple-type))
   (dims := (vl-parse-0+-packed-dimensions))
   (return (make-vl-usertype :kind expr
                             :pdims dims)))))

Function: vl-parse-structmembers-fn

(defun vl-parse-structmembers-fn (tokstream config)
  (declare (xargs :stobjs (tokstream)))
  (declare (xargs :guard (vl-loadconfig-p config)))
  (declare (ignorable config))
  (let ((__function__ 'vl-parse-structmembers))
    (declare (ignorable __function__))
    (seq tokstream
         (first :s= (vl-parse-structmember))
         (when (vl-is-token? :vl-rcurly)
               (return first))
         (rest := (vl-parse-structmembers))
         (return (append first rest)))))

Function: vl-parse-structmember-fn

(defun vl-parse-structmember-fn (tokstream config)
 (declare (xargs :stobjs (tokstream)))
 (declare (xargs :guard (vl-loadconfig-p config)))
 (declare (ignorable config))
 (let ((__function__ 'vl-parse-structmember))
  (declare (ignorable __function__))
  (seq
   tokstream
   (atts := (vl-parse-0+-attribute-instances))
   (when (vl-is-some-token? '(:vl-kwd-rand :vl-kwd-randc))
         (rand := (vl-match)))
   (type :s= (vl-parse-datatype-or-void))
   (decls
     := (vl-parse-1+-variable-decl-assignments-separated-by-commas))
   (:= (vl-match-token :vl-semi))
   (return (let ((rand (and rand
                            (case (vl-token->type rand)
                                  (:vl-kwd-rand :vl-rand)
                                  (:vl-kwd-randc :vl-randc)))))
             (vl-make-structmembers atts rand type decls))))))

Subtopics

Vl-parse-datatype
Vl-parse-structmembers
Vl-parse-structmember
Vl-parse-datatype-or-void