170 likes | 431 Views
Single cycle DataPath . 000000. op. rs. 10111. 11000. rt. 01001. rd. 00000. shamt. 100000. funct. 35. op. rs. 18. 8. rt. 16-bit number. 32. ALU Control. ALU's operation based on instruction type and function code e.g., What should the ALU do with any instruction? Example:
E N D
000000 op rs 10111 11000 rt 01001 rd 00000 shamt 100000 funct 35 op rs 18 8 rt 16-bit number 32 ALU Control • ALU's operation based on instruction type and function code • e.g., What should the ALU do with any instruction? • Example: • add $t1, $s7, $s8 000 AND 001 OR 010 Add 110 Subtract 111 Set-on-less-than lw $t0, 32($s2)
ALU Control • Must describe hardware to compute 4-bit ALU control input • given instruction type 00 = lw, sw 01 = beq, 10 = arithmetic • function code for arithmetic • Describe it using a truth table (can turn into gates):
Control (Reading Assignment: Appendix C.2) • Simple combinational logic (truth tables)
Datapath with control for Jump instruction • J-type instructions use 6 bits for the opcode, and 26 bits for the immediate value (called the target). • newPC <- PC[31-28] IR[25-0] 00
Timing: Single cycle implementation • Calculate cycle time assuming negligible delays except • Memory (2ns), ALU and adders (2ns), Register file access (1ns)
Why is Single Cycle not GOOD??? • Memory - 2ns; • ALU - 2ns; Adder - 2ns; • Reg - 1ns • what if we had floating point instructions to handle?
Where we are headed • Single Cycle Problems: • what if we had a more complicated instruction like floating point? • wasteful of area
Multicycle Approach • We will be reusing functional units • ALU used to compute address and to increment PC • Memory used for instruction and data • Our control signals will not be determined directly by instruction • e.g., what should the ALU do for a “subtract” instruction? • We’ll use a finite state machine for control
Where we are headed • One Solution: • use a “smaller” cycle time • have different instructions take different numbers of cycles • a “multicycle” datapath: • Break up the instructions into steps, each step takes a cycle • balance the amount of work to be done • restrict each cycle to use only one major functional unit • At the end of a cycle • store values for use in later cycles (easiest thing to do) • introduce additional “internal” registers