Upload
lydung
View
222
Download
4
Embed Size (px)
Citation preview
2
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 3
You Must be able to do the Following:
• Form the two's complement of a hexadecimal integer• Convert signed binary to decimal• Convert signed decimal to binary• Convert signed decimal to hexadecimal• Convert signed hexadecimal to decimal
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 4
Signed Integers• The highest bit indicates the sign. 1 = negative,
0 = positive
1 1 1 1 0 1 1 0
0 0 0 0 1 0 1 0
sign bit
Negative
Positive
If the highest digit of a hexadecmal integer is > 7, the value is negative. Examples: 8A, C5, A2, 9D
3
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 5
Forming the Two's Complement• Negative numbers are stored in two's complement notation• Additive Inverse of any binary integer• Steps:
– Complement (reverse) each bit– Add 1
Note that 00000001 + 11111111 = 00000000
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 6
Ranges of Signed Integers
The most significant bit (MSB) is reserved for the sign. This limits the range:
What is the largest positive value that may be stored in 20 bits?
4
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 7
Adder• Signed Binary Numbers
– Conversion between signed binary and decimal• Performs the function of Binary Addition
– MSI Chip • Uses XOR for SUM• Two types
– Half Adder– Full Adder
• Performs Subtraction using 2’s Compliment Addition
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 8
1-Bit Half Adder
5
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 9
1-Bit Full Adder from 2 Half Adders
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 10
Logic Diagram for 1-Bit Full Adder
6
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 11
2-Bit Full Adder
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 12
Truth Table for 2-Bit Full Adder
7
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 13
Logic Diagram for 2-Bit Full Adder
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 14
4-Bit Full Adder
P3P2P1P0Q3Q2Q1Q0
C0Σ3Σ2Σ1Σ0
8
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 15
4-Bit Full Adder
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 16
8-Bit Parallel Adder
9
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 17
Full Adder with Look Ahead Carry
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 18
Carry Propagate and Generate Illustration
10
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 19
Carry Propagate and Generate Logic
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 20
4-Bit Full Adder
11
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 21
4 Stage Look Ahead Adder
Magnitude Comparators
ENGI 251ELEC 241
12
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 23
Magnitude Comparator• Logic behavior similar to Adder
– Does not return Sum or Carry, but whether one value is larger, smaller, or equal
– Uses XOR• Returns result of comparison of two quantities stating
– Px < Qx– Px = Qx– Px > Qx
• Can return either one or all• Usually MSI
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 24
Magnitude Comparator
13
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 25
2-Bit Magnitude Comparator
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 26
Example
14
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 27
4-Bit Magnitude Comparator
ENGI 251/ELEC 241 Multibit Adder/Comparator Design 28
Logic Symbol for 4-Bit Magnitude Comparator