Refine read-instruction to use the stobj states.
Function:
(defun read1-instruction (addr stat feat) (declare (xargs :non-executable t)) (declare (xargs :guard (non-exec (and (stat1p stat) (integerp addr) (statp (stat-from-stat1 stat)) (featp feat) (stat-validp (stat-from-stat1 stat) feat))))) (prog2$ (acl2::throw-nonexec-error 'read1-instruction (list addr stat feat)) (b* (((unless (acl2::mbt$ (stat1p stat))) 0)) (let ((addr (loghead (feat->xlen feat) addr)) (stat (stat-from-stat1 stat))) (and (= (mod addr 4) 0) (let* ((b0 (read-memory-unsigned8 addr stat feat)) (b1 (read-memory-unsigned8 (+ addr 1) stat feat)) (b2 (read-memory-unsigned8 (+ addr 2) stat feat)) (b3 (read-memory-unsigned8 (+ addr 3) stat feat))) (logapp 8 b0 (logapp 8 b1 (logapp 8 b2 (logapp 8 b3 0))))))))))
Theorem:
(defthm read1-instruction-to-read-instruction (implies (stat1p stat) (equal (read1-instruction addr stat feat) (read-instruction addr (stat-from-stat1 stat) feat))) :rule-classes :rewrite)
Theorem:
(defthm read-instruction-to-read1-instruction (implies (statp stat) (equal (read-instruction addr stat feat) (read1-instruction addr (stat1-from-stat stat) feat))) :rule-classes :rewrite)