BranchCONTROLAddAddALUoperationDataMemWriteRegister#AddressRegistersALUHPCAddressInstructionRegister#ZeroDataInstructionmemorymemoryRegister#RegWriteDataMemReadControl
BUILDING A DATAPATH-Datapath- Elements that process data and addressesintheCPU-Registers,ALUs,mux's,memories, ..-We will build a MIPS datapath incrementally-Refining the overview design
▪Datapath ▪ Elements that process data and addresses in the CPU ▪ Registers, ALUs, mux’s, memories, . ▪We will build a MIPS datapath incrementally ▪ Refining the overview design
INSTRUCTION FETCHING-Program counter-AdderAdd-Instructionmemory-Which one(s) isReadcombinational / seguentialPCIncrementbyaddresscircuit?4fornextinstructionInstruction32-bit-Do they need controlregisterInstructionsignal?memory
▪Program counter ▪Adder ▪ Instruction memory ▪Which one(s) is combinational / sequential circuit? ▪Do they need control signal? 32 -bit register Increment by 4 for next instruction
R-FORMAT INSTRUCTIONS-E.g.,add $s0,$sl,$s2Read.ALUoperation-Read two registerregister1Readdata15RegisterReadoperandsZeronumbersregister2DataALUALURegisters5Write-PerformresultregisterReadarithmetic/logicaldata2WriteDataoperationDataRegWrite-Write register resultb. ALUa.Registers-Controlled bya writecontrol signal
▪E.g., add $s0,$s1,$s2 ▪Read two register operands ▪Perform arithmetic/logical operation ▪Write register result ▪ Controlled by a write control signal
LOAD/STORE INSTRUCTIONS (I FORMATlw/sw$tl,MemWriteoffset value($t2)ReadAddress-Read registeroperandsdata1632Sign--Calculate address using 16-bitDataextendoffsetmemoryWrite- Use ALU, but sign-extend offsetdata-Load: Read memory and updateMemReadregistera.Datamemoryunitb.Signextensionunit-Store:Write register value tomemory
▪lw/sw $t1, offset_value($t2) ▪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