• 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
            • Parse-property
              • Vl-parse-property-list-of-arguments
              • Vl-parse-sequence-match-item
              • Vl-parse-property-actual-arg
              • Vl-parse-scoped-or-hierarchical-identifier
              • Vl-parse-cycledelayrange
              • Vl-parse-sequence-abbrev
              • Vl-parse-boolean-abbrev
                • Vl-parse-1+-expression-or-dists-separated-by-commas
                • Vl-parse-property-acceptop
                • Vl-parse-dist-item
                • Vl-parse-sequence-match-item-list
                • Vl-parse-property-spec
                • Vl-parse-impl-prop-expr-op
                • Vl-parse-expression-or-dist
                • Vl-parse-dist-list
                • Vl-alternating-propexpr/op-list-p
                • Vl-left-associate-alternating-propexpr/op-list
                • Vl-left-associate-delay-se-tail
                • Vl-delay-se-tail-p
                • Vl-parse-1+-named-property-list-of-arguments
                • Vl-parse-property-low-prec-unary
                • Vl-parse-within-sequence-expr-aux
                • Vl-parse-throughout-sequence-expr
                • Vl-parse-or-property-expr-aux
                • Vl-parse-intersect-sequence-expr-aux
                • Vl-parse-intersect-sequence-expr
                • Vl-parse-delay-sequence-expr
                • Vl-parse-assign-sequence-expr
                • Vl-parse-and-property-expr-aux
                • Vl-parse-1+-property-case-items
                • Vl-parse-within-sequence-expr
                • Vl-parse-or-property-expr
                • Vl-parse-instance-property-expr
                • Vl-parse-iff-property-expr
                • Vl-parse-delay-sequence-expr-tail
                • Vl-parse-and-property-expr
                • Vl-parse-until-property-expr
                • Vl-parse-strength-property-expr
                • Vl-parse-repeat-sequence-expr
                • Vl-parse-property-expr
                • Vl-parse-property-case-item
                • Vl-parse-not-property-expr
                • Vl-parse-impl-property-expr
                • Vl-parse-firstmatch-sequence-expr
              • 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-property

    Vl-parse-boolean-abbrev

    Matches boolean_abbrev.

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

    Relevant grammar rules:

    boolean_abbrev ::= consecutive_repetition
                     | non_consecutive_repetition
                     | goto_repetition
    
    consecutive_repetition ::= '[*' const_or_range_expression ']'
                             | '[*]'
                             | '[+]'
    
    non_consecutive_repetition ::= ['=' const_or_range_expression ]
    
    goto_repetition ::= ['->' const_or_range_expression ]
    
    const_or_range_expression ::= constant_expression
                                | cycle_delay_const_range_expression
    
    cycle_delay_const_range_expression ::= constant_expression ':' constant_expression
                                         | constant_expression ':' '$'

    Definitions and Theorems

    Function: vl-parse-boolean-abbrev-fn

    (defun vl-parse-boolean-abbrev-fn (tokstream config)
     (declare (xargs :stobjs (tokstream)))
     (declare (xargs :guard (vl-loadconfig-p config)))
     (declare (ignorable config))
     (let ((__function__ 'vl-parse-boolean-abbrev))
      (declare (ignorable __function__))
      (seq
       tokstream
       (:= (vl-match-token :vl-lbrack))
       (when
            (vl-is-token? :vl-plus)
            (:= (vl-match))
            (:= (vl-match-token :vl-rbrack))
            (return (make-vl-repetition :type :vl-repetition-consecutive
                                        :left (vl-make-index 1)
                                        :right *vl-end-of-sequence-$*)))
       (type
          := (vl-match-some-token '(:vl-times :vl-arrow :vl-equalsign)))
       (when
            (and (eq (vl-token->type type) :vl-times)
                 (vl-is-token? :vl-rbrack))
            (:= (vl-match))
            (return (make-vl-repetition :type :vl-repetition-consecutive
                                        :left (vl-make-index 0)
                                        :right *vl-end-of-sequence-$*)))
       (left := (vl-parse-expression))
       (when (vl-is-token? :vl-colon)
             (:= (vl-match))
             (right := (vl-parse-expression)))
       (:= (vl-match-token :vl-rbrack))
       (return
         (make-vl-repetition
              :type (case (vl-token->type type)
                          (:vl-times :vl-repetition-consecutive)
                          (:vl-arrow :vl-repetition-goto)
                          (:vl-equalsign :vl-repetition-nonconsecutive))
              :left left
              :right right)))))

    Theorem: vl-parse-boolean-abbrev-fails-gracefully

    (defthm vl-parse-boolean-abbrev-fails-gracefully
      (implies (mv-nth 0 (vl-parse-boolean-abbrev))
               (not (mv-nth 1 (vl-parse-boolean-abbrev)))))

    Theorem: vl-warning-p-of-vl-parse-boolean-abbrev

    (defthm vl-warning-p-of-vl-parse-boolean-abbrev
      (iff (vl-warning-p (mv-nth 0 (vl-parse-boolean-abbrev)))
           (mv-nth 0 (vl-parse-boolean-abbrev))))

    Theorem: vl-parse-boolean-abbrev-result

    (defthm vl-parse-boolean-abbrev-result
      (implies
           (and t)
           (equal (vl-repetition-p (mv-nth 1 (vl-parse-boolean-abbrev)))
                  (not (mv-nth 0 (vl-parse-boolean-abbrev))))))

    Theorem: vl-parse-boolean-abbrev-count-strong

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