Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Computer Organization Lecture 8 Detailed MIPS datapath Timing overview
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Project 2 overview Sixteen-bit ALU Use four LS181 plus some other logic Arithmetic: +, - Logical: –and, or –shift left, shift right
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Project 2 hints Use four LS181’s ALU Design shifter circuits Use muxes to select between ALU and shifters Design combinational logic to control muxes: consider a ROM
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Project 2 questions?
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering MIPS datapath overview Instruction read from memory Registers selected for operation ALU performs function Result written to register
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Shift register review
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Shift register operation Clock & Reset connected/bused to each flip-flop With Sin = 1, data moves left-to-right on each clock edge (1000, 1100, 1110, 1111) We could modify the design –32-bit shift register –Add combinational logic between flip-flops
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering MIPS datapath Information moves left-to-right
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Key elements of datapath Shared memory: instructions and data Single ALU –PC increment by 4 –Functions: +, -, and, or, etc. –Determines effective & branch/jump addresses Temporary registers: hold data between clock edges (like shift register does)
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering New temporary registers Instruction (IR): holds current instruction Memory data (MDR): holds data read from memory A, B: holds data from register file ALUout: holds ALU output (Project 2) Note: All of these are D-type flip-flops
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering MIPS datapath Data travels left-to-right on each clock edge Clock Driver Clock 1 Clock 2 Clock 3 Clock 4 Clock 5
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Example timing Instruction fetch Instruction decode, register read Execution Memory access Register write Instructions vary from 3 – 5 clocks
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Complete the table? Instruction Total Clocks Clock add $1, $2, $34xxxx beq $1, $2, label4xxx lw $1, offset ($2)5xxxxx sub $1, $2, $34xxxx sw $1, offset ($2)4xxxx j label3xxx 1 = Instruction Fetch 2 = Decode & Register Read 3 = Execution 4 = Memory Access 5 = Register Write
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Datapath organization detail Five muxes select between various sources
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Muxes added 1.Address for memory: PC or ALU 2.Write register: rs or rt 3.Write data: memory, ALU 4.ALU first operand: PC, Register 1 5.ALU second operand: Register 2, 0x4, sign extended, sign extended shifted 2
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Timing parameters D flip-flop has setup and propagation delays t su t prop D input Clock Q output Q Q D C
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Synchronous logic Clock period > T prop + T comb + T set Edge-triggered logic Register
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Find the F max ? Mem = 20 ns; Reg = 15 ns; ALU = 55 ns Assume: mem, reg, ALU dominant terms
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Now add controller signals
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering What do these signals do? SignalFunction? IorDControls address of memory: PC, ALU MemReadPuts memory in read mode MemWritePuts memory in write mode IRWriteWrite data to instruction register RegDstRs or rt for register write data RegWritePuts registers in write mode
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering What do these signals do? SignalFunction? ALUSrcAData for A input of ALU ALUOpFunction code for ALU ALUSrcBData for B input of ALU MemtoRegData for the register write: memory, ALU
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Branch and jump additions Next PC value, three possible sources –PC+4: ALU output –Branch target: ALUout register –Jump address: concatenation of PC 31-28, IR 25-0 shifted left 2, two lsb of zero PC write control –PCWrite: unconditional (increments, jump) –PCWriteCond: conditional write for branch
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Complete datapath new
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Datapath and controller Controller Input
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Complete the table? Instruction Total Clocks Clock add $1, $2, $34xxxx beq $1, $2, label3xxx lw $1, offset ($2)5xxxxx sub $1, $2, $33xxxx sw $1, offset ($2)4xxxx j label3xxx 1 = Instruction Fetch 2 = Decode & Register Read 3 = Execution 4 = Memory Access 5 = Register Write
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Find the F max ? Mem = 20 ns;Reg = 15 ns; ALU = 55 ns F max = 1/55ns = 18.1 MHz Assume: mem, reg, ALU dominant terms 20 ns 15 ns 55 ns
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering What do these signals do? SignalFunction? IorDControls address of memory: PC, ALU MemReadPuts memory in read mode MemWriteData written to memory IRWriteData written to IR RegDstSelects rs or rt for register write RegWriteData written to register file
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering What do these signals do? SignalFunction? ALUSrcADetermines ALU first operand ALUOpDefines ALU function (+, -, etc.) ALUSrcBDetermines ALU second operand MemtoRegMemory or ALU is data for register write