Register-Set Architecture: Modern CPUs have a number of general-purpose registers (GPR's) for internal storage: at least 8 and as many as 32. GPR machines are the most flexible of all, because they allow the user to access any of several registers. The load/store commands must typically specify a register and memory location, to indicate both source and destination of the data. Any register can be used as an accumulator, an index register, or for temporary storage, etc., so many variables and addresses can be manipulated without extra memory accesses. The major bad point of having many registers is the large amount of internal CPU state that must be saved/restore for calls, returns, and interrupts.

A register-set architecture can be designed several different ways. The ALU operations consist of the ALU operator, and two or three registers, which are assumed to contain the 2 operands, and tell where the result should go.One difference is whether arithmetic instructions have two addresses or three addresses:

  + Two-address arithmetic: Each arithmetic instruction contains

a source address and a destination address: the destination

is also the second source operand. For example, an Add R1,R2

instruction adds register R2 to register R1.

+ Three-address arithmetic: Each arithmetic instruction

contains two source addresses and one destination address.

For example, an Add R3,R1,R2 instruction will store the sum

of registers R1 and R2 into register R3.

Two-address instructions are shorter than three-address instructions but they always overwrite a source operand with a result: both source operands can be preserved with three address instructions. Some register-set architectures restrict arithmetic to only registers while other register-set architectures allow arithmetic with memory locations.Of all the possible types of a register-set architecture, three types are common: register-register, register-memory, and memory-memory.

+Register-Register: Each arithmetic instruction has three

addresses but all addresses specify registers: the only

instructions accessing memory are load and store which can't

perform arithmetic. Another name for a register-register

architecture is load- store: a separate load instruction is

required for each source operand in memory and a separate

store instruction is required to put a result in memory.

SHOW ME AN EXAMPLE

 

+ Register-Memory: Each arithmetic instruction has two

addresses where the destination address is always a register

and the source address can be either a register or a memory

location.

SHOW ME AN EXAMPLE

 

+ Memory-Memory: Each arithmetic instruction has three

addresses and any address can specify a register or a memory

location.

 

SHOW ME AN EXAMPLE

 

THIS WAY TO EXAMPLES OF ALL SORTS!!