• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • 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
          • App-view
          • Top-level-memory
          • 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
              • 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
                • Opcode-present?
                • 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
    • Instructions-with-mandatory-prefixes

    Opcode-present?

    Returns a 256-element list, where a 1 at a position i denotes that at least one instruction with opcode i exists in inst-lst; 0 denotes no such instruction is present.

    Signature
    (opcode-present? first-opcode num-opcodes inst-lst) → lst
    Arguments
    first-opcode — Guard (24bits-p first-opcode).
    num-opcodes — Guard (natp num-opcodes).
    inst-lst — Guard (inst-list-p inst-lst).
    Returns
    lst — Type (true-listp lst).

    Definitions and Theorems

    Function: opcode-present?

    (defun opcode-present? (first-opcode num-opcodes inst-lst)
      (declare (xargs :guard (and (24bits-p first-opcode)
                                  (natp num-opcodes)
                                  (inst-list-p inst-lst))))
      (let ((__function__ 'opcode-present?))
        (declare (ignorable __function__))
        (b* (((when (zp num-opcodes)) nil)
             (rest (if (24bits-p (1+ first-opcode))
                       (opcode-present? (1+ first-opcode)
                                        (1- num-opcodes)
                                        inst-lst)
                     (er hard? 'opcode-present?
                         "Illegal opcode ~s0.~%"
                         (str::hexify (1+ first-opcode)))))
             (same-opcode-insts (select-insts inst-lst
                                              :opcode first-opcode))
             ((when (endp same-opcode-insts))
              (cons 0 rest)))
          (cons 1 rest))))

    Theorem: true-listp-of-opcode-present?

    (defthm true-listp-of-opcode-present?
      (b* ((lst (opcode-present? first-opcode num-opcodes inst-lst)))
        (true-listp lst))
      :rule-classes :rewrite)