• 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
                • Exec32-bgeu
                • Exec32-bltu
                • Exec32-blt
                • Exec32-bge
                • Exec32-bne
                • Exec32-beq
                • Exec32-jalr
                • Exec32-branch
                • Exec32-jal
                • Exec32-op
                • Exec32-store
                • Exec32-op-imm
                • Exec32-load
                • Exec32-sra
                • Exec32-sltiu
                • Exec32-op-imms
                • Exec32-srl
                • Exec32-slti
                • Exec32-remu
                • Exec32-rem
                • Exec32-auipc
                • Exec32-xori
                • Exec32-srli
                • Exec32-srai
                • Exec32-ori
                • Exec32-divu
                • Exec32-andi
                • Exec32-addi
                • Exec32-sltu
                • Exec32-slt
                • Exec32-sll
                • Exec32-mulhsu
                • Exec32-lhu
                • Exec32-div
                • Exec32-xor
                • Exec32-slli
                • Exec32-sh
                • Exec32-mulhu
                • Exec32-mulh
                • Exec32-lh
                • Exec32-lbu
                • Exec32-sw
                • Exec32-sub
                • Exec32-sb
                • Exec32-or
                • Exec32-lw
                • Exec32-lb
                • Exec32-and
                • Exec32-mul
                • Exec32-add
                • Exec32-instr
                • Eff32-addr
                  • Exec32-lui
                • States32
                • 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
    • Semantics32

    Eff32-addr

    Effective address for a load or store instruction [ISA:2.6].

    Signature
    (eff32-addr rs1 imm stat) → addr
    Arguments
    rs1 — Guard (ubyte5p rs1).
    imm — Guard (ubyte12p imm).
    stat — Guard (stat32ip stat).
    Returns
    addr — Type (integerp addr).

    We read an unsigned 32-bit integer from rs1; this is the base. We sign-extend the 12-bit immediate to 32 bits; this is the offset. We return the sum of base and offset, as an integer; the functions to read and write memory use the low 32 bits of this integer.

    Definitions and Theorems

    Function: eff32-addr

    (defun eff32-addr (rs1 imm stat)
      (declare (xargs :guard (and (ubyte5p rs1)
                                  (ubyte12p imm)
                                  (stat32ip stat))))
      (let ((__function__ 'eff32-addr))
        (declare (ignorable __function__))
        (b* ((base (read32-xreg-unsigned rs1 stat))
             (offset (loghead 32 (logext 12 (ubyte12-fix imm)))))
          (+ base offset))))

    Theorem: integerp-of-eff32-addr

    (defthm integerp-of-eff32-addr
      (b* ((addr (eff32-addr rs1 imm stat)))
        (integerp addr))
      :rule-classes :rewrite)

    Theorem: eff32-addr-of-ubyte5-fix-rs1

    (defthm eff32-addr-of-ubyte5-fix-rs1
      (equal (eff32-addr (ubyte5-fix rs1) imm stat)
             (eff32-addr rs1 imm stat)))

    Theorem: eff32-addr-ubyte5-equiv-congruence-on-rs1

    (defthm eff32-addr-ubyte5-equiv-congruence-on-rs1
      (implies (ubyte5-equiv rs1 rs1-equiv)
               (equal (eff32-addr rs1 imm stat)
                      (eff32-addr rs1-equiv imm stat)))
      :rule-classes :congruence)

    Theorem: eff32-addr-of-ubyte12-fix-imm

    (defthm eff32-addr-of-ubyte12-fix-imm
      (equal (eff32-addr rs1 (ubyte12-fix imm) stat)
             (eff32-addr rs1 imm stat)))

    Theorem: eff32-addr-ubyte12-equiv-congruence-on-imm

    (defthm eff32-addr-ubyte12-equiv-congruence-on-imm
      (implies (acl2::ubyte12-equiv imm imm-equiv)
               (equal (eff32-addr rs1 imm stat)
                      (eff32-addr rs1 imm-equiv stat)))
      :rule-classes :congruence)

    Theorem: eff32-addr-of-stat32i-fix-stat

    (defthm eff32-addr-of-stat32i-fix-stat
      (equal (eff32-addr rs1 imm (stat32i-fix stat))
             (eff32-addr rs1 imm stat)))

    Theorem: eff32-addr-stat32i-equiv-congruence-on-stat

    (defthm eff32-addr-stat32i-equiv-congruence-on-stat
      (implies (stat32i-equiv stat stat-equiv)
               (equal (eff32-addr rs1 imm stat)
                      (eff32-addr rs1 imm stat-equiv)))
      :rule-classes :congruence)