are also visible to the programmer when the computer is completed, so you can
think of registers as the bricks of computer construction. The size of a register in
the MIPS architecture is 32 bits; groups of 32 bits occur so frequently that they are
given the name word in the MIPS architecture.
One major difference between the variables of a programming language and
registers is the limited number of registers, typically 32 on current computers,
like MIPS. (See Section 2.20 on the CD for the history of the number of registers.)
Thus, continuing in our top-down, stepwise evolution of the symbolic
representation of the MIPS language, in this section we have added the restriction
that the three operands of MIPS arithmetic instructions must each be chosen from
one of the 32 32-bit registers.
The reason for the limit of 32 registers may be found in the second of our four
underlying design principles of hardware technology:
Design Principle 2: Smaller is faster.
A very large number of registers may increase the clock cycle time simply because
it takes electronic signals longer when they must travel farther.
Guidelines such as “smaller is faster” are not absolutes; 31 registers may not be
faster than 32. Yet, the truth behind such observations causes computer designers
to take them seriously. In this case, the designer must balance the craving of programs
for more registers with the designer’s desire to keep the clock cycle fast.
Another reason for not using more than 32 is the number of bits it would take in
the instruction format, as Section 2.5 demonstrates.
Chapter 4 shows the central role that registers play in hardware construction;
as we shall see in this chapter, effective use of registers is critical to program
performance.
Although we could simply write instructions using numbers for registers, from
0 to 31, the MIPS convention is to use two-character names following a dollar sign
to represent a register. Section 2.8 will explain the reasons behind these names. For
now, we will use $s0, $s1, . . . for registers that correspond to variables in C and
Java programs and $t0, $t1, . . . for temporary registers needed to compile the
program into MIPS instructions.