Title: RT level combinational blocks
1RT level combinational blocks
2Goal
- This lecture presents the set of functional
blocks that are usually considered to be
elementary or basic at the RT level.
3Prerequisites
4Homework
- No particular homework is foreseen
5Further readings
- Students interested in making a reference to a
text book on the arguments covered in this
lecture can refer, for instance, to - M. Morris Mano, C.R.Kime Logic and Computer
Design Fundamentals, 2nd edition
updatedPrentice Hall, Upple Saddle River, NJ
(USA), 2001, (chapter 3, pp. 111-148 )
6Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
7Adders
- We shall consider
- half adder
- full adder
- adder-subtracter
8Half-Adder
- A half-adder has
- 2 inputs Ai, Bi
- 2 outputs Si and Ci1
- and computes the binary sum of the 2 input bits,
providing - the sum Si
- the carry Ci1
9Ai Bi
Ci1 Si
10Full-Adder
- A full-adder has
- 3 inputs Ai, Bi and Ci
- 2 outputs Si and Ci1
- and computes the binary sum of the 3 input bits,
providing - the sum Si
- the carry Ci1
11Ai Bi Ci
?
Ci1 Si
- Si Ai ?? Bi ?? Ci
- Ci1 Ai Bi Ai Ci Bi Ci
- Ai Bi ( Ai ?? Bi ) Ci
12Adder-subtracter
- An adder-subtracter is a combinational block
capable of adding/subtracting two n-bits inputs
operands, detecting overflow conditions. It has - 2 n-bits data inputs, both labeled from n-1 to 0
- 1 control input to select one of the two
operations - 1 n-bits data output
- 1 control output asserted when an overflow
condition is occurred.
13Adder-subtracter (contd)
Symbol
ADD/SUB
A(n-1 downto 0)
FUNC(n-1 downto 0)
OVFL
B(n-1 downto 0)
14Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
15Multiplexer
- A multiplexer is a combinational block capable of
forcing its output to the current value of one
of its inputs, according to the values of some
control signals. - Each input can be either a single wire or a bus.
16Multiplexer
- A multiplexer has
- 2k data inputs, labeled from 2k-1 to 0
- k control inputs
- 1 data output.
It gets the value present on the input labeled 2
i, where i (0 ? i ? k-1) is the binary number
present on the control inputs.
k
2k-1 2k-2 2 1 0
MUX
17Multiplexer (cont'd)
Symbol
OUT
IN(2k-1 downto 0)
SEL(k-1 downto 0)
18Multiplexer (contd)
Symbol
M0(n-1 downto 0)
M1(n-1 downto 0)
M2(n-1 downto 0)
OUT(n-1 downto 0)
M2k-1(n-1 downto 0)
SEL(k-1 downto 0)
19Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
20Decoder
- A decoder k ? 2k has
- 1 n-bit data input
- 2 n outputs, labeled from 0 to 2 n-1
- 1 enable.
- When enabled, just the output labeled 2 j is
active, where j is the value present on the data
input. - When disabled, no output is active.
21Decoder (contd)
Symbol
DOUT(0)
DOUT(1)
DOUT(2)
DIN(n-1 downto 0)
DOUT(2n-1)
ENABLE
22Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
23Priority Encoder
- A priority encoder has
- 2k inputs, labeled from 0 to 2k-1 (each input is
assigned a fixed priority) - k outputs
- 1 data valid output
- 1 enable.
24Priority Encoder (contd)
- When enabled
- the outputs get the value j , where j is the
label of the highest priority asserted input - the data valid output is asserted.
- When disabled or when no input is asserted
- the data valid output is not asserted.
25Priority Encoder (contd)
Symbol
M0
VALID
M1
M2
CODE(n-1 downto 0)
M2n-1
ENABLE
26Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
27Comparator
- A comparator gets 2 n-bit binary numbers
- A(n-1 downto 0)
- B(n-1 downto 0)
- and provides in output the result of the
comparison between A and B. - A control input UM/2C specifies whether the
input operands are unsigned or signed,
respectively.
28Comparator (contd)
Symbol
AeqB AneB AltB AgtB AleB AgeB
A
A(n-1 downto 0)
B
B(n-1 downto 0)
UM/2C
Sel
29Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
30Counter of 1s occurrences
- A counter of 1s occurrences has
- 1 n-bit data input
- 1 m-bit data output, being m ? log2 n ?.
- The device counts the number of occurrences of a
1 on its inputs and provides it on its outputs.
31Counter of 1s occurrences(contd)
Symbol
1s C
DIN(n-1 downto 0)
DOUT(m-1 downto 0)
32Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
33ROM
- A 2k ? n ROM (Read-Only Memory) has
- k address inputs
- n data outputs
- 2k n-bit internal cells, storing permanent
values. - The outputs gets the value stored in the j cell,
j being the current value present on address
inputs.
34ROM (contd)
Symbol
D_OUT
DATA(n-1 downto 0)
ADDR
ADDR(2k-1 downto 0)
35Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
36ALU
- An n-bit ALU (Arithmetic Logic Unit) performs
logic and/or arithmetic operations on 2 n-bit
operands, under the control of ad-hoc control
signals.
37ALU (contd)
Symbol
CONTROL
C_IN
A(n-1 downto 0)
FUNC(n-1 downto 0)
B(n-1 downto 0)
STATUS
C_OUT
38Functions implemented by the ALU 181
Input
Functions
S3
S2
S1
S0
arithmetic (M0)
logic (M1)
0
0
0
0
FA minus 1 plus CIN
FA'
0
0
0
1
FAB minus 1 plus CIN
FA' B'
0
0
1
0
FAB' minus 1 plus CIN
FA' B
0
0
1
1
F1111 plus CIN
F 1111
0
1
0
0
FA plus (AB') plus CIN
FA'B'
0
1
0
1
FAB plus (AB') plus CIN
FB'
FA ? B'
0
1
1
0
FA minus B minus 1 plus CIN
0
1
1
1
FAB' plus CIN
FAB'
1
0
0
0
FA plus (AB) plus CIN
FA'B
FA ? B
1
0
0
1
FA plus B plus CIN
1
0
1
0
FAB' plus (AB) plus CIN
FB
1
0
1
1
FAB plus CIN
FAB
1
1
0
0
FA plus A plus CIN
F0000
1
1
0
1
FAB plus A plus CIN
FAB'
1
1
1
0
FAB' plus A plus CIN
FAB
1
1
1
1
FA plus CIN
FA
39Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
40Multiplier
- A multiplier has
- 1 n-bits data inputs, labeled from n-1 to 0
- 1 m-bits data inputs, labeled from m-1 to 0
- no control signals
- k-bits data outputs, labeled from k-1 to 0
- and provides in output the results of the product
between the two input operands.
41Multiplier (contd)
Symbol
A(m-1 downto 0)
MUL_OUT(k-1 downto 0)
B(n-1 downto 0)
42Multiplier (contd)
Symbol
- Signed operands kmn-1
- Unsigned operands kmn
A(m-1 downto 0)
MUL_OUT(k-1 downto 0)
B(n-1 downto 0)
43Elementary functional blocks
Multiplier
Multiplexer
Adder-Subtracter
Decoder
Encoder
ALU
Comparator
ROM
I/O interfaces
1s counter
44I/O interfaces
- The combinational interfaces for the following
I/O devices will be presented - led bar driver
- 7-segments display
- dip-switch
- keypad.
45Led bar interface
LED_BAR interface
DATA(n-1 downto 0)
n
467-segments display interface
DATA
DISPLAYinterface
4, 7
DOT
ENABLE
477-segments display interface
a
a
a
b
BI
f
b
b
g
A
c
c
d
d
B
e
e
C
f
f
c
e
D
g
g
DOT
d
ENABLE
48Dip-switch interface
DIP_SWinterface
DATA
n
n
49Keypad interface
KEYPADinterface
DATA
4, 7
DATA_VALID
50(No Transcript)