• 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
              • 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
                • States64
                • Execution64
              • Rv32im
              • 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
    • Semantics64

    Exec64-instr

    Semantics of instructions.

    Signature
    (exec64-instr instr pc stat) → new-stat
    Arguments
    instr — Guard (instrp instr).
    pc — Guard (ubyte64p pc).
    stat — Guard (state64p stat).
    Returns
    new-stat — Type (state64p new-stat).

    We set the error flag for the RV32I shift instructions, because here we are in RV64I mode.

    Definitions and Theorems

    Function: exec64-instr

    (defun exec64-instr (instr pc stat)
     (declare (xargs :guard (and (instrp instr)
                                 (ubyte64p pc)
                                 (state64p stat))))
     (let ((__function__ 'exec64-instr))
      (declare (ignorable __function__))
      (instr-case
       instr
       :op-imm (exec64-op-imm instr.funct
                              instr.rd instr.rs1 instr.imm stat)
       :op-imms32 (error64 stat)
       :op-imms64 (exec64-op-imms instr.funct
                                  instr.rd instr.rs1 instr.imm stat)
       :op-imm-32 (exec64-op-imm-32 instr.funct
                                    instr.rd instr.rs1 instr.imm stat)
       :op-imms-32 (exec64-op-imms-32 instr.funct
                                      instr.rd instr.rs1 instr.imm stat)
       :lui (exec64-lui instr.rd instr.imm stat)
       :auipc (exec64-auipc instr.rd instr.imm pc stat)
       :op (exec64-op instr.funct
                      instr.rd instr.rs1 instr.rs2 stat)
       :op-32 (exec64-op-32 instr.funct
                            instr.rd instr.rs1 instr.rs2 stat)
       :jal (exec64-jal instr.rd instr.imm pc stat)
       :jalr (exec64-jalr instr.rd instr.rs1 instr.imm pc stat)
       :branch (exec64-branch instr.funct
                              instr.rs1 instr.rs2 instr.imm pc stat)
       :load (exec64-load instr.funct
                          instr.rd instr.rs1 instr.imm stat)
       :store (exec64-store instr.funct
                            instr.rs1 instr.rs2 instr.imm stat))))

    Theorem: state64p-of-exec64-instr

    (defthm state64p-of-exec64-instr
      (b* ((new-stat (exec64-instr instr pc stat)))
        (state64p new-stat))
      :rule-classes :rewrite)

    Theorem: exec64-instr-of-instr-fix-instr

    (defthm exec64-instr-of-instr-fix-instr
      (equal (exec64-instr (instr-fix instr) pc stat)
             (exec64-instr instr pc stat)))

    Theorem: exec64-instr-instr-equiv-congruence-on-instr

    (defthm exec64-instr-instr-equiv-congruence-on-instr
      (implies (instr-equiv instr instr-equiv)
               (equal (exec64-instr instr pc stat)
                      (exec64-instr instr-equiv pc stat)))
      :rule-classes :congruence)

    Theorem: exec64-instr-of-ubyte64-fix-pc

    (defthm exec64-instr-of-ubyte64-fix-pc
      (equal (exec64-instr instr (ubyte64-fix pc)
                           stat)
             (exec64-instr instr pc stat)))

    Theorem: exec64-instr-ubyte64-equiv-congruence-on-pc

    (defthm exec64-instr-ubyte64-equiv-congruence-on-pc
      (implies (acl2::ubyte64-equiv pc pc-equiv)
               (equal (exec64-instr instr pc stat)
                      (exec64-instr instr pc-equiv stat)))
      :rule-classes :congruence)

    Theorem: exec64-instr-of-state64-fix-stat

    (defthm exec64-instr-of-state64-fix-stat
      (equal (exec64-instr instr pc (state64-fix stat))
             (exec64-instr instr pc stat)))

    Theorem: exec64-instr-state64-equiv-congruence-on-stat

    (defthm exec64-instr-state64-equiv-congruence-on-stat
      (implies (state64-equiv stat stat-equiv)
               (equal (exec64-instr instr pc stat)
                      (exec64-instr instr pc stat-equiv)))
      :rule-classes :congruence)