Implements svex-argmasks for
(svmask-for-partsel mask args) → argmasks
Function:
(defun svmask-for-partsel (mask args) (declare (xargs :guard (and (4vmask-p mask) (svexlist-p args)))) (let ((__function__ 'svmask-for-partsel)) (declare (ignorable __function__)) (b* (((svex-nths lsb width in) args) (mask (4vmask-fix mask))) (b* (((when (4vmask-empty mask)) (list 0 0 0)) (widthval (svex-s4xeval width)) (lsbval (svex-s4xeval lsb)) ((unless (s4vec-2vec-p widthval)) (if (s4vec-2vec-p lsbval) (list -1 -1 (sparseint-ash mask (sparseint-val (s4vec->upper lsbval)))) (list -1 -1 -1))) (widthval (s4vec->upper widthval)) ((when (sparseint-< widthval 0)) (list 0 -1 0)) (widthval (sparseint-val widthval)) ((unless (s4vec-2vec-p lsbval)) (if (sparseint-equal 0 (sparseint-concatenate widthval mask 0)) (list -1 -1 0) (list -1 -1 -1))) (lsbval (s4vec->upper lsbval))) (list -1 -1 (sparseint-ash (sparseint-concatenate widthval mask 0) (sparseint-val lsbval)))))))
Theorem:
(defthm 4vmasklist-p-of-svmask-for-partsel (b* ((argmasks (svmask-for-partsel mask args))) (4vmasklist-p argmasks)) :rule-classes :rewrite)
Theorem:
(defthm svmask-for-partsel-of-4vmask-fix-mask (equal (svmask-for-partsel (4vmask-fix mask) args) (svmask-for-partsel mask args)))
Theorem:
(defthm svmask-for-partsel-4vmask-equiv-congruence-on-mask (implies (4vmask-equiv mask mask-equiv) (equal (svmask-for-partsel mask args) (svmask-for-partsel mask-equiv args))) :rule-classes :congruence)
Theorem:
(defthm svmask-for-partsel-of-svexlist-fix-args (equal (svmask-for-partsel mask (svexlist-fix args)) (svmask-for-partsel mask args)))
Theorem:
(defthm svmask-for-partsel-svexlist-equiv-congruence-on-args (implies (svexlist-equiv args args-equiv) (equal (svmask-for-partsel mask args) (svmask-for-partsel mask args-equiv))) :rule-classes :congruence)
Theorem:
(defthm svmask-for-partsel-correct (implies (and (equal (4veclist-mask (svmask-for-partsel mask args) (svexlist-eval args env)) (4veclist-mask (svmask-for-partsel mask args) args1)) (syntaxp (not (equal args1 (cons 'svexlist-eval (cons args (cons env 'nil))))))) (equal (4vec-mask mask (svex-apply 'partsel args1)) (4vec-mask mask (svex-apply 'partsel (svexlist-eval args env))))))