• 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
              • Vl-parse-procedural-continuous-assignments
              • Vl-parse-task-enable
              • Vl-parse-event-trigger
              • Vl-parse-blocking-or-nonblocking-assignment
              • Vl-parse-tf-call
              • Vl-parse-subroutine-call-statement
              • Vl-parse-system-tf-call
              • Vl-make-case-statement
                • Vl-parse-system-task-enable
                • Vl-parse-operator-assignment/inc/dec
                • Vl-parse-disable-statement
                • Vl-filter-parsed-caseitemlist
                • Vl-parse-subroutine-call
                • Vl-parse-1+-id=expr-pairs
                • Vl-parse-case-keyword
                • Vl-actionblock
                • Vl-parse-1+-for-variable-declarations
                • Vl-parse-1+-for-init-assignments
                • Vl-parse-foreach-statement-array-part
                • Vl-parse-for-variable-declaration
                • Vl-parse-1+-for-step-assigns
                • Vl-maybe-parse-assert-deferral
                • Vl-parse-statement-2012-aux
                • Vl-parse-return-statement
                • Vl-parse-for-initialization
                • Vl-parse-unique-priority
                • Vl-parse-statement-top
                • Vl-parse-foreach-loop-variables
                • Vl-parse-case-statement
                • Vl-assign-op-expr
                • Vl-maybe-inject-block-name-into-assertion
                • Vl-parse-for-step
                • Vl-parse-concurrent-assertion-statement
                • Vl-parse-statement-wrapped
                • Vl-parse-statement-2005-aux
                • Vl-foreach-vardecls-from-loopvars
                • Vl-parse-immediate-assertion-statement
                • Vl-inc-or-dec-expr
                • Vl-parse-par-block
                • Vl-parse-seq-block
                • Vl-parse-statement-or-null
                • Vl-parse-procedural-assertion-statement
                • Vl-parse-action-block
                • Vl-parse-case-item
                • Vl-parse-expect-property-statement
                • Vl-parse-statement
                • Vl-parse-statement-aux
                • Vl-parse-1+-case-items
                • *vl-assignment-operators*
              • 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-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-statements

    Vl-make-case-statement

    Final work to turn the parsed elements into a real case statement.

    Signature
    (vl-make-case-statement check type expr items atts loc casekey) 
      → 
    stmt?
    Arguments
    check — Guard (vl-casecheck-p check).
    type — Guard (vl-casetype-p type).
    expr — Guard (vl-expr-p expr).
    items — Guard (vl-caselist-p items).
    atts — Guard (vl-atts-p atts).
    loc — Guard (vl-location-p loc).
    casekey — Guard (or (vl-token-p casekey) (not casekey)).
    Returns
    stmt? — Type (equal (vl-stmt-p stmt?) (if stmt? t nil)).

    This either returns a statement or nil for failure. The only reason it can fail is that more than one default statement was provided.

    Definitions and Theorems

    Function: vl-make-case-statement

    (defun vl-make-case-statement
           (check type expr items atts loc casekey)
      (declare (xargs :guard (and (vl-casecheck-p check)
                                  (vl-casetype-p type)
                                  (vl-expr-p expr)
                                  (vl-caselist-p items)
                                  (vl-atts-p atts)
                                  (vl-location-p loc)
                                  (or (vl-token-p casekey)
                                      (not casekey)))))
      (let ((__function__ 'vl-make-case-statement))
        (declare (ignorable __function__))
        (b* (((mv defaults normal-cases)
              (vl-filter-parsed-caseitemlist items))
             ((when (> (len defaults) 1)) nil)
             (casekey (cond ((not casekey) nil)
                            ((eq (vl-token->type casekey)
                                 :vl-kwd-inside)
                             :inside)
                            ((eq (vl-token->type casekey)
                                 :vl-kwd-matches)
                             :matches)
                            (t nil))))
          (make-vl-casestmt :check check :casetype type :test
                            expr :caselist normal-cases :default
                            (if defaults (car defaults)
                              (make-vl-nullstmt))
                            :atts atts
                            :casekey casekey
                            :loc loc))))

    Theorem: return-type-of-vl-make-case-statement

    (defthm return-type-of-vl-make-case-statement
      (b*
       ((stmt?
             (vl-make-case-statement check
                                     type expr items atts loc casekey)))
       (equal (vl-stmt-p stmt?)
              (if stmt? t nil)))
      :rule-classes :rewrite)