Lecture 6 Datapath and Controller

Size: px
Start display at page:

Download "Lecture 6 Datapath and Controller"

Transcription

1 Lecture 6 Datapath and Controller Peng Liu liupeng@zju.edu.cn

2 Windows Editor and Word Processing UltraEdit, EditPlus Gvim Linux or Mac IOS Emacs vi or vim Word Processing(Windows, Linux, and Mac IOS) LaTex (English) Office (Chinese) 2

3 Review: Critical Timing Issues Flops work great as long as input is stable when clock rises Called setup and hold windows Clock skew can cause some nasty problems Hold time violations Cycle Time = longest Prop Delay + Setup + Clock Skew 3

4 Review: How to Execute Instructions First we need to: Fetch the instruction Then we need to: Decode instruction/fetch register Then we need to: Do the operation Then we need to: Write the result into register file Finally we need to: Calculate the next instruction address 4

5 Review: Memories In Our Design They will be combinational Otherwise we can t complete an instruction in one cycle! Interface is simple: Inputs: Address DataIn WriteEn (WriteEn must be a pulse) Outputs: Dataout Register file: It has three address, two for reads, and one for write It is called a 3-port, since it can perform 3 accesses per cycle Data Memory Addr Din Dout WE 5

6 The First Task: Fetching The Instruction (IF) Not that complex Instr = Mem[PC] Fetch the instruction from memory Update program counter for next cycle What is the address of the next instruction? 6

7 Instruction Fetch 7

8 What Did We Fetch? 8

9 Nice Characteristics of MIPS Machine Code Instructions are fixed length Don t need to decode first instruction to find next one Always add 4 bytes to instruction pointer (PC) Register specifiers are always in the same place Destination moves around some, but Source register are always in the same place Or you don t need that register Can fetch the registers BEFORE you decode instruction Feed bits directly from the instruction memory 9

10 Register to Register Operations In our subset this is only addu and subu I do not want to worry about overflow addu rd, rs, rt subu rd, rs, rt Operation R[rd] <- R[rs] + R[rt]; Add operation R[rd] <- R[rs] - R[rt]; Sub operation

11 Datapath: R-Format Instructions Read two register operands Perform arithmetic/logical operation Write register result

12 OR Immediate RTL OR Immediate instruction ori rt, rs, imm R[rt] <- R[rs] OR ZeroExt(imm); Means I need to get instr[5:] into the datapath, on RT path 2

13 Datapath: Immediate Ops Extend datapath to support immediate operations Write register is rt or rd based on instruction Read data 2 is ignored for immediates Immediates can be sign or zero extended src and operation set based on instruction 3

14 Load Load instruction lw rt, rs, imm Addr <- R[rs] + SignExt(imm); Compute memory address R[rt] <- Mem[Addr]; Load data into register Notice this will use the immediate path as well 4

15 Datapath: Load Extend datapath to support other immediate operations Extender handlers either sign or zero extension MUX selects between result and Memory output 5

16 Store Store instruction sw rt, rs, imm Addr <-R[rs] + SignExt(imm); Compute memory addr Mem[Addr] <- R[rt]; Load data into register Bits OP rs rt imm First Source Register Second Source Register Immediate 6

17 Datapath: Store Read Register 2 is passed on to Memory Memory address calculated just as in lw case 7

18 Branch Branch instruction beq rs, rt, imm Cond <- R[rs] R[rt]; Calculate branch condition If (cond eq ) Test if equal PC <- PC SignExt(imm)*4 else PC <-PC + 4; Calculate next address Bits OP rs rt imm First Source Second Source Immediate 8

19 The Next Address PC is byte-addressed into instruction memory Sequential PC [3:] = PC[3:] + 4 Branch operation PC[3:] = PC[3:] SignExt(imm)x4 Instruction Addresses PC is byte addressed, but instructions are 4 bytes long Simplify hardware by using 3-bit PC Sequential PC [3:2] = PC[3:2] + Branch operation PC[3:2] = PC[3:2] + + SignExt(imm) 9

20 Datapath: IF + Branch 2

21 Jump RTL Jump instruction j target PC[3:2]<- PC[3:29] target[25:]; Bits 6 26 OP target Jump Target Address 2

22 Datapath: IFU + Jump MUX selects pseudodirect jump target 22

23 Putting it All Together 23

24 The MIPS ISA Processor State -bit GPRs, R always contains a single precision FPRs, may also be viewed as 6 double precision FPRs FP status register, used for FP compares & exceptions PC, the program counter some other special registers Data types 8-bit byte, 6-bit half word -bit word for integers -bit word for single precision floating point 64-bit word for double precision floating point Load/Store style instruction set data addressing modes- immediate & indexed branch addressing modes- PC relative & register indirect Byte addressable memory- big endian mode All instructions are bits 24

25 Instruction Execution Execution of an instruction involves. instruction fetch 2. decode and register fetch 3. operation 4. memory operation (optional) 5. write back and the computation of the address of the next instruction 25

26 Datapath: Reg-Reg Instructions x4 Add RegWrite clk PC clk addr inst Inst. Memory inst<25:2> inst<2:6> inst<5:> we rs rs2 rd ws wd rd2 GPRs z inst<5:> Control OpCode RegWrite Timing? rs rt rd func rd (rs) func (rt)

27 Datapath: Reg-Imm Instructions x4 Add RegWrite clk PC clk addr inst Inst. Memory inst<25:2> inst<2:6> inst<5:> inst<3:26> we rs rs2 rd ws wd rd2 GPRs Imm Ext Control z OpCode ExtSel opcode rs rt immediate rt (rs) op immediate

28 Conflicts in Merging Datapath PC clk x4 Add addr inst Inst. Memory inst<25:2> inst<2:6> inst<5:> inst<5:> inst<3:26> inst<5:> RegWrite clk we rs rs2 rd ws wd rd2 GPRs Imm Ext Control z Introduce muxes OpCode ExtSel rs rt rd func rd (rs) func (rt) opcode rs rt immediate rt (rs) op immediate 28

29 Datapath for Instructions x4 Add RegWrite clk PC clk addr inst Inst. Memory <25:2> <2:6> <5:> <5:> we rs rs2 rd ws wd rd2 GPRs Imm Ext z <3:26>, <5:> Control OpCode RegDst rt / rd ExtSel OpSel BSrc Reg / Imm rs rt rd func rd (rs) func (rt) opcode rs rt immediate rt (rs) op immediate 29

30 Datapath for Memory Instructions Should program and data memory be separate? Harvard style: separate (Aiken and Mark influence) - read-only program memory - read/write data memory - Note: Somehow there must be a way to load the program memory Princeton style: the same (von Neumann s influence) - single read/write memory for program and data - Note: A Load or Store instruction requires accessing the memory more than once during its execution 3

31 Load/Store Instructions:Harvard Datapath PC clk x4 Add addr inst Inst. Memory base disp RegWrite clk we rs rs2 rd ws wd rd2 GPRs Imm Ext Control z MemWrite clk we addr rdata Data Memory wdata WBSrc / Mem OpCode RegDst ExtSel OpSel addressing mode opcode rs rt displacement (rs) + displacement BSrc rs is the base register rt is the destination of a Load or the source for a Store 3

32 MIPS Control Instructions Conditional (on GPR) PC-relative branch opcode rs offset BEQZ, BNEZ Unconditional register-indirect jumps opcode rs JR, JALR Unconditional absolute jumps 6 26 opcode target J, JAL PC-relative branches add offset 4 to PC+4 to calculate the target address (offset is in words): ±28 KB range Absolute jumps append target 4 to PC<3:28> to calculate the target address: 256 MB range jump-&-link stores PC+4 into the link register (R3) All Control Transfers are delayed by instruction we will worry about the branch delay slot later

33 Conditional Branches (BEQZ, BNEZ) PCSrc br RegWrite MemWrite WBSrc pc+4 x4 Add Add clk PC clk addr inst Inst. Memory we rs rs2 rd ws wd rd2 GPRs Imm Ext Control z clk we addr rdata Data Memory wdata OpCode RegDst ExtSel OpSel BSrc zero? 33

34 Register-Indirect Jumps (JR) PCSrc br rind RegWrite MemWrite WBSrc pc+4 x4 Add Add clk PC clk addr inst Inst. Memory we rs rs2 rd ws wd rd2 GPRs Imm Ext Control z clk we addr rdata Data Memory wdata OpCode RegDst ExtSel OpSel BSrc zero? 34

35 Register-Indirect Jump-&-Link (JALR) PCSrc br rind RegWrite MemWrite WBSrc pc+4 x4 Add Add clk PC clk addr inst Inst. Memory 3 we rs rs2 rd ws wd rd2 GPRs Imm Ext Control z clk we addr rdata Data Memory wdata OpCode RegDst ExtSel OpSel BSrc zero? 35

36 36 Absolute Jumps (J, JAL) x4 RegWrite Add Add clk WBSrc MemWrite addr wdata rdata Data Memory we RegDst BSrc ExtSel OpCode z OpSel clk zero? clk addr inst Inst. Memory PC rd GPRs rs rs2 ws wd rd2 we Imm Ext Control 3 PCSrc br pc+4 rind jabs

37 37 Harvard-Style Datapath for MIPS x4 RegWrite Add Add clk WBSrc MemWrite addr wdata rdata Data Memory we RegDst BSrc ExtSel OpCode z OpSel clk zero? clk addr inst Inst. Memory PC rd GPRs rs rs2 ws wd rd2 we Imm Ext Control 3 PCSrc br rind jabs pc+4

38 Putting it All Together: Cycle Datapath Inst Memory Adr Rs <2:25> <:5> <:5> <6:2> Rt Rd Imm6 Instruction<3:> PCSrc RegDst Rd Rt Zero ctr MemWr MemtoReg imm6 4 PC Ext Adder Adder Mux PC Clk RegWr busw Clk imm6 5 5 Rs 5 Rw Ra Rb -bit Registers 6 Rt busa busb Extender Mux WrEn Adr Data In Data Memory Clk Mux ExtOp Src 38

39 Controller Since every instruction takes one cycle, control is state free! It is just decoded instruction bits There are also few control points Control the multiplexers Operation type for the Write control on the Instruction & data memories First part of cycle does not have any control Which is good, since we don t have instruction yet Look at setting of the control points for different instructions 39

40 At Beginning of Clock Cycle 4

41 Control for Arithmetic 4

42 Instruction Fetch at End 42

43 Arithmetic Immediate (ori) 43

44 Control for Load 44

45 Control for Store 45

46 Control for Branch (beq) 46

47 Control for Jump (j) 47

48 Given Datapath: RTL -> Control Instruction<3:> Inst Memory Adr Op <2:25> Fun Rt <2:25> <:5> <:5> <6:2> Rs Rd Imm6 Control PCSrc RegWr RegDst ExtOp Src ctr MemWr MemtoReg Zero DATA PATH 49

49 The Single Cycle Datapath during Or Immediate R[rt] <= R[rs] or ZeroExt[Imm6] RegDst <= RegWr <= 5 5 busw Clk 3 Rd Mux imm6 Rt Rs 5 Rw Ra Rb -bit Registers 6 26 Rt busb Extender 2 op rs rt immediate PCSrc <= +4 Clk busa ctr <= Or Mux 6 Data In Src <= Instruction Fetch Unit Clk Zero Instruction<3:> Rt <2:25> WrEn Rs <6:2> MemWr <= Adr Data Memory Rd <:5> <:5> Imm6 MemtoReg <= Mux ExtOp <= 5

50 The Concept of Local Decoding op 6 Main Control func 6 op N Control (Local) ctr 3 55

51 The Encoding of op op 6 Main Control func 6 op N Control (Local) ctr 3 In this exercise, op has to be 2 bits wide to represent: () R-type instructions I-type instructions that require the to perform: (2) Or, (3) Add, and (4) Subtract To implement the more of MIPS ISA, op has to be 3 bits to represent (4 bits in book to include NOR): () R-type instructions I-type instructions that require the to perform: (2) Or, (3) Add, (4) Subtract, and (5) And (Example: andi) R-type ori lw sw beq jump op (Symbolic) R-type Or Add Add Subtract xxx op<2:> xxx 56

52 The Decoding of the func Field op 6 Main Control func 6 op N Control (Local) ctr 3 R-type ori lw sw beq jump op (Symbolic) R-type Or Add Add Subtract xxx op<2:> xxx R-type op rs rt rd shamt funct funct<5:> Instruction Operation add subtract and or set-on-less-than ctr ctr<2:> Operation And Or Add Subtract Set-on-less-than 57

53 Drawback of This Single Cycle Processor Long cycle time: Cycle time must be long enough for the load instruction: PC s Clock -to-q + Instruction Memory Access Time + Register File Access Time + Delay (address calculation) + Data Memory Access Time + Register File Setup Time + Clock Skew Cycle time for load is much longer than needed for all other instructions 58

54 Addr Instr Mem Data What is Single Cycle Control? Equal Combinational Logic (Only Gates, No Flip Flops) Just specify logic functions! rs,rt,rd,imm RegDest RegWr ExtOp src MemWr MemToReg PCSrc RegDest RegFile 5 rs 5 rs2 rd 5 ws rd2 wd WE Ext ctr Equal RegWr ExtOp src MemWr MemToReg 59

55 Two Goals When Specifying Control Logic Bug-free: One that should be a in the control logic function breaks contract with the programmer. Should be easy for humans to read and understand: sensible signal names, symbolic constants... Efficient: Logic function specification should map to hardware with good performance properties: fast, small, low power, etc. 6

56 Advantages Single Cycle Processor Single cycle per instruction makes logic and clock simple Disadvantages Inefficient utilization of memory and functional units since different instructions take different lengths of time only computes values a small amount of the time Cycle time is the worst case path -> long cycle times Load instruction Best possible CPI is 6

57 Single Cycle Processor Performance Functional unit delay Memory: 2ps and adders: 2ps Register file: ps CPU clock cycle = 8 ps =.8ns(.25GHz) 62

58 Variable Clock Single Cycle Processor Performance Instruction Mix 45% 25%loads %stores 5%branches 5%jumps CPU clock cycle =.6x45%+.8x25% +.7x% +.5x5% +.2x5%=.625 ns(.6ghz) 63

59 Increasing Parallelism Problem: Each functional unit used once per cycle Most of the time it is sitting waiting for its turn Well it is calculating all the time, but it is waiting for valid data There is no parallelism in this arrangement Making instructions take more cycles makes machine faster! Each instruction takes roughly the same time While the CPI is much worse, the clock freq is much higher Overlap execution of multiple instructions at the same time Different instructions will be active at the same time This is called Pipelining Increases the parallelism going on in the machine We will look at a 5 stage pipeline Modern machines have order 5 cycles/instruction 64

60 The Five Stages of Load Instruction Cycle Cycle 2 Cycle 3 Cycle 4 Cycle 5 lw IFetch Dec Exec Mem WB IFetch: Instruction Fetch and Update PC Dec: Registers Fetch and Instruction Decode Exec: Execute R-type; calculate memory address Mem: Read/write the data from/to the Data Memory WB: Write the result data into the register file 65

61 Pipelined MIPS Processor Start the next instruction while still working on the current one improves throughput or bandwidth - total amount of work done in a given time (average instructions per second or per clock) instruction latency is not reduced (time from the start of an instruction to its completion) Cycle Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 lw IFetch Dec Exec Mem WB sw IFetch Dec Exec Mem WB R-type IFetch Dec Exec Mem WB pipeline clock cycle (pipeline stage time) is limited by the slowest stage for some instructions, some stages are wasted cycles 66

62 Single Cycle, Multiple Cycle, vs. Pipeline Single Cycle Implementation: Clk Cycle Cycle 2 Load Store Waste Multiple Cycle Implementation: Clk Cycle Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9 Cycle lw IFetch Dec Exec Mem WB sw IFetch Dec Exec Mem R-type IFetch Pipeline Implementation: lw IFetch Dec Exec Mem WB wasted cycles sw IFetch Dec Exec Mem WB R-type IFetch Dec Exec Mem WB 67

63 Multiple Cycle v. Pipeline, Bandwidth v. Latency Multiple Cycle Implementation: Clk Cycle Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9 Cycle lw IFetch Dec Exec Mem WB sw IFetch Dec Exec Mem R-type IFetch Pipeline Implementation: lw IFetch Dec Exec Mem WB sw IFetch Dec Exec Mem WB R-type IFetch Dec Exec Mem WB Latency per lw = 5 clock cycles for both Bandwidth of lw is per clock clock (IPC) for pipeline vs. /5 IPC for multicycle Pipelining improves instruction bandwidth, not instruction latency 68

64 Pipelining the MIPS ISA What makes it easy all instructions are the same length ( bits) easier to fetch in st stage and decode in 2 nd stage few instruction formats (three) with symmetry across formats can begin reading register file in 2 nd stage memory operations can occur only in loads and stores can use the execute stage to calculate memory addresses each MIPS instruction writes at most one result and does so near the end of the pipeline What makes it hard structural hazards: what if we had only one memory? control hazards: what about branches? data hazards: what if an instruction s input operands depend on the output of a previous instruction? 69

65 MIPS Pipeline Datapath Modifications What do we need to add/modify in our MIPS datapath? registers between pipeline stages to isolate them IF:IFetch ID:Dec EX:Execute MEM: MemAccess WB: WriteBack Add PC 4 Instruction Memory Read Address IFetch/Dec Read Addr Register Read Read Addr 2 Data File Write Addr Write Data Read Data 2 Dec/Exec Shift left 2 Add Exec/Mem Address Write Data Data Memory Read Data Mem/WB Sign 6 Extend System Clock 7

66 Graphically Representing MIPS Pipeline IM Reg DM Reg Can help with answering questions like: how many cycles does it take to execute this code? what is the doing during cycle 4? is there a hazard, why does it occur, and how can it be fixed? 7

67 Why Pipeline? For Throughput! Time (clock cycles) I n s t r. Inst Inst IM Reg DM Reg IM Reg DM Reg Once the pipeline is full, one instruction is completed every cycle O r d e r Inst 2 Inst 3 IM Reg DM Reg IM Reg DM Reg Inst 4 Time to fill the pipeline IM Reg DM Reg 72

68 Acknowledgements These slides contain material from courses: UCB CS52 Stanford EE8B 73

69 ExtOp: src: ctr: Meaning of the Control Signals zero, sign regb; immed add, sub, or RegDst RegWr busw Clk imm6 Rd Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 Rt busa busb Extender Zero MemWr: write memory MemtoReg: ; Mem RegDst: RegWr: Mux ctr WrEn Adr Data In Data Memory Clk rt ; rd write register MemWr MemtoReg Mux ExtOp Src 74

70 Two Equivalent Ways to Specify Control Control line Control line Control line n AddU A B SubU ORI LW SW BEQ X Y (Rotate about 45degree axis) Control line Control line Control line n AddU SubU ORI LW SW BEQ A B X Y 75

71 Setting PC Source Control Signal PCSrc: PC <= PC + 4 PC <= PC {SignExt(Im6), 2b} Later in lecture: higher-level connection between mux and branch cond imm6 4 PC Ext Adder Adder PCSrc PC Mux Clk Adr Inst Memory Answer? AddU SubU ORI LW SW BEQ X 8 X X X X X 9 None of the above 76

72 ExtOp: src: ctr: Meaning of the Control Signals zero ; sign regb; immed add, sub, or RegDst RegWr busw Clk imm6 Rd Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 Rt busa busb Extender Zero MemWr: write memory MemtoReg: ; Mem RegDst: RegWr: Mux ctr WrEn Adr Data In Data Memory Clk rt ; rd write register MemWr MemtoReg Mux ExtOp Src 78

73 Specify Source mux Control src: reg as B input; immediate as B input busw Clk imm6 Rd Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 Rt busa busb Extender Mux Data In An sw e r? Ad d U S ubu OR I L W S W B E Q X 6 7 X 8 X X X X X 9 No n e of t h e ab o v e ExtOp Src 79

74 Specify Source mux Control src: reg as B input; immediate as B input busw Clk imm6 Rd Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 Rt busa busb Extender Mux Data In An sw e r? Ad d U S ubu OR I L W S W B E Q X 6 7 X 8 X X X X X 9 No n e of t h e ab o v e ExtOp Src 8

75 Specify Immediate Extender Op Control ExtOp: zero extend immediate ; sign extend imm. busw Clk imm6 Rd Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 Rt busa busb Extender Mux Data In Answer? AddU SubU ORI LW SW BEQ X 7 X X 8 X X 9 None of the above ExtOp Src 8

76 Specify Register Write Control RegWr: write register RegDst RegWr busw Clk imm6 Rd Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 Rt busa busb Extender Mux Answer? AddU SubU ORI LW SW BEQ X X 9 None of the above ExtOp Src 83

77 Specify Register Write Control RegWr: write register RegDst RegWr busw Clk imm6 Rd Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 Rt busa busb Extender Mux Answer? AddU SubU ORI LW SW BEQ X X 9 None of the above ExtOp Src 84

78 RegDst RegWr busw Clk Specify Register Destination Control RegDst: imm6 Rd Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 Rt rt ; rd busa busb Extender ExtOp 3 3 op rs rt rd shamt funct op rs rt immediate Mux Src Answer? AddU SubU ORI LW SW BEQ X X 8 X 9 None of the above 6 85

79 MemWr: Specify the Memory Write Control Signal write memory RegDst Rd RegWr 5 5 Clk imm6 Rt Rw Ra Rb -bit Registers 6 Rs Rt 5 busa busw busb Extender Zero Mux ExtOp Src ctr MemWr Data In WrEn Adr Data Clk Memory MemtoReg Mux Answer? AddU SubU ORI LW SW BEQ X 8 X X X X 9 None of the above 87

80 Specify Memory To Register File Mux Control MemtoReg: ; Mem RegDst Rd RegWr 5 5 Clk imm6 Rt Rw Ra Rb -bit Registers 6 Rs Rt 5 busa busw busb Extender Zero Mux ExtOp Src ct r MemWr MemtoReg WrEn Adr Data In Data Memory Clk Mux Answer? AddU SubU ORI LW SW BEQ 2 3 X 4 X X X 8 X 9 None of the above 89

81 Specify Memory To Register File Mux Control MemtoReg: ; Mem RegDst Rd RegWr 5 5 Clk imm6 Rt Rw Ra Rb -bit Registers 6 Rs Rt 5 busa busw busb Extender ExtOp Zero Mux Src ctr MemWr Data In WrEn Adr Data Clk Memory MemtoReg Mux Answer? AddU SubU ORI LW SW BEQ 2 3 X 4 X X X 8 X 9 None of the above 9

82 Specify the Control Signals ctr: add, sub, 2 or RegDst Rd RegWr 5 5 Clk imm6 Rt Rw Ra Rb -bit Registers 6 Rs Rt 5 busa busw busb Extender ExtOp Zero Mux Src ctr MemWr Data In WrEn Adr Data Memory Clk MemtoReg Mux Answer? AddU SubU ORI LW SW BEQ X 5 2 X X 6 2 X X X 7 X 2 X X X 8 X X 2 9 None of the above 9

83 ctr: Specify the Control Signals add, sub, 2 or RegDst Rt Zero Rd RegWr Rs Rt busa Rw Ra Rb -bit Registers busb Clk busw imm6 6 Extender Mux ExtOp Src ctr MemWr Data In WrEn Adr Data Memory Clk MemtoReg Mux Answer? AddU SubU ORI LW SW BEQ X 5 2 X X 6 2 X X X 7 X 2 X X X 8 X X 2 9 None of the above 92

84 The Add Instruction op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits add rd, rs, rt mem[pc] Fetch the instruction from memory R[rd] <= R[rs] + R[rt] The actual operation PC <= PC + 4 Calculate the next instruction s address 93

85 Instruction Fetch Unit at the Beginning of Add Fetch the instruction from Instruction memory: Instruction <= mem[pc] This is the same for all instructions Inst Memory Adr Instruction<3:> PCSrc 4 imm6 PC Ext Adder Adder PC Mux Clk 94

86 Instruction Fetch Unit at the End of Branch op rs rt immediate if (Zero == ) PC = PC {SignExt[imm6], 2b} ; else PC = PC PCSrc Zero PCSrc Inst Memory Adr Instruction<3:> What is encoding of PCSrc? Direct MUX select? Branch / not branch Let s choose second option 4 imm6 Adder Adder Mux Clk PC PCSrc zero? MUX X 95

87 RegDst = The Single Cycle Datapath during Load RegWr <= 5 5 busw Clk 3 Rd Mux imm6 Rt Rs 5 Rw Ra Rb -bit Registers 6 26 R[rt] <= Data Memory [R[rs] + SignExt[imm6]] Rt busb Extender ExtOp <= 2 op rs rt immediate PCSrc<= +4 Clk busa Mux 6 ctr <= Add Src = Instruction Fetch Unit Data In Clk Zero Instruction<3:> Rt <2:25> WrEn Rs <6:2> MemWr = Adr Data Memory Rd <:5> Imm6 MemtoReg <= <:5> Mux 96

88 The Single Cycle Datapath during Store op rs rt immediate Data Memory [R[rs] + SignExt[imm6]] <= R[rt] RegDst <= busw Clk RegWr <= 3 Rd Mux imm6 Rt Rs 5 Rw Ra Rb -bit Registers 6 Rt 2 PCSrc <= busb Extender Clk busa ExtOp <= 6 ctr <= Mux Data In Src <= Instruction Fetch Unit Clk Zero Instruction<3:> Rt <2:25> WrEn Rs <6:2> MemWr <= Adr Data Memory Rd <:5> <:5> Imm6 MemtoReg <= Mux 97

89 The Single Cycle Datapath during Store RegDst <= x RegWr <= busw Clk 3 Rd Mux imm6 Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 26 Data Memory [R[rs] + SignExt[imm6]] <= R[rt] Rt busb Extender ExtOp <= 2 op rs rt immediate PCSrc<= +4 Clk busa Mux 6 Instruction Fetch Unit ctr <= Add Data In Src <= Clk Zero Instruction<3:> Rt <2:25> WrEn Rs <6:2> MemtoReg <= x MemWr <= Adr Data Memory Rd <:5> <:5> Imm6 Mux 98

90 RegDst <= x The Single Cycle Datapath during Branch RegWr <= busw Clk 3 Rd Mux imm6 Rt 5 5 Rs 5 Rw Ra Rb -bit Registers 6 26 if (R[rs] - R[rt] == ) Zero <= ; else Zero <= Rt busb Extender 2 op rs rt immediate PCSrc<= Br Clk busa ctr <=Sub Mux 6 Data In Src <= Instruction Fetch Unit Clk Zero Instruction<3:> Rt <2:25> WrEn Rs <6:2> MemWr <= Adr Data Memory Rd <:5> <:5> Imm6 MemtoReg <= x Mux ExtOp <= x 99

91 Step 4: Given Datapath: RTL -> Control Instruction<3:> Inst Memory Adr Op <2:25> Fun Rt <2:25> <:5> <:5> <6:2> Rs Rd Imm6 Control PCSrc RegWr RegDst ExtOp Src ctr MemWr MemtoReg Zero DATA PATH

92 A Summary of Control Signals inst Register Transfer ADD R[rd] <= R[rs] + R[rt]; PC <= PC + 4 src = RegB, ctr = add, RegDst = rd, RegWr, PCSrc = +4 SUB R[rd] <= R[rs] R[rt]; PC <= PC + 4 src = RegB, ctr = sub, RegDst = rd, RegWr, PCSrc = +4 ORi R[rt] <= R[rs] + zero_ext(imm6); PC <= PC + 4 src = Im, Extop = Z, ctr = or, RegDst = rt, RegWr, PCSrc = +4 LOAD R[rt] <= MEM[ R[rs] + sign_ext(imm6)]; PC <= PC + 4 src = Im, Extop = Sn, ctr = add, MemtoReg, RegDst = rt, RegWr, PCSrc = +4 STORE MEM[ R[rs] + sign_ext(imm6)] <= R[rs]; PC <= PC + 4 src = Im, Extop = Sn, ctr = add, MemWr, PCSrc = +4 BEQ if ( R[rs] == R[rt] ) then PC <= PC +4 + {sign_ext(imm6)], b2} else PC <= PC + 4 PCSrc = Br, ctr = sub

93 A Summary of the Control Signals See func We Don t Care :-) Appendix A op RegDst Src MemtoReg RegWrite MemWrite PCSrc ExtOp ctr<2:> add sub ori lw sw beq jump x x x x x x x x Add x Subtract Or Add Add x Subtract x xxx R-type op rs rt rd shamt funct add, sub I-type op rs rt immediate ori, lw, sw, beq J-type op target address jump 2

Lecture 7 Pipelining. Peng Liu.

Lecture 7 Pipelining. Peng Liu. Lecture 7 Pipelining Peng Liu liupeng@zju.edu.cn 1 Review: The Single Cycle Processor 2 Review: Given Datapath,RTL -> Control Instruction Inst Memory Adr Op Fun Rt

More information

The Big Picture: Where are We Now? EEM 486: Computer Architecture. Lecture 3. Designing a Single Cycle Datapath

The Big Picture: Where are We Now? EEM 486: Computer Architecture. Lecture 3. Designing a Single Cycle Datapath The Big Picture: Where are We Now? EEM 486: Computer Architecture Lecture 3 The Five Classic Components of a Computer Processor Input Control Memory Designing a Single Cycle path path Output Today s Topic:

More information

361 datapath.1. Computer Architecture EECS 361 Lecture 8: Designing a Single Cycle Datapath

361 datapath.1. Computer Architecture EECS 361 Lecture 8: Designing a Single Cycle Datapath 361 datapath.1 Computer Architecture EECS 361 Lecture 8: Designing a Single Cycle Datapath Outline of Today s Lecture Introduction Where are we with respect to the BIG picture? Questions and Administrative

More information

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath ECE468 Computer Organization and Architecture Designing a Single Cycle Datapath ECE468 datapath1 The Big Picture: Where are We Now? The Five Classic Components of a Computer Processor Control Input Datapath

More information

COMP303 - Computer Architecture Lecture 8. Designing a Single Cycle Datapath

COMP303 - Computer Architecture Lecture 8. Designing a Single Cycle Datapath COMP33 - Computer Architecture Lecture 8 Designing a Single Cycle Datapath The Big Picture The Five Classic Components of a Computer Processor Input Control Memory Datapath Output The Big Picture: The

More information

COMP303 Computer Architecture Lecture 9. Single Cycle Control

COMP303 Computer Architecture Lecture 9. Single Cycle Control COMP33 Computer Architecture Lecture 9 Single Cycle Control A Single Cycle Datapath We have everything except control signals (underlined) RegDst busw Today s lecture will look at how to generate the control

More information

Outline. EEL-4713 Computer Architecture Designing a Single Cycle Datapath

Outline. EEL-4713 Computer Architecture Designing a Single Cycle Datapath Outline EEL-473 Computer Architecture Designing a Single Cycle path Introduction The steps of designing a processor path and timing for register-register operations path for logical operations with immediates

More information

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath CPE 442 single-cycle datapath.1 Outline of Today s Lecture Recap and Introduction Where are we with respect to the BIG picture?

More information

CS3350B Computer Architecture Winter Lecture 5.7: Single-Cycle CPU: Datapath Control (Part 2)

CS3350B Computer Architecture Winter Lecture 5.7: Single-Cycle CPU: Datapath Control (Part 2) CS335B Computer Architecture Winter 25 Lecture 5.7: Single-Cycle CPU: Datapath Control (Part 2) Marc Moreno Maza www.csd.uwo.ca/courses/cs335b [Adapted from lectures on Computer Organization and Design,

More information

CPU Organization (Design)

CPU Organization (Design) ISA Requirements CPU Organization (Design) Datapath Design: Capabilities & performance characteristics of principal Functional Units (FUs) needed by ISA instructions (e.g., Registers, ALU, Shifters, Logic

More information

ECE170 Computer Architecture. Single Cycle Control. Review: 3b: Add & Subtract. Review: 3e: Store Operations. Review: 3d: Load Operations

ECE170 Computer Architecture. Single Cycle Control. Review: 3b: Add & Subtract. Review: 3e: Store Operations. Review: 3d: Load Operations ECE7 Computer Architecture Single Cycle Control Review: 3a: Overview of the Fetch Unit The common operations Fetch the : mem[] Update the program counter: Sequential Code: < + Branch and Jump: < something

More information

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control CS Computer Architecture Single-Cycle CPU Datapath & Control Instructor: Sören Schwertfeger http://shtech.org/courses/ca/ School of Information Science and Technology SIST ShanghaiTech University Slides

More information

Lecture #17: CPU Design II Control

Lecture #17: CPU Design II Control Lecture #7: CPU Design II Control 25-7-9 Anatomy: 5 components of any Computer Personal Computer Computer Processor Control ( brain ) This week ( ) path ( brawn ) (where programs, data live when running)

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #19 Designing a Single-Cycle CPU 27-7-26 Scott Beamer Instructor AI Focuses on Poker CS61C L19 CPU Design : Designing a Single-Cycle CPU

More information

CS 61C: Great Ideas in Computer Architecture Datapath. Instructors: John Wawrzynek & Vladimir Stojanovic

CS 61C: Great Ideas in Computer Architecture Datapath. Instructors: John Wawrzynek & Vladimir Stojanovic CS 61C: Great Ideas in Computer Architecture Datapath Instructors: John Wawrzynek & Vladimir Stojanovic http://inst.eecs.berkeley.edu/~cs61c/fa15 1 Components of a Computer Processor Control Enable? Read/Write

More information

361 control.1. EECS 361 Computer Architecture Lecture 9: Designing Single Cycle Control

361 control.1. EECS 361 Computer Architecture Lecture 9: Designing Single Cycle Control 36 control. EECS 36 Computer Architecture Lecture 9: Designing Single Cycle Control Recap: The MIPS Subset ADD and subtract add rd, rs, rt sub rd, rs, rt OR Imm: ori rt, rs, imm6 3 3 26 2 6 op rs rt rd

More information

Major CPU Design Steps

Major CPU Design Steps Datapath Major CPU Design Steps. Analyze instruction set operations using independent RTN ISA => RTN => datapath requirements. This provides the the required datapath components and how they are connected

More information

Full Datapath. CSCI 402: Computer Architectures. The Processor (2) 3/21/19. Fengguang Song Department of Computer & Information Science IUPUI

Full Datapath. CSCI 402: Computer Architectures. The Processor (2) 3/21/19. Fengguang Song Department of Computer & Information Science IUPUI CSCI 42: Computer Architectures The Processor (2) Fengguang Song Department of Computer & Information Science IUPUI Full Datapath Branch Target Instruction Fetch Immediate 4 Today s Contents We have looked

More information

MIPS-Lite Single-Cycle Control

MIPS-Lite Single-Cycle Control MIPS-Lite Single-Cycle Control COE68: Computer Organization and Architecture Dr. Gul N. Khan http://www.ee.ryerson.ca/~gnkhan Electrical and Computer Engineering Ryerson University Overview Single cycle

More information

CS 61C: Great Ideas in Computer Architecture. MIPS CPU Datapath, Control Introduction

CS 61C: Great Ideas in Computer Architecture. MIPS CPU Datapath, Control Introduction CS 61C: Great Ideas in Computer Architecture MIPS CPU Datapath, Control Introduction Instructor: Alan Christopher 7/28/214 Summer 214 -- Lecture #2 1 Review of Last Lecture Critical path constrains clock

More information

EEM 486: Computer Architecture. Lecture 3. Designing Single Cycle Control

EEM 486: Computer Architecture. Lecture 3. Designing Single Cycle Control EEM 48: Computer Architecture Lecture 3 Designing Single Cycle The Big Picture: Where are We Now? Processor Input path Output Lec 3.2 An Abstract View of the Implementation Ideal Address Net Address PC

More information

CS359: Computer Architecture. The Processor (A) Yanyan Shen Department of Computer Science and Engineering

CS359: Computer Architecture. The Processor (A) Yanyan Shen Department of Computer Science and Engineering CS359: Computer Architecture The Processor (A) Yanyan Shen Department of Computer Science and Engineering Eecuting R-type Instructions 7 Instructions ADD and subtract add rd, rs, rt sub rd, rs, rt OR Immediate:

More information

UC Berkeley CS61C : Machine Structures

UC Berkeley CS61C : Machine Structures inst.eecs.berkeley.edu/~cs6c UC Berkeley CS6C : Machine Structures The Internet is broken?! The Clean Slate team at Stanford wants to revamp the Internet, making it safer (from viruses), more reliable

More information

How to design a controller to produce signals to control the datapath

How to design a controller to produce signals to control the datapath ECE48 Computer Organization and Architecture Designing Single Cycle How to design a controller to produce signals to control the datapath ECE48. 2--7 Recap: The MIPS Formats All MIPS instructions are bits

More information

The Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture

The Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture The Processor Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut CSE3666: Introduction to Computer Architecture Introduction CPU performance factors Instruction count

More information

CSCI 402: Computer Architectures. Fengguang Song Department of Computer & Information Science IUPUI. Today s Content

CSCI 402: Computer Architectures. Fengguang Song Department of Computer & Information Science IUPUI. Today s Content 3/6/8 CSCI 42: Computer Architectures The Processor (2) Fengguang Song Department of Computer & Information Science IUPUI Today s Content We have looked at how to design a Data Path. 4.4, 4.5 We will design

More information

Lecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1

Lecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1 Lecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1 Introduction Chapter 4.1 Chapter 4.2 Review: MIPS (RISC) Design Principles Simplicity favors regularity fixed size instructions small number

More information

CENG 3420 Lecture 06: Datapath

CENG 3420 Lecture 06: Datapath CENG 342 Lecture 6: Datapath Bei Yu byu@cse.cuhk.edu.hk CENG342 L6. Spring 27 The Processor: Datapath & Control q We're ready to look at an implementation of the MIPS q Simplified to contain only: memory-reference

More information

CS 61C: Great Ideas in Computer Architecture Control and Pipelining

CS 61C: Great Ideas in Computer Architecture Control and Pipelining CS 6C: Great Ideas in Computer Architecture Control and Pipelining Instructors: Vladimir Stojanovic and Nicholas Weaver http://inst.eecs.berkeley.edu/~cs6c/sp6 Datapath Control Signals ExtOp: zero, sign

More information

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade CSE 141 Computer Architecture Summer Session 1 2004 Lecture 3 ALU Part 2 Single Cycle CPU Part 1 Pramod V. Argade Reading Assignment Announcements Chapter 5: The Processor: Datapath and Control, Sec. 5.3-5.4

More information

Chapter 4 The Processor 1. Chapter 4A. The Processor

Chapter 4 The Processor 1. Chapter 4A. The Processor Chapter 4 The Processor 1 Chapter 4A The Processor Chapter 4 The Processor 2 Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware

More information

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu CENG 342 Computer Organization and Design Lecture 6: MIPS Processor - I Bei Yu CEG342 L6. Spring 26 The Processor: Datapath & Control q We're ready to look at an implementation of the MIPS q Simplified

More information

Review. N-bit adder-subtractor done using N 1- bit adders with XOR gates on input. Lecture #19 Designing a Single-Cycle CPU

Review. N-bit adder-subtractor done using N 1- bit adders with XOR gates on input. Lecture #19 Designing a Single-Cycle CPU CS6C L9 CPU Design : Designing a Single-Cycle CPU () insteecsberkeleyedu/~cs6c CS6C : Machine Structures Lecture #9 Designing a Single-Cycle CPU 27-7-26 Scott Beamer Instructor AI Focuses on Poker Review

More information

Ch 5: Designing a Single Cycle Datapath

Ch 5: Designing a Single Cycle Datapath Ch 5: esigning a Single Cycle path Computer Systems Architecture CS 365 The Big Picture: Where are We Now? The Five Classic Components of a Computer Processor Control Memory path Input Output Today s Topic:

More information

Working on the Pipeline

Working on the Pipeline Computer Science 6C Spring 27 Working on the Pipeline Datapath Control Signals Computer Science 6C Spring 27 MemWr: write memory MemtoReg: ALU; Mem RegDst: rt ; rd RegWr: write register 4 PC Ext Imm6 Adder

More information

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath & Control Part 2

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath & Control Part 2 CS 6C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath & Control Part 2 Instructors: Krste Asanovic & Vladimir Stojanovic hfp://inst.eecs.berkeley.edu/~cs6c/ Review:

More information

UC Berkeley CS61C : Machine Structures

UC Berkeley CS61C : Machine Structures inst.eecs.berkeley.edu/~cs6c UC Berkeley CS6C : Machine Structures Lecture 26 Single-cycle CPU Control 27-3-2 Exhausted TA Ben Sussman www.icanhascheezburger.com Qutrits Bring Quantum Computers Closer:

More information

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Chapter 4. The Processor. Computer Architecture and IC Design Lab Chapter 4 The Processor Introduction CPU performance factors CPI Clock Cycle Time Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS

More information

The Processor: Datapath & Control

The Processor: Datapath & Control Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture The Processor: Datapath & Control Processor Design Step 3 Assemble Datapath Meeting Requirements Build the

More information

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 28: Single- Cycle CPU Datapath Control Part 1

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 28: Single- Cycle CPU Datapath Control Part 1 CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 28: Single- Cycle CPU Datapath Control Part 1 Guest Lecturer: Sagar Karandikar hfp://inst.eecs.berkeley.edu/~cs61c/ http://research.microsoft.com/apps/pubs/default.aspx?id=212001!

More information

CS61C : Machine Structures

CS61C : Machine Structures CS 61C L path (1) insteecsberkeleyedu/~cs61c/su6 CS61C : Machine Structures Lecture # path natomy: 5 components of any Computer Personal Computer -7-25 This week Computer Processor ( brain ) path ( brawn

More information

Simple Instruction Pipelining

Simple Instruction Pipelining Simple Instruction Pipelining Krste Asanovic Laboratory for Computer Science Massachusetts Institute of Technology Processor Performance Equation Time = Instructions * Cycles * Time Program Program Instruction

More information

CPU Design Steps. EECC550 - Shaaban

CPU Design Steps. EECC550 - Shaaban CPU Design Steps 1. Analyze instruction set operations using independent RTN => datapath requirements. 2. Select set of datapath components & establish clock methodology. 3. Assemble datapath meeting the

More information

Designing a Multicycle Processor

Designing a Multicycle Processor Designing a Multicycle Processor Arquitectura de Computadoras Arturo Díaz D PérezP Centro de Investigación n y de Estudios Avanzados del IPN adiaz@cinvestav.mx Arquitectura de Computadoras Multicycle-

More information

ECE 552 / CPS 550 Advanced Computer Architecture I. Lecture 4 Reduced Instruction Set Computers

ECE 552 / CPS 550 Advanced Computer Architecture I. Lecture 4 Reduced Instruction Set Computers ECE 552 / CPS 550 Advanced Computer Architecture I Lecture 4 Reduced Instruction Set Computers Benjamin Lee Electrical and Computer Engineering Duke University www.duke.edu/~bcl15 www.duke.edu/~bcl15/class/class_ece252fall11.html

More information

CS152 Computer Architecture and Engineering Lecture 10: Designing a Single Cycle Control. Recap: The MIPS Instruction Formats

CS152 Computer Architecture and Engineering Lecture 10: Designing a Single Cycle Control. Recap: The MIPS Instruction Formats CS52 Computer Architecture and Engineering Lecture : Designing a Single Cycle February 7, 995 Dave Patterson (patterson@cs) and Shing Kong (shing.kong@eng.sun.com) Slides available on http://http.cs.berkeley.edu/~patterson

More information

UC Berkeley CS61C : Machine Structures

UC Berkeley CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures Lecture 25 CPU Design: Designing a Single-cycle CPU Lecturer SOE Dan Garcia www.cs.berkeley.edu/~ddgarcia T-Mobile s Wi-Fi / Cell phone

More information

University of California College of Engineering Computer Science Division -EECS. CS 152 Midterm I

University of California College of Engineering Computer Science Division -EECS. CS 152 Midterm I Name: University of California College of Engineering Computer Science Division -EECS Fall 996 D.E. Culler CS 52 Midterm I Your Name: ID Number: Discussion Section: You may bring one double-sided pages

More information

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 18 CPU Design: The Single-Cycle I ! Nasty new windows vulnerability!

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 18 CPU Design: The Single-Cycle I ! Nasty new windows vulnerability! inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 18 CPU Design: The Single-Cycle I CS61C L18 CPU Design: The Single-Cycle I (1)! 2010-07-21!!!Instructor Paul Pearce! Nasty new windows vulnerability!

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #17 Single Cycle CPU Datapath CPS today! 2005-10-31 There is one handout today at the front and back of the room! Lecturer PSOE, new dad

More information

CPE 335 Computer Organization. Basic MIPS Architecture Part I

CPE 335 Computer Organization. Basic MIPS Architecture Part I CPE 335 Computer Organization Basic MIPS Architecture Part I Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides http://www.abandah.com/gheith/courses/cpe335_s8/index.html CPE232 Basic MIPS Architecture

More information

CO Computer Architecture and Programming Languages CAPL. Lecture 18 & 19

CO Computer Architecture and Programming Languages CAPL. Lecture 18 & 19 CO2-3224 Computer Architecture and Programming Languages CAPL Lecture 8 & 9 Dr. Kinga Lipskoch Fall 27 Single Cycle Disadvantages & Advantages Uses the clock cycle inefficiently the clock cycle must be

More information

CS3350B Computer Architecture Quiz 3 March 15, 2018

CS3350B Computer Architecture Quiz 3 March 15, 2018 CS3350B Computer Architecture Quiz 3 March 15, 2018 Student ID number: Student Last Name: Question 1.1 1.2 1.3 2.1 2.2 2.3 Total Marks The quiz consists of two exercises. The expected duration is 30 minutes.

More information

Recap: The MIPS Subset ADD and subtract EEL Computer Architecture shamt funct add rd, rs, rt Single-Cycle Control Logic sub rd, rs, rt

Recap: The MIPS Subset ADD and subtract EEL Computer Architecture shamt funct add rd, rs, rt Single-Cycle Control Logic sub rd, rs, rt Recap: The MIPS Subset EEL-47 - Computer Architecture Single-Cycle Logic ADD and subtract add rd, rs, rt sub rd, rs, rt OR Imm: ori rt, rs, imm 2 rs rt rd shamt t bits 5 bits 5 bits 5 bits 5 bits bits

More information

EECS150 - Digital Design Lecture 10- CPU Microarchitecture. Processor Microarchitecture Introduction

EECS150 - Digital Design Lecture 10- CPU Microarchitecture. Processor Microarchitecture Introduction EECS150 - Digital Design Lecture 10- CPU Microarchitecture Feb 18, 2010 John Wawrzynek Spring 2010 EECS150 - Lec10-cpu Page 1 Processor Microarchitecture Introduction Microarchitecture: how to implement

More information

Instructor: Randy H. Katz hcp://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #18. Warehouse Scale Computer

Instructor: Randy H. Katz hcp://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #18. Warehouse Scale Computer /29/3 CS 6C: Great Ideas in Computer Architecture Building Blocks for Datapaths Instructor: Randy H. Katz hcp://inst.eecs.berkeley.edu/~cs6c/fa3 /27/3 Fall 23 - - Lecture #8 So5ware Parallel Requests Assigned

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 34 Single Cycle CPU Control I 24-4-16 Lecturer PSOE Dan Garcia www.cs.berkeley.edu/~ddgarcia 1.5 Quake?! NBC movie on May 3 rd. Truth stranger

More information

Midterm I October 6, 1999 CS152 Computer Architecture and Engineering

Midterm I October 6, 1999 CS152 Computer Architecture and Engineering University of California, Berkeley College of Engineering Computer Science Division EECS Fall 1999 John Kubiatowicz Midterm I October 6, 1999 CS152 Computer Architecture and Engineering Your Name: SID

More information

Single Cycle CPU Design. Mehran Rezaei

Single Cycle CPU Design. Mehran Rezaei Single Cycle CPU Design Mehran Rezaei What does it mean? Instruction Fetch Instruction Memory clk pc 32 32 address add $t,$t,$t2 instruction Next Logic to generate the address of next instruction The Branch

More information

361 multipath..1. EECS 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor

361 multipath..1. EECS 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor 36 multipath.. EECS 36 Computer Architecture Lecture : Designing a Multiple Cycle Processor Recap: A Single Cycle Datapath We have everything except control signals (underline) Today s lecture will show

More information

Processor (I) - datapath & control. Hwansoo Han

Processor (I) - datapath & control. Hwansoo Han Processor (I) - datapath & control Hwansoo Han Introduction CPU performance factors Instruction count - Determined by ISA and compiler CPI and Cycle time - Determined by CPU hardware We will examine two

More information

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control ELEC 52/62 Computer Architecture and Design Spring 217 Lecture 4: Datapath and Control Ujjwal Guin, Assistant Professor Department of Electrical and Computer Engineering Auburn University, Auburn, AL 36849

More information

Lecture 9. Pipeline Hazards. Christos Kozyrakis Stanford University

Lecture 9. Pipeline Hazards. Christos Kozyrakis Stanford University Lecture 9 Pipeline Hazards Christos Kozyrakis Stanford University http://eeclass.stanford.edu/ee18b 1 Announcements PA-1 is due today Electronic submission Lab2 is due on Tuesday 2/13 th Quiz1 grades will

More information

CS 152 Computer Architecture and Engineering. Lecture 10: Designing a Multicycle Processor

CS 152 Computer Architecture and Engineering. Lecture 10: Designing a Multicycle Processor CS 152 Computer Architecture and Engineering Lecture 1: Designing a Multicycle Processor October 1, 1997 Dave Patterson (http.cs.berkeley.edu/~patterson) lecture slides: http://www-inst.eecs.berkeley.edu/~cs152/

More information

Lecture Topics. Announcements. Today: Single-Cycle Processors (P&H ) Next: continued. Milestone #3 (due 2/9) Milestone #4 (due 2/23)

Lecture Topics. Announcements. Today: Single-Cycle Processors (P&H ) Next: continued. Milestone #3 (due 2/9) Milestone #4 (due 2/23) Lecture Topics Today: Single-Cycle Processors (P&H 4.1-4.4) Next: continued 1 Announcements Milestone #3 (due 2/9) Milestone #4 (due 2/23) Exam #1 (Wednesday, 2/15) 2 1 Exam #1 Wednesday, 2/15 (3:00-4:20

More information

Recap: A Single Cycle Datapath. CS 152 Computer Architecture and Engineering Lecture 8. Single-Cycle (Con t) Designing a Multicycle Processor

Recap: A Single Cycle Datapath. CS 152 Computer Architecture and Engineering Lecture 8. Single-Cycle (Con t) Designing a Multicycle Processor CS 52 Computer Architecture and Engineering Lecture 8 Single-Cycle (Con t) Designing a Multicycle Processor February 23, 24 John Kubiatowicz (www.cs.berkeley.edu/~kubitron) lecture slides: http://inst.eecs.berkeley.edu/~cs52/

More information

CPE 335. Basic MIPS Architecture Part II

CPE 335. Basic MIPS Architecture Part II CPE 335 Computer Organization Basic MIPS Architecture Part II Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides http://www.abandah.com/gheith/courses/cpe335_s08/index.html CPE232 Basic MIPS Architecture

More information

Midterm I March 12, 2003 CS152 Computer Architecture and Engineering

Midterm I March 12, 2003 CS152 Computer Architecture and Engineering University of California, Berkeley College of Engineering Computer Science Division EECS Spring 2003 John Kubiatowicz Midterm I March 2, 2003 CS52 Computer Architecture and Engineering Your Name: SID Number:

More information

CS 61C: Great Ideas in Computer Architecture Lecture 12: Single- Cycle CPU, Datapath & Control Part 2

CS 61C: Great Ideas in Computer Architecture Lecture 12: Single- Cycle CPU, Datapath & Control Part 2 CS 6C: Great Ideas in Computer Architecture Lecture 2: Single- Cycle CPU, Datapath & Control Part 2 Instructor: Sagar Karandikar sagark@eecs.berkeley.edu hbp://inst.eecs.berkeley.edu/~cs6c Midterm Results

More information

EC 513 Computer Architecture

EC 513 Computer Architecture EC 513 Computer Architecture Single-cycle ISA Implementation Prof. Michel A. Kinsy Computer System View Processor Applications Compiler Firmware ISA Memory organization Digital Design Circuit Design Operating

More information

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 19 CPU Design: The Single-Cycle II & Control !

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 19 CPU Design: The Single-Cycle II & Control ! inst.eecs.berkeley.edu/~cs6c CS6C : Machine Structures Lecture 9 CPU Design: The Single-Cycle II & Control 2-7-22!!!Instructor Paul Pearce! Dell may have shipped infected motherboards! Dell is warning

More information

EECS150 - Digital Design Lecture 9- CPU Microarchitecture. Watson: Jeopardy-playing Computer

EECS150 - Digital Design Lecture 9- CPU Microarchitecture. Watson: Jeopardy-playing Computer EECS150 - Digital Design Lecture 9- CPU Microarchitecture Feb 15, 2011 John Wawrzynek Spring 2011 EECS150 - Lec09-cpu Page 1 Watson: Jeopardy-playing Computer Watson is made up of a cluster of ninety IBM

More information

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor. COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor The Processor - Introduction

More information

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition The Processor - Introduction

More information

ECE 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor

ECE 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor ECE 6 Computer Architecture Lecture : Designing a Multiple Cycle Processor 6 multipath.. Recap: A Single Cycle Datapath We have everything except control signals (underline) RegDst Today s lecture will

More information

EECS 151/251A Fall 2017 Digital Design and Integrated Circuits. Instructor: John Wawrzynek and Nicholas Weaver. Lecture 13 EE141

EECS 151/251A Fall 2017 Digital Design and Integrated Circuits. Instructor: John Wawrzynek and Nicholas Weaver. Lecture 13 EE141 EECS 151/251A Fall 2017 Digital Design and Integrated Circuits Instructor: John Wawrzynek and Nicholas Weaver Lecture 13 Project Introduction You will design and optimize a RISC-V processor Phase 1: Design

More information

Review: Abstract Implementation View

Review: Abstract Implementation View Review: Abstract Implementation View Split memory (Harvard) model - single cycle operation Simplified to contain only the instructions: memory-reference instructions: lw, sw arithmetic-logical instructions:

More information

Midterm I March 3, 1999 CS152 Computer Architecture and Engineering

Midterm I March 3, 1999 CS152 Computer Architecture and Engineering University of California, Berkeley College of Engineering Computer Science Division EECS Spring 1999 John Kubiatowicz Midterm I March 3, 1999 CS152 Computer Architecture and Engineering Your Name: SID

More information

Systems Architecture

Systems Architecture Systems Architecture Lecture 15: A Simple Implementation of MIPS Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some or all figures from Computer Organization and Design: The Hardware/Software

More information

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle

More information

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition. Chapter 4. The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor The Processor? Chapter 4 The Processor 2 Introduction We will learn How the ISA determines many aspects

More information

CPE 335 Computer Organization. Basic MIPS Pipelining Part I

CPE 335 Computer Organization. Basic MIPS Pipelining Part I CPE 335 Computer Organization Basic MIPS Pipelining Part I Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides http://www.abandah.com/gheith/courses/cpe335_s08/index.html CPE232 Basic MIPS Pipelining

More information

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface Chapter 4 The Processor: A Based on P&H Introduction We will examine two MIPS implementations A simplified version A more realistic pipelined

More information

Mark Redekopp and Gandhi Puvvada, All rights reserved. EE 357 Unit 15. Single-Cycle CPU Datapath and Control

Mark Redekopp and Gandhi Puvvada, All rights reserved. EE 357 Unit 15. Single-Cycle CPU Datapath and Control EE 37 Unit Single-Cycle CPU path and Control CPU Organization Scope We will build a CPU to implement our subset of the MIPS ISA Memory Reference Instructions: Load Word (LW) Store Word (SW) Arithmetic

More information

ECE468. Computer Organization and Architecture. Designing a Multiple Cycle Processor

ECE468. Computer Organization and Architecture. Designing a Multiple Cycle Processor ECE68 Computer Organization and Architecture Designing a Multiple Cycle Processor ECE68 multipath.. op 6 Instr RegDst A Single Cycle Processor busw RegWr Main imm6 Instr Rb -bit Registers 6 op RegDst

More information

Chapter 4. The Processor

Chapter 4. The Processor Chapter 4 The Processor Recall. ISA? Instruction Fetch Instruction Decode Operand Fetch Execute Result Store Next Instruction Instruction Format or Encoding how is it decoded? Location of operands and

More information

Chapter 4. The Processor

Chapter 4. The Processor Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS implementations A simplified

More information

Chapter 4. The Processor

Chapter 4. The Processor Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware 4.1 Introduction We will examine two MIPS implementations

More information

CS 110 Computer Architecture Review Midterm II

CS 110 Computer Architecture Review Midterm II CS 11 Computer Architecture Review Midterm II http://shtech.org/courses/ca/ School of Information Science and Technology SIST ShanghaiTech University Slides based on UC Berkley's CS61C 1 Midterm II Date:

More information

CSCI-564 Advanced Computer Architecture

CSCI-564 Advanced Computer Architecture CSCI-564 Advanced Computer Architecture Lecture 6: Pipelining Review Bo Wu Colorado School of Mines Wake up! Time to do laundry! The Laundry Analogy Place one dirty load of clothes in the washer When the

More information

Lecture 4: Review of MIPS. Instruction formats, impl. of control and datapath, pipelined impl.

Lecture 4: Review of MIPS. Instruction formats, impl. of control and datapath, pipelined impl. Lecture 4: Review of MIPS Instruction formats, impl. of control and datapath, pipelined impl. 1 MIPS Instruction Types Data transfer: Load and store Integer arithmetic/logic Floating point arithmetic Control

More information

ECE4680. Computer Organization and Architecture. Designing a Multiple Cycle Processor

ECE4680. Computer Organization and Architecture. Designing a Multiple Cycle Processor ECE68 Computer Organization and Architecture Designing a Multiple Cycle Processor ECE68 Multipath. -- op 6 Instr RegDst A Single Cycle Processor busw RegWr Main imm6 Instr Rb -bit Registers 6 op

More information

C 1. Last Time. CSE 490/590 Computer Architecture. ISAs and MIPS. Instruction Set Architecture (ISA) ISA to Microarchitecture Mapping

C 1. Last Time. CSE 490/590 Computer Architecture. ISAs and MIPS. Instruction Set Architecture (ISA) ISA to Microarchitecture Mapping CSE 49/59 Computer Architecture ISAs and MIPS Last Time Computer Architecture >> ISAs and RTL Comp. Arch. shaped by technology and applications Computer Architecture brings a quantitative approach to the

More information

Lecture 12: Single-Cycle Control Unit. Spring 2018 Jason Tang

Lecture 12: Single-Cycle Control Unit. Spring 2018 Jason Tang Lecture 12: Single-Cycle Control Unit Spring 2018 Jason Tang 1 Topics Control unit design Single cycle processor Control unit circuit implementation 2 Computer Organization Computer Processor Memory Devices

More information

ECS 154B Computer Architecture II Spring 2009

ECS 154B Computer Architecture II Spring 2009 ECS 154B Computer Architecture II Spring 2009 Pipelining Datapath and Control 6.2-6.3 Partially adapted from slides by Mary Jane Irwin, Penn State And Kurtis Kredo, UCD Pipelined CPU Break execution into

More information

COMPUTER ORGANIZATION AND DESIGN

COMPUTER ORGANIZATION AND DESIGN COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle

More information

The Processor (1) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

The Processor (1) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University The Processor (1) Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3050: Theory on Computer Architectures, Spring 2017, Jinkyu Jeong (jinkyu@skku.edu)

More information

ECE468 Computer Organization and Architecture. Designing a Multiple Cycle Controller

ECE468 Computer Organization and Architecture. Designing a Multiple Cycle Controller ECE468 Computer Organization and Architecture Designing a Multiple Cycle Controller ECE468 multicontroller Review of a Multiple Cycle Implementation The root of the single cycle processor s problems: The

More information

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath Control Part 1

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath Control Part 1 CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath Control Part 1 Instructors: Krste Asanovic & Vladimir Stojanovic hfp://inst.eecs.berkeley.edu/~cs61c/ Review

More information

LECTURE 5. Single-Cycle Datapath and Control

LECTURE 5. Single-Cycle Datapath and Control LECTURE 5 Single-Cycle Datapath and Control PROCESSORS In lecture 1, we reminded ourselves that the datapath and control are the two components that come together to be collectively known as the processor.

More information