• 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
              • Vl-parse-param-or-localparam-declaration-2012
                • Vl-parse-param-or-localparam-declaration-2005
                • Vl-parse-param-assignment
                • Vl-parse-module-parameter-port-list-2012
                • Vl-parse-param-or-localparam-declaration
                • Vl-parse-list-of-param-assignments
                • Vl-parse-parameter-port-declaration-2012
                • Vl-parse-module-parameter-port-list-aux-2005
                • Vl-parse-1+-parameter-port-declarations-2012
                • Vl-parse-module-parameter-port-list-2005
                • Vl-parse-list-of-type-assignments
                • Vl-parse-module-parameter-port-list
                • Vl-parse-type-assignment
                • Vl-maybe-parse-parameter-port-list
              • Parse-blockitems
              • 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-paramdecls

    Vl-parse-param-or-localparam-declaration-2012

    Signature
    (vl-parse-param-or-localparam-declaration-2012 
         atts types &key (tokstream 'tokstream) 
         (config 'config)) 
     
      → 
    (mv errmsg? value new-tokstream)
    Arguments
    config — Guard (vl-loadconfig-p config).

    Definitions and Theorems

    Function: vl-parse-param-or-localparam-declaration-2012-fn

    (defun vl-parse-param-or-localparam-declaration-2012-fn
           (atts types tokstream config)
     (declare (xargs :stobjs (tokstream)))
     (declare (xargs :guard (vl-loadconfig-p config)))
     (declare (ignorable config))
     (declare
      (xargs
        :guard (and (vl-atts-p atts)
                    (true-listp types)
                    (subsetp types
                             '(:vl-kwd-parameter :vl-kwd-localparam)))))
     (let
        ((__function__ 'vl-parse-param-or-localparam-declaration-2012))
      (declare (ignorable __function__))
      (seq
       tokstream
       (start := (vl-match-some-token types))
       (when
        (vl-is-token? :vl-kwd-type)
        (:= (vl-match))
        (decls
           :=
           (vl-parse-list-of-type-assignments atts
                                              (eq (vl-token->type start)
                                                  :vl-kwd-localparam)))
        (return decls))
       (when (vl-is-some-token? '(:vl-kwd-signed :vl-kwd-unsigned))
             (signing := (vl-match)))
       (when (vl-is-token? :vl-lbrack)
             (range := (vl-parse-range)))
       (when
        (or signing range)
        (decls
         :=
         (vl-parse-list-of-param-assignments
              atts
              (eq (vl-token->type start)
                  :vl-kwd-localparam)
              (make-vl-implicitvalueparam
                   :range range
                   :sign (and signing
                              (case (vl-token->type signing)
                                    (:vl-kwd-signed :vl-signed)
                                    (:vl-kwd-unsigned :vl-unsigned))))))
        (return decls))
       (return-raw
        (b*
         ((localp (eq (vl-token->type start)
                      :vl-kwd-localparam))
          (emptytype (make-vl-implicitvalueparam :range nil
                                                 :sign nil))
          (backup (vl-tokstream-save))
          ((mv some-err some-decls tokstream)
           (seq tokstream (type := (vl-parse-datatype))
                (decls := (vl-parse-list-of-param-assignments
                               atts localp
                               (make-vl-explicitvalueparam :type type)))
                (return decls)))
          ((unless some-err)
           (mv some-err some-decls tokstream))
          (some-tokens (vl-tokstream->tokens))
          (tokstream (vl-tokstream-restore backup))
          ((mv empty-err empty-decls tokstream)
           (vl-parse-list-of-param-assignments atts localp emptytype))
          ((unless empty-err)
           (mv empty-err empty-decls tokstream))
          (empty-tokens (vl-tokstream->tokens))
          (tokstream (vl-tokstream-restore backup)))
         (if (< (len empty-tokens) (len some-tokens))
             (mv empty-err empty-decls tokstream)
           (mv some-err some-decls tokstream)))))))

    Theorem: vl-parse-param-or-localparam-declaration-2012-fails-gracefully

    (defthm
         vl-parse-param-or-localparam-declaration-2012-fails-gracefully
     (implies
      (mv-nth
           0
           (vl-parse-param-or-localparam-declaration-2012 atts types))
      (not
       (mv-nth
          1
          (vl-parse-param-or-localparam-declaration-2012 atts types)))))

    Theorem: vl-warning-p-of-vl-parse-param-or-localparam-declaration-2012

    (defthm
          vl-warning-p-of-vl-parse-param-or-localparam-declaration-2012
     (iff
      (vl-warning-p
       (mv-nth
            0
            (vl-parse-param-or-localparam-declaration-2012 atts types)))
      (mv-nth
           0
           (vl-parse-param-or-localparam-declaration-2012 atts types))))

    Theorem: vl-parse-param-or-localparam-declaration-2012-result

    (defthm vl-parse-param-or-localparam-declaration-2012-result
     (implies
      (and
        (and (force (vl-atts-p atts))
             (force (true-listp types))
             (force (subsetp types
                             '(:vl-kwd-parameter :vl-kwd-localparam)))))
      (vl-paramdecllist-p
       (mv-nth
          1
          (vl-parse-param-or-localparam-declaration-2012 atts types)))))

    Theorem: vl-parse-param-or-localparam-declaration-2012-true-listp

    (defthm vl-parse-param-or-localparam-declaration-2012-true-listp
     (true-listp
       (mv-nth
            1
            (vl-parse-param-or-localparam-declaration-2012 atts types)))
     :rule-classes :type-prescription)

    Theorem: vl-parse-param-or-localparam-declaration-2012-count-strong

    (defthm vl-parse-param-or-localparam-declaration-2012-count-strong
     (and
      (<=
       (vl-tokstream-measure
        :tokstream
        (mv-nth
            2
            (vl-parse-param-or-localparam-declaration-2012 atts types)))
       (vl-tokstream-measure))
      (implies
       (not
        (mv-nth
            0
            (vl-parse-param-or-localparam-declaration-2012 atts types)))
       (<
        (vl-tokstream-measure
         :tokstream
         (mv-nth
            2
            (vl-parse-param-or-localparam-declaration-2012 atts types)))
        (vl-tokstream-measure))))
     :rule-classes ((:rewrite) (:linear)))