The RISC philosophy
Having used the term RISC to describe
the ARM chip that powered the Archimedes, and because the same tag can be
applied to today’s ARM technology, it makes sense to start by investigating
this approach to the design of a microprocessor. To do that, we need to begin
with a brief history lesson.
Early 8-bit microprocessors like the
Intel 8080 or the Motorola 6800 had only a few simple instructions. They didn’t
even have an instruction to multiply two integer numbers, for example, so this
had to be done using long software routines involving multiple shifts and
additions. Working on the belief that hardware was fast but software was slow,
subsequent microprocessor development involved providing processors with more
instructions to carry out ever more complicated functions. Called the CISC
(complicated instruction set computer) approach, this was the philosophy that
Intel adopted and that, more or less, is still followed by today’s latest Core
i7 processors. This move to increasingly complicated instructions came at a
cost. Although the first microprocessors could execute most of their
instructions in just a handful of clock cycles, as processors became more
complicated, significantly more clock cycles were required.
In the early 1980s a radically
different philosophy called RISC (reduced instruction set computer) was
conceived. According to this model of computing, processors would have only a
few simple instructions but, as a result of this simplicity, those instructions
would be super-fast, most of them executing in a single clock cycle. So while
much more of the work would have to be done in the software, an overall gain in
performance would be achievable. Many RISC-based processor families adopted
this approach and exhibited impressive performance in their niche application
of Unix-based servers and engineering workstations. Some of these families are
now long gone
but the fact that several — including
IBM’s POWER, Sun’s SPARC and, of course, ARM — are giving the x86 architecture
a run for its money rather suggests that less can indeed be more.
We really are talking about a
minimalist approach here. In a classic RISC design, all arithmetic and logic
operations are carried out on data stored in the processor’s internal
registers. The only instructions that access memory are a load instruction,
which writes a value from memory into a processor register, and the store
instruction that does the opposite. A simple example will illustrate how this
results in more instructions having to be executed. If you’ve ever tried your
hand at programming using a high-level language like BASIC, you’ll surely have
written an instruction like A = B + C that adds together the values in
variables (memory locations) A and B, and writes the result to another variable
called C. With a CISC processor, this one instruction would become three as
shown in the following example, which is for a typical processor:
·
LOAD A
·
ADDB
·
STORE C
In this example, the LOAD instruction
writes the value from memory location A into the processor’s accumulator (a
special register used for arithmetic and logic operations), the ADD instruction
adds the value from memory location B to the value in the accumulator, and the
STORE instruction writes the value from the accumulator into memory location C.
In a RISC processor, the following instructions would be needed. It’s important
to note that a RISC processor has several registers, not just the accumulator,
so these have to be specifically referred to as RI and R2 for example) in the
instructions.
·
LOAD A,
RI
·
LOAD B.
R2
·
ADD R1,
R2
·
STORE
R2,C
ARM
evolved from a research division at Acorn Computers. The company responsible
for the hugely influential BBC Micro
Learn
to program ARM chips
Get
to grips with the mbed rapid prototyping platform
Given that ARM can trace
its ancestry back to the educational market, it’s perhaps appropriate that the
company has launched an initiative that represents a return to its roots. In
those early days of the BBC Micro, if you wanted to do something useful with
the hardware, it often meant rolling up your sleeves and creating some BASIC
code. In an attempt to get people programming again, ARM has launched the mbed
rapid prototyping platform, which simplifies the process of developing code for
ARM processors. The name mbed comes from the concept of an embedded
application, the name given to an application that runs in the background,
perhaps in something like a microwave or a washing machine, often completely
unbeknown to the user.
Although you’d have to buy
a development board a small circuit board containing an ARM processor and the
necessary circuitry to interface it to external hardware and costing from
around $56 — the associated C/C++ compiler is freely available at http://mbed.org.
You can find all the necessary project documentation on the mbed website, along
with a large collection of ARM code, contributed by other mbed users, that you
are free to adapt for use in your own software.
If you’re still to be
convinced that mbed is for you, you might be interested to know that an
ARM-powered robot arm has solved the world speed record for solving the Rubik’s
Cube, and other exciting amateur projects have involved racing robots around a
track and controlling a remote weather station.