Semantics of the
We use the 20 bits of the immediate as
the high bits of an unsigned 32-bit integer,
whose low bits are 0.
In 64-bit mode,
we extend the unsigned 32-bit integer to 64 bits,
obtaining an unsigned 64-bit integer.
We add the integer to the address of the instruction,
which is passed as the
Function:
(defun exec-auipc (rd imm pc stat feat) (declare (xargs :guard (and (ubyte5p rd) (ubyte20p imm) (statp stat) (featp feat)))) (declare (xargs :guard (and (stat-validp stat feat) (cond ((feat-32p feat) (ubyte32p pc)) ((feat-64p feat) (ubyte64p pc)) (t (impossible)))))) (let ((__function__ 'exec-auipc)) (declare (ignorable __function__)) (b* ((offset (ash (ubyte20-fix imm) 12)) (offset (if (feat-64p feat) (loghead 64 (logext 32 offset)) offset)) (result (+ pc offset)) (stat (write-xreg (ubyte5-fix rd) result stat feat)) (stat (inc4-pc stat feat))) stat)))
Theorem:
(defthm statp-of-exec-auipc (b* ((new-stat (exec-auipc rd imm pc stat feat))) (statp new-stat)) :rule-classes :rewrite)
Theorem:
(defthm exec-auipc-of-ubyte5-fix-rd (equal (exec-auipc (ubyte5-fix rd) imm pc stat feat) (exec-auipc rd imm pc stat feat)))
Theorem:
(defthm exec-auipc-ubyte5-equiv-congruence-on-rd (implies (ubyte5-equiv rd rd-equiv) (equal (exec-auipc rd imm pc stat feat) (exec-auipc rd-equiv imm pc stat feat))) :rule-classes :congruence)
Theorem:
(defthm exec-auipc-of-ubyte20-fix-imm (equal (exec-auipc rd (ubyte20-fix imm) pc stat feat) (exec-auipc rd imm pc stat feat)))
Theorem:
(defthm exec-auipc-ubyte20-equiv-congruence-on-imm (implies (acl2::ubyte20-equiv imm imm-equiv) (equal (exec-auipc rd imm pc stat feat) (exec-auipc rd imm-equiv pc stat feat))) :rule-classes :congruence)
Theorem:
(defthm exec-auipc-of-stat-fix-stat (equal (exec-auipc rd imm pc (stat-fix stat) feat) (exec-auipc rd imm pc stat feat)))
Theorem:
(defthm exec-auipc-stat-equiv-congruence-on-stat (implies (stat-equiv stat stat-equiv) (equal (exec-auipc rd imm pc stat feat) (exec-auipc rd imm pc stat-equiv feat))) :rule-classes :congruence)
Theorem:
(defthm exec-auipc-of-feat-fix-feat (equal (exec-auipc rd imm pc stat (feat-fix feat)) (exec-auipc rd imm pc stat feat)))
Theorem:
(defthm exec-auipc-feat-equiv-congruence-on-feat (implies (feat-equiv feat feat-equiv) (equal (exec-auipc rd imm pc stat feat) (exec-auipc rd imm pc stat feat-equiv))) :rule-classes :congruence)