Instruction formats and addressing modes


Consider a machine that uses a stack for everything. If you need to add two numbers together, the CPU will take the top two numbers off the stack, add them, and put the result back onto the stack. For this particular add operation, the location of the data and the result is always the same. Nothing comes from memory, nothing is put into a register. This is known as a "zero-address" instruction. Everything is implicit.

A more common older architecture used one main register in the CPU for everything. This register, often known as an accumulator , was the main source or destination for all instructions. A load would get data from memory and place it into the register; a store would put it back to memory. An add needed to have a memory address specified; it would get the data from that location, add it to the value currently in the accumulator, and put the result there as well. This is a single address instruction ”one source and the destination are always the same. Many of the old 8-bit microprocessors follow this scheme.

A double-address instruction would provide a source and a destination in the instruction code itself. This is most commonly used on machines with many registers in the CPU. An add would take a value from one register and add it to the value in another.

And finally, a triple-address instruction would indicate two source operands and a destination (usually using registers for all of them). This scheme would allow you to take a value from one register, add it to the value in another, and place the result in a third.

Aside from providing some interesting history, why are we telling you about all of this? Well, you'll soon find that the SPARC processor uses several of these formats for its instructions, especially the last. Triple-address instructions are used for all arithmetic.



PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net