You are on page 1of 29

Digital Logic Design

ECE2002

Dr. Anirban Bhowmick


Assistant Professor
VIT Bhopal
Lecture : 4
Module 1: Digital Logic
Design Fundamentals
Number Systems: Positional number systems,
Number base conversions between binary, octal
, decimal and hexadecimal numbers –
Unsigned and Signed binary number systems.
Boolean Algebra: Basic definitions, theorems
and properties of Boolean Algebra - Boolean
functions – canonical and standard forms –
Digital logic gates – Introduction to digital
logic families (RTL , TTL,ECL and CML)
Software Required:
1. Multisim
2. VHDL Simulator (Xilinx/Quartus/ModelSim)
3. Proteus
4. MATLAB
Unit:1
Digital Logic
Design
Fundamentals

Topic: Complements
Complements of Numbers
• We take complement to represent negative number because the computer cannot
perform subtraction directly
• We can perform (r-1)’s complement or r’s complement to represent the negative
number, where r=radix is base of the number system (e.g : 10 for decimal , 8 for
octal, 16 for hexadecimal and 2 for binary)
(r-1)’s complement

Given a number N in base r having n digits, the (r-1)’s


complement of N, i.e , its diminished radix complement, is
defined as (-1)-N

•Calculate :
•9’s complement of 546700, 12398
•1’s complement of 1011000, 0101101
r’s complement

The r’s complement of an n-digit number N in base r is


defined as -N
•Calculate :
•10’s complement of 546700
•2’s complement of 0101101
Complement Arithmetic rules
• In r’s complement subtraction:
1. Equate the number of digits if the two numbers are not equal
2. If the result needs an extra digit then equate the digits as per the digits present in
result (In binary operation generally the size of register will be given, In other
number system operation as we are not converting them to binary register size is
irrelevant )
3. Represent negative number in r’s complement.
4. Add both the numbers
5. If the result is positive then it will generate a carry and the carry will be ignored
6. If the result is negative then it will not generate a carry (If it generates ignore also),
we will take the r’s complement again of the result to get the result and you will put
a negative sign.
Complement Arithmetic rules
In (r-1)’s complement subtraction:
1. Equate the number of digits if the two numbers are not equal.
2. If the result needs an extra digit then equate the digits as per the digits present
in result (In binary operation generally the size of register will be given, In other
number system operation as we are not converting them to binary register size is
irrelevant )
3. Represent negative number in (r-1)’s complement
4. Add both the numbers
5. If the result is positive then it will generate a carry and the carry will be added to
the least significant bit (LSB).
6. If the result is negative then it will generate a carry and the carry will be added to
the least significant bit (LSB). we will take the (r-1)’s complement again of the
result to get the result and you will put a negative sign.
Subtraction with Complement
Compute (M-N)
M=72532, N=3250
by 10’s complement & 9’s Complement
9’s complement method:
Step 1: Equate the number of digits if the two numbers are not equal
3250 => 03250
9’s Complement of 03250 = 99999-03250 = 96749
Step 2: Add both the number
72532
+96749
169281
+ 1
69282
Subtraction with Complement
10’s complement method:

Step 1: Equate the number of digits if the two numbers are not equal
3250 => 03250
10’s Complement of 03250 = 99999-03250 = 96749+1=96750
Step 2: Add both the number
72532
+96750
169282 Step 3: Ignore carry

Ans : 69282
Subtraction with Complement
Compute (M-N)
N=72532, M=3250
by 10’s complement & 9’s Complement
9’s complement method:
Step 1: Equate the number of digits if the two numbers are not equal
9’s Complement of 72532 = 99999-72532 = 27467
Step 2: Add both the number
03250
+27467
30717 Step 3: No carry do the 9’s complement of the result and put negative
sign
9’s Complement of 30717 = 99999-30717 = 69282
Ans : -69282
Subtraction with Complement
Compute (M-N)
N=72532, M=3250
by 10’s complement & 9’s Complement
10’s complement method:
Step 1: Equate the number of digits if the two numbers are not equal
10’s Complement of 72532 = 99999-72532 = 27467+1 = 27468
Step 2: Add both the number
03250
+27468
30718 Step 3: No carry do the 10’s complement of the result and put negative
sign
10’s Complement of 30718 = 99999-30718 = 69281+1=69282
Ans : -69282
For both positive
Binary Number System and Negative
Numbers
Only for positive Binary Number
System Signed Number
Numbers
Representation
Unsigned Number
Representation
Sign Magnitude Form 2’s Complement Form
1’s Complement Form
Unsigned numbers are by definition
positive numbers and thus do not
require an arithmetic sign. An 𝒏-bit Signed numbers, on the other hand, require an
unsigned number represents all arithmetic sign. The most significant bit of a binary
numbers in the range 0 to 𝟐^𝒏−𝟏. EX: number is used to represent the sign bit. If the sign bit
The range of 8 bit unsigned binary is equal to zero, the signed binary number is positive;
numbers is from 0 to 255 in decimal, otherwise, it is negative. The remaining bits represent
00 to FF in hexadecimal. the actual number.
If an bit binary number is signed the leftmost bit is
used to represent the sign leaving bits to represent the
number.
Sign Magnitude Form
In this approach, a number's sign is represented with a sign bit: setting that bit (often the most significant bit) to 0
for a positive number or positive zero, and setting it to 1 for a negative number or negative zero. The remaining
bits in the number indicate the magnitude (or absolute value).

Ex:
(+3) = 0011 (-3) = 1011
(+7) = 0111 (-7) = 1111
(+0) = 0000 (-0) = 1000
1’s Complement Form 1‘s
The ones' complement form of a negative binary Binary Unsigned
value complement interpretation
number is the bitwise NOT applied to it, i.e. the interpretation
"complement" of its positive counterpart. 00000000 +0 0
00000001 1 1
1‘s complement also has two representations of 0:
⋮ ⋮ ⋮
00000000 (+0) and 11111111 (−0) 01111101 125 125
The range of signed numbers using ones' complement 01111110 126 126
is represented by to and . 01111111 127 127
10000000 −127 128
A conventional 8-bit byte is to with zero being either 10000001 −126 129
or .
10000010 −125 130
⋮ ⋮ ⋮
11111101 −2 253
11111110 −1 254
11111111 −0 255

Ex: Express in 8-bit 1’s Complement Form.


2’s Complement Form Binary 2‘s complement Unsigned
The 2’s complement form of a negative binary number is the value interpretation interpretation
bitwise NOT applied to all the bits and then adding one to that
result.. 00000000 0 0
2‘s complement has unique 0 representation: 00000001 1 1
00000000. ⋮ ⋮ ⋮
The range of signed numbers using ones' complement is 01111110 126 126
represented by .
01111111 127 127
A conventional 8-bit byte is to with unique 0 representation.
10000000 −128 128
10000001 −127 129
10000010 −126 130
⋮ ⋮ ⋮
11111110 −2 254
11111111 −1 255
Ex: Express in 8-bit 2’s Complement Form.
Representation Comparison
Subtraction with 1’s Complement
1. Write down 1’s complement of the subtrahend.
2. Add this with the minuend.
3. If the result of addition has a carry over then it is dropped and an 1 is
added in the last bit.
4. If there is no carry over, then 1’s complement of the result of addition
is obtained to get the final result and it is negative.
Evaluate:(i) 110101 – 100101 Evaluate:(ii) 1011.001 – 110.10
Subtraction with 2’s Complement
1. At first, 2’s complement of the subtrahend is found.
2. Then it is added to the minuend.
3. If the final carry over of the sum is 1, it is dropped and the result is positive.
4. If there is no carry over, the two’s complement of the sum will be the result and it is
negative.
Evaluate:(i) 10110 – 11010 Evaluate:(ii) 1010.11 – 1001.01
Solution
Add (-25) to (-18) in 1’s complement with 8 bit register

ECE2002-Dr.Anirban Bhowmick
Binary Signed Arithmetic
Add (-25) to (-18) in 2’s and 1’s complement with 8 bit register
Solution:

1’s complement:
As this is signed binary number, we will use 0 to represent positive and 1 to
represent
negative in sign bit.
In 1’s complement arithmetic, we will represent negative number in 1’s
complement
form
sign magnitude representation in 8 bit = 1 0011001 Sign Magnitude
in 1’s complement = 11100110 (fix sign bit and flip magnitude bit)
sign magnitude representation in 8 bit = 1 0010010 Sign Magnitude
in 1’s complement = 11101101 (fix sign bit and flip magnitude bit)
Binary Signed Arithmetic
Add both the number = 11100110
11101101
----------------
111010011 Add carry to
+ 1 LSB
-----------------
11010100

Result is negative so we will take 1’s complement of the result to find the magnitude and put a
negative sign

1’s complement of the magnitude = 0101011 = 43


Final answer = -43
Solution
Add (-25) to (-18) in 2’s complement with 8 bit register

ECE2002-Dr.Anirban Bhowmick
Binary Signed Arithmetic
Add (-25) to (-18) in 2’s and 1’s complement with 8 bit register
Solution:

2’s complement:
As this is signed binary number, we will use 0 to represent positive and 1 to
represent
negative in sign bit.
In 2’s complement arithmetic, we will represent negative number in 2’s
complement
form
sign magnitude representation in 8 bit = 1 0011001 Sign Magnitude
in 2’s complement = 11100111 (fix sign bit and flip magnitude bit and add 1)
sign magnitude representation in 8 bit = 1 0010010 Sign Magnitude
in 1’s complement = 11101110 (fix sign bit and flip magnitude bit and add 1)
Binary Signed Arithmetic
Add both the number = 11100111
11101110
----------------
111010101 Ignore carry
-----------------
11010101

Result is negative so we will take 2’s complement of the result to find the magnitude and put a
negative sign

2’s complement of the magnitude = 0101011 = 43


Final answer = -43
Example
Add -45.75 to +87.5 using the 12 bit 2’s complement

You might also like