The MIPS Instruction Formats ° All MIPS instructions are 32 bits long. The three instruction formats: 31
• R-type • I-type • J-type
26 op 6 bits
31
21 rs 5 bits
26 op 6 bits
31
16 rt 5 bits
21 rs 5 bits
11
6
rd 5 bits
0
shamt 5 bits
funct 6 bits
16
0 immediate
rt 5 bits
16 bits
26
0
op 6 bits
target address 26 bits
° The different fields are: • • • • • •
op: operation of the instruction rs, rt, rd: the source and destination register specifiers shamt: shift amount funct: selects the variant of the operation in the “op” field address / immediate: address offset or immediate value target address: target address of the jump instruction
cps 104 3
The MIPS Subset (We can’t implement them all!) 31
° ADD and subtract • add rd, rs, rt • sub rd, rs, rt
An Abstract View of the Critical Path ° Register file and ideal memory: • The CLK input is a factor ONLY during write operation • During read operation, behave as combinational logic: - Address valid => Output valid after “access time.” Clk
PC Instruction Address Ideal Instruction Memory
Rd Rs 5 5
Rt 5
Rw Ra Rb 32 32-bit Registers
Imm 16 32 32
ALU
32
Instruction
Clk
Data Address Data In
Ideal Data Memory
Clk
32 cps 104 7
Overview of the Instruction Fetch Unit ° The common RTL operations • Fetch the Instruction: mem[PC] • Update the program counter: - Sequential Code: PC