| Register file | ||||||||||||||
| Need a group of registers to store operands (32 in MIPS) | ||||||||||||||
| Registers are very fast memory, part of the CPU | ||||||||||||||
| Why not use only registers for all data? | ||||||||||||||
| Costs more to make registers than RAM | ||||||||||||||
| More registers mean more circuits to control them, therefore slower | ||||||||||||||
| Consider 32 integer registers inside a black box called a register file | ||||||||||||||
| Set of registers with combinational logic to select | ||||||||||||||
| Instruction to run: | ||||||||||||||
| add $1, $2, $3 # R[1] <- R[2] + R[3] | ||||||||||||||
| Fetch operands: | ||||||||||||||
| Need values in registers 2 and 3 | ||||||||||||||
| To tell the register file which registers to use: | ||||||||||||||
| Need a value from 0 to 31 | ||||||||||||||
| How many bits? ceil( lg( 32 ) ) = 5 bits | ||||||||||||||
| Need to specify 5 bits for each register | ||||||||||||||
| Where to get the 10 bits for register numbers? | ||||||||||||||
| From the instruction itself | ||||||||||||||
| IR (instruction register) | ||||||||||||||
| Hidden register containing the instruction currently being executed | ||||||||||||||