• 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
      • Riscv
        • Semantics
          • Exec-bgeu
          • Exec-bltu
          • Exec-blt
          • Exec-bge
          • Exec-jalr
          • Exec-bne
          • Exec-beq
          • Exec-sra
          • Exec-op-imms-32
          • Exec-srl
          • Exec-branch
          • Exec-sll
          • Exec-op-imms64
          • Exec-op-imms32
          • Exec-op-imm-32
          • Exec-op-32
          • Exec-op
          • Exec-srlw
          • Exec-srliw
          • Exec-sraw
          • Exec-sraiw
          • Exec-sltiu
          • Exec-remuw
          • Exec-op-imm
          • Exec-jal
          • Exec-store
          • Exec-srli64
          • Exec-srli32
          • Exec-srai64
          • Exec-srai32
          • Exec-sllw
            • Exec-remw
            • Exec-load
            • Exec-divuw
            • Exec-addiw
            • Exec-xori
            • Exec-slti
            • Exec-slliw
            • Exec-remu
            • Exec-rem
            • Exec-divw
            • Exec-sw
            • Exec-slli64
            • Exec-slli32
            • Exec-ori
            • Exec-mulhsu
            • Exec-divu
            • Exec-andi
            • Exec-addi
            • Exec-sltu
            • Exec-slt
            • Exec-mulhu
            • Exec-div
            • Exec-auipc
            • Exec-addw
            • Exec-xor
            • Exec-mulw
            • Exec-mulh
            • Exec-lwu
            • Exec-and
            • Exec-subw
            • Exec-sub
            • Exec-sh
            • Exec-sd
            • Exec-sb
            • Exec-or
            • Exec-lhu
            • Exec-lh
            • Exec-ld
            • Exec-lbu
            • Exec-lb
            • Exec-mul
            • Exec-add
            • Exec-lw
            • Exec-lui
            • Eff-addr
            • Exec-instr
          • Instructions
          • States
          • Decoding
          • Encoding
          • Features
          • Rv32im
          • Rv64im
          • Execution
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • 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
      • Community
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Semantics

    Exec-sllw

    Semantics of the SLLW instruction [ISA:4.2.2].

    Signature
    (exec-sllw rd rs1 rs2 stat feat) → new-stat
    Arguments
    rd — Guard (ubyte5p rd).
    rs1 — Guard (ubyte5p rs1).
    rs2 — Guard (ubyte5p rs2).
    stat — Guard (statp stat).
    feat — Guard (featp feat).
    Returns
    new-stat — Type (statp new-stat).

    We read an unsigned 32-bit integer from rs1 and an unsigned 32-bit integer from rs2. The low 5 bits of the second integer are the shift amount, from 0 to 31. We shift the first integer left by the shift amount. We write the result to rd as a signed 32-bit integer. We increment the program counter.

    Definitions and Theorems

    Function: exec-sllw

    (defun exec-sllw (rd rs1 rs2 stat feat)
      (declare (xargs :guard (and (ubyte5p rd)
                                  (ubyte5p rs1)
                                  (ubyte5p rs2)
                                  (statp stat)
                                  (featp feat))))
      (declare (xargs :guard (and (feat-64p feat)
                                  (stat-validp stat feat))))
      (let ((__function__ 'exec-sllw))
        (declare (ignorable __function__))
        (b* ((rs1-operand (read-xreg-unsigned32 (ubyte5-fix rs1)
                                                stat feat))
             (rs2-operand (read-xreg-unsigned32 (ubyte5-fix rs2)
                                                stat feat))
             (shift-amount (loghead 5 rs2-operand))
             (result (ash rs1-operand shift-amount))
             (stat (write-xreg-32 (ubyte5-fix rd)
                                  result stat feat))
             (stat (inc4-pc stat feat)))
          stat)))

    Theorem: statp-of-exec-sllw

    (defthm statp-of-exec-sllw
      (b* ((new-stat (exec-sllw rd rs1 rs2 stat feat)))
        (statp new-stat))
      :rule-classes :rewrite)

    Theorem: stat-validp-of-exec-sllw

    (defthm stat-validp-of-exec-sllw
      (implies (stat-validp stat feat)
               (b* ((?new-stat (exec-sllw rd rs1 rs2 stat feat)))
                 (stat-validp new-stat feat))))

    Theorem: exec-sllw-of-ubyte5-fix-rd

    (defthm exec-sllw-of-ubyte5-fix-rd
      (equal (exec-sllw (ubyte5-fix rd)
                        rs1 rs2 stat feat)
             (exec-sllw rd rs1 rs2 stat feat)))

    Theorem: exec-sllw-ubyte5-equiv-congruence-on-rd

    (defthm exec-sllw-ubyte5-equiv-congruence-on-rd
      (implies (ubyte5-equiv rd rd-equiv)
               (equal (exec-sllw rd rs1 rs2 stat feat)
                      (exec-sllw rd-equiv rs1 rs2 stat feat)))
      :rule-classes :congruence)

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

    (defthm exec-sllw-of-ubyte5-fix-rs1
      (equal (exec-sllw rd (ubyte5-fix rs1)
                        rs2 stat feat)
             (exec-sllw rd rs1 rs2 stat feat)))

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

    (defthm exec-sllw-ubyte5-equiv-congruence-on-rs1
      (implies (ubyte5-equiv rs1 rs1-equiv)
               (equal (exec-sllw rd rs1 rs2 stat feat)
                      (exec-sllw rd rs1-equiv rs2 stat feat)))
      :rule-classes :congruence)

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

    (defthm exec-sllw-of-ubyte5-fix-rs2
      (equal (exec-sllw rd rs1 (ubyte5-fix rs2)
                        stat feat)
             (exec-sllw rd rs1 rs2 stat feat)))

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

    (defthm exec-sllw-ubyte5-equiv-congruence-on-rs2
      (implies (ubyte5-equiv rs2 rs2-equiv)
               (equal (exec-sllw rd rs1 rs2 stat feat)
                      (exec-sllw rd rs1 rs2-equiv stat feat)))
      :rule-classes :congruence)

    Theorem: exec-sllw-of-stat-fix-stat

    (defthm exec-sllw-of-stat-fix-stat
      (equal (exec-sllw rd rs1 rs2 (stat-fix stat)
                        feat)
             (exec-sllw rd rs1 rs2 stat feat)))

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

    (defthm exec-sllw-stat-equiv-congruence-on-stat
      (implies (stat-equiv stat stat-equiv)
               (equal (exec-sllw rd rs1 rs2 stat feat)
                      (exec-sllw rd rs1 rs2 stat-equiv feat)))
      :rule-classes :congruence)

    Theorem: exec-sllw-of-feat-fix-feat

    (defthm exec-sllw-of-feat-fix-feat
      (equal (exec-sllw rd rs1 rs2 stat (feat-fix feat))
             (exec-sllw rd rs1 rs2 stat feat)))

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

    (defthm exec-sllw-feat-equiv-congruence-on-feat
      (implies (feat-equiv feat feat-equiv)
               (equal (exec-sllw rd rs1 rs2 stat feat)
                      (exec-sllw rd rs1 rs2 stat feat-equiv)))
      :rule-classes :congruence)