• 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-maybe-parse-lifetime
            • Parse-dpi-import-export
            • Parse-ports
              • Parse-port-types
              • Creating-portdecls/vardecls
              • Verilog-2005-ports
              • Sv-non-ansi-portdecls
              • Vl-parse-ansi-port-declaration-2005
                • Vl-parse-1+-port-declarations-separated-by-commas-2005
                • Vl-parse-ansi-port-declaration
                • Vl-parse-1+-ansi-port-declarations
                • Verilog-2005-portdecls
              • 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-ports

    Vl-parse-ansi-port-declaration-2005

    Matches a port declaration (which may involve several comma-separated variable names), and creates an ansi-portdecl object for each of them.

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

    Definitions and Theorems

    Function: vl-parse-ansi-port-declaration-2005-fn

    (defun vl-parse-ansi-port-declaration-2005-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-ansi-port-declaration-2005))
      (declare (ignorable __function__))
      (seq
       tokstream
       (unless
            (vl-is-some-token? *vl-directions-kwds*)
            (return-raw (vl-parse-error "Expected a port direction")))
       (dir := (vl-parse-port-direction))
       (nettype := (vl-parse-optional-nettype))
       (when
        (and (eq dir :vl-output) (not nettype))
        (type := (vl-match-some-token
                      '(:vl-kwd-reg :vl-kwd-integer :vl-kwd-time)))
        (when (eq (vl-token->type type) :vl-kwd-reg)
              (when (vl-is-token? :vl-kwd-signed)
                    (signed := (vl-match)))
              (when (vl-is-token? :vl-lbrack)
                    (range := (vl-parse-range))))
        (id := (vl-match-token :vl-idtoken))
        (rest := (vl-parse-0+-port-identifiers-as-ansi-decls-2005))
        (return
         (cons
          (make-vl-ansi-portdecl
             :atts atts
             :dir dir
             :nettype nil
             :type (make-vl-coretype :name
                                     (case (vl-token->type type)
                                           (:vl-kwd-integer :vl-integer)
                                           (t :vl-time))
                                     :signedp
                                     (if signed t
                                       (eq (vl-token->type type)
                                           :vl-kwd-integer))
                                     :pdims (and range (list range)))
             :name (vl-idtoken->name id)
             :loc (vl-token->loc id))
          rest)))
       (unless
        nettype
        (return-raw
         (vl-parse-error
          "Expected a nettype after an 'input' or 'inout' declaration.")))
       (when (vl-is-token? :vl-kwd-signed)
             (signed := (vl-match)))
       (when (vl-is-token? :vl-lbrack)
             (range := (vl-parse-range)))
       (id := (vl-match-token :vl-idtoken))
       (rest := (vl-parse-0+-port-identifiers-as-ansi-decls-2005))
       (return
        (cons
           (make-vl-ansi-portdecl
                :atts atts
                :dir dir
                :nettype nettype
                :type (make-vl-coretype :name :vl-logic
                                        :signedp (and signed t)
                                        :pdims (and range (list range)))
                :name (vl-idtoken->name id)
                :loc (vl-token->loc id))
           rest)))))

    Theorem: vl-parse-ansi-port-declaration-2005-fails-gracefully

    (defthm vl-parse-ansi-port-declaration-2005-fails-gracefully
      (implies
           (mv-nth 0
                   (vl-parse-ansi-port-declaration-2005 atts))
           (not (mv-nth 1
                        (vl-parse-ansi-port-declaration-2005 atts)))))

    Theorem: vl-warning-p-of-vl-parse-ansi-port-declaration-2005

    (defthm vl-warning-p-of-vl-parse-ansi-port-declaration-2005
     (iff
      (vl-warning-p (mv-nth 0
                            (vl-parse-ansi-port-declaration-2005 atts)))
      (mv-nth 0
              (vl-parse-ansi-port-declaration-2005 atts))))

    Theorem: vl-parse-ansi-port-declaration-2005-result

    (defthm vl-parse-ansi-port-declaration-2005-result
      (implies
           (and (force (vl-atts-p atts)))
           (vl-ansi-portdecllist-p
                (mv-nth 1
                        (vl-parse-ansi-port-declaration-2005 atts)))))

    Theorem: vl-parse-ansi-port-declaration-2005-true-listp

    (defthm vl-parse-ansi-port-declaration-2005-true-listp
      (true-listp (mv-nth 1
                          (vl-parse-ansi-port-declaration-2005 atts)))
      :rule-classes :type-prescription)

    Theorem: vl-parse-ansi-port-declaration-2005-count-strong

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