Based off opcode-maps, pre-computing the opcodes that have a
valid instruction corresponding to the following prefixes:
Function:
(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:
(defthm true-listp-of-opcode-present? (b* ((lst (opcode-present? first-opcode num-opcodes inst-lst))) (true-listp lst)) :rule-classes :rewrite)