12/5/2023
Datapath Design
By Vivek Desai
Department of Electronics
K.I.T.’s College of Engineering Kolhapur
Circuits to add several numbers
A Combinational circuit to add four numbers
1
12/5/2023
Circuits to add several numbers
•Control signals are generated by
the control unit
•Status signals to the control unit
Datapath design is also referred to as
register-transfer level (RTL)
Datapath to add one million numbers.
Designing Dedicated Datapaths
• What kind of registers to use, and how many are needed?
1
• What kind of functional units to use, and how many are needed?
2
• Can a certain functional unit be shared between two or more
3 operations?
• How are the registers and functional units connected together so that
4 all of the data movements specified bythe algorithm can be realized?
2
12/5/2023
A=A+3
A=B+C
3
12/5/2023
Datapath for A = A + 3 and A = B + C
without multiplexer—wrong
Datapath for A = A + 3 and A = B + C
With multiplexer— correct
4
12/5/2023
Datapath for A = A + 3 and A = B + C
using only one adder.
Selecting Registers
Circuit of a register with two sources.
5
12/5/2023
Selecting Functional Units
a=b+c d=e+f
Datapaths for realizing two addition operations using two separate adders
Selecting Functional Units
Datapaths for realizing two addition operations one adder
6
12/5/2023
Data Transfer Methods
Multiple Sources
Multiple Sources
A register having two sources.
7
12/5/2023
Multiple Destinations Tri-state Bus
Generating Status Signals
Generating Status Signals
8
12/5/2023
Generating Status Signals
Generating Status Signals
Generating Status Signals
IF (A is an odd number) THEN …
Generating Status Signals
9
12/5/2023
Using Dedicated Datapaths
Any given datapath will have a number of control signals.
the execution of an operation requires the correct assertion
and de-assertion of all of the control signals together.
A group of the control signals of a datapath are referred as a
control word.
One register-transfer operation, is determined by the values
set in one control word
Each control word operation will take one clock cycle to
perform
Datapath control word
1 A 3
A = A + 3 and A = B + C using only one adder. A+3
10
12/5/2023
Datapath control word
0 B C
A = A + 3 and A = B + C using only one adder.
B+C
Examples of Dedicated Datapaths
Simple IF-THEN-ELSE
1 INPUT A
2 IF (A = 5) THEN
3 B=8
4 ELSE
5 B = 13
6 END IF
7 OUTPUT B
11
12/5/2023
Datapath for the simple IF-THEN-ELSE
1 INPUT A
2 IF (A = 5) THEN
3 B=8
4 ELSE
5 B = 13
6 END IF
7 OUTPUT B
Control words for the simple IF-THEN-ELSE
Datapath
1 INPUT A
2 IF (A = 5) THEN
3 B=8
4 ELSE
5 B = 13
6 END IF
7 OUTPUT B
12
12/5/2023
Counting 1 to 10 Algorithm
1 i = 0
2 WHILE (i ≠ 10){
3 i=i+1
4 OUTPUT i
5 }
Counting 1 to 10 Datapath
1 i=0
2 WHILE (i ≠ 10){
3 i=i+1
4 OUTPUT i
5 }
13
12/5/2023
Summation of n Down to 1
1 sum = 0
2 INPUT n
3 WHILE (n ≠ 0){
4 sum = sum + n
5 n=n-1
6 }
7 OUTPUT sum
Summation of n Down to 1 Datapath
14
12/5/2023
Factorial of n
1 INPUT n
2 product = 1
3 WHILE (n > 1) {
4 product = product * n
5 n=n–1
}
6 OUTPUT product
15
12/5/2023
Datapath for Factorial of n
Using
five
control
words
16
12/5/2023
Using
three
control
words
Count 0’s and 1’s
Input an 8-bit number. Output a 1 if the number has the same number of 0’s and 1’s,
otherwise, output a 0.
INPUT n
countbit = 0 // for counting the number of zero and one bits
counteight = 0 // for looping eight times
WHILE (counteight ≠ 8) {
IF (n0 = 1) THEN // test whether bit 0 of n is a 1
countbit = countbit + 1 ELSE countbit = countbit – 1
END IF
n = n >> 1 // shift n right one bit
counteight = counteight + 1; }
IF (countbit = 0) THEN
OUTPUT 1 // same number of 0’s and 1’s,
ELSE
OUTPUT 0 // Different number of 0’s and 1’s,
END IF
ASSERT Done
17
12/5/2023
Registers and functional units needed
An 8-bit shifter with parallel load register for storing and
shifting n.
• A 4-bit up counter for counteight.
• A 4-bit up-down counter for countbit.
• A “not equal to 8” comparator for looping eight times.
• An “equal to 0” comparator for testing with countbit.
Datapath
to Count 0’s
and 1’s
18
12/5/2023
Control words for datapath of
Count 0’s and 1’s
A simple, general datapath circuit.
The control word to load a value from
the external data input
19
12/5/2023
Using a general datapath to output the numbers from 1 to 10
the status signal (i ≠ 10) added to the general datapath
20
12/5/2023
A More Complex General Datapath
Sum the numbers from n down to 1.
21