Introduction To Digital Systems 9 - Standard Combinational Modules
Introduction To Digital Systems 9 - Standard Combinational Modules
• DECODERS
• ENCODERS
• MULTIPLEXERS (Selectors)
• DEMULTIPLEXERS (Distributors)
• SHIFTERS
HIGH-LEVEL DESCRIPTION:
Inputs: x = (xn−1, . . . , x0), xj ∈ {0, 1}
Enable E ∈ {0, 1}
Outputs: y = (y2n−1, . . . , y0), yi ∈ {0, 1}
1 if (x = i) and (E = 1)
Function: yi =
0 otherwise
n−1
x= xj 2 j
X
j=0
and
i = 0, . . . , 2n − 1
E
y
En 0
0
y
Outputs
Inputs
x 1
1
x n-1
n-1
y n
n 2 -1
2 -1
E x2 x1 x0 x y7 y6 y5 y4 y3 y2 y1 y0
1 0 0 0 0 0 0 0 0 0 0 0 1
1 0 0 1 1 0 0 0 0 0 0 1 0
1 0 1 0 2 0 0 0 0 0 1 0 0
1 0 1 1 3 0 0 0 0 1 0 0 0
1 1 0 0 4 0 0 0 1 0 0 0 0
1 1 0 1 5 0 0 1 0 0 0 0 0
1 1 1 0 6 0 1 0 0 0 0 0 0
1 1 1 1 7 1 0 0 0 0 0 0 0
0 - - - - 0 0 0 0 0 0 0 0
BINARY SPECIFICATION:
Inputs: x = (xn−1, . . . , x0), xj ∈ {0, 1}
E ∈ {0, 1}
Outputs: y = (y2n−1, . . . , y0), yi ∈ {0, 1}
Function: yi = E · mi(x) , i = 0, . . . , 2n − 1
y
0
x0 y1
y
x 2
1
y3
OPCODE field
4-Input Binary
E=1 En Decoder
15 . . . 4 3 2 1 0
LOAD
STORE
ADD Decoded
operations
JUMP
E=1
Binary Decoder
Address 1
14 2
14
RAM Module Address
14
(2 x 1)
16383
Read/write
Read/write
Data output
Figure 9.4: RANDOM ACCESS MEMORY (RAM): a) MODULE; b) ADDRESSING OF BINARY CELLS.
• UNIVERSAL
Example 9.5:
x2 x1 x0 z2 z1 z0
000 0 1 0
001 1 0 0
010 0 0 1
011 0 1 0
100 0 0 1
101 1 0 1
110 0 0 0
111 1 0 0
E=1
y0
En 0
y1
Binary Decoder 1
y2 z2
2
x0 0 y3
3
x1 y4 z1
1
4
x2 2 y5
5
y z
6 0
6
y
7
7
x = (xleft, xright)
y = DEC(xleft)
w = DEC(xright)
zi = AN D(ys, wt)
i = 24 × s + t
x3 x2 x1 x0
0 1 0 0
4-Input Binary
1 En Decoder
15 . . .4 3 2 1 0
w 1
4
z0
x4 0
2 1 0
4-Input Binary
1 y
Decoder
x5 2
x6 0 1
...
0 z 36
x7
15
En
1
E
z 255
y = dec(xleft, E)
w = dec(xright , 1)
x n/2-1 x0
1 En DECODER W
w n/2 w0
2 -1
wt
z0
y0
DECODER Y
x n/2
ys
x n-1
En
z n/2
y n/2 2 s+t
2 -1
E
z n
2 -1
x = (xleft, xright)
x3 x2 x1 x0
x=6: 0 1 1 0
1 0
Level 1 E En DEC
3 2 1 0
0 0 1 0
1 0 En 1 0 En 1 0 En 1 0 En
Level 2 DEC 3 DEC 2 DEC 1 DEC 0
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
z 15 z 12 z8 z 6 =1 z4 z0
w = dec(xleft, E)
x x
left right
x n-1 x n/2 x n/2-1 x0
Level 1 E En
DEC
w n/2
2 -1 w0
wt
En En En
Level 2 n/2
DEC 2 -1 DEC t DEC 0
z n z 2 (n/2)t+s z0
2 -1
Coincident Tree
Decoder modules 2 2k + 1
and gates 22k –
Load per network input 1 decoder input 2k decoder inputs (max)
Fanout per decoder output 2k and inputs 1 enable input
Number of module inputs 2k + 2 + 22k+1 1 + k + 2k + k2k
(related to number of
connections)
Delay tdecoder + tAND 2tdecoder
x0 0
Decoder
z0
x1 1
x0 0 z0
Decoder
x2 z1 1 z1
7 x1
E
x2
7 z7
x3 0
Decoder
1
1 x4
x5 7
x3 0
Decoder
1 0 z 56
Decoder
x4
1 z 57
x5 z 63
7
7 z 63
(a) (b)
Coincident Tree
Decoder modules 2 9
and gates 64 –
Load per network input 1 decoder input 8 decoder inputs (max)
Fanout per decoder output 8 and inputs 1 enable input
Number of module inputs 136 36
Delay 3d 4d
Data input
Binary cell
E=1
0
0 1
Tree Decoder
1
12 2
2
Address
4095
4096 lines
from decoder
to cell array 4095
Read/write
Data output
(a)
Decoder
Binary
6 0
63 1
12
Address E=1
0
Decoder
Binary
6
63 4095
(b)
En
Outputs
Inputs 1
1
y n-1
n-1
n
2
x n n
2 -1 2 -1
Ac
0 otherwise
1 if
(some xi = 1) and (E = 1)
A =
0 otherwise
n−1
y= yj 2 j
X
j=0
and
i = 0, . . . , 2n − 1
E x7 x6 x5 x4 x3 x2 x1 x0 y y2 y1 y0 A
1 0 0 0 0 0 0 0 1 0 0 0 0 1
1 0 0 0 0 0 0 1 0 1 0 0 1 1
1 0 0 0 0 0 1 0 0 2 0 1 0 1
1 0 0 0 0 1 0 0 0 3 0 1 1 1
1 0 0 0 1 0 0 0 0 4 1 0 0 1
1 0 0 1 0 0 0 0 0 5 1 0 1 1
1 0 1 0 0 0 0 0 0 6 1 1 0 1
1 1 0 0 0 0 0 0 0 7 1 1 1 1
1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 - - - - - - - - 0 0 0 0 0
E ∈ {0, 1}
A ∈ {0, 1}
Function: yj = E · P(xk ), j = 0, . . . , n − 1
A = E · P(xi), i = 0, . . . , 2n − 1
y0 = E · (x1 x3 x5 x7)
y1 = E · (x2 x3 x6 x7)
y2 = E · (x4 x5 x6 x7)
A = E · (x0 x1 x2 x3 x4 x5 x6 x7)
x7 x6 x5 x4 x3 x2 x1 x0
E
y0
y1
y2
Wind direction
in unary code
0
0
1 Wind direction
1
BINARY ENCODER
n in binary code
0
2
nw ne 0 1
0
3 1 0
w e 0 4
2 0
0
sw se 5
s 0 6
0
7
Function:
i if (xi = 1) and (xk = 0, k > i) and (E = 1)
y =
0 otherwise
1 if (some xi = 1) and (E = 1)
A =
0 otherwise
n−1
y= yj 2 j
X
j=0
and
i, k ∈ {0, 1, . . . , 2n − 1}
E x7 x6 x5 x4 x3 x2 x1 x0 y2 y1 y0 A
1 0 0 0 0 0 0 0 1 0 0 0 1
1 0 0 0 0 0 0 1 - 0 0 1 1
1 0 0 0 0 0 1 - - 0 1 0 1
1 0 0 0 0 1 - - - 0 1 1 1
1 0 0 0 1 - - - - 1 0 0 1
1 0 0 1 - - - - - 1 0 1 1
1 0 1 - - - - - - 1 1 0 1
1 1 - - - - - - - 1 1 1 1
1 0 0 0 0 0 0 0 0 0 0 0 0
0 - - - - - - - - 0 0 0 0
E
Lowest
En
priority z
0
Priority Resolution
x 1 y
1 1 1 1 0
0
y
Outputs
1
Inputs
y n-1
n-1
n
z n
2
x n n n 2 -1 n
2 -1 2 -1 2 -1 2 -1
Highest Ac
priority
A
0 otherwise
with i, k = 0, 1, . . . , 2n − 1
• BINARY DESCRIPTION:
zi = x02n−1x02n−2 . . . x0i+1xi , i = 0, 1, . . . , 2n − 1
OR ITERATIVELY
ci−1 = ci xi
zi = c0ixi
x0 z0
c0
x0
z0 Cell
x1 x1 z1
z1
c1
x2
z2
x2
z2
x3 z3 c2
x3 z3
(a) (b)
Request E=1
lines
1 En
Device A 0
lowest Highest
priority priority
PRIORITY ENCODER
0 0 request
Device B 1 0
PROCESSOR
1 1
Device C 2 1
0
Device D 3
Ac
highest Request
priority present
A=1
E=1
x 7 x 6 x 5 x 4 x 3 x2 x1 x 0
0 0 1 0 1 0 0 1 En
1
ENCODER
PRIORITY
0
0
1
1
2
Ac
SHIFTER
Figure 9.18: DETECTING THE LEFTMOST 1 IN A BIT-VECTOR AND REMOVING LEADING ZEROES.
0 if E = 0
n−1
s= sj 2 j
X
j=0
2nX
−1
z = E · xi · mi(s)
i=0
x 0 En
0
2 - Input Multiplexer
x 1
1
Data inputs
x 2
2 Data output
n
x n n
2 -1 2 -1
n-1 0
s n-1 s0
Select inputs
Figure 9.19: 2n -INPUT MULTIPLEXER.
E s1 s0 z
1 0 0 x0
1 0 1 x1
1 1 0 x2
1 1 1 x3
0 - - 0
x0
x1
x z
2
x3
E
s s
1 0
R0 R1 R0 R2 R3 R4
0 1 0 1 2 3
SelA SelB
MUX A MUX B
Z= f(A,B)
0 0
En E=1
8 - Input Multiplexer
1 En
x 0
1 2 2
4 - Input Multiplexer
x’ 1
0 f = one-set(1,2,4,6,7) 2 f = one-set(1,2,4,6,7)
3
1 1 2
4
x
0 2 3
5
1 6 1 0
1 7 2 1 0
x x
Select 1 0
inputs
x x x
2 1 0
(a) (c)
x0 x0
0 1 0 1
x2 x’2 x2 1
x2 1 0 1 1
x1 x1
(b)
a b cin z cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
cin En 0 En
0 0
4-Input Multiplexer
4-Input Multiplexer
c’in
1 1
z cout
2 2
3 1 3
1 0 1 0
0 1 0 1 0 0 1 0
a 1 0 1 0 a 0 1 1 1
b b
wj = x(4j+sright) , 0 ≤ j ≤ 3
z = wsleft
s = 4sleft + sright
z = x4sleft+sright = xs
x 15 x 14 x 13 x 12 x 11 x 10 x 9 x 8 x7 x6 x5 x4 x3 x2 x1 x0
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
1 En 1 En 1 En 1 En
1 MUX 1 MUX 1 MUX 1 MUX
0 0 0 0
s1
0
s0
1
x 13 x9 x5 x1
3 2 1 0
E En
s3 MUX
1
1
s2 0
0
z = x9
• A HIGH-LEVEL DESCRIPTION:
Inputs: x, E ∈ {0, 1}
s = (sn−1, . . . , s0) , sj ∈ {0, 1}
Outputs: y = (y2n−1, . . . , y0) , yi ∈ {0, 1}
x if (i = s) and (E = 1)
Function: yi =
0 if (i 6= s) or (E = 0)
n−1
s= sj 2 j , 0 ≤ i ≤ 2 n − 1
X
j=0
E
y0
En 0
y1
1
y2
Demultiplexer
2
Data input Data outputs
(DMUX)
x
n
y n
2 -1
2 -1
n-1 0
s n-1 s0
Select inputs
Figure 9.25: 2n -OUTPUT DEMULTIPLEXER.
E s1 s0 s y3 y2 y1 y0
1 0 0 0 0 0 0 x
1 0 1 1 0 0 x 0
1 1 0 2 0 x 0 0
1 1 1 3 x 0 0 0
0 - - - 0 0 0 0
yi = E · x · mi(s), 0 ≤ i ≤ 2n − 1
x y
0
y
1
y
2
y
3
s s
1 0
Figure 9.26: GATE NETWORK IMPLEMENTATION OF A 4-OUTPUT DEMULTIPLEXER.
DMUX Sel
0 1 2 3
S0 S1 S2 S3
0 1 2 3
MUX
Z= f(X)
n n-1 i 0 -1
shift/
s no shift
E
n-bit Simple Shifter
d left/
right
n-1 i 0
(a)
xn x n-1 x i+1 x 1 x 0 x -1
s= YES shift/
no shift E=1
d= RIGHT left/
right
y n-1 yi y0
SIMPLE SHIFTER
(b)
shift/
s= YES no shift
E=1
left/
d= LEFT right
Figure 9.28: n-BIT SIMPLE SHIFTER: a) BLOCK DIAGRAM; b) RIGHT SHIFT; c) LEFT SHIFT.
y n-1 yi y0
9 – Standard Combinational Modules
(c)
54
55
SIMPLE SHIFTER: HIGH-LEVEL DESCRIPTION
Inputs: x = (xn, xn−1, . . . , x0, x−1) , xj ∈ {0, 1}
d ∈ {RIGHT, LEF T }
s ∈ {Y ES, N O}
E ∈ {0, 1}
Outputs: y = (yn−1, . . . , y0) , yj ∈ {0, 1}
Function:
xi−1 if (d = LEF T ) and (s = Y ES) and (E = 1)
x if (d = RIGHT ) and (s = Y ES) and (E = 1)
yi = i+1
xi if (s = N O) and (E = 1)
0 if (E = 0)
for 0 ≤ i ≤ n − 1.
0 left shift with 0 insert
x−1 = 1 left shift with 1 insert
x
n−1 left rotate
0 right shift with 0 insert
xn = 1 right shift with 1 insert
x
0 right rotate
Control Data
s d x 4 x3 x2 x1 x0 x−1
1 0 0 1 1 0
No shift no – 0 0 1 1
Right shift yes right 1 0 0 1
Left shift yes left 0 1 1 0
y3 y2 y1 y0
Coding:
s d
0 no 0 right
1 yes 1 left
RIGHT
E
s
NO SHIFT
y n-1 y0
(a)
xn x n-1 x n-2 x1 x0 x -1
E
En 3 2 1 0 En 3 2 1 0
1 MUX 1 MUX
0 0
s
d
y n-1 y0
(b)
Function:
xi−s if (d = LEF T ) and (E = 1)
yi = xi+s if (d = RIGHT ) and (E = 1)
0 if (E = 0)
0≤i≤n−1
x n+p-1 x n x n-1 x 0 x -1 x -p
s distance
log(p+1) n-bit p-Shifter En E
d left/right
y n-1 y0
Figure 9.30: n-BIT p-SHIFTER.
Stage 0
Stage 1
Stage 2
Stage 3
n+2p
0 or 4 SHIFT
0 or 8 SHIFT
0 or 1 SHIFT
0 or 2 SHIFT
x
y
d
s0
s2
3
s
s
Figure 9.31: BARREL SHIFTER FOR p = 15.
x6 x5 x4 x3 x2 x1 x0
En 3 2 1 0 En 3 2 1 0 En 3 2 1 0 En 3 2 1 0
y3 y2 y1 y0
• ALIGNMENT OF A BIT-VECTOR