Write the program counter.
We pass an unsigned integer of arbitrary size,
of which only the low
[ISA:1.4] says that address computations wrap around ignoring overflow, i.e. the last address in the address space is adjacent to address 0. This function handles the wrapping around, see e.g. inc4-pc.
Function:
(defun write-pc (pc stat feat) (declare (xargs :guard (and (natp pc) (statp stat) (featp feat)))) (declare (xargs :guard (stat-validp stat feat))) (let ((__function__ 'write-pc)) (declare (ignorable __function__)) (change-stat stat :pc (loghead (feat->xlen feat) (lnfix pc)))))
Theorem:
(defthm statp-of-write-pc (b* ((new-stat (write-pc pc stat feat))) (statp new-stat)) :rule-classes :rewrite)
Theorem:
(defthm stat-validp-of-write-pc (implies (stat-validp stat feat) (b* ((?new-stat (write-pc pc stat feat))) (stat-validp new-stat feat))))
Theorem:
(defthm write-pc-of-nfix-pc (equal (write-pc (nfix pc) stat feat) (write-pc pc stat feat)))
Theorem:
(defthm write-pc-nat-equiv-congruence-on-pc (implies (acl2::nat-equiv pc pc-equiv) (equal (write-pc pc stat feat) (write-pc pc-equiv stat feat))) :rule-classes :congruence)
Theorem:
(defthm write-pc-of-stat-fix-stat (equal (write-pc pc (stat-fix stat) feat) (write-pc pc stat feat)))
Theorem:
(defthm write-pc-stat-equiv-congruence-on-stat (implies (stat-equiv stat stat-equiv) (equal (write-pc pc stat feat) (write-pc pc stat-equiv feat))) :rule-classes :congruence)
Theorem:
(defthm write-pc-of-feat-fix-feat (equal (write-pc pc stat (feat-fix feat)) (write-pc pc stat feat)))
Theorem:
(defthm write-pc-feat-equiv-congruence-on-feat (implies (feat-equiv feat feat-equiv) (equal (write-pc pc stat feat) (write-pc pc stat feat-equiv))) :rule-classes :congruence)