Composing the Elements Datapath Design 1 Firstcut data

  • Slides: 20
Download presentation
Composing the Elements Datapath Design 1 First-cut data path does an instruction in one

Composing the Elements Datapath Design 1 First-cut data path does an instruction in one clock cycle - Each datapath element can only do one function at a time - Hence, we need separate instruction and data memories Use multiplexers where alternate data sources are used for different instructions CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

R-Type/Load/Store Datapath How would this execute: 000000 op CS@VT August 2009 add 10001 rs

R-Type/Load/Store Datapath How would this execute: 000000 op CS@VT August 2009 add 10001 rs Datapath Design 2 $s 0, $s 1, $s 2; 10010 rt 10000 rd Computer Organization I 00000 shamt 100000 funct © 2006 -09 Mc. Quain, Feng & Ribbens

R-Type Execution 000000 op 10001 rs Datapath Design 3 00011 rt 100000 rd shamt

R-Type Execution 000000 op 10001 rs Datapath Design 3 00011 rt 100000 rd shamt 100000 funct Reg #s for $s 1 and $s 2 are input to the register file's read register ports. Low 16 bits from instruction are fed to the Sign-extend logic… irrelevant. Values from $s 1 and $s 2 are fetched and passed to ALU (ALUSrc set to 0 by Control). CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

R-Type Execution 000000 op 10001 rs Datapath Design 4 00011 rt 100000 rd shamt

R-Type Execution 000000 op 10001 rs Datapath Design 4 00011 rt 100000 rd shamt 100000 funct ALU computes sum of operands (ALU operation control set by Control). ALU output tranferred to MUX, set to pass through input 0 by Control. CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

R-Type Execution 000000 op 10001 rs Datapath Design 5 00011 rt 100000 rd shamt

R-Type Execution 000000 op 10001 rs Datapath Design 5 00011 rt 100000 rd shamt 100000 funct Reg# for $s 0 is input to register file write register port. ALU output transferred to register file Write data port. Reg. Write control line set by Control. CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

R-Type/Load/Store Datapath How would this execute: 100011 op lw Datapath Design 6 $s 0,

R-Type/Load/Store Datapath How would this execute: 100011 op lw Datapath Design 6 $s 0, 16($s 1); 10000 rs 10001 rt 0000 0010 0000 16 -bit number QTP Alert!! CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

Full Datapath How would this execute: Datapath Design 7 beq $s 0, $s 1,

Full Datapath How would this execute: Datapath Design 7 beq $s 0, $s 1, Label 0; QTP Alert!! CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

Simplified ALU Design Datapath Design 8 Here's a simplified ALU for 4 -bit operands

Simplified ALU Design Datapath Design 8 Here's a simplified ALU for 4 -bit operands that illustrates the control interface we need: Effectively, this ALU has a 4 -bit control mechanism for selecting the desired function. Inv. A Inv. B Fn. Sel ALU Fn 0 0 00 AND 0 0 01 OR 0 0 10 add 0 1 10 sub 0 1 11 slt 1 1 00 NOR CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

ALU Control Datapath Design 9 ALU used for - Load/Store - Branch - R-type

ALU Control Datapath Design 9 ALU used for - Load/Store - Branch - R-type CS@VT August 2009 Function = add Function = subtract Function depends on funct field Computer Organization I Inv. A Inv. B Fn. Sel ALU Fn 0 0 00 AND 0 0 01 OR 0 0 10 add 0 1 10 sub 0 1 11 slt 1 1 00 NOR © 2006 -09 Mc. Quain, Feng & Ribbens

ALU Control Datapath Design 10 Assume 2 -bit control signal ALUOp derived from opcode

ALU Control Datapath Design 10 Assume 2 -bit control signal ALUOp derived from opcode - Combinational logic derives ALU control opcode ALUOp Operation funct ALU function ALU control lw 00 load word XXXXXX add 0010 sw 00 store word XXXXXX add 0010 beq 01 branch equal XXXXXX subtract 0110 R-type 10 add 100000 add 0010 subtract 100010 subtract 0110 AND 100100 AND 0000 OR 100101 OR 0001 set-on-less-than 101010 set-on-less-than 0111 ALU Control CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

The Main Control Unit Datapath Design 11 Control signals derived from instruction R-type Load/

The Main Control Unit Datapath Design 11 Control signals derived from instruction R-type Load/ Store Branch CS@VT August 2009 0 rs rt rd shamt funct 31: 26 25: 21 20: 16 15: 11 10: 6 5: 0 35 or 43 rs rt address 31: 26 25: 21 20: 16 15: 0 4 rs rt address 31: 26 25: 21 20: 16 15: 0 opcode always read, except for load Computer Organization I write for R -type and load sign-extend add © 2006 -09 Mc. Quain, Feng & Ribbens

Datapath With Control CS@VT August 2009 Datapath Design 12 Computer Organization I © 2006

Datapath With Control CS@VT August 2009 Datapath Design 12 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

Datapath Control Signals Datapath Design 13 Reg. Dst selects instruction bits for write register

Datapath Control Signals Datapath Design 13 Reg. Dst selects instruction bits for write register # Branch 1 iff instruction is beq Mem. Read 1 iff memory location is to be read Memto. Reg selects source for write data port ALUOp specifies instruction class to ALU control Mem. Write 1 iff memory location is to be written ALUSrc selects source for 2 nd operand to ALU Reg. Write 1 iff register is to be written CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

Main Control Truth Table Signal Name I N P U T O U T

Main Control Truth Table Signal Name I N P U T O U T P U T Datapath Design 14 R-format lw sw beq Op 5 0 1 1 0 Op 4 0 0 Op 3 0 0 1 0 Op 2 0 0 0 1 Op 1 0 1 1 0 Op 0 0 1 1 0 Reg. Dst 1 0 X X ALUSrc 0 1 1 0 Memto. Reg 0 1 X X Reg. Write 1 1 0 0 Mem. Read 0 1 0 0 Mem. Write 0 0 1 0 Branch 0 0 0 1 ALUOp 1 1 0 0 0 ALUOp 0 0 1 Why are these don't-cares? Why these values? CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

Relevancies for R-Type Instruction CS@VT August 2009 Computer Organization I Datapath Design 15 ©

Relevancies for R-Type Instruction CS@VT August 2009 Computer Organization I Datapath Design 15 © 2006 -09 Mc. Quain, Feng & Ribbens

Relevancies for Load Instruction CS@VT August 2009 Computer Organization I Datapath Design 16 ©

Relevancies for Load Instruction CS@VT August 2009 Computer Organization I Datapath Design 16 © 2006 -09 Mc. Quain, Feng & Ribbens

Relevancies for beq Instruction CS@VT August 2009 Computer Organization I Datapath Design 17 ©

Relevancies for beq Instruction CS@VT August 2009 Computer Organization I Datapath Design 17 © 2006 -09 Mc. Quain, Feng & Ribbens

Implementing Jumps Jump Datapath Design 18 2 address 31: 26 25: 0 Jump uses

Implementing Jumps Jump Datapath Design 18 2 address 31: 26 25: 0 Jump uses word address Update PC with concatenation of - Top 4 bits of old PC - 26 -bit jump address - 00 Need an extra control signal decoded from opcode CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens

Datapath With Jumps Added CS@VT August 2009 Computer Organization I Datapath Design 19 ©

Datapath With Jumps Added CS@VT August 2009 Computer Organization I Datapath Design 19 © 2006 -09 Mc. Quain, Feng & Ribbens

Performance Issues Datapath Design 20 Longest delay determines clock period - Critical path: load

Performance Issues Datapath Design 20 Longest delay determines clock period - Critical path: load instruction - Instruction memory register file ALU data memory register file Not feasible to vary the clock period for different instructions Violates design principle - Making the common case fast We will improve performance (in 2506) by pipelining CS@VT August 2009 Computer Organization I © 2006 -09 Mc. Quain, Feng & Ribbens