• 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
            • Parse-strengths
            • Vl-parse-genvar-declaration
            • Vl-parse
            • Parse-ports
              • Parse-port-types
              • Sv-ansi-portdecls
              • Creating-portdecls/vardecls
              • Sv-non-ansi-portdecls
              • Verilog-2005-ports
                • Vl-parse-port-reference
                  • Vl-parse-1+-ports-separated-by-commas
                  • Vl-parse-1+-port-references-separated-by-commas
                  • Vl-parse-nonnull-port
                  • Vl-parse-port-expression
                • Sv-ansi-port-interpretation
                • Verilog-2005-portdecls
              • 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
    • Verilog-2005-ports

    Vl-parse-port-reference

    Matches port_reference.

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

    Note: We assume that if a bracket follows the identifier, it belongs to this port reference. This is safe in port-expressions since only a comma or end curly-brace will follow them. Since port_reference never occurs anywhere else in the grammar, this should be fine everywhere.

    Definitions and Theorems

    Function: vl-parse-port-reference-fn

    (defun vl-parse-port-reference-fn (tokstream config)
     (declare (xargs :stobjs (tokstream)))
     (declare (xargs :guard (vl-loadconfig-p config)))
     (declare (ignorable config))
     (let ((__function__ 'vl-parse-port-reference))
      (declare (ignorable __function__))
      (seq
       tokstream
       (id := (vl-match-token :vl-idtoken))
       (unless
        (vl-is-token? :vl-lbrack)
        (return
         (make-vl-atom :guts (make-vl-id :name (vl-idtoken->name id)))))
       (:= (vl-match))
       (range := (vl-parse-range-expression))
       (unless
        (or (eq (vl-erange->type range) :vl-index)
            (eq (vl-erange->type range) :vl-colon))
        (return-raw
         (vl-parse-error
          "The +: or -: operators are not allowed in port expressions.")))
       (:= (vl-match-token :vl-rbrack))
       (return
        (vl-build-range-select
           (make-vl-atom :guts (make-vl-id :name (vl-idtoken->name id)))
           range)))))

    Theorem: vl-parse-port-reference-fails-gracefully

    (defthm vl-parse-port-reference-fails-gracefully
      (implies (mv-nth 0 (vl-parse-port-reference))
               (not (mv-nth 1 (vl-parse-port-reference)))))

    Theorem: vl-warning-p-of-vl-parse-port-reference

    (defthm vl-warning-p-of-vl-parse-port-reference
      (iff (vl-warning-p (mv-nth 0 (vl-parse-port-reference)))
           (mv-nth 0 (vl-parse-port-reference))))

    Theorem: vl-parse-port-reference-result

    (defthm vl-parse-port-reference-result
      (implies (and t)
               (equal (vl-expr-p (mv-nth 1 (vl-parse-port-reference)))
                      (not (mv-nth 0 (vl-parse-port-reference))))))

    Theorem: vl-parse-port-reference-count-strong

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