• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • X86isa
        • Program-execution
        • Sdm-instruction-set-summary
        • Tlb
        • Running-linux
        • Introduction
        • Asmtest
        • X86isa-build-instructions
        • Publications
        • Contributors
        • Machine
          • X86isa-state
          • Syscalls
          • Cpuid
          • Linear-memory
          • Rflag-specifications
          • Characterizing-undefined-behavior
          • Top-level-memory
          • App-view
          • X86-decoder
          • Physical-memory
          • Decoding-and-spec-utils
            • Read-operands-and-write-results
            • Effective-address-computations
            • Select-operand-size
            • Instruction-pointer-operations
            • Stack-pointer-operations
            • Select-segment-register
            • Prefix-modrm-sib-decoding
              • Modr/m-decoding
                • Modr/m-structures
                  • Modr/m
                    • !modr/m->r/m
                    • !modr/m->reg
                    • !modr/m->mod
                    • Modr/m-p
                    • Modr/m->reg
                    • Modr/m->mod
                    • Modr/m-fix
                    • Modr/m->r/m
                    • Modr/m-equiv-under-mask
                    • Modr/m-debug
                  • Three-byte-opcode-modr/m-p
                  • 64-bit-mode-0f-3a-three-byte-opcode-modr/m-p
                  • 64-bit-mode-0f-38-three-byte-opcode-modr/m-p
                  • 32-bit-mode-0f-3a-three-byte-opcode-modr/m-p
                  • 32-bit-mode-0f-38-three-byte-opcode-modr/m-p
                  • 64-bit-mode-two-byte-opcode-modr/m-p
                  • 32-bit-mode-two-byte-opcode-modr/m-p
                  • Two-byte-opcode-modr/m-p
                  • Show-no-modr/m-insts
                  • 64-bit-mode-one-byte-opcode-modr/m-p
                  • 32-bit-mode-one-byte-opcode-modr/m-p
                  • Vex-opcode-modr/m-p
                  • One-byte-opcode-modr/m-p
                • Mandatory-prefixes-computation
                • Modr/m-detection
                • Legacy-prefixes-decoding
                • Compute-mandatory-prefix-for-three-byte-opcode
                • 64-bit-compute-mandatory-prefix-for-0f-3a-three-byte-opcode
                • 64-bit-compute-mandatory-prefix-for-0f-38-three-byte-opcode
                • 32-bit-compute-mandatory-prefix-for-0f-3a-three-byte-opcode
                • 32-bit-compute-mandatory-prefix-for-0f-38-three-byte-opcode
                • 64-bit-compute-mandatory-prefix-for-two-byte-opcode
                • 32-bit-compute-mandatory-prefix-for-two-byte-opcode
                • Instructions-with-mandatory-prefixes
                • Compute-mandatory-prefix-for-0f-3a-three-byte-opcode
                • Compute-mandatory-prefix-for-0f-38-three-byte-opcode
                • Compute-mandatory-prefix-for-two-byte-opcode
              • Select-address-size
              • Rex-byte-from-vex-prefixes
              • Check-instruction-length
              • Error-objects
              • Rip-guard-okp
              • Sib-decoding
            • Instructions
            • Register-readers-and-writers
            • X86-modes
            • Segmentation
            • Other-non-deterministic-computations
            • Environment
            • Paging
          • Implemented-opcodes
          • To-do
          • Proof-utilities
          • Peripherals
          • Model-validation
          • Modelcalls
          • Concrete-simulation-examples
          • Utils
          • Debugging-code-proofs
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Modr/m

    Modr/m->r/m

    Access the |X86ISA|::|R/M| field of a modr/m bit structure.

    Signature
    (modr/m->r/m x) → r/m
    Arguments
    x — Guard (modr/m-p x).
    Returns
    r/m — Type (3bits-p r/m).

    Definitions and Theorems

    Function: modr/m->r/m$inline

    (defun modr/m->r/m$inline (x)
      (declare (xargs :guard (modr/m-p x)))
      (mbe :logic
           (let ((x (modr/m-fix x)))
             (part-select x :low 0 :width 3))
           :exec (the (unsigned-byte 3)
                      (logand (the (unsigned-byte 3) 7)
                              (the (unsigned-byte 8) x)))))

    Theorem: 3bits-p-of-modr/m->r/m

    (defthm 3bits-p-of-modr/m->r/m
      (b* ((r/m (modr/m->r/m$inline x)))
        (3bits-p r/m))
      :rule-classes :rewrite)

    Theorem: modr/m->r/m$inline-of-modr/m-fix-x

    (defthm modr/m->r/m$inline-of-modr/m-fix-x
      (equal (modr/m->r/m$inline (modr/m-fix x))
             (modr/m->r/m$inline x)))

    Theorem: modr/m->r/m$inline-modr/m-equiv-congruence-on-x

    (defthm modr/m->r/m$inline-modr/m-equiv-congruence-on-x
      (implies (modr/m-equiv x x-equiv)
               (equal (modr/m->r/m$inline x)
                      (modr/m->r/m$inline x-equiv)))
      :rule-classes :congruence)

    Theorem: modr/m->r/m-of-modr/m

    (defthm modr/m->r/m-of-modr/m
      (equal (modr/m->r/m (modr/m r/m reg mod))
             (3bits-fix r/m)))

    Theorem: modr/m->r/m-of-write-with-mask

    (defthm modr/m->r/m-of-write-with-mask
     (implies
      (and
         (fty::bitstruct-read-over-write-hyps x modr/m-equiv-under-mask)
         (modr/m-equiv-under-mask x y fty::mask)
         (equal (logand (lognot fty::mask) 7) 0))
      (equal (modr/m->r/m x)
             (modr/m->r/m y))))