18. Multi-Cycle Datapath Design

Question.2

A designer claims that a multi-cycle circuit reuses one arithmetic resource to calculate Y = (A + B) - C.

The ADD and SUB states run in different cycles, but the physical architecture is:

Resource Sharing

Does this satisfy a requirement for one shared ADD/SUB arithmetic unit?

Need Help? Refer to the Quick Guide below

1. Datapath and Controller Architecture

Datapath

A datapath is the part of a digital system that stores, moves, and processes data.

It performs the operations required by an algorithm.

Functionality:

Stores input and intermediate values, routes selected data, performs operations, and stores results.

Typical datapath resources include:

  • Registers - Store operands, temporary values, and results.
  • Counters - Track iterations and timing steps.
  • MUXes - Select data sources.
  • Functional units or ALUs - Perform arithmetic and logic operations.
  • Comparators - Generate comparison conditions.
  • Shifters - Perform shift operations.

Example:

A_Reg stores A
B_Reg stores B
MUXes route A_Reg and B_Reg
Adder calculates A + B
Result_Reg stores the sum

Controller

A controller sequences datapath operations.

It decides what the hardware does during each clock cycle.

Functionality:

Generates control signals and coordinates datapath activity according to the current processing step.

The controller determines:

  • Execution of the required operation.
  • Selection of the required operand source.
  • Update of the intended destination register.
  • Progress through wait, repeat, and completion steps.

Example:

LOAD state:
    A_Load = 1
    B_Load = 1

ADD state:
    ALU_Op = ADD
    Result_Load = 1

Datapath–Controller Architecture

The controller sends control signals to the datapath. The datapath returns status signals to the controller.

Datapath and Controller Architecture
  • The datapath stores and transforms values.
  • The controller tracks progress and schedules operations.
  • Control Signals travels from controller to datapath.
  • Status Signals travels from datapath to controller.

Important: Data, control, status, and state have different roles. Mixing these roles makes a design difficult to verify.

Control Signals

A control signal commands a datapath resource to perform a specific action.

Important examples:

Control SignalTypical Action
LoadStore a selected value in a register
Src_SelSelect a datapath source
ALU_OpSelect an arithmetic or logic operation
Count_EnableAllow a counter update

Status Signals

A status signal reports a condition calculated from datapath values. The controller uses it to choose a future action or state.

Common examples:

Status SignalMeaning
ZeroResult equals zero
EqualTwo values are equal
GreaterOne value is greater than another
NegativeSigned result is negative
Count_DoneRequired iteration count is reached

Architectural Partitioning

Architectural partitioning is required to separate data processing from operation sequencing.

It keeps:

  • Datapath resources focused on values.
  • Controller focused on timing and decisions.

Each design requirement is assigned to the datapath or controller.

RequirementTypical Location
Store dataDatapath
Select dataDatapath
Add or subtractDatapath
Compare valuesDatapath
Track algorithm progressController
Select an operationController
Enable register writesController

This separation provides:

  • Modularity: Processing and sequencing can be understood separately.
  • Resource reuse: One functional unit can serve several scheduled operations.
  • Simpler sequencing: Controller states describe when each action occurs.
  • Easier verification: Data errors and control errors can be isolated.

Architecture Example

Required behavior:

Y = A + B

Required datapath resources:

Resource GroupComponentsFunctionality
Storage RegistersA_Reg, B_Reg, Result_RegStore operands and the final result
Adder1 adderCalculate A_Reg + B_Reg

Controller flow:

Controller Flow of a simple machine
StateDatapath Action
LOADA_Reg ← A, B_Reg ← B
EXECUTEResult_Reg ← A_Reg + B_Reg
DONEHold the result and indicate completion

The controller selects the actions. The datapath performs them.

2. Register Transfer

Register Transfer Level

Register Transfer Level (RTL) describes a digital system in terms of clocked registers and the operations performed between them.

RTL states:

  • Storage of input, temporary, and result values.
  • Movement of data between registers.
  • Transformation of data through combinational logic.
  • Register updates on the specified active clock edge.

Examples:

A ← B
R ← A + B
COUNT ← COUNT + 1

Each left-side register updates at the specified active clock edge.

Micro-operation

A micro-operation is one small register-level action performed during a clock cycle.

Micro-operations:
A ← Input
TEMP ← A + B
COUNT ← COUNT + 1
RESULT ← TEMP

Algorithm:
Y = (A + B) - C

Decomposed micro-operations:
TEMP ← A + B
Y ← TEMP - C

An algorithm is converted into a sequence of micro-operations.

TEMP preserves the intermediate sum for the later subtraction.

Conditional Transfer

A conditional transfer occurs only when a control or status condition is true.

if Load = 1:
    R ← Data

if Greater = 1:
    MAX ← Data

If the condition is false, the destination register normally holds its current value.

Same-Edge Register Transfer

Consider two transfers assigned to the same active edge:

Same-edge transfers:
A ← B
B ← A

Before the edge:
A = 0011
B = 1010

After the edge:
A = 1010
B = 0011

Both registers capture their pre-edge source values. One register does not receive the value just written into the other register on that same edge.

Important: Evaluate every right-hand side using values that exist immediately before the active edge.

Register Enable and Hold

A register enable controls whether the register captures a new value.

Enable = 1: Update
Enable = 0: Hold

Registers should update only when explicitly enabled.

Load / Hold / Clear

ActionRegister Behavior
LoadCapture the selected input value
HoldKeep the current stored value
ClearStore 0

Example:

Clear = 1: R ← 0
Load  = 1: R ← Data
Else:      R ← R

Control Priority

Priority defines which action wins when several register controls are active together.

Reset > Clear > Load > Enable > Hold
ResetClearLoadEnableOperation
1XXXReset
01XXClear
001XLoad
0001Update
0000Hold

Caution: If overlapping controls have no defined priority, the register behavior is ambiguous.

3. Data Selection

Source Selection

Source selection chooses which value drives a shared datapath input. A MUX performs the selection under controller command.

For four 3-bit source registers:

Src_SelSelected Source
00Register A
01Register B
10Register C
11Register D
Source Register Selection Block Diagram
Four 3-bit source registers connected to a 4-to-1 multiplexer controlled by a source-select signal.

Destination Selection

Destination selection chooses which register stores the value on a shared input path. The controller enables the selected register.

For four 3-bit Destination Register:

Dst_selSelected Register
00Register A
01Register B
10Register C
11Register D
Destination register selection block diagram

Dst_Sel enables one destination. Only the enabled destination captures the value. All other registers hold.

One 3-bit input path connected to four destination registers with individual enables generated from a destination-select signal.
  • Source selection: Selects the value supplied to the data path.
  • Destination selection: Selects the register that stores the value.

Shared Data Path / Bus

A shared data path or bus lets several registers reuse one transfer path.

Shared Datapath Registers

For a transfer such as Register R ← Register P, the controller selects Register P as the source and enables only Register R as the destination.

Width and Signedness

Data width and interpretation must be defined before values move between resources.

CaseExampleResult
Zero extensionUnsigned 1010 extended from 4 to 8 bits00001010
Sign extensionSigned 1010 extended from 4 to 8 bits11111010
TruncationKeep the low 4 bits of 101101100110
Unsigned interpretation4-bit 101010
Signed interpretation4-bit two's-complement 1010-6

Warning: The same bit pattern can represent different values. Extension and comparison logic must match the intended signedness.

4. Controlled Datapath Operations

Shared Functional Unit

A shared functional unit is one physical operator reused for several operations. It reduces duplicated hardware.

ALU_OpOperation
00ADD
01SUB
10AND (&)
11OR (|)

The controller changes ALU_Op; the same physical unit performs the selected operation.

This example uses 2-bit input registers and a 3-bit result so the ADD output can include the carry bit.

Two 2-bit registers connected to a shared functional unit that generates a 3-bit result selected by the ALU_Op control code.

Operand Selection

Two operand-selection MUXes choose the values presented to the functional unit.

Operand Selection Block Diagram

The MUXes choose operands. ALU_Op chooses the operation. These are separate control decisions.

Detailed controlled datapath with selectable operands from 2-bit registers, two operand multiplexers, an ALU_Op-controlled functional unit, and a 3-bit result

Operation Selection

ALU_Op tells the shared functional unit which operation to perform.

Operation Selection Block Diagram

Example:

ALU_Op = 00: Result = A + B
ALU_Op = 01: Result = A - B
ALU_Op = 10: Result = A & B
ALU_Op = 11: Result = A | B

SrcA_Sel = A
SrcB_Sel = B
ALU_Op   = 01

ALU_Out = A - B

Changing ALU_Op to 00 changes the operation to A + B.

Result Selection and Writeback

The functional-unit result may feed several register inputs.

Result Selection and Writeback Block Diagram

Destination selection and write enable determine which register captures the result.

Important: Data present at a register input does not update the register unless its write enable is active at the clock edge.

Accumulator Datapath

An accumulator datapath stores a running value in ACC. The stored value is fed back to an adder so new data can be added over several clock cycles.

Accumulator operation:

1. Clear:      ACC ← 0
2. Load:       ACC ← Data
3. Accumulate: ACC ← ACC + Data
4. Hold:       ACC ← ACC
  • Clear starts a new accumulation from zero.
  • Load initializes ACC with a supplied value.
  • Accumulate adds new data to the stored value.
  • Hold keeps the current value when no update is required.
Accumulator Datapath

The controller selects one next value and enables ACC at the active clock edge. A defined priority prevents conflicting actions.

Control Word

A control word groups several datapath controls into one binary value.

Field layout:
ALU_Op[3:0] | SrcA[1:0] | SrcB[1:0]

Field values:
ADD = 0001
A   = 01
B   = 10

Combined fields:
0001 01 10

Control word:
00010110

The binary word has meaning only after the field widths and positions are defined.

Safe Control Outputs

Control outputs should begin with safe defaults. Register write controls normally default to 0.

A_Load      = 0
B_Load      = 0
TEMP_Load   = 0
RESULT_Load = 0

The active controller state then asserts only the required controls.

Safe defaults prevent:

  • Unintended register writes.
  • Multiple destination registers updating by mistake.
  • Stale controls carrying into the next state.
  • Invalid source and destination combinations.

Caution: Unless a multi-destination update is explicitly required, assert no more than one destination write enable for a shared writeback path.

Status Generation

Status signals are datapath outputs derived from stored values or a functional-unit result.

Zero     = (Result == 0)
Equal    = (A == B)
Greater  = (A > B)
Negative = Result MSB
StatusPractical Meaning
ZeroAll result bits are 0
EqualCompared values match
GreaterOne value is larger under the selected signedness
NegativeMost-significant bit of a signed result is 1
CarryUnsigned addition produced a carry beyond the result width
OverflowSigned arithmetic result exceeded the representable range

Carry and Overflow describe different arithmetic conditions and should not be treated as interchangeable.

Control–Status Feedback

Control Status Feedback

Controller actions affect datapath values, and datapath values generate conditions that affect future controller decisions.

This feedback relationship forms the basis of an FSMD.

5. Finite State Machine with Datapath (FSMD)

FSMD Concept

A Finite State Machine with Datapath (FSMD) combines a controller FSM with registers and functional units that process data over one or more clock cycles.

Controller state
+ Datapath registers
+ Datapath operations
+ Status conditions
= FSMD
FSM ViewFSMD View
Describes control states and transitionsDescribes control states, data operations, and status-driven transitions
Outputs mainly represent control behaviorOutputs command register transfers and functional units
State stores progressState stores progress while datapath registers store working values

Conceptual Signal Flow

Conceptual Signal Flow Diagram

State Register and Datapath Registers

The state register stores the current step of the algorithm. Its value identifies the controller state whose actions are active during the present clock cycle.

The datapath registers store:

  • Operands.
  • Temporary data.
  • Counter values.
  • Accumulated values.
  • Results.

Example snapshot:

State = ADD
TEMP  = 101101
COUNT = 0011

State represents control progress. TEMP and COUNT represent working data.

State-Based Operations

Each controller state activates a defined set of datapath controls.

State ADD:
    SrcA_Sel = A
    SrcB_Sel = B
    ALU_Op   = ADD
    TEMP_Load = 1

Active-edge operation:
TEMP ← A + B

Algorithm to FSMD

Required behavior:

Y = (A + B) - C

Design transformation:

Algorithm to FSMD Flow

Possible datapath resources:

A_Reg, B_Reg, C_Reg
TEMP, Y
Shared ADD/SUB unit
Operand MUXes

Possible controller sequence:

Possible Controller Sequence

Datapath activity controlled by each state:

Activity Controller by each state
StateRegister TransferMain Controls
IDLEHoldWait for Start
LOADA_Reg ← A, B_Reg ← B, C_Reg ← COperand loads active
ADDTEMP ← A_Reg + B_RegSelect A_Reg, B_Reg, and ADD
SUBY ← TEMP - C_RegSelect TEMP, C_Reg, and SUB
DONEHold YPulse Done

The same physical ADD/SUB unit can perform both arithmetic operations in different clock cycles.

Status-Driven State Transition

A controller can remain in a processing state until the datapath reports completion.

Process Driven State Transition

The datapath calculates Count_Done. The controller uses it as a transition condition.

Clock-Edge Status Timing

Assume Count_Done is combinationally generated from the registered counter.

Before Edge N:
COUNT = 2
Count_Done = 0

Edge N:
COUNT ← 3

After Edge N:
COUNT = 3
Count_Done = 1

Edge N+1:
Controller uses Count_Done = 1

The status changes after COUNT updates. The controller captures the resulting transition at the following active edge.

Important: Do not reason as if a controller can use a newly registered value before the edge that creates it.

6. Algorithmic State Machine (ASM)

ASM Concept

An Algorithmic State Machine (ASM) chart is a structured graphical representation of:

  • Controller states.
  • Datapath actions.
  • Status decisions.
  • Conditional actions.

ASM does not replace an FSMD. It presents FSMD behavior in a clearer cycle-oriented form when an ordinary state diagram becomes crowded.

Why ASM Is Useful with FSMD

An ASM chart keeps the following information together:

State Actions
Decision Conditions
Conditional Register Updates
Next-State Flow

This makes it easier to derive controller outputs and verify what occurs in each cycle.

State Box

A state box names a controller state and lists actions that always occur while that state is active.

ACCUMULATE

SUM ← SUM + Data
COUNT ← COUNT + 1

These register updates occur at the active edge when their enables are asserted.

Decision Box

A decision box tests a condition, usually supplied by datapath status logic.

Count_Done?
A > B?

Each outcome selects a different control or next-state path.

Conditional Output

A conditional output is asserted only on one selected decision path.

if Data > MAX:
    MAX ← Data

Here, Greater is a datapath status signal and MAX_Load is the controller output enabled on the true path.

Conditional Output Datapath

ASM to FSMD

ASM ElementFSMD Implementation
State boxesController states and unconditional control outputs
Decision boxesDatapath status inputs to next-state logic
Register actionsRegister enables, MUX selects, and functional-unit controls
Conditional outputsControl outputs enabled only on a selected decision path
Connecting pathsNext-state flow
ASM State Boxes
β†’ Controller States / Control Outputs

ASM Decision Boxes
β†’ Datapath Status Inputs

ASM Register Actions
β†’ Register Enables / MUX Selects / Functional-Unit Controls

7. Multi-Cycle Scheduling and Resource Sharing

Multi-Cycle Design

A multi-cycle design divides an operation across several clock cycles. Each clock cycle performs part of the required behavior.

Clock Cycle 1: Capture A, B, and C
Clock Cycle 2: TEMP ← A + B
Clock Cycle 3: RESULT ← TEMP - C
Clock Cycle 4: Indicate completion

Spreading operations across clock cycles can allow the same hardware to be reused.

Operation Dependency

An operation is dependent when it needs a result produced by an earlier operation.

TEMP ← A + B
RESULT ← TEMP - C

The subtraction must wait until TEMP contains the sum.

Independent operations do not require each other's results:

X ← A + B
Y ← C + D

They can theoretically execute in the same clock cycle if separate hardware and write paths are available.

Scheduling

Scheduling assigns each micro-operation to a clock cycle.

Clock CycleOperation
1Capture A, B, and C
2TEMP ← A + B
3RESULT ← TEMP - C
4Completion

A valid schedule respects data dependencies and available hardware resources.

Resource Sharing

Resource sharing reuses one physical functional unit for operations that occur in different clock cycles.

Clock Cycle 2: Shared ADD/SUB performs ADD
Clock Cycle 3: Same ADD/SUB performs SUB

Functional correctness alone does not prove resource sharing. The same physical resource must actually be reused.

Resource Binding

Resource binding maps scheduled operations onto specific physical hardware.

Scheduled OperationClock CycleBound Physical Resource
A + B2Shared ADD/SUB unit
TEMP - C3Same shared ADD/SUB unit

Both operations are bound to the same ADD/SUB unit at different times.

Temporary Register

A temporary register stores an intermediate value until a later clock cycle uses it.

TEMP ← A + B

RESULT ← TEMP - C

TEMP is required because the sum must survive the clock edge and remain available for the later subtraction.

Iterative Datapath

An iterative datapath repeatedly reuses the same resources until a status condition indicates completion.

Example:

SUM ← SUM + Sample
COUNT ← COUNT + 1

Repeat until:
COUNT == 4
Iterative Datapath

Area, Latency and Throughput

  • Area: Approximate amount of hardware used.
  • Latency: Time or cycle count from accepted input to completed result.
  • Throughput: Number of completed results per unit time.
Fixed latency:
Expression: (A + B) - C
Schedule: Capture, add, subtract, and complete
Result: Every transaction uses the same number of clock cycles.

Variable latency:
Operation: Process sensor samples until Data >= Limit
Result: The clock-cycle count depends on when the threshold is reached.
ArchitectureAreaLatencyThroughput
Single-cycle / ParallelHigherLow cycle countPotentially high
Shared Multi-cycleLowerHigherLower
PipelinedMore registers and controlMulti-cycleHigh steady-state

Pipeline architecture is preferred in many high-throughput industry designs because, after the pipeline is filled, different processing stages can work on different data at the same time and complete results more frequently.

Select Answer

Restart quiz!