• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • Event-macros
        • Java
        • Riscv
          • Specification
          • Executable
          • Specialized
            • Specialized-rv64im-le
              • Rv64im-le-semantics
              • Rv64im-le-states
                • Write64-xreg
                • Write64-xreg-32
                • Xregfile64
                • State64
                • Memory64
                • Write64-mem-ubyte64-lendian
                • Write64-mem-ubyte16-lendian
                • Write64-pc
                • Write64-mem-ubyte32-lendian
                • Read64-mem-ubyte64-lendian
                • Read64-mem-ubyte16-lendian
                  • Read64-xreg-unsigned
                  • Read64-mem-ubyte8
                  • Read64-mem-ubyte32-lendian
                  • Read64-xreg-unsigned32
                  • Write64-mem-ubyte8
                  • Read64-xreg-signed32
                  • Read64-xreg-signed
                  • Inc64-pc
                  • Read64-pc
                  • Error64p
                  • Error64
                  • Stat-rv64im-le-p
                  • *mem64-size*
                • Rv64im-le-execution
                • Rv64im-le-features
              • Specialized-rv32im-le
            • Optimized
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Rv64im-le-states

    Read64-mem-ubyte16-lendian

    Read an unsigned 16-bit little endian integer from memory.

    Signature
    (read64-mem-ubyte16-lendian addr stat) → val
    Arguments
    addr — Guard (integerp addr).
    stat — Guard (state64p stat).
    Returns
    val — Type (ubyte16p val).

    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.

    Definitions and Theorems

    Function: read64-mem-ubyte16-lendian

    (defun read64-mem-ubyte16-lendian (addr stat)
      (declare (xargs :guard (and (integerp addr) (state64p stat))))
      (b* ((b0 (read64-mem-ubyte8 addr stat))
           (b1 (read64-mem-ubyte8 (1+ (ifix addr))
                                  stat)))
        (+ b0 (ash b1 8))))

    Theorem: ubyte16p-of-read64-mem-ubyte16-lendian

    (defthm ubyte16p-of-read64-mem-ubyte16-lendian
      (b* ((val (read64-mem-ubyte16-lendian addr stat)))
        (ubyte16p val))
      :rule-classes :rewrite)

    Theorem: read64-mem-ubyte16-lendian-of-ifix-addr

    (defthm read64-mem-ubyte16-lendian-of-ifix-addr
      (equal (read64-mem-ubyte16-lendian (ifix addr)
                                         stat)
             (read64-mem-ubyte16-lendian addr stat)))

    Theorem: read64-mem-ubyte16-lendian-int-equiv-congruence-on-addr

    (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: read64-mem-ubyte16-lendian-of-state64-fix-stat

    (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: read64-mem-ubyte16-lendian-state64-equiv-congruence-on-stat

    (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)