Match a Verilog-style wire name, bit-select, or part-select.
(stv-wirename-parse str) → (mv err? basename msb? lsb?)
Examples:
If the wire name isn't of an acceptable form, an error message is returned as the first return value.
Function:
(defun stv-wirename-parse (str) (declare (xargs :guard (stringp str))) (let ((__function__ 'stv-wirename-parse)) (declare (ignorable __function__)) (b* ((expr (vl2014::vl-parse-expr-from-str str)) ((unless expr) (mv (str::cat (symbol-name __function__) ": failed to parse: " str) "" nil nil)) ((mv err from msb lsb) (stv-maybe-match-select expr)) ((when err) (mv err "" nil nil)) ((unless (vl2014::vl-idexpr-p from)) (mv (str::cat (symbol-name __function__) ": invalid wire name: " str) "" nil nil))) (mv nil (vl2014::vl-idexpr->name from) msb lsb))))
Theorem:
(defthm maybe-stringp-of-stv-wirename-parse.err? (b* (((mv ?err? ?basename ?msb? ?lsb?) (stv-wirename-parse str))) (maybe-stringp err?)) :rule-classes :type-prescription)
Theorem:
(defthm stringp-of-stv-wirename-parse.basename (b* (((mv ?err? ?basename ?msb? ?lsb?) (stv-wirename-parse str))) (stringp basename)) :rule-classes :rewrite)
Theorem:
(defthm maybe-natp-of-stv-wirename-parse.msb? (b* (((mv ?err? ?basename ?msb? ?lsb?) (stv-wirename-parse str))) (maybe-natp msb?)) :rule-classes :type-prescription)
Theorem:
(defthm maybe-natp-of-stv-wirename-parse.lsb? (b* (((mv ?err? ?basename ?msb? ?lsb?) (stv-wirename-parse str))) (maybe-natp lsb?)) :rule-classes :type-prescription)