Read an unsigned 16-bit little endian integer from memory.
We read the byte at the given address, and the byte at the address just after, which could be 0 if the given address is the last one in the space. We put the two bytes together in little endian order.
Function:
(defun read64-mem-ubyte16-lendian (addr stat) (declare (xargs :guard (and (integerp addr) (state64p stat)))) (let ((__function__ 'read64-mem-ubyte16-lendian)) (declare (ignorable __function__)) (b* ((b0 (read64-mem-ubyte8 addr stat)) (b1 (read64-mem-ubyte8 (1+ (ifix addr)) stat))) (+ b0 (ash b1 8)))))
Theorem:
(defthm ubyte16p-of-read64-mem-ubyte16-lendian (b* ((val (read64-mem-ubyte16-lendian addr stat))) (ubyte16p val)) :rule-classes :rewrite)
Theorem:
(defthm read64-mem-ubyte16-lendian-of-ifix-addr (equal (read64-mem-ubyte16-lendian (ifix addr) stat) (read64-mem-ubyte16-lendian addr stat)))
Theorem:
(defthm read64-mem-ubyte16-lendian-int-equiv-congruence-on-addr (implies (acl2::int-equiv addr addr-equiv) (equal (read64-mem-ubyte16-lendian addr stat) (read64-mem-ubyte16-lendian addr-equiv stat))) :rule-classes :congruence)
Theorem:
(defthm read64-mem-ubyte16-lendian-of-state64-fix-stat (equal (read64-mem-ubyte16-lendian addr (state64-fix stat)) (read64-mem-ubyte16-lendian addr stat)))
Theorem:
(defthm read64-mem-ubyte16-lendian-state64-equiv-congruence-on-stat (implies (state64-equiv stat stat-equiv) (equal (read64-mem-ubyte16-lendian addr stat) (read64-mem-ubyte16-lendian addr stat-equiv))) :rule-classes :congruence)