RISC
|
A Complex Instruction Set Computer (CISC) provides a large and powerful range of instructions, but executes them more slowly due to the fact that each instruction may do many things. For example, the 8086 microprocessor family has these instructions:
JA Jump if Above JAE Jump if Above or Equal JB Jump if Below ... JPO Jump if Parity Odd JS Jump if Sign JZ Jump if ZeroThere are 32 jump instructions in the 8086, and the 80386 adds more.
By contrast, the Reduced Instruction Set Computer (RISC) concept is to identify the subcomponents and use those. There are only two Jump instructions in the ARM processor - Branch and Branch with Link. The "if equal, if carry set, if zero" type of selection is handled by condition options, so for example:
BLNV Branch with Link NeVer (useful!) BLEQ Branch with Link if EQualand so on. The
BL
part is the instruction, and the following part is the condition.
This is made more powerful by the fact that conditional execution can be applied to most
instructions! This has the benefit that you can test something, then only do the next few
commands if the criteria of the test matched. No branching off, you simply add conditional flags
to the instructions you require to be conditional.
Most modern CISC processors, such as the Pentium, uses a fast RISC core with an interpreter sitting between the core and the instruction. So when you are running Windows95 on a PC, it is not that much different to trying to get W95 running on the software PC emulator. Just imagine the power of the underlying hardware in the Pentium...
Another benefit of RISC is that it contains a large number of registers, most of which can be used as general purpose registers.
As you have seen above the ARM register set defines at minimum R15 as the program counter, and R14 as the link register (although, after saving the contents of R14 you can use this register as you wish). R0 to R13 can be used in any way you choose, although the Operating System suggests that R13 is used as a stack pointer. You can, if you don't require a stack, use R13 for your own purposes. APCS applies firmer rules and assigns more functions to registers (such as Stack Limit). However, again as long as you store the contents of the registers and restore after, even under APCS you can use R0 to R14 as you like.
The 8086 offers you fourteen registers, but with caveats:
The first four (A, B, C, and D) are Data registers (a.k.a. scratch-pad registers). They are 16bit
and accessed as two 8bit registers, thus register A is really AH (A, high-order byte) and AL (A
low-order byte). These can be used as general purpose registers, but they can also have dedicated
functions - Accumulator, Base, Count, and Data.
The next four registers are Segment registers for Code, Data, Extra, and Stack.
Then come the five Offset registers: Instruction Pointer (PC), SP and BP for the stack, then SI
and DI for indexing data.
Finally, the flags register holds the processor state.
As you can see, most of the registers are tied up with the bizarre memory addressing scheme used
by the 8086. So only four general purpose registers are available, and even they are not as
flexible as ARM registers.
A final example of minimal registers is the 6502 processor, which offers you:
Accumulator - for results of arithmetic instructions
X register - First general purpose register
Y register - Second general purpose register
PC - Program Counter
SP - Stack Pointer, offset into page one (at &01xx).
PSR - Processor Status Register - the flags.
While it might seem like utter madness to only have two general purpose registers,
the 6502 was a very popular processor in the '80s. Many famous computers have been built
around it.
For the Europeans: consider the Acorn BBC Micro, Master, Electron...
For the Americans: consider the Apple2 and the Commadore PET.
The ORIC uses a 6502, and the C64 uses a varient of the 6502.
(in case you were wondering, the Speccy uses the other popular processor - the ever
bizarre Z80)
So if entire systems could be created with a 6502, imagine the flexibility of the ARM
processor.
It has been said that the 6502 is the bridge between CISC design and RISC. Acorn chose the
6502 for their original machines such as the Atom and the System# units. They went from
there to design their own processor - the ARM.