Instruction Set Architectures

The key point of the instruction set architecture is that it is the interface from the programmer to the hardware. Over time, views as to how best to design an instruction set to make the best use of the hardware have evolved:

Classification of Architectures

While every instruction set is different, they can be discussed and classified in broad "families".

The first, and most widely used, distinction is based on the number of operands available to specify common arithmetic operations such as addition.

0-Operand
These are also called "stack machines": there is direct support in the instruction set for a stack, and arithmetic operations don't specify any operands explicitly. Instead, when one executes, say, an add instruction, the top two elements of the stack are added together. Adding a couple of operands in a stack machine would look something like
push xyzzy  # push first operand
push blarg  # push second operand
add         # add them together
pop res     # put result in location 'res'

In some ways, we might say that a stack machine epitomized the CISC design philosophy: since we think of expression evaluation in terms of a stack model, we should directly support that stack model in the instruction set. I've even got one early-1980s computer architecture text that makes the assertion that in the future we will look askance at instruction sets that use registers (!).

Unfortunately, a stack-based instruction set introduces dependencies - typically false dependencies - between virtually all the arithmetic instructions. These instruction sets are virtually unknown today. We still regard expression evaluation in terms of a stack, but we try to use the registers effectively to avoid unnecessary conflicts.

1-Operand
These are also called "accumulator machines", because in early computers the single arithmetic register was known as the "accumulator." In an accumulator machine, you get to specify a single memory operand when performing arithmetic, as in
ld  xyzzy  # load first operand into accumulator
add blarg  # add second operand to it
st  res    # store result to res

Accumulator machines are still seen down in the 8-bit microcontroller world. The very popular Freescale (nee Motorola) HC11 family might be called a one-and-a-half address machine, since it has two accumulators.

2-Operand
In a two-operand machine, you get to specify a source operand and a destination operand; the second source is the same as the destination. So you'd do something like:
mov  xyzzy, res # copy first operand to final destination
add  blarg, res # add second operand to it

Notice that in this example, no registers are used! Two-operand computers would have several registers, and might require at least one of the operands to be in one of the registers (this latter is true of the Intel x86 family).

These machines also typically have very powerful addressing mode support: rather than simply specifying a memory address, quite intricate arithmetic could be performed on the addressing itself. A DEC PDP-11 could emulate a stack machine with its addressing modes! A stack add would involve

add (sp)+ (sp)

This instruction would use register 6 (the stack pointer) as a pointer into memory, read the first operand, and increment the stack pointer. It would then read the second operand (also using the stack pointer as a pointer into memory), add the operands, and put the result into the location pointed to by the SP.

The Intel x86 family is, of course, the dominant instruction set in use today. It's a two-operand instruction set; it has an addressing mode that allows it to do a array lookup in a local variable in a single operand of an instruction! On the other hand, it is restricted to requiring that at least one of its operands must be in memory for most arithmetic instructions.

3-Operand
This is the most general, and flexible, class of instruction sets: it lets the programmer specify both operands and the destination, separately. The DEC VAX was a three-operand machine.

The RISC computers were all three-operand computers, but with the restriction that all operands of arithmetic instructions had to be in registers, with separate instructions required to load and store the registers. These were referred to as load-store instruction sets.


Last modified: Fri Jan 16 13:15:25 MST 2009

Valid HTML 4.01 Transitional