Removes any explicit signed indicator from a datatype.
(vl-datatype-set-unsigned x) → new-x
This is rather specific in purpose and generally shouldn't be used. The case where it is useful is when we are indexing into an (explicitly signed) packed array; this means that the whole array is signed, but not the selected parts. So we strip the signed qualifier off of the type when we index into packed dimensions. (This doesn't apply to usertypes that are defined as signed types! If we index down to such a type, it IS signed, but any packed array of such a type is not. So we don't need to descend into usertypes or somehow mark them as unsigned. We just have to know that a usertype with one or more packed dimensions counts as unsigned.)
Function:
(defun vl-datatype-set-unsigned (x) (declare (xargs :guard (vl-datatype-p x))) (let ((__function__ 'vl-datatype-set-unsigned)) (declare (ignorable __function__)) (vl-datatype-case x :vl-coretype (mbe :logic (change-vl-coretype x :signedp nil) :exec (if x.signedp (change-vl-coretype x :signedp nil) x)) :vl-struct (mbe :logic (change-vl-struct x :signedp nil) :exec (if x.signedp (change-vl-struct x :signedp nil) x)) :vl-union (mbe :logic (change-vl-union x :signedp nil) :exec (if x.signedp (change-vl-union x :signedp nil) x)) :otherwise (vl-datatype-fix x))))
Theorem:
(defthm vl-datatype-p-of-vl-datatype-set-unsigned (b* ((new-x (vl-datatype-set-unsigned x))) (vl-datatype-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm vl-datatype-resolved-p-of-set-unsigned (b* ((?new-x (vl-datatype-set-unsigned x))) (implies (vl-datatype-resolved-p x) (vl-datatype-resolved-p new-x))))
Theorem:
(defthm vl-datatype-set-unsigned-of-vl-datatype-fix-x (equal (vl-datatype-set-unsigned (vl-datatype-fix x)) (vl-datatype-set-unsigned x)))
Theorem:
(defthm vl-datatype-set-unsigned-vl-datatype-equiv-congruence-on-x (implies (vl-datatype-equiv x x-equiv) (equal (vl-datatype-set-unsigned x) (vl-datatype-set-unsigned x-equiv))) :rule-classes :congruence)