Industrial Training




Instruction Sets

The instruction set, also called instruction set architecture (ISA), is part of a computer that pertains to programming, which is basically machine language. The instruction set provides commands to the processor, to tell it what it needs to do. The instruction set consists of addressing modes, instructions, native data types, registers, memory architecture, interrupt, and exception handling, and external I/O.

An example of an instruction set is the x86 instruction set, which is common to find on computers today. Different computer processors can use almost the same instruction set while still having very different internal design. Both the Intel Pentium and AMD Athlon processors use nearly the same x86 instruction set. An instruction set can be built into the hardware of the processor, or it can be emulated in software, using an interpreter. The hardware design is more efficient and faster for running programs than the emulated software version.



Examples of instruction set ADD - Add two numbers together.
COMPARE - Compare numbers.
IN - Input information from a device, e.g. keyboard.
JUMP - Jump to designated RAM address.
JUMP IF - Conditional statement that jumps to a designated RAM address.
LOAD - Load information from RAM to the CPU.
OUT - Output information to device, e.g. monitor.
STORE - Store information to RAM.

The instruction sets can be differentiated by

Operand storage in the CPU
Number of explicit operands per instruction
Operand location
Operations
Type and size of operands

The type of internal storage in the CPU is the most basic differentiation. The major choices are
a stack (the operands are implicitly on top of the stack)
an accumulator (one operand is implicitly the accumulator)
a set of registers (all operands are explicit either registers or memory locations)



the code segment c = a + b how it would appear on the classes of instruction sets
stack accumulator register
push a load a load r1,a
push b add b add r1,b
add store c store c,r1
pop c


While most early machines used stack or accumulator-style architectures, all machines designed in the past ten years use a general purpose architecture. The reason is the registers are:


faster then memory
easier for a compiler to use
can be used more effectively



primary advantages and disadvantages of each class of machine
machine type advantages disadvantages
stack simple model of expression evaluation. good code density. a stack can't be randomly accessed. it makes it difficult to generate efficient code.
accumulator minimizes internal state of machine. short instructions since accumulator is only temporary storage, memory traffic is highest.
register most general model for code generation all operands must be named, leading to longer instructions.


classification of general purpose register machines

there are two major instruction set characteristics that divide gpr architectures. they concern
whether an alu instruction has two or three operands
add r3, r1, r2 
r3 <-r1 + r2
              or add r1, r2 
r1 <- r1 + r2


how many of the operands may be memory addressed in alu instruction



register- register (load/store)
add r3, r1, r2     (r3 <- r1 + r2)


register - memory
add r1, a               (r1 <- r1 + a)


memory - memory
add c, a, b            (c <- a + b)



Hi I am Pluto.