• 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-assignment

    Signature
    (vl-parse-param-assignment atts 
                               localp type &key (tokstream 'tokstream) 
                               (config 'config)) 
     
      → 
    (mv errmsg? value new-tokstream)
    Arguments
    config — Guard (vl-loadconfig-p config).

    Definitions and Theorems

    Function: vl-parse-param-assignment-fn

    (defun vl-parse-param-assignment-fn
           (atts localp type tokstream config)
     (declare (xargs :stobjs (tokstream)))
     (declare (xargs :guard (vl-loadconfig-p config)))
     (declare (ignorable config))
     (declare
      (xargs
       :guard
       (and (vl-atts-p atts)
            (booleanp localp)
            (vl-paramtype-p type)
            (member (vl-paramtype-kind type)
                    '(:vl-implicitvalueparam :vl-explicitvalueparam)))))
     (let ((__function__ 'vl-parse-param-assignment))
      (declare (ignorable __function__))
      (seq
       tokstream
       (id := (vl-match-token :vl-idtoken))
       (when
        (vl-parsestate-is-user-defined-type-p (vl-idtoken->name id)
                                              (vl-tokstream->pstate))
        (return-raw
         (vl-parse-error
            (cat "Parameter names that shadow types are not supported: "
                 (vl-idtoken->name id)))))
       (when (and (not (vl-is-token? :vl-equalsign))
                  (not (eq (vl-loadconfig->edition config)
                           :verilog-2005))
                  (not localp))
             (return (make-vl-paramdecl :loc (vl-token->loc id)
                                        :name (vl-idtoken->name id)
                                        :atts atts
                                        :localp localp
                                        :type type)))
       (:= (vl-match-token :vl-equalsign))
       (default := (vl-parse-mintypmax-expression))
       (return
            (make-vl-paramdecl
                 :loc (vl-token->loc id)
                 :name (vl-idtoken->name id)
                 :atts atts :localp localp :type
                 (if (vl-paramtype-case type :vl-implicitvalueparam)
                     (change-vl-implicitvalueparam type
                                                   :default default)
                   (change-vl-explicitvalueparam type
                                                 :default default)))))))

    Theorem: vl-parse-param-assignment-fails-gracefully

    (defthm vl-parse-param-assignment-fails-gracefully
      (implies
           (mv-nth 0
                   (vl-parse-param-assignment atts localp type))
           (not (mv-nth 1
                        (vl-parse-param-assignment atts localp type)))))

    Theorem: vl-warning-p-of-vl-parse-param-assignment

    (defthm vl-warning-p-of-vl-parse-param-assignment
      (iff (vl-warning-p
                (mv-nth 0
                        (vl-parse-param-assignment atts localp type)))
           (mv-nth 0
                   (vl-parse-param-assignment atts localp type))))

    Theorem: vl-parse-param-assignment-result

    (defthm vl-parse-param-assignment-result
     (implies
      (and
       (and
        (force (vl-atts-p atts))
        (force (booleanp localp))
        (force (vl-paramtype-p type))
        (force
            (member (vl-paramtype-kind type)
                    '(:vl-implicitvalueparam :vl-explicitvalueparam)))))
      (equal
          (vl-paramdecl-p
               (mv-nth 1
                       (vl-parse-param-assignment atts localp type)))
          (not (mv-nth 0
                       (vl-parse-param-assignment atts localp type))))))

    Theorem: vl-parse-param-assignment-count-strong

    (defthm vl-parse-param-assignment-count-strong
     (and
      (<= (vl-tokstream-measure
               :tokstream
               (mv-nth 2
                       (vl-parse-param-assignment atts localp type)))
          (vl-tokstream-measure))
      (implies
          (not (mv-nth 0
                       (vl-parse-param-assignment atts localp type)))
          (< (vl-tokstream-measure
                  :tokstream
                  (mv-nth 2
                          (vl-parse-param-assignment atts localp type)))
             (vl-tokstream-measure))))
     :rule-classes ((:rewrite) (:linear)))