Title: Controllers and Datapaths
1Controllers and Datapaths
CS 153, Spring 2007 Ian G. Harris Department of
Computer Science University of California Irvine
2Implementing Complex Behaviors
- A Datapath is needed to perform
arithmetic/boolean operations on data - , -, , /, mod, AND, OR, ltlt, lt, gtgt, gt, 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.
3Simple Controller/Datapath
in3
A in1 B in2 D in3 C A B E C D
Controller
Datapath
Behavior
- One-to-one mapping from behavior to datapath
components - var-reg, op-op
4Alternate Controller, Same Datapath
A in1 B in2 D in3 C A B E C D
Behavior
Optimized Controller
Controller
- Optimize performance by merging many operations
into one state - Merging continues until a data dependency (or
conditional) is reached
5Algorithm 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
6Datapath/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
A in1 B in2 D in3 C A B E C D
7Datapath/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
st1
st2
st3
No conditional
With Conditional
8Controller Definition Continued
4. Draw FSM edges based on control flow
Agt2
!Agt2
No conditional
With Conditional
9Controller Definition Continued
5. Label controller states with outputs
ldA1 ldB1 ldD1
ldC1
ldE1