• 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
            • Semantics
              • Exec-bltu
              • Exec-bgeu
              • Exec-bge
              • Exec-blt
              • Exec-bne
              • Exec-beq
              • Exec-jalr
              • Exec-jal
              • Exec-sra
              • Exec-op
              • Exec-srl
              • Exec-op-imms-32
              • Exec-op-32
              • Exec-sll
              • Exec-branch
              • Exec-srlw
              • Exec-sraw
              • Exec-remuw
              • Exec-op-imms64
              • Exec-op-imms32
              • Exec-op-imm-32
              • Exec-srliw
              • Exec-sraiw
              • Exec-sltiu
              • Exec-remw
              • Exec-op-imm
              • Exec-load
              • Exec-divuw
              • Exec-store
              • Exec-srli64
              • Exec-srli32
              • Exec-srai64
              • Exec-srai32
              • Exec-sllw
              • Exec-remu
              • Exec-divw
              • Exec-addiw
              • Exec-xori
              • Exec-slti
              • Exec-slliw
              • Exec-rem
              • Exec-ori
              • Exec-mulhsu
              • Exec-divu
              • Exec-auipc
              • Exec-andi
              • Exec-sw
              • Exec-sltu
              • Exec-slt
              • Exec-slli64
              • Exec-slli32
              • Exec-mulhu
              • Exec-div
              • Exec-addw
              • Exec-addi
              • Exec-xor
              • Exec-mulw
              • Exec-mulh
              • Exec-lwu
              • Exec-and
              • Exec-subw
              • Exec-sub
              • Exec-or
              • Exec-lhu
              • Exec-lbu
              • Exec-sd
              • Exec-mul
              • Exec-lh
              • Exec-ld
              • Exec-lb
              • Exec-add
              • Exec-sh
              • Exec-sb
              • Exec-lw
              • Exec-lui
              • Eff-addr
              • Exec-instr
              • Features
              • Instructions
              • Encoding
              • States
              • Reads-over-writes
              • Semantics-equivalences
              • Decoding
              • Execution
            • Executable
            • Specialized
            • 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
    • Semantics

    Exec-instr

    Semantics of instructions.

    Signature
    (exec-instr instr pc stat feat) → new-stat
    Arguments
    instr — Guard (instrp instr).
    pc — Guard (unsigned-byte-p (feat->xlen feat) pc).
    stat — Guard (statp stat).
    feat — Guard (featp feat).
    Returns
    new-stat — Type (statp new-stat).

    Definitions and Theorems

    Function: exec-instr

    (defun exec-instr (instr pc stat feat)
     (declare (xargs :guard (and (instrp instr)
                                 (statp stat)
                                 (featp feat)
                                 (unsigned-byte-p (feat->xlen feat)
                                                  pc))))
     (declare (xargs :guard (and (instr-validp instr feat)
                                 (stat-validp stat feat))))
     (let ((__function__ 'exec-instr))
       (declare (ignorable __function__))
       (instr-case
            instr
            :op-imm (exec-op-imm instr.funct
                                 instr.rd instr.rs1 instr.imm stat feat)
            :op-imms32
            (exec-op-imms32 instr.funct
                            instr.rd instr.rs1 instr.imm stat feat)
            :op-imms64
            (exec-op-imms64 instr.funct
                            instr.rd instr.rs1 instr.imm stat feat)
            :op-imm-32
            (exec-op-imm-32 instr.funct
                            instr.rd instr.rs1 instr.imm stat feat)
            :op-imms-32
            (exec-op-imms-32 instr.funct
                             instr.rd instr.rs1 instr.imm stat feat)
            :lui (exec-lui instr.rd instr.imm stat feat)
            :auipc (exec-auipc instr.rd instr.imm pc stat feat)
            :op (exec-op instr.funct
                         instr.rd instr.rs1 instr.rs2 stat feat)
            :op-32 (exec-op-32 instr.funct
                               instr.rd instr.rs1 instr.rs2 stat feat)
            :jal (exec-jal instr.rd instr.imm pc stat feat)
            :jalr (exec-jalr instr.rd
                             instr.rs1 instr.imm pc stat feat)
            :branch (exec-branch instr.funct instr.rs1
                                 instr.rs2 instr.imm pc stat feat)
            :load (exec-load instr.funct
                             instr.rd instr.rs1 instr.imm stat feat)
            :store (exec-store instr.funct instr.rs1
                               instr.rs2 instr.imm stat feat))))

    Theorem: statp-of-exec-instr

    (defthm statp-of-exec-instr
      (b* ((new-stat (exec-instr instr pc stat feat)))
        (statp new-stat))
      :rule-classes :rewrite)

    Theorem: stat-validp-of-exec-instr

    (defthm stat-validp-of-exec-instr
      (implies (and (stat-validp stat feat)
                    (instr-validp instr feat))
               (b* ((?new-stat (exec-instr instr pc stat feat)))
                 (stat-validp new-stat feat))))

    Theorem: exec-instr-of-instr-fix-instr

    (defthm exec-instr-of-instr-fix-instr
      (equal (exec-instr (instr-fix instr)
                         pc stat feat)
             (exec-instr instr pc stat feat)))

    Theorem: exec-instr-instr-equiv-congruence-on-instr

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

    Theorem: exec-instr-of-stat-fix-stat

    (defthm exec-instr-of-stat-fix-stat
      (equal (exec-instr instr pc (stat-fix stat)
                         feat)
             (exec-instr instr pc stat feat)))

    Theorem: exec-instr-stat-equiv-congruence-on-stat

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

    Theorem: exec-instr-of-feat-fix-feat

    (defthm exec-instr-of-feat-fix-feat
      (equal (exec-instr instr pc stat (feat-fix feat))
             (exec-instr instr pc stat feat)))

    Theorem: exec-instr-feat-equiv-congruence-on-feat

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