1 / 14

Computer Architecture

Computer Architecture. Single-Cycle Implementation. Single-Cycle Datapath. PCSrc. 0 MUX 1. Add. ALU. 4. Add. result. RegWrite. Shift left 2. Instruction [25-21]. Read register 1. Read data 1. MemWrite. Read address. PC. Instruction [20-16]. Read register 2. ALUSrc. MemtoReg.

ntrevino
Download Presentation

Computer Architecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Architecture Single-Cycle Implementation

  2. Single-Cycle Datapath PCSrc 0MUX1 Add ALU 4 Add result RegWrite Shift left 2 Instruction [25-21] Read register 1 Read data 1 MemWrite Read address PC Instruction [20-16] Read register 2 ALUSrc MemtoReg Zero Instruction 0MUX1 Read data 2 ALU ALU [31-0] Write register 0MUX1 result Address Read data 1MUX0 Instruction Instruction [15-11] Write data memory Registers Data memory Write data RegDst 16 32 Instruction [15-0] Sign extend ALU control MemRead Instruction [5-0] ALUOp • This datapath supports the following instructions: • add, sub, and, or, slt, lw, sw, beq

  3. Single-Cycle Control RegDst Select destination register RegWrite Specify if the destination register is written ALUSrc Select whether source is register or immediate ALUOp Specify operation for ALU MemWrite Specify whether memory is to be written MemRead Specify whether memory is to be read MemtoReg Select whether memory or ALU output is used PCSrc Select whether next PC or computed address is used

  4. R-format Instruction Dataflow • For add, sub, and, or, slt instructions PCSrc 0MUX1 Add ALU 4 Add result Shift left 2 RegWrite Instruction [25-21] Read register 1 Read data 1 MemWrite Read address PC Instruction [20-16] Read register 2 ALUSrc MemtoReg Zero Instruction 0MUX1 Read data 2 ALU ALU [31-0] Write register 0MUX1 result Address Read data 1MUX0 Instruction Instruction [15-11] Write data memory Registers Data memory Write data RegDst 16 32 Instruction [15-0] Sign extend ALU control MemRead Instruction [5-0] ALUOp

  5. R-format Instruction Control • Control signal summary RegDst 1to select Rd RegWrite 1 to enable writing Rd ALUSrc 0 to select Rt value from register file ALUOp Dependent on operation (see below) MemWrite 0 to disable writing memory MemRead 0 to disable reading memory MemtoReg 0 to select ALU output to register PCSrc 0 to select next PC • ALUOp add OP (add) and OP (and) sub OP (sub) or OP (or) sltOP (slt)

  6. I-format Load Instruction Dataflow • For lw instruction PCSrc 0MUX1 Add ALU 4 Add result Shift left 2 RegWrite Instruction [25-21] Read register 1 Read data 1 MemWrite Read address PC Instruction [20-16] Read register 2 ALUSrc MemtoReg Zero Instruction 0MUX1 Read data 2 ALU ALU [31-0] Write register 0MUX1 result Address Read data 1MUX0 Instruction Instruction [15-11] Write data memory Registers Data memory Write data RegDst 16 32 Instruction [15-0] Sign extend ALU control MemRead Instruction [5-0] ALUOp

  7. I-format Load Instruction Control • Control signal summary RegDst 0 to select Rt RegWrite 1 to enable writing Rt ALUSrc 1 to select immediate field value from instruction ALUOp add MemWrite 0 to disable writing memory MemRead 1 to enable reading memory MemtoReg 1 to select memory output to register PCSrc 0 to select next PC

  8. I-format Store Instruction Dataflow • For sw instruction PCSrc 0MUX1 Add ALU 4 Add result Shift left 2 RegWrite Instruction [25-21] Read register 1 Read data 1 MemWrite Read address PC Instruction [20-16] Read register 2 ALUSrc MemtoReg Zero Instruction 0MUX1 Read data 2 ALU ALU [31-0] Write register 0MUX1 result Address Read data 1MUX0 Instruction Instruction [15-11] Write data memory Registers Data memory Write data RegDst 16 32 Instruction [15-0] Sign extend ALU control MemRead Instruction [5-0] ALUOp

  9. I-format Store Instruction Control • Control signal summary RegDst x (don’t care) RegWrite 0 to disable writing a register ALUSrc 1 to select Rt value from register file ALUOp add MemWrite 1 to enable writing memory MemRead 0 to disable reading memory MemtoReg x (don’t care) PCSrc 0 to select next PC

  10. I-format Branch Instruction Dataflow • For beq instruction 0MUX1 Add ALU 4 Add result Shift left 2 RegWrite PCSrc Instruction [25-21] Read register 1 Read data 1 MemWrite Read address PC Instruction [20-16] Read register 2 ALUSrc MemtoReg Zero Instruction 0MUX1 Read data 2 ALU ALU [31-0] Write register 0MUX1 result Address Read data 1MUX0 Instruction Instruction [15-11] Write data memory Registers Data memory Write data RegDst 16 32 Instruction [15-0] Sign extend ALU control MemRead Instruction [5-0] ALUOp

  11. I-format Branch Instruction Control • Control signal summary RegDst x (don’t care) RegWrite 0 to disable writing a register ALUSrc 0 to select Rt value from register file ALUOp sub MemWrite 0 to disable writing memory MemRead 0 to disable reading memory MemtoReg x (don’t care) PCSrc zero

  12. Single-Cycle Control Signals Summary SignalR-fmtI-fmt (lw)I-fmt (sw)I-fmt (beq) RegDst 1 0 x x RegWrite 1 1 0 0 ALUSrc 0 1 1 0 ALUOp OP add add sub MemWrite 0 0 1 0 MemRead 0 1 0 0 MemtoReg 0 1 x x PCSrc 0 0 0 zero

  13. More Details on Control Signal Generation

  14. Review and Projection • Single-Cycle implementation is easy • Control is based solely on the operation (and results!) • dictates ALU operation • controls multiplexor selection • enables/disables storage elements • Processor signals (control and data) stabilize and then any state (register and/or memory) change takes place when the clock cycle ends • Multi-Cycle implementation explained in the next class • Instruction processing takes multiple steps, one step per cycle • Within a given clock cycle, signals stabilize and their local state change takes place when the clock cycle ends

More Related