Generate the expression to truncate a wire.
(vl-make-chopped-id name name-width trunc-width) → expr
We require that
Function:
(defun vl-make-chopped-id (name name-width trunc-width) (declare (xargs :guard (and (stringp name) (posp name-width) (posp trunc-width)))) (declare (xargs :guard (< trunc-width name-width))) (let ((__function__ 'vl-make-chopped-id)) (declare (ignorable __function__)) (b* ((trunc-width (lposfix trunc-width)) (name-width (lposfix name-width)) (name-expr (vl-idexpr name name-width :vl-unsigned)) (left (vl-make-index (- trunc-width 1))) (zero (vl-make-index 0)) ((when (eql trunc-width 1)) (make-vl-nonatom :op :vl-bitselect :args (list name-expr zero) :finalwidth 1 :finaltype :vl-unsigned))) (make-vl-nonatom :op :vl-partselect-colon :args (list name-expr left zero) :finalwidth trunc-width :finaltype :vl-unsigned))))
Theorem:
(defthm vl-expr-p-of-vl-make-chopped-id (b* ((expr (vl-make-chopped-id name name-width trunc-width))) (vl-expr-p expr)) :rule-classes :rewrite)
Theorem:
(defthm vl-make-chopped-id-of-str-fix-name (equal (vl-make-chopped-id (str-fix name) name-width trunc-width) (vl-make-chopped-id name name-width trunc-width)))
Theorem:
(defthm vl-make-chopped-id-streqv-congruence-on-name (implies (streqv name name-equiv) (equal (vl-make-chopped-id name name-width trunc-width) (vl-make-chopped-id name-equiv name-width trunc-width))) :rule-classes :congruence)
Theorem:
(defthm vl-make-chopped-id-of-pos-fix-name-width (equal (vl-make-chopped-id name (pos-fix name-width) trunc-width) (vl-make-chopped-id name name-width trunc-width)))
Theorem:
(defthm vl-make-chopped-id-pos-equiv-congruence-on-name-width (implies (acl2::pos-equiv name-width name-width-equiv) (equal (vl-make-chopped-id name name-width trunc-width) (vl-make-chopped-id name name-width-equiv trunc-width))) :rule-classes :congruence)
Theorem:
(defthm vl-make-chopped-id-of-pos-fix-trunc-width (equal (vl-make-chopped-id name name-width (pos-fix trunc-width)) (vl-make-chopped-id name name-width trunc-width)))
Theorem:
(defthm vl-make-chopped-id-pos-equiv-congruence-on-trunc-width (implies (acl2::pos-equiv trunc-width trunc-width-equiv) (equal (vl-make-chopped-id name name-width trunc-width) (vl-make-chopped-id name name-width trunc-width-equiv))) :rule-classes :congruence)