• 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-drive-strength-or-charge-strength
              • Vl-parse-drive-strength
                • Vl-parse-optional-drive-strength
                • Vl-parse-charge-strength
                • *vl-strength1-alist*
                • *vl-strength0-alist*
                • *vl-ds1-alist*
                • *vl-ds0/1-keywords*
                • *vl-ds0-alist*
                • *vl-charge-strengths-keywords*
                • *vl-charge-strengths-alist*
                • *vl-ds1-keywords*
                • *vl-ds0-keywords*
              • 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-strengths

    Vl-parse-drive-strength

    Match drive_strength, return a vl-gatestrength-p.

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

    Definitions and Theorems

    Function: vl-parse-drive-strength-fn

    (defun vl-parse-drive-strength-fn (tokstream config)
     (declare (xargs :stobjs (tokstream)))
     (declare (xargs :guard (vl-loadconfig-p config)))
     (declare (ignorable config))
     (let ((__function__ 'vl-parse-drive-strength))
      (declare (ignorable __function__))
      (seq
        tokstream
        (:= (vl-match-token :vl-lparen))
        (first := (vl-match-some-token *vl-ds0/1-keywords*))
        (:= (vl-match-token :vl-comma))
        (second := (vl-match-some-token *vl-ds0/1-keywords*))
        (:= (vl-match-token :vl-rparen))
        (return-raw
             (b* (((mv s-zero s-one)
                   (if (member-eq (vl-token->type first)
                                  *vl-ds0-keywords*)
                       (mv (vl-token->type first)
                           (vl-token->type second))
                     (mv (vl-token->type second)
                         (vl-token->type first))))
                  ((when (and (member-eq s-zero *vl-ds0-keywords*)
                              (member-eq s-one *vl-ds1-keywords*)
                              (or (not (eq s-zero :vl-kwd-highz0))
                                  (not (eq s-one :vl-kwd-highz1)))))
                   (mv nil
                       (make-vl-gatestrength
                            :zero (cdr (assoc-eq s-zero *vl-ds0-alist*))
                            :one (cdr (assoc-eq s-one *vl-ds1-alist*)))
                       tokstream)))
               (vl-parse-error "Invalid drive strength."))))))

    Theorem: vl-parse-drive-strength-fails-gracefully

    (defthm vl-parse-drive-strength-fails-gracefully
      (implies (mv-nth 0 (vl-parse-drive-strength))
               (not (mv-nth 1 (vl-parse-drive-strength)))))

    Theorem: vl-warning-p-of-vl-parse-drive-strength

    (defthm vl-warning-p-of-vl-parse-drive-strength
      (iff (vl-warning-p (mv-nth 0 (vl-parse-drive-strength)))
           (mv-nth 0 (vl-parse-drive-strength))))

    Theorem: vl-parse-drive-strength-result

    (defthm vl-parse-drive-strength-result
     (implies
         (and t)
         (equal (vl-gatestrength-p (mv-nth 1 (vl-parse-drive-strength)))
                (not (mv-nth 0 (vl-parse-drive-strength))))))

    Theorem: vl-parse-drive-strength-count-strong

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