DATAPATH FOR R-FORMAT
R type instructions (e.g. ADD $t1, $t2, $t3)
---> steps:
• Read two registers
– Register file
• Perform an ALU operations
– ALU
• Write the result into a register
– Register file
Datapath component
--->Register file
• A collection of registers in which any register can be read or written by specifying the number of register (register address) in the file.
• Needs a write control signal “RegWrite”.
• How many ports are required?
---> ALU
R- FORMAT INSTRUCTION
- Read two register operands (each 5 bits)
- Perform arithmetic/logical operation (6 bits)
- Write register result (5 bits)
R- FORMAT INSTRUCTION DATAPATH
TABLE 2
Table 2 shows the operation of the datapath for R-format instruction, such as add $t0, $t1, $t2. The operation:
1.The instruction is fetched, and the PC is incremented
2.Two registers, $t1 and $t2, are read from the register file; also RegDst, RegWrite and ALUOp is set.
3.The ALU operates on the data read from the register file, using the function code (bits 5:0, in the funct field) to generate the ALU function
4.The result from the ALU is written into the register file using bits 15:11 of the instruction to select the destination register ($t0)
LOAD / STORE INSTRUCTION
---> Read register operands
---> Calculate address using 16-bit offset
◦Use ALU, but sign-extend offset
---> Load: Read memory and update register
---> Store: Write register value to memory
LOAD / STORE DATAPATH
TABLE 3
Table 3 illustrate the execution of load word such as lw $t1, 4($t2) :
1.Instruction is fetched from the instruction memory, and PC is incremented.
2.Value of register $t2 is read from the register file.
3.The ALU computes the sum of the value read from the register file and the sign-extended, lower 16 bits of the instruction (offset = 4).
4.The sum from the ALU is used as the address for the data memory.
5.The data from the memory unit is written into the register file; the register destination is given by bits 20:16 of the instruction ($t1)
BY AINI KHAIRANI BT AZMI
No comments:
Post a Comment