(vl-datatype-syscall-to-svex orig-x fn type index ss scopes) → (mv warnings res)
Function:
(defun vl-datatype-syscall-to-svex (orig-x fn type index ss scopes) (declare (xargs :guard (and (vl-expr-p orig-x) (stringp fn) (vl-datatype-p type) (maybe-natp index) (vl-scopestack-p ss) (vl-elabscopes-p scopes)))) (let ((__function__ 'vl-datatype-syscall-to-svex)) (declare (ignorable __function__)) (b* ((warnings nil) (fn (string-fix fn)) (index (maybe-natp-fix index)) (orig-x (vl-expr-fix orig-x)) ((when (and index (zp index))) (mv (fatal :type :vl-expr-to-svex-fail :msg "Dimension argument of 0 is illegal in array query system calls: ~a0" :args (list orig-x)) (svex-x))) ((when (and index (member-equal fn '("$bits" "$dimensions" "$unpacked_dimensions")))) (mv (fatal :type :vl-expr-to-svex-fail :msg "Dimension argument is illegal: ~a0" :args (list orig-x)) (svex-x))) ((mv err type) (vl-datatype-usertype-resolve type ss :scopes scopes)) ((when err) (mv (fatal :type :vl-expr-to-svex-fail :msg "Couldn't resolve datatype in ~a0: ~@1" :args (list orig-x err)) (svex-x)))) (cond ((equal fn "$bits") (b* (((mv err size) (vl-datatype-size type)) ((when (or err (not size))) (mv (fatal :type :vl-expr-to-svex-fail :msg "Couldn't size datatype in ~a0: ~@1" :args (list orig-x (or err "unsizable datatype"))) (svex-x)))) (mv (ok) (svex-int size)))) ((equal fn "$dimensions") (mv nil (svex-int (vl-datatype-$dimensions type)))) ((equal fn "$unpacked_dimensions") (mv nil (svex-int (vl-datatype-$unpacked_dimensions type)))) ((member-equal fn '("$left" "$right" "$increment" "$low" "$high" "$size")) (b* (((mv err dim) (vl-datatype-syscall-remove-dims (if index (1- index) 0) type)) ((when (or err (not (vl-dimension-case dim :range)) (not (vl-range-resolved-p (vl-dimension->range dim))))) (mv (fatal :type :vl-expr-to-svex-fail :msg "Couldn't resolve outermost dimension for ~a0: ~@1" :args (list orig-x (or err "unresolved dimension"))) (svex-x))) (dim.range (vl-dimension->range dim)) ((vl-range dim) dim.range)) (cond ((equal fn "$left") (mv nil (svex-int (vl-resolved->val dim.msb)))) ((equal fn "$right") (mv nil (svex-int (vl-resolved->val dim.lsb)))) ((equal fn "$increment") (mv nil (svex-int (if (< (vl-resolved->val dim.msb) (vl-resolved->val dim.lsb)) -1 1)))) ((equal fn "$low") (mv nil (svex-int (if (< (vl-resolved->val dim.msb) (vl-resolved->val dim.lsb)) (vl-resolved->val dim.msb) (vl-resolved->val dim.lsb))))) ((equal fn "$high") (mv nil (svex-int (if (< (vl-resolved->val dim.msb) (vl-resolved->val dim.lsb)) (vl-resolved->val dim.lsb) (vl-resolved->val dim.msb))))) (t (mv nil (svex-int (vl-range-size dim.range))))))) (t (mv (fatal :type :vl-expr-unsupported :msg "Unrecognized system function: ~a0" :args (list orig-x)) (svex-x)))))))
Theorem:
(defthm vl-warninglist-p-of-vl-datatype-syscall-to-svex.warnings (b* (((mv ?warnings ?res) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm svex-p-of-vl-datatype-syscall-to-svex.res (b* (((mv ?warnings ?res) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes))) (sv::svex-p res)) :rule-classes :rewrite)
Theorem:
(defthm vars-of-vl-datatype-syscall-to-svex (b* (((mv ?warnings ?res) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes))) (equal (sv::svex-vars res) nil)))
Theorem:
(defthm vl-datatype-syscall-to-svex-of-vl-expr-fix-orig-x (equal (vl-datatype-syscall-to-svex (vl-expr-fix orig-x) fn type index ss scopes) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes)))
Theorem:
(defthm vl-datatype-syscall-to-svex-vl-expr-equiv-congruence-on-orig-x (implies (vl-expr-equiv orig-x orig-x-equiv) (equal (vl-datatype-syscall-to-svex orig-x fn type index ss scopes) (vl-datatype-syscall-to-svex orig-x-equiv fn type index ss scopes))) :rule-classes :congruence)
Theorem:
(defthm vl-datatype-syscall-to-svex-of-str-fix-fn (equal (vl-datatype-syscall-to-svex orig-x (str-fix fn) type index ss scopes) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes)))
Theorem:
(defthm vl-datatype-syscall-to-svex-streqv-congruence-on-fn (implies (streqv fn fn-equiv) (equal (vl-datatype-syscall-to-svex orig-x fn type index ss scopes) (vl-datatype-syscall-to-svex orig-x fn-equiv type index ss scopes))) :rule-classes :congruence)
Theorem:
(defthm vl-datatype-syscall-to-svex-of-vl-datatype-fix-type (equal (vl-datatype-syscall-to-svex orig-x fn (vl-datatype-fix type) index ss scopes) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes)))
Theorem:
(defthm vl-datatype-syscall-to-svex-vl-datatype-equiv-congruence-on-type (implies (vl-datatype-equiv type type-equiv) (equal (vl-datatype-syscall-to-svex orig-x fn type index ss scopes) (vl-datatype-syscall-to-svex orig-x fn type-equiv index ss scopes))) :rule-classes :congruence)
Theorem:
(defthm vl-datatype-syscall-to-svex-of-maybe-natp-fix-index (equal (vl-datatype-syscall-to-svex orig-x fn type (maybe-natp-fix index) ss scopes) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes)))
Theorem:
(defthm vl-datatype-syscall-to-svex-maybe-nat-equiv-congruence-on-index (implies (acl2::maybe-nat-equiv index index-equiv) (equal (vl-datatype-syscall-to-svex orig-x fn type index ss scopes) (vl-datatype-syscall-to-svex orig-x fn type index-equiv ss scopes))) :rule-classes :congruence)
Theorem:
(defthm vl-datatype-syscall-to-svex-of-vl-scopestack-fix-ss (equal (vl-datatype-syscall-to-svex orig-x fn type index (vl-scopestack-fix ss) scopes) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes)))
Theorem:
(defthm vl-datatype-syscall-to-svex-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-datatype-syscall-to-svex orig-x fn type index ss scopes) (vl-datatype-syscall-to-svex orig-x fn type index ss-equiv scopes))) :rule-classes :congruence)
Theorem:
(defthm vl-datatype-syscall-to-svex-of-vl-elabscopes-fix-scopes (equal (vl-datatype-syscall-to-svex orig-x fn type index ss (vl-elabscopes-fix scopes)) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes)))
Theorem:
(defthm vl-datatype-syscall-to-svex-vl-elabscopes-equiv-congruence-on-scopes (implies (vl-elabscopes-equiv scopes scopes-equiv) (equal (vl-datatype-syscall-to-svex orig-x fn type index ss scopes) (vl-datatype-syscall-to-svex orig-x fn type index ss scopes-equiv))) :rule-classes :congruence)