Skip to content
STIMSMITH

instr datatype

CodeArtifact WIKI v1 · 5/25/2026

The `instr` datatype is an Isabelle abstract datatype used to model the assembler instruction set. Its constructors correspond to instruction mnemonics with operands, grouped into data transfer, arithmetic/logical, test, shift, control, and interrupt instructions.

instr datatype

Overview

instr is an Isabelle abstract datatype defining the assembler instruction set in the cited microprocessor case study. The datatype uses operation mnemonics as datatype constructors, with each constructor carrying the operands for the corresponding assembler operation. The evidence presents instr as part of an assembler-level model used for instruction semantics and transition definitions. [C1]

Instruction categories

The datatype distinguishes several classes of instructions. The source excerpt gives representative constructors rather than a complete listing:

datatype instr =
  -- {* data transfer (memory) *}
  Ilb regname regname immed
  | ...
  -- {* data transfer (constant) *}
  | Ilhgi regname immed
  | ...
  -- {* data transfer (registers) *}
  | Imovs2i regname regname
  | ...
  -- {* arithmetic / logical operations *}
  | Iaddio regname regname immed
  | ...
  -- {* test operations *}
  | Iclri regname
  | ...
  -- {* shift operations *}
  | Islli regname regname shift_amount
  | ...
  -- {* control operations *}
  | Ibeqz regname immed
  | ...
  -- {* interrupt *}
  | Itrap immed
  | ...

The listed groups are data transfer commands, arithmetic and logical operations, test operations, shift operations, control operations, and basic interrupts. [C1]

Semantic role

Instruction semantics are defined by a function over assembler configurations and instr values:

fun exec_instr :: [ASMcoret, instr] ⇒ ASMcoret

For a given initial assembler configuration and instruction, exec_instr returns the resulting configuration after executing that instruction. The evidence shows representative semantic clauses for arithmetic, logical, and shift instructions, such as Iaddo, Iand, and Isll, each delegating to helper operations such as arith_exec. [C2]

Use in transition relation

The model defines a transition function Step that advances an assembler configuration by executing the current instruction:

definition Step :: ASMcoret ⇒ ASMcoret
where Step st ≡ exec_instr st (current_instr st)

Thus, instr values are the instruction objects consumed by the execution semantics underlying the assembler-level transition relation. [C3]

Configuration context

The assembler configurations acted on by exec_instr are records of type ASMcoret, containing a delayed program counter dpc, a program-counter-related field pcp, general-purpose registers gprs, special-purpose registers sprs, and memory mm. Register files are modeled as lists of integer register contents, and the well-formedness predicate is_ASMcore requires both general-purpose and special-purpose register files to contain exactly 32 registers and requires register and memory values to satisfy validity predicates. [C4]

Abstraction level

The assembler model containing instr is described as more abstract than the processor model. The source states that details such as interrupt handling, virtual memory and caching, pipelining, and instruction reordering are made transparent at this level. [C5]

LINKED ENTITIES

1 links

CITATIONS

6 sources
6 citations
[1] The `instr` datatype is an Isabelle abstract datatype defining the assembler instruction set, with operation mnemonics used as constructors associated with operands. Test Program Generation for a Microprocessor: A Case Study
[2] The datatype distinguishes data transfer, arithmetic/logical, test, shift, control, and interrupt instruction classes, with representative constructors such as `Ilb`, `Ilhgi`, `Imovs2i`, `Iaddio`, `Iclri`, `Islli`, `Ibeqz`, and `Itrap`. Test Program Generation for a Microprocessor: A Case Study
[3] `exec_instr` maps an assembler configuration and an `instr` value to the resulting assembler configuration, with representative clauses for arithmetic, logical, and shift instructions. Test Program Generation for a Microprocessor: A Case Study
[4] The `Step` transition executes the current instruction with `exec_instr st (current_instr st)`. Test Program Generation for a Microprocessor: A Case Study
[5] `ASMcoret` contains `dpc`, `pcp`, `gprs`, `sprs`, and `mm`; register files are integer lists; and `is_ASMcore` requires 32 general-purpose and 32 special-purpose registers with valid register and memory values. Test Program Generation for a Microprocessor: A Case Study
[6] The assembler model is more abstract than the processor model and abstracts over details including interrupt handling, virtual memory and caching, pipelining, and instruction reordering. Test Program Generation for a Microprocessor: A Case Study