• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
        • Instructions
        • States
        • Decoding
        • Encoding
        • Features
        • Semantics
          • Semantics64
            • Exec64-bgeu
            • Exec64-bltu
            • Exec64-blt
            • Exec64-bge
            • Exec64-bne
            • Exec64-beq
            • Exec64-jalr
            • Exec64-branch
            • Exec64-jal
            • Exec64-op-imms-32
            • Exec64-op-32
            • Exec64-op
            • Exec64-srlw
            • Exec64-sraw
            • Exec64-op-imm-32
            • Exec64-op-imm
            • Exec64-auipc
            • Exec64-store
            • Exec64-sra
            • Exec64-sltiu
            • Exec64-remw
            • Exec64-remuw
            • Exec64-op-imms
            • Exec64-load
            • Exec64-srliw
            • Exec64-srl
            • Exec64-sraiw
            • Exec64-slti
            • Exec64-sllw
            • Exec64-remu
            • Exec64-rem
            • Exec64-divw
            • Exec64-divuw
            • Exec64-addiw
            • Exec64-xori
            • Exec64-srli
            • Exec64-srai
            • Exec64-ori
            • Exec64-divu
            • Exec64-andi
            • Exec64-addi
            • Exec64-sltu
            • Exec64-slt
            • Exec64-slliw
            • Exec64-sll
            • Exec64-mulhsu
            • Exec64-lwu
            • Exec64-lhu
            • Exec64-div
            • Exec64-xor
            • Exec64-sw
            • Exec64-slli
            • Exec64-sh
            • Exec64-mulw
            • Exec64-mulhu
            • Exec64-mulh
            • Exec64-lw
            • Exec64-lh
            • Exec64-lbu
            • Exec64-addw
            • Exec64-subw
            • Exec64-sub
            • Exec64-sd
            • Exec64-sb
            • Exec64-or
            • Exec64-ld
            • Exec64-lb
            • Exec64-and
            • Exec64-mul
            • Exec64-add
            • Exec64-instr
            • Eff64-addr
              • Exec64-lui
            • Semantics32
          • Execution
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Semantics64

    Eff64-addr

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

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

    We read an unsigned 64-bit integer from rs1; this is the base. We sign-extend the 12-bit immediate to 64 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 64 bits of this integer.

    Definitions and Theorems

    Function: eff64-addr

    (defun eff64-addr (rs1 imm stat)
      (declare (xargs :guard (and (ubyte5p rs1)
                                  (ubyte12p imm)
                                  (state64p stat))))
      (let ((__function__ 'eff64-addr))
        (declare (ignorable __function__))
        (b* ((base (read64-xreg-unsigned rs1 stat))
             (offset (loghead 64 (logext 12 (ubyte12-fix imm)))))
          (+ base offset))))

    Theorem: integerp-of-eff64-addr

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

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

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

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

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

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

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

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

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

    Theorem: eff64-addr-of-state64-fix-stat

    (defthm eff64-addr-of-state64-fix-stat
      (equal (eff64-addr rs1 imm (state64-fix stat))
             (eff64-addr rs1 imm stat)))

    Theorem: eff64-addr-state64-equiv-congruence-on-stat

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