Escolar Documentos
Profissional Documentos
Cultura Documentos
1-1
1.1.2 Positive and Negative Logic
In digital systems there are two states – one for representing value ‘1’ and
other for representing value ‘0’ (as a binary variable can have value either 0 or
1). These states are represented by two different voltage levels (or sometimes
current levels).
If logic state ‘1’ is represented by a higher voltage level (or current level)
and logic state ‘0’ is represented by a lower voltage level (or current level), it is
called as positive logic system. E.g. If 0V and +5V are the two voltage levels
and +5V is used for representing ‘1’ and 0V is used for representing ‘0’, this is a
positive logic system.
5V
HIGH
3.5 V
1V
LOW
0V
Figure 1.3: Positive Logic
If logic state ‘0’ is represented by a higher voltage level (or current level)
and logic state ‘1’ is represented by a lower voltage level (or current level), it is
called as negative logic system. E.g. If 0V and +5V are the two voltage levels
and +5V is used for representing ‘0’ and 0V is used for representing ‘1’, this is a
negative logic system.
5V
LOW
3.5 V
1V
HIGH
0V
Figure 1.4: Negative Logic
1-3
- Noise immunity
- Power supply requirements
- Operating temperature
1.2.1.6 Fan–in
Fan–in is the number of inputs to a gate. For a two-input gate, fan–in is 2
and for a 3-input gate, fan–in is 3 and so on.
1-5
Unwanted signal is called as noise. Stray electric or magnetic fields may
induce noise in the input to the digital circuits. Due to noise, input voltage may
drop below VIH or may rise above VIL. Both the circumstances will result in
undesired operations of the digital circuit.
Every circuit should have ability to tolerate the noise signal. This ability
of tolerating noise signal is called as noise immunity. Measure of noise
immunity is called as noise margin. The noise margin at logic ‘1’ state and
logic ‘0’ state are computed as,
Logic ‘1’ state noise margin: ∆1 = 𝑉𝑂𝐻 − 𝑉𝐼𝐻
Logic ‘0’ state noise margin: ∆0 = 𝑉𝑂𝐿 − 𝑉𝐼𝐿
1-6
Logic Families
Bi-MOS Logic
Bipolar Families MOS Families
Family
Resistor
Diode Logic (DL) Transistor Logic PMOS Family NMOS Family
(RTL)
Transistor
Diode Transistor
Transistor CMOS Family
Logic (DTL)
Logic (TTL)
Emitter Integrated
Coupled Logic Injection Logic
(ECL) (I2L)
1-8
VIL (buffered devices) =1.5V (for VDD =5V)
=3.0V (for VDD = 10V)
=4.0V (for VDD = 15V)
VIL (unbuffered devices) =1.0V (for VDD =5V)
=2.0V (for VDD = 10V)
=2.5V (for VDD =15V)
VOH =4.95V (for VDD =5V)
=9.95V (for VDD =10V)
=14.95V (for VDD =15V)
VOL=0.05V
VDD =3– 15V
propagation delay (buffered devices) =150ns (for VDD =5V)
=65ns (for VDD =10V)
=50ns (for VDD =15V)
propagation delay (unbuffered devices) =60ns (for VDD =5V)
=30ns (for VDD =10V)
=25ns (for VDD =15V)
noise margin (buffered devices) =1.0V (for VDD =5V)
=2.0V (for VDD =10V)
=2.5V (for VDD = 15V)
noise margin (unbuffered devices) =0.5V (for VDD =5V)
=1.0V(for VDD =10V)
=1.5V(for VDD =15V)
Output transition time (for VDD =5Vand CL=50pF)
=100ns (buffered devices)
=50–100ns (for unbuffered devices)
power dissipation per gate (for f =100kHz)=0.1mW
speed–power product (for f =100kHz)=5pJ
Number system is one of the most important and basic topic in digital
electronics. It is important to understand a number system as it helps in
understanding how data is represented before processing it in digital system.
Important characteristics of number systems are:
- Independent digits used (radix or base).
- Place value of different digits.
- Maximum numbers that can be represented using given number of
digits.
1-9
Where,
N → A number
b → Base or radix of the number system
n → Number of digits in Integer part
m → Number of digits in Fractional part
𝑑𝑛−1 → Most Significant Digit (MSD)
𝑑−𝑚 → Least Significant Digit (LSD)
Each digit (i.e. 𝑑𝑖 and 𝑑−𝑓 ) must be within the range from 0 to b–1
including the boundaries.
Example 1:
(6251)8 = 6 × 83 + 2 × 82 + 5 × 81 + 1 × 80
6 × 512 + 2 × 64 + 5 × 8 + 1 × 1
3072 + 128 + 40 + 1
(3241)10
Example 2:
(37.40)8 = 3 × 81 + 7 × 80 + 4 × 8−1 + 0 × 8−2
3 × 8 + 7 × 1 + 4 × 0.125 + 0 × 0.0625
24 + 7 + 0.5 + 0
1-13
(31.5)10
1-14
2 4 1
2 2 0
2 1 0
-- 0 1
(293)10 = (100100101)2
Converting the fractional part (0.52)10 :
Fraction Multiplier Result Carry
.52 2 .04 1
.04 2 .08 0
.08 2 .16 0
.16 2 .32 0
.32 2 .64 0
.64 2 .28 1
.28 2 .56 0
.56 2 .12 1
. .
. .
. .
(0.52)10 = (. 10000101)2
Therefore,
(293.52)10 = (100100101.10000101)2
Example 2:
(63.25)10 = (? )2
As a first step, the number should be separated in integer part and
fractional parts as,
(63.25)10 = (63)10 + (0.25)10
Converting the integer part (63)10 :
Divisor Dividend Remainder
2 63 --
2 31 1
2 15 1
2 7 1
2 3 1
2 1 1
-- 0 1
(63)10 = (111111)2
Converting the fractional part (0.25)10 :
Fraction Multiplier Result Carry
.25 2 .5 0
.5 2 .0 1
(0.25)10 = (. 01)2
Therefore,
1-15
(63.25)10 = (111111.01)2
(293)10 = (445)2
Converting the fractional part (0.52)10 :
Fraction Multiplier Result Carry
.52 8 .16 4
.16 8 .28 1
.28 8 .24 2
.24 8 .92 1
.92 8 .36 7
.36 8 .88 2
.88 8 .04 7
.04 8 .32 0
. .
. .
(0.52)10 = (. 41217270)2
Therefore,
(293.52)10 = (445.41217270)2
Example 2:
(63.25)10 = (? )8
1-16
As a first step, the number should be separated in integer part and
fractional parts as,
(63.25)10 = (63)10 + (0.25)10
Converting the integer part (63)10 :
Divisor Dividend Remainder
8 63 --
8 7 7
-- 0 7
(63)10 = (77)8
Converting the fractional part (0.25)10 :
Fraction Multiplier Result Carry
.25 8 .0 2
(0.25)10 = (. 2)8
Therefore,
(63.25)10 = (77.2)8
(293)10 = (125)16
Converting the fractional part (0.52)10 :
Fraction Multiplier Result Carry
.52 16 .32 8
.32 16 .12 5
.12 16 .92 1
.92 16 .72 14(E)
.72 16 .52 11(B)
.52 16 .32 8
.32 16 .12 5
Results will be repeated
(0.52)10 = (. 851𝐸𝐵)16
Therefore,
(293.52)10 = (125.851𝐸𝐵)16
Example 2:
(63.25)10 = (? )16
As a first step, the number should be separated in integer part and
fractional parts as,
(63.25)10 = (63)10 + (0.25)10
Converting the integer part (63)10 :
Divisor Dividend Remainder
16 63 --
16 3 15(F)
-- 0 3
(63)10 = (3𝐹)16
Converting the fractional part (0.25)10 :
Fraction Multiplier Result Carry
.25 16 .0 4
(0.25)10 = (. 4)16
Therefore,
(63.25)10 = (3𝐹. 4)16
1-19
The binary number is split into groups of three bits from binary point.
11 010 . 01
Here the first group and the last group
are incomplete. For completing them 0’s are added on left side of first group and
on right side of last group.
011 010 . 010
Then octal equivalent of each group
of bits is written.
011 010 . 010
3 2 . 2
Therefore, (11010.01)2 = (32.2)8
Example 2:
(𝐸𝐵. 25)16 = (? )2
1-20
Each hexadecimal digit is replaced by its four-bit binary equivalent.
E B . 2 5
Therefore, 1110 1011 . 0010 0101 (𝐸𝐵. 25)16 =
(11101011.00100101)2
For converting a binary number into hexadecimal number both the
integer part and the fractional part of the binary number are split into groups of
four bits starting from radix point (in binary number system it may be called as
binary point). If the outermost groups are not complete (i.e. of four bits), then
sufficient number of 0’s are added to make them complete (on left side of
leftmost group and on right side of rightmost group). Then each group is
replaced by its octal equivalent as shown in table 1.3.
Example 1:
(100101101.01011)2 = (? )16
The binary number is split into groups of four bits from binary point.
1 0010 1101 . 0101 1
Here the first group and the
last group are incomplete. For completing them 0’s are added on left side of first
group and on right side of last group.
0001 0010 1101 . 0101 1000
Then hexadecimal
equivalent of each group of bits is written.
0001 0010 1101 . 0101 1000
1 2 D . 5 8
Therefore,
(100101101.01011)2 = (12𝐷. 58)16
Example 2:
(11010.01)2 = (? )16
The binary number is split into groups of four bits from binary point.
1 1010 . 01
Here the first group and the last group
are incomplete. For completing them 0’s are added on left side of first group and
on right side of last group.
0001 1010 . 0100
Then octal equivalent of each group
of bits is written.
0001 1010 . 0100
1 A . 4
Therefore, (11010.01)2 = (1𝐴. 4)16
1-22
10 1110 . 0000 11
0010 1110 . 0000 1100
2 E . 0 C
1-23
In this representation, positive decimal numbers are represented same as
that of sign-bit magnitude method. But negative numbers are represented in a
different way.
For representing negative numbers, following steps are performed.
1. Represent the number with positive sign.
2. Find its 1’s complement. (By replacing each ‘0’ with ‘1’ and vice a
versa. i.e. by inverting all the bits we get 1’s complement).
Output of step 2 is 1’s complement representation of the negative number.
Example 1:
(+53)10 = (00110101)1′ 𝑠𝑐𝑜𝑚𝑝𝑙𝑒𝑚𝑒𝑛𝑡
Example 2:
(+33)10 = (00010001)1′ 𝑠𝑐𝑜𝑚𝑝𝑙𝑒𝑚𝑒𝑛𝑡
Example 3:
(−53)10 = (? )1′ 𝑠𝑐𝑜𝑚𝑝𝑙𝑒𝑚𝑒𝑛𝑡
Example 4:
(−33)10 = (? )1′ 𝑠𝑐𝑜𝑚𝑝𝑙𝑒𝑚𝑒𝑛𝑡
Using 1’s complement binary representation, when eight bits are used;
numbers in the range –127 to +127 can be represented. In an n-bit
representation, range of numbers those can be represented using 1’s
complement representation are −(2𝑛−1 − 1) to +(2𝑛−1 − 1).
Example 2:
(+33)10 = (00010001)2′ 𝑠𝑐𝑜𝑚𝑝𝑙𝑒𝑚𝑒𝑛𝑡
Example 3:
(−53)10 = (? )2′ 𝑠𝑐𝑜𝑚𝑝𝑙𝑒𝑚𝑒𝑛𝑡
Example 4:
(−33)10 = (? )2′ 𝑠𝑐𝑜𝑚𝑝𝑙𝑒𝑚𝑒𝑛𝑡
Using 2’s complement binary representation, when eight bits are used;
numbers in the range –128 to +127 can be represented. In an n-bit
representation, range of numbers those can be represented using 1’s
complement representation are −(2𝑛−1 ) to +(2𝑛−1 − 1).
This is the most popular method of representing signed numbers. It is
become popular due to two reasons.
1. It is easy to generate 2’s complement of a binary number.
2. Arithmetic operations in 2’s complement method are easy.
1-25
Generally, floating point numbers are expressed in the following form.
𝑁 = 𝑚 × 𝑏𝑒
Here m is called significand or mantissa, e is called exponent and b is
base. Some examples are shown below.
0.000005312 = 5.312 × 10−6
531200 = 5.312 × 10+5
𝐵2𝐵. 2𝐶 = 𝐵. 2𝐵2𝐶 × 16+2
0.0031𝐹 = 3.1𝐹 × 16−3
11001.0110 = 0.110010110 × 2+5 = 0.110010110𝑒 + 0101
0.000110110 = 0.110110 × 2−3 = 0.110110𝑒 − 0011
The most commonly used format for representing floating point numbers
is IEEE-754 standard. This standard defines two basic formats as single
precision and double precision.
In single precision format, 8 bits are used for representing exponent and
24 bits are used for representing. Within 8 bits of exponent one bit is used for
representing sign of exponent and remaining 7 bits are used for representing
magnitude of exponent. So value of exponent can range from –127 to +127. (from
2−127 to 2+127 . i.e. from 10−38 to 10+38 ). From 24 bits reserved for mantissa, one
bit is used as sign bit and remaining 23 bits are used for representing
magnitude of mantissa.
In double precision format, 11 bits are used for representing exponent and
53 bits are used for representing. Within 11 bits of exponent one bit is used for
representing sign of exponent and remaining 10 bits are used for representing
magnitude of exponent. So value of exponent can range from –1024 to +1024.
(from 2−1024 to 2+1024. i.e. from 10−308 to 10+308). From 53 bits reserved for
mantissa, one bit is used as sign bit and remaining 52 bits are used for
representing magnitude of mantissa.
1-26
Some examples of performing binary addition are given below.
Example 1:
(1001110)2 + (11110)2 = (? )2
1 0 0 1 1 1 0
+ 1 1 1 1 0
C 1 1 1 1
1 1 0 1 1 0 0
Example 2:
(11110000)2 − (11000111)2 = (? )2
1 1 1 1 0 0 0 0
– 1 1 0 0 0 1 1 1
B 1 1 1 1
0 0 1 0 1 0 0 1
1-27
1.3.7.3 Binary Multiplication
Basic rules for performing binary multiplication are given in table 1.6.
Table 1.6: Rules for binary multiplication
A B AXB
0 0 0
0 1 0
1 0 0
1 1 1
Some examples of performing binary multiplication are given below.
Example 1:
(1001110)2 × (110)2 = (? )2
1 0 0 1 1 1 0
X 1 1 0
0 0 0 0 0 0 0
+ 1 0 0 1 1 1 0 X
+ 1 0 0 1 1 1 0 X X
1 1 1
1 1 1 0 1 0 1 0 0
0 1 0 1 0
- 1 0 1 0
R 0 0 0 0 0 0 0
1-28
(11110000)2 − (1010)2 = (11000)2
Example 2:
(1001111)2 ÷ (110)2 = (? )2
Q 0 0 0 1 1 0 1
1 1 0 1 0 0 1 1 1 1
- 1 1 0
1 1
0 0 1 1 1
- 1 1 0
0 0 1 1 1
- 1 1 0
R 0 0 1
Example 1:
(83)10 + (39)10 = (? )10
Step 1: 1’s complement representation of numbers
(83)10 = 01010011
(39)10 = 00100111
1 0 0 0 0 1 0 1
Step 5: As MSB is 1, result is negative,
10000101
01111010
∴ 𝑅𝑒𝑠𝑢𝑙𝑡𝑖𝑠(−122)10
∴ (−83)10 − (39)10 = (−122)10
1-31
1.3.9 Two’s complement Arithmetic
Arithmetic operations discussed in 1.3.7 deals with unsigned binary
numbers only. For signed numbers, the arithmetic operations depend on the
way how they are represented. When signed numbers are represented using
two’s complement representation, we have to perform addition or subtraction by
using the steps discussed below.
As these rules deal with signed numbers, we can represent any
subtraction operation in terms of addition as shown in following examples.
𝐴 − 𝐵 = 𝐴 + (−𝐵)
−𝐴 − 𝐵 = (−𝐴) + (−𝐵)
−𝐴 − (−𝐵) = (−𝐴) + 𝐵
Following are the steps for performing 2’s complement addition
(subtraction also – First subtraction should be represented as addition).
1. Represent both the numbers using 2’s complement representation.
2. Perform simple binary addition.
3. If any carry is generated out of MSBs, ignore it.
4. If MSB is 0, result is positive. Find equivalent of result.
5. If MSB is 1, result is negative. Find 2’s complement of result and then its
equivalent.
1-32
+ 1
--------------------
10101101
(−83)10 = 10101101
(39)10 = 00100111
Step 2: Simple Binary addition
1 0 1 0 1 1 0 1
+ 0 0 1 0 0 1 1 1
1 1 1 1 1
1 1 0 1 0 1 0 0
Step 5: As MSB is 1, result is negative,
11010100
00101011
Then by adding 1 in the result we get 2’s complement as,
00101011
+ 1
--------------------
00101100
∴ 𝑅𝑒𝑠𝑢𝑙𝑡𝑖𝑠(−44)10
∴ (−83)10 + (39)10 = (−44)10
Example 3:
(83)10 − (39)10 = (? )10
The above subtraction can be represented in terms of addition as,
(83)10 + (−39)10 = (? )10
Step 1: 2’s complement representation of numbers
(83)10 = 01010011
(−39)10 =?
(39)10 = 00100111
00100111
11011000
11011000
+ 1
--------------------
11011001
(−39)10 = 11011001
Step 2: Simple Binary addition
0 1 0 1 0 0 1 1
1-33
+ 1 1 0 1 1 0 0 1
1 1 1 1 1
1 0 0 1 0 1 1 0 0
Step 3: Carry generated out of MSB is ignored.
Step 4: As MSB is 0, result is positive and it is,
00101100 = (+44)10
∴ (83)10 − (39)10 = (+44)10
Example 4:
(−83)10 − (39)10 = (? )10
The above subtraction can be represented in terms of addition as,
(−83)10 + (−39)10 = (? )10
Step 1: 2’s complement representation of numbers(−83)10 =?
(83)10 = 01010011
01010011
10101100
Then by adding 1 in the result we get 2’s complement as,
10101100
+ 1
--------------------
10101101
(−83)10 = 10101101
(−39)10 =?
(39)10 = 00100111
00100111
11011000
Then by adding 1 in the result we get 2’s complement as,
11011000
+ 1
--------------------
11011001
(−39)10 = 11011001
Step 2: Simple Binary addition
1 0 1 0 1 1 0 1
+ 1 1 0 1 1 0 0 1
1 1 1 1 1 1
1 1 0 0 0 0 1 1 0
Step 3: Carry generated out of MSB is ignored.
Step 5: As MSB is 1, result is negative,
10000110
01111001
1-34
Then by adding 1 in the result we get 2’s complement as,
01111001
+ 1
--------------------
01111010
∴ 𝑅𝑒𝑠𝑢𝑙𝑡𝑖𝑠(−122)10
∴ (−83)10 − (39)10 = (−122)10
From above examples, it can be easily observed that more number of bits
is required for representing a number using BCD code as compared to simple
binary equivalent. This is disadvantage of BCD code. BCD arithmetic is also
somewhat critical. But even then, BCD code is convenient and useful code for
input and output operations.
Decimal to BCD conversion and BCD to Decimal conversion are very easy
as only the table 1.7 is used for doing the conversion.
BCD is also known as 8-4-2-1 code as the bits in the code have weights as
8, 4, 2 and 1.
1-35
The basic BCD code is 8421 BCD code. There are some more weighted
BCD codes as 4221 BCD code and 5421 BCD code. Obviously, 4, 2, 2, 1 in 4221
BCD code and 5, 4, 2, 1 in 5421 BCD code are weights of respective bits. Table
1.8 shows how decimal digits from 0 through 9 are represented using these BCD
codes.
Table 1.8: Other BCD Codes
Decimal Digit 4221 BCD 5421 BCD
Code Code
0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 1
2 0 0 1 0 0 0 1 0
3 0 0 1 1 0 0 1 1
4 1 0 0 0 0 1 0 0
5 0 1 1 1 1 0 0 0
6 1 1 0 0 1 0 0 1
7 1 1 0 1 1 0 1 0
8 1 1 1 0 1 0 1 1
9 1 1 1 1 1 1 0 0
(000100100010)𝐵𝐶𝐷 = (122)10
∴ (83)10 + (39)10 = (122)10
Example 2:
(29)10 + (58)10 = (? )10
Step 1: BCD code representation of numbers
(29)10 = 00101001
(58)10 = 01011000
Step 2: Simple Binary addition
0 0 1 0 1 0 0 1
+ 0 1 0 1 1 0 0 0
1 1 1 1
1 0 0 0 0 0 0 1
Step 3: As carry is generated from least significant digit to next
digit 0110 is added to lest significant digit,
1 0 0 0 0 0 0 1
+ 0 1 1 0
1 0 0 0 0 1 1 1
(10000111)𝐵𝐶𝐷 = (87)10
∴ (29)10 + (58)10 = (87)10
Example 3:
1-37
(637)10 + (463)10 = (? )10
Step 1: BCD code representation of numbers
(637)10 = 011000110111
(463)10 = 010001100011
Step 2: Simple Binary addition
0 1 1 0 0 0 1 1 0 1 1 1
+ 0 1 0 0 0 1 1 0 0 0 1 1
1 1 1 1 1 1
1 0 1 0 1 0 0 1 1 0 1 0
Step 3: As least significant digit and most significant digit are
invalid, 0110 is added to both these digits.
1 0 1 0 1 0 0 1 1 0 1 0
+ 0 1 1 0 0 1 1 0
1 1 1 1 1 1 1
1 0 0 0 0 1 0 1 0 0 0 0 0
As result contains invalid digit, 0110 is added to that digit.
1 0 0 0 0 1 0 1 0 0 0 0 0
+ 0 1 1 0
1 1 1
1 0 0 0 1 0 0 0 0 0 0 0 0
(0001000100000000)𝐵𝐶𝐷 = (1100)10
∴ (637)10 + (463)10 = (1100)10
Example 4:
1001 + 1101 =?
Step 1: The above numbers are represented in binary
representation. First number is binary equivalent of (9)10 and second number is
binary equivalent of (13)10 . BCD code representation of these numbers is,
(9)10 = 1001
(13)10 = 00010011
Step 2: Simple Binary addition
1 0 0 1
+ 0 0 0 1 0 0 1 1
1 1
0 0 0 1 1 1 0 0
Step 3: As least significant digit is invalid, 0110 is added to that
digit.
0 0 0 1 1 1 0 0
+ 0 1 1 0
1 1 1
0 0 1 0 0 0 1 0
1-38
(00100010)𝐵𝐶𝐷 = (22)10
∴ (1001)2 + (1101)2 = (22)10 = (10110)2
BCD code is
72 = 01110010
Step 3: BCD addition
0 1 0 0 0 1 0 1
+ 0 1 1 1 0 0 1 0
1 0 1 1 0 1 1 1
As most significant digit of result contain invalid BCD code,
1 0 1 1 0 1 1 1
+ 0 1 1 0
1 1
1 0 0 0 1 0 1 1 1
Step 4: As carry is generated out of MSB, it is added to result.
(Result is positive)
0 0 0 1 0 1 1 1
+ 1
1 1 1
0 0 0 1 1 0 0 0
(00011000)𝐵𝐶𝐷 = (+18)10
1-39
∴ (45)10 − (27)10 = (+18)10
Example 2:
(45)10 − (83)10 = (? )10
Step 1: BCD code representation of A
(45)10 = 01000101
Step 2: 9’s complement of B is,
(83)10 = (16)9′ 𝑠𝑐𝑜𝑚𝑝𝑙𝑒𝑚𝑒𝑛𝑡
BCD code is
16 = 00010110
Step 3: BCD addition
0 1 0 0 0 1 0 1
+ 0 0 0 1 0 1 1 0
1
0 1 0 1 1 0 1 1
As least significant digit of result contain invalid BCD code,
0 1 0 1 1 0 1 1
+ 0 1 1 0
1 1 1 1
0 1 1 0 0 0 0 1
Step 5: As carry is not generated out of MSB, result is negative and
it is in 9’s complement form
(01100001)𝐵𝐶𝐷 = (61)10
But as result is in 9’s complement form, true result is
∴ (45)10 − (83)10 = (−38)10
1-40