Given a dimensionlist like [5:0][3:1][0:8], multiplies the dimensions together to get the total number of bits, or returns nil if there are unsized dimensions (e.g., associative dimensions, queue dimensions, or dynamic array dimensions).
(vl-dimensionlist-total-size x) → size
Function:
(defun vl-dimensionlist-total-size (x) (declare (xargs :guard (vl-dimensionlist-p x))) (declare (xargs :guard (vl-dimensionlist-resolved-p x))) (let ((__function__ 'vl-dimensionlist-total-size)) (declare (ignorable __function__)) (b* (((when (atom x)) 1) (rest-size (vl-dimensionlist-total-size (cdr x))) ((unless rest-size) nil) ((mv first-unresolved first-size) (vl-dimension-size (car x))) ((when (or first-unresolved (not first-size))) nil)) (* first-size rest-size))))
Theorem:
(defthm maybe-posp-of-vl-dimensionlist-total-size (b* ((size (vl-dimensionlist-total-size x))) (maybe-posp size)) :rule-classes :type-prescription)
Theorem:
(defthm vl-dimensionlist-total-size-of-cdr (implies (vl-dimensionlist-total-size x) (vl-dimensionlist-total-size (cdr x))) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm vl-dimensionlist-total-size-of-append (equal (vl-dimensionlist-total-size (append x y)) (and (vl-dimensionlist-total-size x) (vl-dimensionlist-total-size y) (* (vl-dimensionlist-total-size x) (vl-dimensionlist-total-size y)))))
Theorem:
(defthm vl-dimensionlist-total-size-of-vl-dimensionlist-fix-x (equal (vl-dimensionlist-total-size (vl-dimensionlist-fix x)) (vl-dimensionlist-total-size x)))
Theorem:
(defthm vl-dimensionlist-total-size-vl-dimensionlist-equiv-congruence-on-x (implies (vl-dimensionlist-equiv x x-equiv) (equal (vl-dimensionlist-total-size x) (vl-dimensionlist-total-size x-equiv))) :rule-classes :congruence)