• 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-branch

    Semantics of the instructions with the BRANCH opcode [ISA:2.5.2].

    Signature
    (exec-branch funct rs1 rs2 imm pc stat feat) → new-stat
    Arguments
    funct — Guard (branch-funct-p funct).
    rs1 — Guard (ubyte5p rs1).
    rs2 — Guard (ubyte5p rs2).
    imm — Guard (ubyte12p imm).
    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-branch

    (defun exec-branch (funct rs1 rs2 imm pc stat feat)
      (declare (xargs :guard (and (branch-funct-p funct)
                                  (ubyte5p rs1)
                                  (ubyte5p rs2)
                                  (ubyte12p imm)
                                  (statp stat)
                                  (featp feat)
                                  (unsigned-byte-p (feat->xlen feat)
                                                   pc))))
      (declare (xargs :guard (and (stat-validp stat feat)
                                  (< (lnfix rs1) (feat->xnum feat))
                                  (< (lnfix rs2) (feat->xnum feat)))))
      (let ((__function__ 'exec-branch))
        (declare (ignorable __function__))
        (branch-funct-case funct
                           :beq (exec-beq rs1 rs2 imm pc stat feat)
                           :bne (exec-bne rs1 rs2 imm pc stat feat)
                           :blt (exec-blt rs1 rs2 imm pc stat feat)
                           :bltu (exec-bltu rs1 rs2 imm pc stat feat)
                           :bge (exec-bge rs1 rs2 imm pc stat feat)
                           :bgeu (exec-bgeu rs1 rs2 imm pc stat feat))))

    Theorem: statp-of-exec-branch

    (defthm statp-of-exec-branch
      (b* ((new-stat (exec-branch funct rs1 rs2 imm pc stat feat)))
        (statp new-stat))
      :rule-classes :rewrite)

    Theorem: stat-validp-of-exec-branch

    (defthm stat-validp-of-exec-branch
     (implies
          (stat-validp stat feat)
          (b* ((?new-stat (exec-branch funct rs1 rs2 imm pc stat feat)))
            (stat-validp new-stat feat))))

    Theorem: exec-branch-of-branch-funct-fix-funct

    (defthm exec-branch-of-branch-funct-fix-funct
      (equal (exec-branch (branch-funct-fix funct)
                          rs1 rs2 imm pc stat feat)
             (exec-branch funct rs1 rs2 imm pc stat feat)))

    Theorem: exec-branch-branch-funct-equiv-congruence-on-funct

    (defthm exec-branch-branch-funct-equiv-congruence-on-funct
      (implies
           (branch-funct-equiv funct funct-equiv)
           (equal (exec-branch funct rs1 rs2 imm pc stat feat)
                  (exec-branch funct-equiv rs1 rs2 imm pc stat feat)))
      :rule-classes :congruence)

    Theorem: exec-branch-of-ubyte5-fix-rs1

    (defthm exec-branch-of-ubyte5-fix-rs1
      (equal (exec-branch funct (ubyte5-fix rs1)
                          rs2 imm pc stat feat)
             (exec-branch funct rs1 rs2 imm pc stat feat)))

    Theorem: exec-branch-ubyte5-equiv-congruence-on-rs1

    (defthm exec-branch-ubyte5-equiv-congruence-on-rs1
      (implies
           (ubyte5-equiv rs1 rs1-equiv)
           (equal (exec-branch funct rs1 rs2 imm pc stat feat)
                  (exec-branch funct rs1-equiv rs2 imm pc stat feat)))
      :rule-classes :congruence)

    Theorem: exec-branch-of-ubyte5-fix-rs2

    (defthm exec-branch-of-ubyte5-fix-rs2
      (equal (exec-branch funct rs1 (ubyte5-fix rs2)
                          imm pc stat feat)
             (exec-branch funct rs1 rs2 imm pc stat feat)))

    Theorem: exec-branch-ubyte5-equiv-congruence-on-rs2

    (defthm exec-branch-ubyte5-equiv-congruence-on-rs2
      (implies
           (ubyte5-equiv rs2 rs2-equiv)
           (equal (exec-branch funct rs1 rs2 imm pc stat feat)
                  (exec-branch funct rs1 rs2-equiv imm pc stat feat)))
      :rule-classes :congruence)

    Theorem: exec-branch-of-ubyte12-fix-imm

    (defthm exec-branch-of-ubyte12-fix-imm
      (equal (exec-branch funct rs1 rs2 (ubyte12-fix imm)
                          pc stat feat)
             (exec-branch funct rs1 rs2 imm pc stat feat)))

    Theorem: exec-branch-ubyte12-equiv-congruence-on-imm

    (defthm exec-branch-ubyte12-equiv-congruence-on-imm
      (implies
           (acl2::ubyte12-equiv imm imm-equiv)
           (equal (exec-branch funct rs1 rs2 imm pc stat feat)
                  (exec-branch funct rs1 rs2 imm-equiv pc stat feat)))
      :rule-classes :congruence)

    Theorem: exec-branch-of-stat-fix-stat

    (defthm exec-branch-of-stat-fix-stat
      (equal (exec-branch funct rs1 rs2 imm pc (stat-fix stat)
                          feat)
             (exec-branch funct rs1 rs2 imm pc stat feat)))

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

    (defthm exec-branch-stat-equiv-congruence-on-stat
      (implies
           (stat-equiv stat stat-equiv)
           (equal (exec-branch funct rs1 rs2 imm pc stat feat)
                  (exec-branch funct rs1 rs2 imm pc stat-equiv feat)))
      :rule-classes :congruence)

    Theorem: exec-branch-of-feat-fix-feat

    (defthm exec-branch-of-feat-fix-feat
      (equal (exec-branch funct
                          rs1 rs2 imm pc stat (feat-fix feat))
             (exec-branch funct rs1 rs2 imm pc stat feat)))

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

    (defthm exec-branch-feat-equiv-congruence-on-feat
      (implies
           (feat-equiv feat feat-equiv)
           (equal (exec-branch funct rs1 rs2 imm pc stat feat)
                  (exec-branch funct rs1 rs2 imm pc stat feat-equiv)))
      :rule-classes :congruence)