Register–memory architecture


In computer engineering, a register–memory architecture is an instruction set architecture that allows operations to be performed on memory, as well as registers. If the architecture allows all operands to be in memory or in registers, or in combinations, it is called a "register plus memory" architecture.
In a register–memory approach one of the operands for operations such as the ADD operation may be in memory, while the other is in a register. This differs from a load–store architecture in which both operands for an ADD operation must be in registers before the ADD.
Example of Load-Store

;Add mem1 to mem2
mov r1, ; Load first value into register
mov r2, ; Load second value into register
add r2, r1, r2 ; r2 = r1 + r2
mov,r2 ; Store result

Example of register-memory
Some register-memory machines cannot write ALU results to memory, only their registers. This is like an accumulator machine with multiple accumulators:

;Add mem1 to mem2, if add-register-to-memory instructions are not supported
mov r1, ; Load first value into register
add r1, ; Add second value into register
mov, r1 ; Store result

Some register-memory machines are able to write ALU results directly to memory, saving an instruction:

;Add mem1 to mem2, if add-register-to-memory instructions are supported
mov r1, ; Load first value into register
add,r1 ; Add it to second value

Example of register plus memory

;Add mem1 to mem2
add, ; Add first to second value

An example of register-memory architecture that can write ALU results to memory is the Intel x86.
Examples of register plus memory architecture are: