0% found this document useful (0 votes)
17 views31 pages

EE413_Part I_Notes_2024_2025(final)

The document contains lecture notes for EE413: Digital Systems, covering topics such as the differences between analog and digital signals, number systems, and logic circuits. It emphasizes the advantages of digital signals, including noise immunity, simplicity in circuitry, and lower power consumption. The notes also review various number systems, including decimal, binary, octal, and hexadecimal, and explain their positional notation and conversion methods.

Uploaded by

Gyang Emmanuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views31 pages

EE413_Part I_Notes_2024_2025(final)

The document contains lecture notes for EE413: Digital Systems, covering topics such as the differences between analog and digital signals, number systems, and logic circuits. It emphasizes the advantages of digital signals, including noise immunity, simplicity in circuitry, and lower power consumption. The notes also review various number systems, including decimal, binary, octal, and hexadecimal, and explain their positional notation and conversion methods.

Uploaded by

Gyang Emmanuel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

ABUBAKAR TAFAWA BALEWA UNIVERSITY, BAUCHI

FACULTY OF ENGINEERING AND ENGINEERING TECHNOLOGY

DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

EE413: Digital Systems

Part I Lecture Notes


by
I.N Chiroma

Outline
- Review of Analog and Digital Signals
- Review of Number Systems
- Review of Complement Arithmetic
- Codes and code conversion
- Review of logic Gates/logic Circuit timing diagrams
- Boolean Algebra and Logic Minimization
- Karnaugh Maps and logic Minimization
- Introduction to Combinational Circuits (part II to continue from here)
-
EE413: DIGITAL SYSTEMS (PART I)
1. Review of Signals: Digital versus Analog Signals and Systems
In most fields of endeavour, we constantly deal with quantities, which are measured, monitored, recorded,
manipulated arithmetically, or in some other way. A signal is a quantity that represents an electric current or
electromagnetic field used to convey data from one place to another. Basically, there are two ways of representing
the numerical value of quantities: analog and digital. In analog representation, a quantity is represented by a
continuous varying, proportional indicator. In digital representation, the quantity is represented discretely, mostly
by symbols called digits. Thus, an analog signal represents an infinite continuum of levels .i.e. a signal that is
continuous (figure 1-left); it has infinitely many levels between a minimum and maximum, while a digital signal
represents finite, discrete levels. Mostly, a digital signal can be in only one of two states, called binary digits
(bits) denoted by logical 0 and logical 1(figure 1 – right). Accordingly, an analog system is a device that
manipulates physical quantities that are represented in analog form, while a digital system is a device designed to
manipulate logical information or quantities represented in digital form.

Fig. 1: Analog versus digital signals


In digital circuits, two different voltage levels are used to represent the two bits.
• HIGH → is near the supply voltage (e.g + 5V = 1)
• Low → in near the 0V and is referred to 0)
The exact value of the voltage is not very important. Instead a range of values are used to represent to represent a
‘high’ or a ‘low’. This is referred to as logic levels (i.e. the voltages used to represent a 1 and 0) as illustrated
below (figure 2).
VH (max) HIGH (binary 1) or 5V

VH (min)
Unacceptable region

VL(max) Low
VL (min) (binary 0) or 0V
Figure 2: Logic levels range of voltage for digital circuits.
Note: the voltage in the unacceptable range can appear as either a high or a low to a given circuit, hence, is
undefined and not used.
→ A signal without a bar (—) or prime (‘) is said to be active, when it is at logic 1, and inactive, when it is at
logic 0. A signal with a bar or prime on it, is active when it is at logic 0. It is inactive when at logic 1.
Advantages of Digital signals over their Analog Counterparts
1. Their ability to operate within the presence of noise: Since an analog signal is a direct representation of the
physical quantity it is transmitting, any noise that is coupled onto the electrical signal is interpreted as noise
2|I N C h i r o m a
on the original physical quantity. As an example, when you are listening to AM/FM radio, you may hear
distortion of the sound coming out of the speaker. The distortion is not due to actual distortion of the music as
it was played at the radio station, but rather electrical noise that was coupled onto the analog signal transmitted
to your radio prior to being converted back into sound by the speakers. Since the signal in this case is analog,
the speaker simply converts it in its entirety (noise + music) into sound. In the case of digital signal, a
significant amount of noise can be added to the signal while still preserving the original 1’sand 0’s that are
being transmitted. For example, if the signal is representing a 0, the receiver will still interpret the signal as a
0 as long as the noise doesn’t cause the level to exceed the threshold. Once the receiver interprets the signal
as a 0, it stores the encoded value as a 0, ignoring any noise present during transmission (figure 3(right)).

Fig. 3: Noise immunity by digital signals compared with analog signals

Figure 3 shows the exact same noise added to the analog and digital signals from figure 1
2. The simplicity of the circuitry: Digital systems are generally easier to design: The circuits in digital
systems are switching circuits, where exact values of voltages or current are not very important; only the range
(HIGH or LOW) in which they fall. In order to produce a 1 and 0, you simply need an electrical switch. If the
switch connects the output to a voltage below the threshold, then it produces a 0. If the switch connects the
output to a voltage above the threshold, then it produces a 1. It is relatively simple to create such a switching
circuit using modern transistors. Analog circuitry, however, needs to perform the conversion of the physical
quantity it is representing (e.g., pressure, sound) into an electrical signal while maintaining a direct correspon-
dence between the input and output. Since analog circuits produce a direct, continuous representation of
information, they require more complicated designs to achieve linearity in the presence of environmental
variations (e.g., power supply, temperature). Figure 4 shows an example comparison between an analog
inverting amplifier and a digital inverter.

Fig. 4: The simplicity of digital circuitry compared to analog signals

3. Less Power Consumption: Another reason that digital systems are being widely adopted is their reduced
power consumption. With the advent of Complementary Metal Oxide Semiconductor (CMOS), electrical
switches can be created that consume very little power to turn on or off and consume relatively negligible
amounts of power to keep on or off. This has allowed large scale digital systems to be fabricated without

3|I N C h i r o m a
excessive levels of power consumption. Analog circuits, on the other hand, require continuous power to
accurately convert and transmit the electrical signal representing the physical quantity. Also, the circuit
techniques that are required to compensate for variances in power supply and fabrication processes in analog
systems require additional power consumption.
4. Ease of Manipulation of Information: Digital devices can compress data and hence use storage effectively;
mass storage techniques can store billions of bits in a relatively small space
5. Accuracy and Precision are easier to maintain in digital systems: Once a system is digitized, the
information it contains does not deteriorate during processing, unlike in analog systems where voltage and
current tend to be distorted by environmental factors such as temperature, humidity and components tolerance
variation.
For the aforementioned reasons, analog systems are increasingly being replaced with digital systems wherever
possible, although analog systems will always be needed at the transition between the physical (e.g., microphones)
and the electrical world, the push toward digitization of everything will continue.
Clocking of a signal
Clock: A clock is a sequence of pulses. It is a signal that causes things to happen at regularly spaced intervals. An
ideal clock is shown in figure 5(a) below, while a non-ideal or actual clock is shown in figure 5(b). All digital
circuits need clocks to time their operations, especially μPs. A clock is generated by a clock generator. While some
μPs have the clock generator built into the same chip, others require an external clock generator. For example, the
8085 μP has a built-in clock generator, whereas 8088 μP requires as external clock generator.

Fig.5 (a) and (b) below indicate the representation of signals changing their state
from low to high (active high) and high to low (active low), respectively.

2. Review of Number Systems


As stated earlier, our world is inherently analog. Humans sense continuous signal levels such as the intensity of
light or sound. If humans were born with digital sensory organs, we would only sense binary states, for example
brightness or darkness, silence or noise; no varying noise. However, in discrete form, the human brain has been
taught to count, label and measure using the decimal number system, which contains 10 unique symbols (0 - 9).
→ In order to bridge the gap between the way our brains think (decimal) and how we build our computers (binary),
we need to understand the basics of number systems; how to convert between different number systems that contain
different numbers of symbols. In this section, we will review four different number systems: decimal, binary, octal,
and hexadecimal. The study of decimal and binary is obvious as they represent how our brains interpret the physical
world (decimal) and how our computers work (binary). Hexadecimal is studied because it is a useful means to
represent large sets of binary values using a manageable number of symbols. The Though Octal is rarely used
today, it is always studied as an example of how the formalization of the number systems can be applied to all
systems regardless of the number of symbols they contain.

4|I N C h i r o m a
Positional Notation in Number Systems
A positional number system allows the expansion of the original set of symbols so that they can be used to represent
any arbitrarily large (or small) value. For example, if we use the 10 symbols in our decimal system, we can count
from 0 to 9. Using just the individual symbols we do not have enough symbols to count beyond 9. So we use the
same set of symbols but assign a different value to the symbol based on its position within the number. The position
of the symbol with respect to other symbols in the number allows an individual symbol to represent greater (or
lesser) values. Accordingly, all number systems have a base, and the weight accorded to each position is some
power of this base. Number systems where the weight of a digit depends on its relative position within the number
are known as positional number systems. In general, a number N when expressed in a form called ‘Positional
notation in base b is written as
anan-1an-2 an-3 . . . a1a0a-1a-2 a-3 . . . a-m and defined as
→ anbn + an-1bn-1 + an-2bn-2+ an-3bn-3 . . . + a1b1 + a0b0 + a-1b-1 + a-2b-2 + a-3b-3 + . . . + a-mb-m =∑𝑛𝑖= −𝑚 𝑎𝑖 𝑏 𝑖
where ais are the digits and may have one of bi (weight) possible values.
A number represented in any base (or number system) can be converted to any other system where each digit
within the number to be converted in multiplied by the weight of its position, and then all the values are added.
Four of these number systems (bases) are often used in digital circuits.
1. Decimal - has a base or radix of 10, i.e. it 10 symbols → b = 10, a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2. Binary - has a base or radix of 2, .i.e. it uses only 2 symbols → b = 2, a = [0, 1]
3. Octal - has a base or a radix of 8 ; uses 8 different symbols → b = 8, a = [0, 1, 2, 3, 4, 5, 6, 7]
4. Hexadecimal (Hex) - has a base or radix of 16 - uses 16 different symbols
→ b = 16, a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F], where A = 10, B= 11, C = 12, D = 13, E= 14, F=15
Conversion between Number Bases
→ Decimal Number System: In decimal number system, there are ten distinct symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8
and 9. Any combination of these 10 digits together with a plus or minus sign is a valid integer in this number
system. The weights can be written as the power of its base as 10 0, 101, 102, 103 etc. Thus, the decimal number
1963.469 equals to 1 × 103 + 9 × 102 + 6 × 101 + 3 × 100 + 4 × 10–1 × 6 × 10–2 × 9 × 10–3. Hence, 1963.469 is the
sum of all digits multiplied by their weights. Each position’s value 10 times greater than the one to its right.
→ Binary Number System: uses only two digits, 0 and 1 to represent any number. The weight or place value
of each position can be expressed in terms of 2, and as 20, 21, 22 etc. Thus, the weights are in the ascending power
of 2 or 1, 2, 4, 8, 16, 32, 64, etc. Computers and other digital circuits process information in binary format. Each
character is assigned 7 or 8 bit binary code to indicate its character which may be numeric, alphabet or special
character.
→ Octal Number System: The octal number system was used extensively by early minicomputers. However, for
both large and small systems, it has largely been replaced by the hexadecimal system. Sets of 3 bit binary numbers
can be represented by octal numbers and this can conveniently be used for entire data in the computer. A number
system that uses eight digits: 0, 1, 2, 3, 4, 5, 6 and 7 is called an octal number system. It has a base of eight. The
digits, 0 through 7 have exactly the same physical meaning as decimal symbols. In this system, each digit has a
weight corresponding to its position as follows:
an8n + ... a383 + a282 + a181 + a– 18–1 + a– 28–2 + ... + a– n8– n
→ Hexadecimal Number System: has a base of 16. It has 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 plus the letters
A, B, C, D, E and F. When counting in hex, each digit can be incremented from 0 to F. Once it reaches F, the next

5|I N C h i r o m a
count causes it to recycle to 0 and the next-higher digit is incremented. This is illustrated in the following counting
sequences: 0038, 0039, 003A, 003B, 003C, 003D, 003E, 003F, 0040; 06B8, 06B9, 06BA, 06BB, 06BC, 06BD,
06BE, 06BF, 06C0, 06C1.
Examples
1. 146810 = 1 x103 + 4 x 102 + 6 x 101 + 8 x 100 = 100 + 400 + 60 + 8
2. 2573.46710 = 2 x 103 + 5 x 102 + 7 x 101 + 3 x 100 + 4 x 10-1 + 6 x 10-2 + 7x 10-3
3. 1101.0112 = 1x23 + 1x 22 + 0x21 + 1 x 20 + 0 x 2-1 +1 x 2-2 x 1x2-3 → equiv. to 13.37510.
4. 2568 = 2 x 82 + 5x81 + 6 x 80 → equivalent to 17410
Other examples (mixed whole numbers & fractions)
Convert 101101. 10112 to equivalent decimal number
101101. 10112 = 1 x 25 + 0 x 24 1 x 23 + 1x22 + 0 x 21 + 1 x 20 + 1x2-1 + 0 x 2-2 + 1 x 2-3 + 1x2-4
= 32 + 8 + 4 + 1 + 0.5 + 0.125 + 0.0625 = 45.6875 10

i. Decimal to Binary
To convert from decimal to binary, the given number is divided successively by 2 to give reminders of 0s & 1s.
Example: 18210 = (?)2
Base Number Reminder
2 182
2 91 0
2 45 1
2 22 1
2 11 0 →10110110 Hence, 18210= 10110102
2 5 1 Read bottom to top to get the required binary number
2 2 1
2 1 0
2 0 1
Example: 0.6562510 = (?)2
Number Base Product Carry
0.65625 x 2 = 1.31125 1
0.31125 x 2 = 0.6250 0
0.6250 x 2 = 1.250 1 The whole number part read top to bottom to get the
0.2500 x 2 = 0.500 0 required fraction in base 2
0.5000 x 2 = 1.000 1
 (0.65625)10 = (0.10101)2
Decimal to Octal Conversion
The process is similar to decimal to binary, only the base (radix) is different
Example (4629.12)10 = (?)8
Integer part
8 4629
8 578 r 5
8 72 r 2
8 9 r 0 ➔ 462910 = 110258
8 1 r 1
8 0 r 1

Fractional part
0.1210 = (?)8
carry
0.12 x 8 = 0.96
0.96 x 8 = 7.68
0.68 x 8 = 5.44 → 0.1210 = 0.07 5341… 3
0.44 x 8 = 3.52
0.52 x 8 = 4.16
0.16 x 8 = 1.28
4629.1210 = 11025.0753418
6|I N C h i r o m a
ii. Octal to Decimal
11025.07553418 = 1 x 84 + 1 x 83 + 0x82 + 2 x 81 + 5 x 8 0 + 0 x 8-1 + 7 x 3-2 + 5 x 8-3 + 5x 8-4 + 3 x 8-5 + 4x8-6 + 1 x
8-7 = 4629.1210

iii. Hexadecimal (Hex) to Decimal


429.1210 = (?)16
Integer part
16 429
16 26 r D (13)
16 1 r A (10) ➔ 42910 = (1AD) 16
0 r 1

Fractional part

0.12 x 16 = 1.92
0.92 x 16 = 14.72 ➔ .3216 = 0.1EB85…
0.72 x 16 = 11.52
0.52 x 16 = 8.32
0.32 x 16 = 5.12
4.29.3210 = 1AD. 51E8..16

iv. Hex to Decimal


1AD.51E816 = 1x162 + 10x161 + 13x160 + 5x16-1 + 1x16-2 + 14x8-3 + 8x6-4 = 429.3210
Convert the following binary numbers to Decimal, Octal and Hexadecimal
i) 101101.11012 ii) 11011011.1001012

Solution for i)
Decimal conversion: 101101.11012 = 1x25 + 0x 24 +1x23 + 1x22 +0x21 + 1x20 +1x 2-1 + 1x2-2 + 0x2-3 + 1x2-4
= 32 + 8 + 4 + 1 + 0.5 + 0.25 + 0.25
= 45.812510
Octal conversion: 101101.11012 = 101 101 . 110 100
5 5 6 4 = 55.648

Hex conversion: 101101.11012 = 0010 1101 . 1101


2 D D = (2D.D)Hex

Follow the same procedure to get the solutions for the following binary number: 11011011.1001012

Decimal (answer: 219.57812510) ii) Octal (answer: 333.458) iii) Hex (answer: DB.94Hex)

Example: Determine the values of base x if: (i) 211X = 1528 (ii) 193X = 6238

(i) 211X = 1528 => 2xX2 + 1xX1 + 1xX0 = 1x82 + 5x81 + 2x80
2X2 + X + 1 = 64 + 40 +2
2X2 + X -105 = 0
Solving the quadratic equation for X, we obtain X = 7 .i.e. 2117 = 1528

(ii) 193X = 6238 => 1xX2 + 9xX1 + 3xX0 = 6x82 + 2x81 + 3x80
X2 + 9X + 3 = 384 + 16 +3
X2 + 9X + 3 = 403
X2 + 9X – 400 = 0
Solving the quadratic equation for X, we obtain X = 16 .i.e. 19316 = 6238
Home work: Convert (2AC5.D)Hex to i) decimal ii) octal and iii) binary
Solutions: (2AC5.D)Hex = (10949.8125)10, (2AC5.D)Hex = (25305.64)8, (2AC5.D)Hex =(10101011000101.1101)2

7|I N C h i r o m a
3. Binary Arithmetic
3.1 Binary Addition, Subtraction and Multiplication
Binary arithmetic follows the same rules as decimal arithmetic.
Table 2: binary Addition, subtraction and Multiplication
Addition Subtraction Multiplication
0+0 = 0 0-0 = 0 0x0 = 0
0+1 = 1 0-1 =1 borrow 1-0 0x1 = 0
1+0 = 1 =1 1x0 = 0
1+1 = 0 carry 1 1-1 = 0 1x1= 1

Addition
Examples:

1) 1) 1 0 1 1 0 12 (4510) 2) 001100112 (5110) 3) 1 1 0 1


+ 01 0 1 1 12 (2310) + 010101102 (8610) + 1011
1 0 0 0 1 0 02 (6810) 100011012 (13710) + 10110
+ 11111
+ 1111
1 0 1 1 1 0 02
We can carry out octal or hexadecimal addition in the same way. All we have to remember is that if we
add together two digits whose sum is greater than 8 (or 16), there will be a carry. For example,
123458
+ 670138
1013608

Binary Subtraction
Subtraction can also be carried out in a conventional way, although we shall see later that a computer
does not subtract numbers in the way we do because negative numbers are not usually represented in a
sign plus magnitude form but by means of their complements as will be shown.
Example: Subtract 1910 from 2210 after converting to binary
Solution: 1910 =100112 and 2210 = 101102
10110
- 10011
0 0 0 1 1 (310)
In binary addition, if you ignore carry in addition and borrow in subtraction, then the result of addition
and subtraction will be identical, which gives what is called modulo-2 arithmetic.

8|I N C h i r o m a
Binary multiplication
The multiplication of binary numbers is done similar to pen and paper method of shifting and adding.
However, in practice, the computer use somewhat modified technique (repetitive adding user adders).
Examples: Perform the following multiplications (i) 101102X11012 (ii) 0011010x0001100
10110 (ii) (ii) (ii) & (iii) have the answers given in front
x 1101
10110
00000
10110
10110
--------------------
1 0 0 0 1 1 1 1 02
Binary division
Binary division is also carried out by repetitive subtraction; 0/1 =0 and 1/1 =1, 0/0 & 1/0 undefined.
Examples: (i) 1000012 /1102 (ii) 101010/000110
(i)
110 1 0 0 0 0 1
101.1 1 1 0
----------
001001
110
--------------
00110
00110
---------------
000

Binary Addition: Hardware


• Half Adder: Two inputs (A,B) and two outputs (carry (C), sum (S)).
• Full Adder: Three inputs (A,B, carry in (Cin)) and two outputs (carry (Cout), sum(S)).

Fig.6 Half Adder (left) and Full Adder (right)


Half Adder (HA) and Full Adder (FA) truth tables and logic expressions
From figure 6, the A and B are two binary input bits to be added
A B S C
S = A’B + AB’ = A ⊕ B
0 0 0 0
C = A.B
0 1 1 0
1 0 1 0
1 1 0 1

9|I N C h i r o m a
Logic expression for FA can be shown
This is left as an exercise

HA vs FA: The half adder does not add the carry generated in the previous addition to the next addition. In case of full
adder, the carry produced in the previous addition is added in the next addition.

Complement Arithmetic
Subtraction of two numbers using the computer is complicated and expensive in terms of circuitry,
especially for repeated borrowing from one column to another. Complements are used in the digital
computers in order to simplify the subtraction operation and for the logical manipulations, by changing
subtractions to addition, and hence borrow circuits are eliminated, and cost reduced.
→ In complement arithmetic, the negativeness of a number is contained within the number itself. If we
are to add X to Y, the operation is that of addition if both X and Y are positive. But if Y is negative, the
end result is that of subtraction, i.e. Y is in its negative form.
→ In general, for each radix r system, there are following two types of complements:
(i) The radix complement and (ii) the diminished radix complement.
The radix complement is referred to as the r’s complement and the diminished radix complement is
referred to as (r-1)’s complement. If we consider the binary system with a base r=2, the two types of
complements for the binary system are 2’s complement and 1’s complement. Similarly, for an octal
system, we have 8’s complement and 7’s complement. And for a decimal system, we have r=10 and the
types of complements are 10’s complement and 9’s complement. Our focus will be on binary system,
.i.e. 1’s and 2’s complements.
One’s (1’s) Complement
1’s complement of a binary number is obtained by subtracting each digit of the number from 1. This is
the same as replacing 1s with 0s, and replacing 0s with 1s; or taking the direct complement of every digit.
This is achieved by using parallel inverter (NOT circuit). E.g. the 1’s complement of 110101 is 001010.
Two’s (2’s) Complement
To get the 2’s complement of a binary number, first obtain the 1’s complement and then add 1 to the
least significant bit (LSB) of the result. 2’s complement = 1’s complement+ 1.
Thus,
Example: Obtain the 1’s and 2’s complements of the following binary numbers: (i) 1010 (ii) 11010101
(i) 1’s complement of 1010 = 0101. Thus, 2’s complement = 0101 + 1 = 0110 or 110
(ii) 1’s complement of 11010101= 00101010 → 2’s compl.= 00101010+1 = 00101011 or 101011

10 | I N C h i r o m a
Subtraction and Addition Using Complement Arithmetic
Subtraction is a special case of addition. Basically, in subtraction operation, the sign of the subtrahend
(the number to be subtracted) is changed and added to the minuend(the number being deducted from).
Example: Subtracting +6 (subtrahend) from +9 (the minuend) is equivalent to adding -6 to +9.
Note: The sign of a binary number (+ve or –ve) is changed by taking its 2’s complement. Therefore,
to perform subtraction operation on two signed numbers, get the 2’s complement of the subtrahend
and add to the given minuend. 2’s complement is true complement in binary system.
Subtraction can be performed using either 1’s complement or 2’s complements.
1. Using 1’s complement method of subtraction
I) Get the 1’s complement of the subtrahend
II) Add the result of i) (complement) to the minuend
III) If there is any end around carry, add it the sum obtained in ii)
If there is no carry, it means a larger number has been subtracted from a smaller number.
In this case, re-complement the sum and attach a negative sign (-) to obtain the correct result.
Examples: Perform the following using 1’s complement (i) 11012 – 1102 (ii) 0100102 -1000112
(i) 1 1 0 1 → Minuend
+ 1 0 0 1 → 1’s complement of subtrahend
10110
+1
0 1 1 1 ----> 01112

(ii) 0 1 0 0 1 0 → Minuend
+ 0 1 1 1 0 0 → 1’s complement of subtrahend
101110
In this case there is no carry, meaning the minuend is smaller than the subtrahend. Hence, the correct
result is obtained by re-complementing the sum and attaching a (-) sign. → Ans = -0100012
A close look at the two numbers show that the minuend is 1810 and the subtrahend 3510.
2. Using 2’s complement method of subtraction
The procedure is almost the same with 1’s complement, only that in the case of 2’s complement, if there
is any end-around-carry, it is discarded, because 2’s complement is a true complement of a given binary
number.
Example: Perform the following using 2’s complement (i) 110101012 – 100110102 (ii) 011112-010002
(i) 1’s complement of the subtrahend = 01100101 -> 2’s compl. = 01100101+1 =01100110
1 1 0 1 0 1 0 1 → Minuend
+ 0 1 1 0 0 1 1 0 → 2’s complement of subtrahend
100111011
Discard the end-around-carry (shaded bit (1)) -> Ans = 00111011 or 1110112 (21310 -15410 = 5910)
(ii) Following the same procedure, answer for (ii) = 00111 or 01112 (1510 -810 = 710)
11 | I N C h i r o m a
Addition with Complement Arithmetic
The two numbers in an addition are the addend (the number being added) and augend (the number to
which another is being added to). The result is the sum. Four cases occur in adding two signed numbers:
(i) Both +ve (ii) one +ve with magnitude larger than –ve number
(iii) One -ve with magnitude > +ve number (iv) both –ve
Examples: (i) 1112 + 1002
1 1 12
+ 1 0 02
1 0 1 12 -> 710 + 410 = 1110
(ii) 000011112 + 111110102

0 0 0 0 1 1 1 1 (1510)
+ 1 1 1 1 1 0 1 0 (-610) --> in 2’s complement
1 0 0 0 0 1 0 0 1 (910)
This end around carry is discarded.
The sum is +ve and less than the minuend. This means the subtrahend is a –ve number (already in 2’s
complement form).
(iii) 111110112 – 111101112

1 1 1 1 1 0 1 1(-510)
+ 1 1 1 1 0 1 1 1 (-910)
1 0 0 0 0 1 0 0 1 (910
Discard final carry
Here, the result (sum) is –ve and therefore must be in 2’s complement. We can cross check as follows
11110010 – 1 = 11110001 = 00001110 (+14)
2’s compl 1’s complement
Home Work
Carryout the following using 2’s complement: (i) 110101012 - 100110102 (ii) 01112 - 010002
Answers: (i) 001110112 (ii) 001112

4. Binary Codes
In the coding, when numbers, letters or words are represented by a specific group of symbols, it is said
that the number, letter or word is being encoded. The group of symbols is called as a code. The digital
data is represented, stored and transmitted as group of binary bits. This group is also called as binary
code. The binary code is represented by the number as well as alphanumeric letter.

12 | I N C h i r o m a
Classification of Codes
1.Weighted Codes
The main characteristic of weighted code is that each binary digit is assigned a specific weight. The
common example of weighted code is BCD code or 8421 code in which the weights of different bits are
1, 2, 4 & 8.
Non-Weighted Code
These don’t follow the principle of positional weighting system i.e. each position within the number
doesn’t follow or have any fixed weight. For ex- Excess-3, Gray code.
Alphanumeric Codes
Apart from numeric data, a computer system may process some alphanumeric data just like the
employees’ names, address as well as some special characters. An Alphanumeric data generally consist
of sequence of characters where a character is any one of the following:-
• Letters or alphabets, digits 0-9 and special characters, e.g. +,-,π, *,%,$ etc.
• In the computer system, each character is stored in some code form depending upon the coding scheme.
The character may take 6, 7, or 8 bits. There are number of codes which are used for some specific
application i.e. ASCII Code, EBCDIC Code, UNIT Code, etc.
Importance of Codes
1. The code refers to encryption system.
2. Various binary codes are used to represent data.
3. The interpretation of data is only possible if the code in which the information is available is known.
i. Binary Coded Decimal (BCD)
In this coding, each decimal digit (0 to 9) is represented by the equivalent 4 bits. Therefore, if we are to
represent 1110 in binary it is 1011 while in BCD it is 0001 0001. So we can see corresponding binary &
BCD equivalent of decimal numbers in the following table:
Decimal Binary BCD
0. 0000 0000
1. 0001 0001
2. 0010 0010
3. 0011 0011
4. 0100 0100
5. 0101 0101
6. 0110 0110
7. 0111 0111
8. 1000 1000
9. 1001 1001
10. 1010 0001 0000
11. 1011 0001 0001
12. 1100 0001 0010
13. 1101 0001 0011
14. 1110 0001 0100
15. 1111 0001 0101
13 | I N C h i r o m a
Note from above that 1010, 1011, 1100,1101, 1110 and 1111 are invalid digits in BCD coding. Thus,
BCD code requires more bits than straight binary code. It is however suitable for some input and output
operations in digital systems.
• BCD code provides an excellent interface to binary systems: Keypad inputs; digital readouts
– Used to represent the decimal digits 0 - 9.
– 4 bits are used.
– Each bit position has a weight associated with it (weighted code).
– Weights are: 8, 4, 2, and 1 from MSB to LSB (called 8-4-2-1 code).
– Used to encode numbers for output to numerical displays
– Used in processors that perform decimal arithmetic.
– Example: (9750)10 = ( 1001 0111 0101 0000)BCD
9 7 5 0
BCD Addition
• BCD is a numerical code and can be used in arithmetic operations. To add two BCD numbers:
– Add the two BCD numbers, using the rules for basic binary addition.
– If a 4-bit sum is equal to or less than 9, it is a valid BCD number.
– If a 4-bit sum > 9, or if a carry out of the 4-bit group is generated it is an invalid result. Add 6 (0110)
to a 4-bit sum in order to skip the six invalid states and return the code to 8421. If a carry results when 6
is added, simply add the carry to the next 4-bit group.
Try the following additions
(a) 0011+0100, (b) 00100011 + 00010101,(c) 10000110 + 00010011, (d) 010001010000 + 010000010111
(e) 1001 + 0100, (f) 1001 + 1001, (g) 00010110 + 00010101, (h) 01100111 + 01010011
BCD Subtraction
Here is how to subtract two BCD numbers:
– Subtract the two BCD numbers, using the rules for basic binary subtraction.
– If there is no borrow from the next higher group, no correction is required.
– If there is borrow from the next group, then (0110) is subtracted from the difference term of this group.
– Example 38 – 15
38 0011 1000 (38 in BCD)
15 0001 0101 (15 in BCD)
__________
0010 0011 (No borrow, so it is a correct answer)

Try adding the following numbers


(a) 0011-0100 , b) 00100011 – 00010101, (c) 10000110 – 00010011, (d) 010001010000 - 010000010111
ii. The Gray Code
What is Gray Code?
Gray code – also known as Cyclic Code, Reflected Binary Code (RBC), Reflected Binary (RB) or
Grey code – is defined as an ordering of the binary number system such that each incremental value
14 | I N C h i r o m a
can only differ by one bit. In gray code, while traversing from one step to another step only one bit in
the code group changes. That is to say that two adjacent code numbers differ from each other by only
one bit. As mentioned, this coding system has a property that there is only one bit change between
consecutive gray codes.
• Differs from leading and following by a single bit.
• Thus, Gray code for 2 is 0011 and for 3 is 0010.
• No weights are assigned to the bit positions
It is a very useful code in which a decimal number is represented in binary form in such a way so that
each gray code number differs from preceding & the succeeding number by a single bit.
– This property is important in many applications, such as shaft position encoders.
• Binary-to-Gray code conversion
– The MSB in the Gray code is the same as corresponding MSB in the binary number.
– Going from left to right, add each adjacent pair of binary code bits to get the next Gray code bit.
- Discard any carry

➔ You can also use your knowledge of XOR as follows:


1. The MSB (Most Significant Bit) of the gray code will be exactly equal to the first bit of the
given binary number.
2. The second bit of the code will be XOR of the 1st and 2nd bit of the given binary number; i.e. if
both the bits are same the result will be 0 and if they are different the result will be 1.
3. The third bit of gray code will be equal to the exclusive-or (XOR) of the 2nd and 3rd bit of the
given binary number and so on. An example is given below to illustrate these steps.

Example 2: Binary to Gray Code (step by step Conversion using XOR method)
Say we have a binary number 01001 which we wish to convert to gray code. Let’s go through an
example of how we would perform this conversion:
1. The MSB is kept the same. Thus, MSB of the binary is 0, the MSB of the gray code will be 0.
2. Next, ithe first bit is 0, and the second bit is 1. Since the bits are different, the gray bit will be 1
3. Next, the second bit is 1, and the third bit is 0. The bits are again different, the gray bit will be 1.
4. Next, the third bit is 0, and the fourth bit is 0, and therefore the resultant gray bit will be 0.
5. Lastly, the fourth bit is 0, and the fifth bit is 1. These bits are different so the gray bit will be 1
6. Hence the result of binary to gray code conversion of 01001 produces a gray code of 01101.

15 | I N C h i r o m a
• Gray-to-Binary Conversion
→The MSB in the binary code is the same as the corresponding bit in the Gray code.
→ Add each binary code bit generated to the Gray code bit in the next adjacent position. Discard carries.
Example: convert the Gray code word 11011 to binary

Gray Code to Binary Conversion (using XOR method)


1. The MSB of the binary number will be equal to the MSB of the given gray code.
2. Now if the second gray bit is 0, then the second binary bit will be the same as the previous or
the first bit. If the gray bit is 1 the second binary bit will alter. If it was 1 it will be 0 and if it
was 0 it will be 1.
3. This step is continued for all the bits to do Gray code to binary conversion.

An example on the design of a 4 bit gray to binary code converter is considered in later pages

iv. Excess 3 Code


This is another form of BCD code, in which each decimal is coded into a 4-bit binary code. The code for
each decimal digit is obtained by adding decimal 3 to the natural BCD code of the digit.
• A BCD Code formed by adding 3 (0011) to its true four bit binary value.
• Excess 3 is a selfcomplementing code. If the bits of the Excess-3 digit are inverted, they yield the 9’s
complement of the decimal equivalent.
• Excess-3 code is useful for performing decimal arithmetic digitally.

16 | I N C h i r o m a
Examples
• 3 = 0011 + 0011 = 0110 = 6 in E-3.
• 1 = 0001 + 0011 = 0100 = 4 in E-3
• If we complement 1’s = 1011 in E-3 this is the code for an 8.
• 9’s Complement of 1(0100) = (9 - 1) = 8 (self Complement)
Alphanumeric Codes
• Represent numbers and alphabetic characters.
– Also represents other characters such as symbols and various instructions necessary for conveying
information.
• The ASCII is the most common alphanumeric code.
– ASCII = American Standard Code for Information Interchange
• It is 7-bit or 8-bit alphanumeric code
• 7-bit code is the standard ASCII code and supports 127 characters
• 8-bit ASCII code is extended ASCII code that supports 256 symbols with special graphics and
math’s symbol added.
Extended Binary Coded Decimal Interchange Code (EBCDIC)
• 8-bit alphanumeric code developed by IBM for its mainframe computers; supports 256 symbols

ERROR DETECTION & CORRECTION CODES


Error is a condition when the output information does not match with the input information
transmission. During As stated earlier, bit errors are sometimes introduced into frames because of
electrical interference or thermal noise. Although errors are rare, especially on optical links, some
mechanism is needed to detect these errors so that corrective action can be taken. Otherwise, the end
user is left wondering why the C program that successfully compiled just a moment ago now suddenly
has a syntax error in it, when all that happened in the interim is that it was copied across a network file
system. During transmission, digital signals suffer from noise that can introduce errors in the binary
bits travelling from one system to other. That means a 0 bit may change to 1 or a 1 bit may change to 0.

Error-Detecting codes: Whenever a message is transmitted, it may get scrambled by noise or data
may get corrupted. To avoid this, we use error-detecting codes which are additional data added to a
given digital message to help us detect if an error occurred during transmission of the message. A
simple example of error-detecting code is parity check.

17 | I N C h i r o m a
Error-Correcting codes: Along with error-detecting code, we can also pass some data to figure out
the original message from the corrupt message that we received. This type of code is called an error-
correcting code. Error-correcting codes also deploy the same strategy as error-detecting codes but
additionally, such codes also detect the exact location of the corrupt bit.
In error-correcting codes, parity check has a simple way to detect errors along with a sophisticated
mechanism to determine the corrupt bit location. Once the corrupt bit is located, its value is reverted
(from 0 to 1 or 1 to 0) to get the original message.
How to Detect and Correct Errors
To detect and correct the errors, additional bits are added to the data bits at the time of transmission.
The additional bits are called parity bits. They allow detection or correction of the errors.
The data bits along with the parity bits form a code word.
Parity Checking of Error Detection
It is the simplest technique for detecting and correcting errors. The MSB of an 8-bits word is used as the
parity bit and the remaining 7 bits are used as data or message bits. The parity of 8-bits transmitted word
can be either even parity or odd parity.

Even parity – Even parity means the number of 1's in the given word including the parity bit should be
even.
Odd parity -- Odd parity means the number of 1's in the given word including the parity bit should be
odd
How Does Error Detection Take Place? Parity checking at the receiver can detect the presence of an
error if the parity of the receiver signal is different from the expected parity. That is, if it is known that
the parity of the transmitted signal is always going to be "even" and if the received signal has an odd
parity, then the receiver can conclude that the received signal is not correct. If an error is detected then
the receiver will ignore the received byte and request for retransmission of the same byte.

18 | I N C h i r o m a
5. Review of Logic Gates
A logic gate is an electronic circuit which performs logical manipulations on one or more logic variables
to make logical decisions. Logic gates are the building blocks of digital systems. The basic gates include
AND, OR and NOT. From the fundamental gates other useful gates are derived. They include NAND,
NOR, X-OR and X-NOR. In a binary number system, 0 and 1 are the two required numerical digits. The
mathematics for variables having only two values (0 and 1) has been systematized by Shannon using the
concepts developed by George Boole. This branch of mathematics is called Boolean algebra. Two
distinct classes of components from which a computer and other digital systems are constructed are the
logic gate and flip-flops, respectively referred to combinational and sequential logic circuits.

1. Basic Gates : AND, OR and NOT are the basic or fundamental gates
2. Derived Gates: The following gates are derived from the three basic gates, but they are very
useful in digital circuits. They are Exclusive OR (X-OR) and Exclusive NOR (X-NOR), which are
derived gates.
3. Universal Gates: NAND and NOR logic gates are called universal logic gates, because basic
gates such as AND, OR and NOT gates can be realised using either only NAND only NOR gates as
illustrated below.

19 | I N C h i r o m a
Fig. 7: NAND and NOR as universal gates

Logic Circuit Analysis Using Timing Diagrams


A timing diagram is the graphical representation of input and output signals as functions of time. Since
the inputs and outputs can only take the values 0 or 1, their graphical representations are series of square
pulses with a variety of time lengths. The inputs and outputs are drawn on the same diagram to show the
input-output behavior of the digital system. A timing diagram is usually generated by an oscilloscope or
logic analyzer.

Fig. 8: AND and OR gates Timing Diagrams

Fig. 9: NOT and NAND timing diagrams

20 | I N C h i r o m a
Fig. 10: NOR timing diagram and X-OR and X-NOR gates (timing diagrams left as exercise
Example: Determine the OR gates outputs in figure 11(a) and b The OR gate inputs A and B are varying
according to the timing diagrams shown.
1
A
0 A
1
B
0 B

O/P
C
t0 t1 t2 t3 t4 t5 t6 t7
O/P
Fig. 11a & b: OR gate Timing Waveforms

Exercise: Repeat the above problem, assuming that fig 10a is a NAND gate and 16b is an AND gate.

6. Boolean Algebra and Logic Expression Simplification


Boolean algebra, developed by a mathematician, named George Boole had developed it in 1854, is a convenient
and systematic way of expressing and analyzing the operation of logic circuits. It deals with binary numbers
& binary variables. Hence, it is also called Binary Algebra or logical Algebra.
Postulates and Theorems of Boolean Algebra
The Postulates and theorems are listed below. The three basic laws of Boolean algebra are:
• Commutative law
• Associative law
• Distributive law
We can verify these laws easily, by substituting the Boolean variables with ‘0’ or ‘1’.
i. Boolean postulates ( compare with AND and OR gates outputs)
P1: x = 0 or x =1 P5 : 1+1=1
P2: 0.0 =0 P6 : 0+0=0
P3: 1.0 = 0.1 =0 P7 : 1+0=0+1=1
P4: 1.1 =1
Boolean algebra theorems
T1: Commutative laws T2: Associative Laws
a. A + B =B+A a. (A+B) + C = A + (B+C)
b. A.B = B.A b. (A.B).C = A.(B.C)

21 | I N C h i r o m a
T3: Distributive Laws T4: Identity Laws
(a) A. (A+B) = A.B +A.C a. A+A = A (A= 0 or 1)
(b) A+ (B.C) = (A+B). (A+C) b. A.A = A

T5: Negative Law T6: Redundance Law


(Ā)= A a. A+A.B = A
b. A.(A+B) = A

T7: (a) 0+A = A T8: a. Ā+ A=1


(b) 1+A=1 b. Ā.A=0
(c) 0.A= 0
(d) 1.A = A

T9: (a) A+Ā.B = A+B T10: De-Morgan’s theorems


(b) A.(Ā+B) = A.B a. ̅̅̅̅̅̅̅̅
(𝐴 + 𝐵) = 𝐴̅. 𝐵̅
b. ̅̅̅̅̅
𝐴. 𝐵= 𝐴̅+ 𝐵̅

Most of these theorems can be proved in two ways – using truthtable method or Boolean algebra.

Simplification Using Boolean Algebra


• A simplified Boolean expression should use the fewest gates possible to implement a given expression

Fig.12: logic circuit diagram

22 | I N C h i r o m a
THE STANDARD Sop FORM
A standard SOP expression is one in which all the variables in the domain appear in each product term in the
expression. Example:

ABCD+ABCD+ABCD

Standard SOP expressions are important in constructing truth tables and Karnaugh map simplification method

CONVERTING PRODUCT TERMS TO STANDARD SOP


• Step 1: Multiply each nonstandard product term by a term made up of the
sum of a missing variable and its complement. This results in two product
terms, since multiplying anything by 1 doesn’t change its value.

• Step 2: Repeat step 1 until all resulting product term contains all variables
in the domain in either complemented or uncomplemented form. In converting a
product term to standard form, the number of product terms is doubled for each
missing variable.

CONVERTING PRODUCT TERMS TO STANDARD SOP

EXAMPLE:

IMPLEMENTATION OF A POS

X = (A+B)(B+C+D)(A+C)

Fig.13 logic circuit diagram

23 | I N C h i r o m a
The Standard POS Form
A standard POS expression is one in which all the variables in the domain appear in each sum term in the
expression.

Converting a Sum Term to Standard POS


Example:  Convert the following Boolean expression into standard POS form:

→Converting Standard SOP to Standard POS


Converting Standard SOP to Standard POS
EXAMPLE: Convert the SOP expression to an equivalent POS expression:

Boolean Expressions & Truth Table


 All standard Boolean expression can be easily converted into truth table format using binary

values for each term in the expression.


 Also, standard SOP or POS expression can be determined from the truth table.
All standard Boolean expressions can be converted into truth table format using binary values for each term in the

expression. Also, standard SOP or POS expression can be determined from the truth table .
Example:

Determining Standard Expression from a Truth table


To determine the standard POS expression represented by a truth table.
24 | I N C h i r o m a
 Step 1: List the binary values of the input variables for which the output is 0.
 Step 2: Convert each binary value to the corresponding product term by replacing:

 each 1 with the corresponding variable complement, and  each 0 with the corresponding variable .

DETERMINING STANDARD EXPRESSION FROM A TRUTH TABLE. EXAMPLE:

7. Karnaugh Map and Logic Minimization


→ A K-map provides a systematic method for simplifying Boolean expressions and, if properly
used, will produce the simplest or minimum SOP or POS expression possible.
K-map is similar to truth table, but instead of being organized (i/p and o/p) into columns and rows, the K-map is an
array of cells in which each cell represents a binary value of the input variables.
→The cells are arranged in a way that simplification of a given expression is simply done by grouping of cells.
→ K-maps can be used for expressions with 2, 3, 4, and even 5 variables.
3 and 4 variables are illustrated below, with 4 and 8 cells respectively:

Fig. 14a: 3-variable K-map


Fig. 14b-variable K-map

8. Combinational Circuits
• Logic circuits for digital systems
– Combinational
– Sequential
• A combinational circuit
– outputs at any time are determined from the present combination of inputs.
– Performs operation specified by a set of Boolean functions.
• Sequential circuits
– Employ storage elements in addition to logic gates.
– Their outputs are a function of inputs and state of the storage elements.
– Not only present values of inputs, but also on past inputs.
– Circuit behaviour must be specified by a time sequence of inputs and internal states.
25 | I N C h i r o m a
• Combinational circuit consist of input variables and logic gates
• Accept signals from the inputs
• Generate signals to the output
– Output variables

For n input variable, there are 2n possible binary input combinations.


• For each possible input combination there is one possible input output value.

Analysis Procedure
• To obtain the output Boolean functions from a logic diagram:
- Label all gate outputs that are function of input variables
• Determine the Boolean functions for each gate output
- Label the gates that are a function of input variables and previously labelled gates.
- Find the Boolean function for these gates.
3. Repeat the process outlined in step 2 until the outputs are obtained.
4. Obtain the output Boolean functions in terms of input variables as follows;

Fig. 15: Truth table approach

26 | I N C h i r o m a
Fig. 16: Circuit analysis - Truth table approach

Design Procedure

• For a given a problem statement:


– Determine the number of inputs and outputs
– Derive the truth table
– Simplify the Boolean expression for each output
– Produce the required circuit
A truth table for a combinational circuit consist of:
– Input columns obtained from 2n binary numbers for the n input variables.
– Output columns determined from the stated specifications.
• Output functions specified in the truth table give exact definition of the combinational circuit.
• The output binary functions listed in the truth table are simplified by any method:
– Boolean algebra , K-map method, Variable Entered map (VEM), Tabular Method (Quine McCluskey), etc.
Design Example 1 (Code conversion)
• Code converter is a circuit that makes two systems compatible even though each uses a different binary code.
• To convert from binary code A to binary code B

• Design a circuit to convert a “BCD” code to “Excess 3” code.

Design steps

27 | I N C h i r o m a
K-map for w

k-map for x

k-map for y

28 | I N C h i r o m a
k-map for z

Example 2: Design a 7-Segment Decoder


Features
- a, b,c,d,e,f,g are the outputs as shown in figure below
- Example – if 5 is entered, then the segments (outputs) that should be turned on are a, c, d, f, g

29 | I N C h i r o m a
Example 3: Design a combinational circuit that converts 4-bit Gray Code to 4-bit Binary bits
To design a 4 bit gray to binary code converter, we first have to draw a gray code conversion table, as follows:

Next, we use K-map to get the equations for the binary bits, A,B,C and D as follows:

Therefore, the gray code to binary converter circuit is shown as follows:

Home work: The circuit given below convert 4-bit binary numbers to 4-bit Gray code. Design the circuit.

30 | I N C h i r o m a
Hint: The bits of 4-bit gray code are considered as G4G3G2G1. Thus, from conversion table,

From above SOPs, the K-maps is developed for G4, G3, G2, and G1 . G4 is obtained as shown in the above K-map.
Follow the same procedure to get G3, G2, and G1.

31 | I N C h i r o m a

You might also like