• 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
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Riscv
          • Specification
          • Executable
          • Specialized
            • Specialized-features
            • Rv64im
            • Rv32im
              • Semantics32
              • States32
                • Write32-xreg
                • Write32-mem-ubyte16-lendian
                • Write32-mem-ubyte32-lendian
                • Write32-pc
                • Write32-mem-ubyte8
                • Read32-mem-ubyte16-lendian
                • Read32-xreg-unsigned
                • Read32-mem-ubyte8
                • Read32-mem-ubyte32-lendian
                • Read32-xreg-signed
                  • Inc32-pc
                  • Read32-pc
                  • Error32p
                  • Error32
                • Execution32
              • Specialized-states
            • Optimized
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • States32

    Read32-xreg-signed

    Read a signed 32-bit integer from an x register.

    Signature
    (read32-xreg-signed reg stat) → val
    Arguments
    reg — Guard (ubyte5p reg).
    stat — Guard (stat32ip stat).
    Returns
    val — Type (sbyte32p val).

    The register index consists of 5 bits. We read an unsigned 32-bit integer from the register, and convert it to signed.

    Definitions and Theorems

    Function: read32-xreg-signed

    (defun read32-xreg-signed (reg stat)
      (declare (xargs :guard (and (ubyte5p reg) (stat32ip stat))))
      (let ((__function__ 'read32-xreg-signed))
        (declare (ignorable __function__))
        (logext 32 (read32-xreg-unsigned reg stat))))

    Theorem: sbyte32p-of-read32-xreg-signed

    (defthm sbyte32p-of-read32-xreg-signed
      (b* ((val (read32-xreg-signed reg stat)))
        (sbyte32p val))
      :rule-classes :rewrite)

    Theorem: read32-xreg-signed-of-ubyte5-fix-reg

    (defthm read32-xreg-signed-of-ubyte5-fix-reg
      (equal (read32-xreg-signed (ubyte5-fix reg)
                                 stat)
             (read32-xreg-signed reg stat)))

    Theorem: read32-xreg-signed-ubyte5-equiv-congruence-on-reg

    (defthm read32-xreg-signed-ubyte5-equiv-congruence-on-reg
      (implies (ubyte5-equiv reg reg-equiv)
               (equal (read32-xreg-signed reg stat)
                      (read32-xreg-signed reg-equiv stat)))
      :rule-classes :congruence)

    Theorem: read32-xreg-signed-of-stat32i-fix-stat

    (defthm read32-xreg-signed-of-stat32i-fix-stat
      (equal (read32-xreg-signed reg (stat32i-fix stat))
             (read32-xreg-signed reg stat)))

    Theorem: read32-xreg-signed-stat32i-equiv-congruence-on-stat

    (defthm read32-xreg-signed-stat32i-equiv-congruence-on-stat
      (implies (stat32i-equiv stat stat-equiv)
               (equal (read32-xreg-signed reg stat)
                      (read32-xreg-signed reg stat-equiv)))
      :rule-classes :congruence)