• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • Java
      • Riscv
        • Specification
        • Executable
          • Decoding-left-inverse
          • Decoding-executable
            • Decodex
            • Get-fields-rtype
            • Get-fields-stype
            • Get-fields-itype
            • Get-fields-btype
            • Get-imm-jtype
            • Get-imm-btype
              • Get-imm-utype
              • Get-fields-utype
              • Get-imm-stype
              • Get-imm-itype
              • Get-funct7
              • Get-funct3
              • Get-fields-jtype
              • Get-rs2
              • Get-rs1
              • Get-rd
              • Get-opcode
            • Decoding-right-inverse
            • Execution-executable
            • Decoding-correct
          • Specialized
          • Optimized
        • Taspi
        • Bitcoin
        • Zcash
        • Des
        • X86isa
        • Sha-2
        • Yul
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Axe
        • Poseidon
        • Where-do-i-place-my-book
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Decoding-executable

    Get-imm-btype

    Retrieve the immediate field of a B-type instruction.

    Signature
    (get-imm-btype enc) → imm
    Arguments
    enc — Guard (ubyte32p enc).
    Returns
    imm — Type (ubyte12p imm).

    This consists of four chunks, in bits 8-11, 25-30, 7, and 31 [ISA:2.2], which, when joined, form the bits imm[12:1] of the immediate. We return those 12 bits, not imm[12:0] with imm[0] implicitly 0.

    Definitions and Theorems

    Function: get-imm-btype

    (defun get-imm-btype (enc)
      (declare (xargs :guard (ubyte32p enc)))
      (b* ((imm[4.1] (part-select enc :low 8 :high 11))
           (imm[10.5] (part-select enc :low 25 :high 30))
           (imm[11] (part-select enc :low 7 :high 7))
           (imm[12] (part-select enc :low 31 :high 31)))
        (logappn 4 imm[4.1]
                 6 imm[10.5] 1 imm[11] 1 imm[12])))

    Theorem: ubyte12p-of-get-imm-btype

    (defthm ubyte12p-of-get-imm-btype
      (b* ((imm (get-imm-btype enc)))
        (ubyte12p imm))
      :rule-classes :rewrite)