UNIT-3 - Arithmetic Logic Circuit
UNIT-3 - Arithmetic Logic Circuit
REPRESENTING SIGNED
NUMBERS
1’s-Complement Form
Sign Extension
To store 5-bit negative numbers in an 8 bit
register, 2’s- complement binary
representation for -9 is 1 0111
Negation
Start with 00001001 +9 2’s complement
(negate) 11110111 ₋9 negate again 00001001
+9
Thus, we negate a signed binary number
by 2’s complementing it.
(6.2) Tocci; Each of the following numbers
is a five bit signed binary number in the
2’s-complement system. Determine the
decimal value in each case: (a) 01100 (b)
11010 (c)10001 P-303 Tocci
Special Case in 2’s-Complmnt
Representation Whenever a signed number has a 1
in the sign bit and all 0s for the magnitude bits, its
decimal equivalent is ₋2N, where N is the number of
bits in magnitude, e.g.,
N
1000 = ₋2 -8
N
10000 = ₋2 -16
100000 = ₋2N -32
Complete range of values that can be represented in
2’s-complement system having N magnitude bits is-
N N
₋2 to + (2 - 1)
N+1
There are a total of different 2 values, including
zero
For example, Table 6-1 lists all signed numbers that
can be represented in four bits using the 2’s
complement system (note there are three magnitude
N
bits, so N = 3 ). Note that the sequence starts at ₋2 =
to
6.4 Tocci; What is the range of signed decimal values
that can be represented in a byte?
ADDITION IN 2’s-COMPLEMENT
SYSTEM Case I: Two Positive Numbers.
The addition of two positive numbers is
straightforward. Consider the addition of +9
and +4
Case II: +ve Number and Smaller –ve number
Consider the addition of +9 and -4. Remember that the
-4 will be in its 2’s-complement form. Thus, +4
(00100) must be converted to -4 (11100).
The result is 00101 = (sum +5).
Case III: +ve Number & Larger -ve
Number. Consider the addition of -9 and +4
Sum has a sign bit of 1, indicating a negative number.
Because sum is negative, it is in 2’s-complement form
Case IV: Two Negative
Numbers
Result
is 00000 (sum = + 0)The result is obviously +0, as
expected
SUBTRACTION IN 2’s-COMPLEMENT SYSTM
Subtraction opn using 2’s-complement system actually
involves the operation of addition and is really no
different from the various cases for addition. In
subtracting one binary number (subtrahend) from another
binary number (minuend), use the procedure: 1. Negate
the subtrahend. This will change the subtrahend to its
equivalent value of opposite sign. 2. Add this to the
minuend. Result of this addition will represent difference
between subtrahend and minuend
Consider case where +4 is to be subtracted
from +9
(a) +9 – (-4);
(b) -9 – (+4)
(c) -9 – (-4)
(d) +4 – (-4)
Remember that when the result has a sign bit of 1, it is
negative and in 2’s-complement form.
MULTIPLICATION OF BINARY NUMBERS
Multiplication in 2’s-Complement
System
BINARY DIVISION
BCD ADDITION
Sum Equals 9 or Less; Consider adding 5 and 4
using BCD to represent each digit
simplified map
using K
K map for as from
algebraic
Cout
method.
gives same Pg-322 Tocci
expression
Pg-322 Tocci
Cout
Block symbol for 74HC283 four-bit parallel
adder;
Cascading two 74HC283s
Parallel adder used to add and subtract numbers
in2’s-complement system.
Subtracting +6
from +4 in 2’s
complement system
BINARY ADDER-SUBTRACTOR
Half Adder
Pg-134 Mano
FULL ADDER
Carry Propagation
,,
an assertion of Ci +1)
C1 = G0 + P0C0
C2 = G1 + P1C1 = G1 + P1(G0 + P0C0)
C2 = G1 + P1G0 + P1P0C0 Similarly
C3 = G2 + P2C2 = G2 + P2G1 + P2P1G0 + P2P1P0C0
C4 = G3 + P3C3 Hence,
C4 = G3 + P3G2 + P3P2G1 + P3P2P1G0 + P3P2P1P0C0
Carry
Lookahea
d
Generator
4-bit Adder
With Carry
Lookahead
Binary Multiplier
Binary Multiplier
4-bit by 3-bit Binary Multiplier
B3 B2 B1 B0
A2 A1 A0
------------------------------------------------------------------------------
- A0B3 A0B2 A0B1 A0B0
A1B3 A1B2 A1B1 A1B0
A1B3 A1B2 A1B1 A1B0
--------------------------------------------------------------------------------------
- C6 C5 C4 C3 C2 C1 C0
--------------------------------------------------------------------------------------
-
4-bit by Multipli
3-bit er 3
10
32
0
Binary 2
Adder A
1
CA4
(Carry)
ΣA1 ΣA3 ΣA2 ΣA0
CA4ΣA3 ΣA2
ΣA1
3 2 rB 3 0
1
Adde 0 21
ΣB2 ΣB1 ΣB0 ΣB3
ΣA0
Carry CB4
4-bit adder–
subtractor
with
overflow
detection
Truth Table
For M = 0 X=B 1=
X = B 0 = B B′
For M = of X-OR gate M
1
BCD
Adde
r
C=K
+
Z8Z4 +
Z8Z2
Block diagram
of a BCD
adder
Magnitude Comparator
A magnitude comparator is a combinational circuit
that compares two numbers A and B and determines
their relative magnitudes. The outcome of the
comparison is specified by three binary variables that
indicate whether A > B, A = B, or A < B.
A comparator circuit possesses an inherent well
defined regularity can be designed by means of an
algorithm—a procedure which specifies a finite set of
steps that, if followed, give solution to a problem. We
illustrate this method here by deriving an algorithm for
design of a four-bit magnitude comparator. Algorithm
is a direct application of the procedure a person uses to
compare the relative magnitudes of two numbers.
Consider two numbers, A and B, with 4 digits each A
= A 3 A2 A1 A0
B = B3 B2 B1 B0
Each subscripted letter represents one of digits in no.
Two numbers are equal if all pairs of significant digits
are equal: A 3 = B3, A 2 = B2, A 1 = B1, and A 0 = B0
When the numbers are binary, the digits are either 1 or
0, and equality of each pair of bits can be expressed
logically with an exclusive-NOR function as xi = A iBi
+ A i′Bi′ for i = 0, 1, 2, 3
xi = 1 only if the pair of bits in position i are equal
(i.e., if both are 1 or both are 0).
(A = B) = x3x2x1x0
The binary variable (A = B) is equal to 1 only if all
pairs of digits of the two numbers are equal For (A >
B)