2. Arithmetic Competencies
18. Given an 8-bit binary signed number, state whether the number is
positive or negative with 100% accuracy.
19. Given an 8-bit binary number, state the 1’s compliment of that number
with 100% accuracy.
20. Given an 8-bit signed binary number, state the 2’s compliment of the
number with 100% accuracy.
21. Given 2 decimal numbers, use two’s complement and show the steps to solve
for the sum, and show the sum in binary and decimal with 100% accuracy.
22. Given 2 decimal numbers, use two’s complement and show the steps involved
to solve for the difference, and show the difference in binary and decimal with
100% accuracy.
37. Without reference the student will explain the difference between a half
adder and a full adder with 100% accuracy.
38. Without reference the student will draw a schematic showing how an
eight-bit adder can be made using two four bit adders with 100% accuracy.
3. Binary Addition
•In decimal, when we add two numbers and they
exceed the place value of a digit, we carry over.
1
9
10
+ 3 10
12 10
•The same thing works in binary
1
12
+ 12
10 2
4. Binary Addition
The four possible combinations of adding two binary
numbers can be stated as follows:
0
0
+
+
0
1
=
=
0
1
carry
carry
0
0
1
+
0
=
1
carry
0
1
+
1
=
0
carry
1
6. TEST
Perform the following decimal additions.
Convert the original decimal numbers to
binary and add them.
(A) 5 + 2
(B) 8 + 3
(C) 18 + 2
(D) 147 +75
(E) 31 + 7
We represent all binary
numbers in groups of 8
because it’s the standard for
most computers.
5
+ 2
0
+ 0
0
0
0
0
0
0
0
0
1
0
0
1
1
0
7
0
0
0
0
0
1
1
1
=
7
10
7. Two’s Complement Representation
The most widely used method of representing binary numbers
and performing arithmetic in computer systems.
Both positive and negative numbers can be represented in
the same format and binary subtraction is greatly
simplified.
Two’s complement uses the most significant bit (MSB) of the 8bit number to signify whether the number is positive or
negative.
The MSB called the sign bit and is defined as 0 for positive
numbers and 1 for negative numbers.
D7 D6 D5 D4 D3 D2 D1D0
SIGN BIT
8. Two’s Complement Representation
A table of two’s-complement numbers can be developed by
starting with some positive number and continuously subtracting
1
9. STEPS FOR
DECIMAL-TO-TWO’S-COMPLEMENT CONVERSION
1. If the decimal number is positive, the two’s-complement
number
is the true binary equivalent of the decimal number.
+18 = 0001 0010
2. If the decimal number is negative, the two’s-complement
number
is found by:
the
(a)
Complementing each bit of the true binary equivalent of
decimal number ( one’s complement ).
(b) Adding 1 to the one’s complement number to get the
magnitude bits. The sign bit will always be 1.
12. STEPS FOR
TWO’S-COMPLEMENT-TO-DECIMAL CONVERSION
1. If the two’s-complement number is positive (SIGN BIT = 0), do
a
regular binary-to-decimal conversion.
2. If the two’s-complement number is negative (SIGN BIT = 1), the
decimal sign will be minus and the decimal number is found by:
bit.
(A)
Complementing the entire two’s complement number, bit by
(B)
Adding 1 to arrive at the true binary equivalent.
(C) Doing a regular binary-to-decimal conversion.
13. STEPS FOR
TWO’S-COMPLEMENT-TO-DECIMAL CONVERSION
EXAMPLE
Convert 1101 1101 two’s complement back to decimal.
SOLUTION: The sign bit is 1 so decimal result will be
negative.
Two’s complement = 1101 1101
Complement
= 0010 0010
Add 1
True binary
+1
= 0010 0011
Decimal equivalent = -35 Answer
14. Two’s Complement Arithmetic
•All basic arithmetic functions involving positive and negative
numbers can be dealt with simply by using 2’s complement.
•Subtraction is done by adding the 2’s complement
numbers.
•Adding in 2’s complement, do regular binary addition.
•Subtraction 2’s complement numbers, convert the number
to be subtracted to a negative 2’s complement number and
perform regular binary addition (5 - 3 = 5 + (-3). If the
result is negative, the sign bit will be a 1.
19. HALF ADDER
• Logic device that adds two binary numbers
• Only adds Least Significant Digit (LSD) column
(1s column) in binary addition
Input
Logic
Symbol:
Logic
Diagram:
A
B
Output
Half
Adder
Σ (sum)
C0 (carry out)
20. FULL ADDER
Used for adding binary place values other than the 1s place
Input
Logic
Symbol:
Logic
Diagram:
Cin
A
B
Output
Full
Adder
Σ (sum)
C0 (carry out)
21. FULL ADDER
FULL ADDER
A
B
C IN
SUM
0
0
0
0
0
1
0
1
C OUT
0
0
0
0
1
1
0
1
1
0
0
1
1
1
0
0
1
1
0
0
1
1
1
1
0
1
0
1
1
1
0
1
C OUT
A
B
C IN
SUM
22. PARALLEL ADDING
• Use half adder for LSD
• Use full adder for other digits
A2 A1 A0
+ B2 B1
B0
26. WHAT IS THIS ?
B
A
0
0
4321
4321
B4
B3
B2
B1
74LS83A
A4
A3
A2
A1
s4
B4
s3
B3
s2
B2
s1
B1
Cin
Cout
A
0
0
1
1
B
0
1
0
1
out
0
1
1
0
27. TEST
19. Given an 8-bit signed number state whether the number is
positive or negative.
1001 1111
negative
20. Given an 8-bit signed number state the one’s
complement of the number.
1001 1111
0110 0000
21. Given an 8-bit signed number state the two’s complement of
the number.
1001 1111
0110 0000
+1
0110 0001
28. TEST
22. Given two decimal numbers, use two’s complement form and
show the steps to solve for the sum, and show the sum in binary
and decimal.
100
0110 0100
26
0001 1010
+
0111 1110 = 126
23. Given two decimal numbers, use two’s complement form and
show the steps to solve for the difference, and show the
difference in binary and decimal.
-
78
32
0010 0000
0100 1110
1101 1111
1110 0000
+1
1110 0000
0010 1110 = 46