Presentation is loading. Please wait.

Presentation is loading. Please wait.

Controllers and Datapaths

Similar presentations


Presentation on theme: "Controllers and Datapaths"— Presentation transcript:

1 Controllers and Datapaths
CS 153, Spring 2007 Ian G. Harris Department of Computer Science University of California Irvine

2 Implementing Complex Behaviors
A Datapath is needed to perform arithmetic/boolean operations on data +, -, *, /, mod, AND, OR, <<, <, >>, >, etc. A Controller is needed to tell datapath components what to do and when to do it Status information from the datapath may be needed A controller drives the control inputs of the datapath components load, reset, shiftleft, ALUOp, etc. Datapath Controller Control bits Status bits Register load reset

3 Simple Controller/Datapath
Reg A load D Q Reg B + Reg C Reg E Reg D in1 in2 ldA ldC ldB ldD ldE in3 ldA=1 ldB=1 ldC=1 ldD=1 ldE=1 A = in1; B = in2; D = in3; C = A + B; E = C + D; Behavior Controller Datapath One-to-one mapping from behavior to datapath components var-reg, op-op

4 Alternate Controller, Same Datapath
ldA=1 ldB=1 ldC=1 ldD=1 ldE=1 A = in1; B = in2; D = in3; C = A + B; E = C + D; ldE=1 ldA=1 ldB=1 ldD=1 ldC=1 Behavior Controller Optimized Controller Optimize performance by merging many operations into one state Merging continues until a data dependency (or conditional) is reached

5 Algorithm to Make Datapath and Controller
Determine all datapath components needed by looking at each step of the behavior Assume no hardware sharing 5 Registers - one for each variable 2 adders - one for each addition A = in1; B = in2; D = in3; C = A + B; E = C + D; ld Reg A ld Reg B ld Reg C + ld Reg E ld Reg D +

6 Datapath/Controller Algorithm Continued
2. Connect datapath components by identifying connections needed for each step in the behavior. Be sure to label control inputs, status outputs in1 in2 in3 ld Reg A Reg B Reg C Reg D Reg E + ldA ldB ldC ldD ldE A = in1; B = in2; D = in3; C = A + B; E = C + D;

7 Datapath/Controller Algorithm Controller Definition
3. Group steps of the behavior into states Pack as many steps as possible into a state No data dependency can exist in a state No conditional can exist in a state - all ops in state MUST occur together A = B + C; If (A > 2) then X = Y + Z; Else P = Q + R; Result = X + P; A = in1; B = in2; D = in3; C = A + B; E = C + D; st1 st2 st3 No conditional With Conditional

8 Controller Definition Continued
4. Draw FSM edges based on control flow A = B + C; If (A > 2) then X = Y + Z; Else P = Q + R; Result = X + P; A = in1; B = in2; D = in3; C = A + B; E = C + D; A>2 !A>2 No conditional With Conditional

9 Controller Definition Continued
5. Label controller states with outputs ldA=1 ldB=1 ldD=1 A = in1; B = in2; D = in3; C = A + B; E = C + D; ldC=1 ldE=1


Download ppt "Controllers and Datapaths"

Similar presentations


Ads by Google