Definition
An instruction set architecture (ISA) is the specification of a processor as software sees it: the instructions and their binary encodings, the registers and memory that software can use, and the exact effect of each instruction on them, including what happens when an instruction cannot complete normally. Machine code that relies only on what the ISA defines gives the same results on every processor that implements it. How a processor produces those results, and how fast, is its microarchitecture §4.39, which the ISA leaves open. Examples are x86-64 and Armv7-M.
The idea
A compiler turns a C program into machine code once, and that one file of machine code runs on processors that differ greatly inside. x86-64 processors from different manufacturers and generations, with different pipelines, cache sizes and clock speeds, all run the same program and compute the same results. That is possible only because every one of them obeys the same written contract about what each instruction does. The ISA is that contract. The compiler writer reads it to know what code to emit; the processor designer reads it to know what to build; neither needs to know about the other.
The contract is about results, not about speed. A restaurant menu is a fair picture: it promises which dish you get when you order an item, and every kitchen that serves from the menu must deliver that dish; how the kitchen is laid out, and how long you wait, is the kitchen’s business. The picture stops in two places. An ISA deliberately leaves some outcomes open, for example the result of certain malformed encodings. Also, an ISA has versions and optional extensions, so a program must name the exact version and extensions it relies on.
How it works
An ISA specifies five parts.
Architectural state, the values software can observe and change: the general-purpose registers and their width, for example sixteen 32-bit registers
r0tor15in Armv7-M, of whichr15is the program counter §2.9, the register that holds the address of the next instruction; status bits such as the condition flags §4.42, which record properties of the last result, for example whether it was zero; the memory, seen as an array §14.5 of bytes numbered by address; and system registers that control the processor.Instructions and their encodings. Each instruction is stored as a bit pattern, its instruction encoding §2.7, in which some fields select the operation and others name the operands. Decoding reads the bits and identifies the operation, given by the opcode §2.8 field, and the operands, the registers or constant values the operation uses. The same bits can mean different instructions in different ISAs, or in different modes of one ISA, so a byte sequence has a meaning only together with the ISA and mode it was written for.
The effect of each instruction: an exact rule that maps the architectural state before the instruction to the state after it, including which flags change.
Exceptions and privilege. What happens when an instruction cannot complete, for example an undefined encoding, a forbidden memory access, or a division by zero on a processor configured to trap it; and which instructions and registers only software at a higher privilege level §6.10, such as an operating system kernel, may use.
The memory model: which orders of memory accesses other processor cores and devices may observe, and which memory barrier §4.37 instructions restrict those orders.
What the ISA leaves to each implementation is its microarchitecture: the pipeline that overlaps the work on several instructions, the caches, the branch predictor that guesses which way a branch will go before the branch is decided, the number of cycles each instruction takes, and the power drawn. Two processors with the same ISA and different microarchitectures run the same program to the same results in different times.
An ISA can also describe a machine that exists only in software. The Linux kernel documentation specifies the instruction set of the extended Berkeley Packet Filter §2.1 (eBPF) as an ISA. A virtual machine §2.3, a program that carries out the instructions of another machine, executes it, or a compiler translates it into the host processor’s machine code.
The ISA does not fix how functions pass arguments, which registers a called function must preserve, or how data are laid out in memory. Those conventions form the application binary interface (ABI §12.47), which is defined on top of the ISA. Two pieces of code for the same ISA can work together only if they also follow the same ABI.
Worked example
Take the 16-bit instruction written ADDS r0, #1 in the Thumb §4.40 instruction set that Armv7-M processors execute. It adds 1 to register r0 and updates the condition flags. Its instruction encoding is 0x3001, the bits 00110 000 00000001:
the five bits
00110act as the opcode and select the operation “add an 8-bit constant to a register”;000is register number 0, sor0is both a source and the destination;00000001is the constant 1.
Now execute the instruction with r0 holding 0xFFFFFFFF, the largest 32-bit unsigned value, 4,294,967,295.
The mathematical sum is .
The register keeps only 32 bits, so
r0becomes , that is0x00000000.The flags: N (negative) is 0, because bit 31 of the result is 0; Z (zero) is 1, because the result is 0; C (carry) is 1, because the unsigned sum did not fit in 32 bits; V (overflow) is 0, because read as signed numbers the sum is , which fits.
Every Armv7-M processor, whatever its microarchitecture, must produce exactly this state. That is an architectural guarantee.
Timing is a different matter. The Cortex-M4 §6.3 technical reference manual, the manual for that one processor design, lists the divide instructions UDIV and SDIV as taking from 2 to 12 cycles, with fewer cycles for some operand values, because the divider stops early when it can. The Armv7-M architecture manual says what a division computes and nothing about how long it takes. So the statement that a division takes 2 to 12 cycles is a property of the Cortex-M4 design, and a measurement such as “this division took 5 cycles on my board” is an observation about one chip, one clock configuration and one memory setup. Neither is an ISA guarantee. Code whose security depends on timing, such as a constant-time comparison §4.33, must not give such an instruction secret operands.
Stated precisely
Let be the architectural state: every register, flag, memory byte and system setting that software can observe. For each valid encoding , the ISA defines a rule that maps the state before the instruction to the state after it, , or that names the exception the instruction raises. Where the ISA leaves a choice open, the rule gives a set of permitted results instead of one result. Choices the specification calls implementation defined must be documented by each implementation; results it calls unpredictable must not be relied on. Time does not appear in , so no rule of this form says anything about how long an instruction takes. Everything these rules determine is an architectural guarantee: it holds on every conforming implementation of the same ISA version with the same optional extensions.
Timing can be promised in two other ways, each with its own scope. A processor’s technical reference manual can publish cycle counts for that processor design; they hold for that design only, and still depend on its memory system and configuration. An architecture can also add an explicit timing guarantee as a feature: Armv8.4-A added Data Independent Timing (DIT), a processor state bit that, when set, guarantees that a listed set of instructions take a time independent of the data values they process.
Limits and common mistakes
An instruction’s name is not its specification. The mnemonic, the short written name of an instruction such as ADDS, means only what the exact ISA version defines, and two ISAs can use one mnemonic for operations with different flag or exception behavior.
A behavior observed on one processor is not a guarantee. Code that happens to work on one chip while relying on a result the ISA leaves unpredictable may fail on another chip.
The same ISA does not mean the same timing, power or side-channel §1.29 behavior. Caches and branch predictors belong to the microarchitecture, and most leakage through timing comes from them. The ISA guarantees only that the architectural state ends up as if no instruction on a wrongly predicted path had run; it says nothing about the traces such instructions leave in the cache, which is how the Spectre attacks published in 2018 read secrets through timing [252].
A different ISA is not an isolation boundary by itself. A virtual machine that runs another ISA, such as an eBPF interpreter §2.13, protects its host only as far as the interpreter checks every memory access and every operation.
Questions answered
Which properties are architectural guarantees rather than implementation timing observations?
Architectural guarantees are the properties that the ISA (instruction set architecture) specification states for every conforming processor: the encoding of each instruction and how it decodes; the values each instruction writes to registers, flags and memory; which exceptions occur and when; the register set and register widths; alignment §4.22 rules; privilege rules; and the memory-ordering rules together with the meaning of each barrier instruction. They hold on every implementation of the same ISA version with the same extensions, and only for behavior the ISA defines rather than leaves open.
Implementation timing observations are everything about time: cycles per instruction, latency, throughput, cache hit and miss times, and the duration of a measured run. They depend on the microarchitecture, the clock and memory configuration and the cache contents, and they can change from one processor to another. A timing property becomes a guarantee only when a document of matching scope states it: a processor’s technical reference manual for that design, such as the Cortex-M4’s 2 to 12 cycles for a division, or an architectural feature that explicitly promises timing, such as Arm’s Data Independent Timing (DIT). A single measurement is an observation, never a guarantee.
Related entries: Microarchitecture (§4.39), Opcode (§2.8), Interpreter semantic fidelity (§2.38), Condition flags (APSR) (§4.42), Instruction encoding (§2.7), Arm Thumb and Thumb-2 (§4.40), Native application binary interface (ABI) (§12.47). Further reading: [1, 5, 81, 252].