Digital
Digital
character ($, %, #, etc.) is represented in binary code. Fortunately, there are only two
methods in wide use: EBCDIC and ASCII. IBM's mainframes and midrange systems
use EBCDIC. ASCII is used for everything else, including PCs and Macs.
It is noticeable that the BCD is nothing more than a binary representation of each
digit of a decimal number.
It cannot be ignored that the BCD representation of the given decimal number uses
extra bits, which makes it heavy-weighted.
ASCII Code
The ASCII stands for American Standard Code for Information Interchange. The
ASCII code is an alphanumeric code used for data communication in digital
computers. The ASCII is a 7-bit code capable of representing 2 7 or 128 number of
different characters. The ASCII code is made up of a three-bit group, which is
followed by a four-bit code.
EBCDIC code.
Decimal Hex Binary Code Code description
0 00 0000 0000 NUL Null character
1 01 0000 0001 SOH Start of header
2 02 0000 0010 STX Start of text
3 03 0000 0011 ETX End of text
4 04 0000 0100 PF Punch off
5 05 0000 0101 HT Horizontal tab
6 06 0000 0110 LC Lower case
7 07 0000 0111 DEL Delete
8 08 0000 1000
9 09 0000 1001
10 0A 0000 1010 SMM Start of manual message
11 0B 0000 1011 VT Vertical tab
12 0C 0000 1100 FF Form feed
13 0D 0000 1101 CR Carriage return
14 0E 0000 1110 SO Shift out
15 0F 0000 1111 SI Shift in
16 10 0001 0000 DLE Data link escape
17 11 0001 0001 DC1 Device control 1
18 12 0001 0010 DC2 Device control 2
19 13 0001 0011 TM Tape mark
20 14 0001 0100 RES Restore
21 15 0001 0101 NL New line
22 16 0001 0110 BS Backspace
23 17 0001 0111 IL Idle
24 18 0001 1000 CAN Cancel
25 19 0001 1001 EM End of medium
26 1A 0001 1010 CC Cursor control
27 1B 0001 1011 CU1 Customer use 1
28 1C 0001 1100 IFS Interchange file separator
29 1D 0001 1101 IGS Interchange group separator
30 1E 0001 1110 IRS Interchange record separator
31 1F 0001 1111 IUS Interchange unit separator
32 20 0010 0000 DS Digit select
33 21 0010 0001 SOS Start of significance
34 22 0010 0010 FS Field separator
35 23 0010 0011
36 24 0010 0100 BYP Bypass
37 25 0010 0101 LF Line feed
38 26 0010 0110 ETB End of transmission block
39 27 0010 0111 ESC Escape
40 28 0010 1000
41 29 0010 1001
42 2A 0010 1010 SM Set mode
43 2B 0010 1011 CU2 Customer use 2
44 2C 0010 1100
45 2D 0010 1101 ENQ Enquiry
46 2E 0010 1110 ACK Acknowledge
47 2F 0010 1111 BEL Bell
48 30 0011 0000
The first four-bit group, called the ‘zone’, represents the category of the character,
while the
second group, called the ‘digit’, identifies the specific character.
Signed Binary Number System
Signed binary is very similar to binary, only that it includes negative numbers as well.
The sign of the binary number is determined by the leading (furthest left) digit. If it is
a 1, then it is negative, and the magnitude, or absolute value, can be found by flipping
all 1’s to 0’s and 0’s to 1’s. If it is a leading 0, then treat it like a normal binary
number. This can be seen in the table below, how unsigned and signed binary numbers
differ in their decimal interpretation.
The disadvantage here is that whereas before we had a full range n-bit unsigned binary
number, we now have an n-1 bit signed binary number giving a reduced range of digits
from:
-2(n-1) to +2(n-1)
So for example: if we have 4 bits to represent a signed binary number, (1-bit for
the Sign bit and 3-bits for the Magnitude bits), then the actual range of numbers we
can represent in sign-magnitude notation would be:
-2(4-1) – 1 to +2(4-1) – 1
-2(3) – 1 to +2(3) – 1
-7 to +7
Whereas before, the range of an unsigned 4-bit binary number would have been
from 0 to 15, or 0 to F in hexadecimal, we now have a reduced range of -7 to +7. Thus
an unsigned binary number does not have a single sign-bit, and therefore can have a
larger binary range as the most significant bit (MSB) is just an extra bit or digit rather
than a used sign bit.
Another disadvantage here of the sign-magnitude form is that we can have a positive
result for zero, +0 or 00002, and a negative result for zero, -0 or 10002. Both are valid
but which one is correct.
Signed Binary Numbers Example No1
Convert the following decimal values into signed binary numbers using the sign-
magnitude format:
-1510 as a 6-bit number ⇒ 1011112
Then we can see that it is very easy to find the one’s complement of a binary
number N as all we need do is simply change the 1’s to 0’s and the 0’s to 1’s to give
us a -N equivalent. Also just like the previous sign-magnitude representation, one’s
complement can also have n-bit notation to represent numbers in the range from: -2(n-
1)
and +2(n-1) – 1. For example, a 4-bit representation in the one’s complement format
can be used to represent decimal numbers in the range from -7 to +7 with two
representations of zero: 0000 (+0) and 1111 (-0) the same as before.
Addition and Subtraction Using One’s Complement
One of the main advantages of One’s Complement is in the addition and subtraction
of two binary numbers. In mathematics, subtraction can be implemented in a variety of
different ways as A – B, is the same as saying A + (-B) or -B + A etc. Therefore, the
complication of subtracting two binary numbers can be performed by simply using
addition.
We saw in the Binary Adder tutorial that binary addition follows the same rules as for
the normal addition except that in binary there are only two bits (digits) and the largest
digit is a “1”, (just as “9” is the largest decimal digit) thus the possible combinations
for binary addition are as follows:
0 0 1 1
+0 +1 +0 +1
0 1 1 1← 0 ( 0 plus a carry 1 )
When the two numbers to be added are both positive, the sum A + B, they can be
added together by means of the direct sum (including the number and bit sign),
because when single bits are added together, “0 + 0”, “0 + 1”, or “1 + 0” results in a
sum of “0” or “1”. This is because when the two bits we want to be added together are
odd (“0” + “1” or “1 + 0”), the result is “1”. Likewise when the two bits to be added
together are even (“0 + 0” or “1 + 1”) the result is “0” until you get to “1 + 1” then the
sum is equal to “0” plus a carry “1”. Let’s look at a simple example.
Subtraction of Two Binary Numbers
An 8-bit digital system is required to subtract the following two numbers 115 and 27
from each other using one’s complement. So in decimal this would be: 115 – 27 = 88.
First we need to convert the two decimal numbers into binary and make sure that each
number has the same number of bits by adding leading zero’s to produce an 8-bit
number (byte). Therefore:
11510 in binary is: 0 1 1 1 0 0 1 1 2
2710 in binary is: 0 0 0 1 1 0 1 1 2
Now we need to find the complement of the second binary number, (00011011) while
leaving the first number (01110011) unchanged. So by changing all the 1’s to 0’s and
0’s to 1’s, the one’s complement of 00011011 is therefore equal to 11100100.
Adding the first number and the complement of the second number gives:
01110011
+ 11100100
Overflow → 1 01010111
Since the digital system is to work with 8-bits, only the first eight digits are used to
provide the answer to the sum, and we simply ignore the last bit (bit 9). This bit is call
an “overflow” bit. Overflow occurs when the sum of the most significant (left-most)
column produces a carry forward. This overflow or carry bit can be ignored
completely or passed to the next digital section for use in its calculations. Overflow
indicates that the answer is positive. If there is no overflow then the answer is
negative.
The 8-bit result from above is: 01010111 (the overflow “1” cancels out) and to convert
it back from a one’s complement answer to the real answer we now have to add “1” to
the one’s complement result, therefore:
01010111
+ 1
01011000
So the result of subtracting 27 ( 000110112 ) from 115 ( 011100112 ) using 1’s
complement in binary gives the answer of: 010110002 or (64 + 16 + 8) = 8810 in
decimal.
Then we can see that signed or unsigned binary numbers can be subtracted from each
other using One’s Complement and the process of addition. Binary adders such as the
TTL 74LS83 or 74LS283 can be used to add or subtract two 4-bit signed binary
numbers or cascaded together to produce 8-bit adders complete with carry-out.
Two’s Complement
Two’s Complement or 2’s Complement as it is also termed, is another method like
the previous sign-magnitude and one’s complement form, which we can use to
represent negative binary numbers in a signed binary number system. In two’s
complement, the positive numbers are exactly the same as before for unsigned binary
numbers. A negative number, however, is represented by a binary number, which
when added to its corresponding positive equivalent results in zero.
In two’s complement form, a negative number is the 2’s complement of its positive
number with the subtraction of two numbers being A – B = A + ( 2’s complement of B
) using much the same process as before as basically, two’s complement is one’s
complement + 1.
The main advantage of two’s complement over the previous one’s complement is that
there is no double-zero problem plus it is a lot easier to generate the two’s complement
of a signed binary number. Therefore, arithmetic operations are relatively easier to
perform when the numbers are represented in the two’s complement format.
Let’s look at the subtraction of our two 8-bit numbers 115 and 27 from above using
two’s complement, and we remember from above that the binary equivalents are:
11510 in binary is: 0 1 1 1 0 0 1 1 2
2710 in binary is: 0 0 0 1 1 0 1 1 2
Our numbers are 8-bits long, then there are 28 digits available to represent our values
and in binary this equals: 1000000002 or 25610. Then the two’s complement of
2710 will be:
(28)2 – 00011011 = 100000000 – 00011011 = 111001012
The complementation of the second negative number means that the subtraction
becomes a much easier addition of the two numbers so therefore the sum
is: 115 + ( 2’s complement of 27 ) which is:
01110011 + 11100101 = 1 010110002
As previously, the 9th overflow bit is disregarded as we are only interested in the first
8-bits, so the result is: 010110002 or (64 + 16 + 8) = 8810 in decimal the same as
before.
4-bit Signed Binary Number Comparison
Decimal Signed Signed One’s Signed Two’s
Magnitude Complement Complement
+7 0111 0111 0111
+6 0110 0110 0110
+5 0101 0101 0101
+4 0100 0100 0100
+3 0011 0011 0011
+2 0010 0010 0010
+1 0001 0001 0001
+0 0000 0000 0000
-0 1000 1111 –
-1 1001 1110 1111
-2 1010 1101 1110
-3 1011 1100 1101
-4 1100 1011 1100
-5 1101 1010 1011
-6 1110 1001 1010
-7 1111 1000 1001
Signed-complement forms of binary numbers can use either 1’s complement or 2’s
complement. The 1’s complement and the 2’s complement of a binary number are
important because they permit the representation of negative numbers.
The method of 2’s complement arithmetic is commonly used in computers to handle
negative numbers the only disadvantage is that if we want to represent negative binary
numbers in the signed binary number format, we must give up some of the range of
the positive number we had before.
Cyclic Code
Cyclic Code is known to be a subclass of linear block codes where cyclic shift in the
bits of the codeword results in another codeword. It is quite important as it offers easy
implementation and thus finds applications in various systems.
Cyclic codes are widely used in satellite communication as the information sent
digitally is encoded and decoded using cyclic coding. These are error-correcting codes
where the actual information is sent over the channel by combining with the parity
bits.
Introduction
Cyclic codes are known to be a crucial subcategory of linear coding technique because
these offers efficient encoding and decoding schemes using a shift register. These are
used in error correction as they can check for double or burst errors. Various other
important codes like, Reed Solomon, Golay, Hamming, BCH, etc. can be represented
using cyclic codes.
Basically, a shift register and a modulo-2 adder are the two crucial elements
considered as building blocks of cyclic encoding. Using a shift register, encoding can
be efficiently performed. The fundamental elements of shift registers are flip flops
(that acts as a storage unit) and input-output. While the other i.e., a binary adder has
two inputs and one output.
For a given codeword C = [1011], the codeword polynomial will be given as:
C(X) = 1*X0 + 0*X1 + 1*X2 + 1*X3
C(X) = X3 + X2 + 1
In a similar way, for any message codeword m, the message polynomial
Therefore,
Hence, the obtained value of P(X) = 1
Now, substituting the values in codeword polynomial equation,
C(X) = X3 (X3 + X2 + 1) + 1
C(X) = 1 + X3 + X5 + X6
Hence, the codeword for the above code polynomial will be:
C = [1001011]
So, here the first 3 bits are parity bits and the last four bits are message bits. And we
can cross-check that we have considered [1011] as the message bits and parity
polynomial remainder was 1 i.e., code [100].
Hence, in this way encoding of non-systematic and systematic codewords is
performed.
Decoding
To understand how the detection of cyclic code takes place. Consider R(X) as received
polynomial, C(X) as the encoded polynomial, G(X) to be generator polynomial, and
E(X) as error polynomial.
Syndrome or error involved during transmission is given as:
Since R(X) is a combination of encoded polynomial and error polynomial thus above
equation can be written as:
Here, if the obtained remainder is 0 then there will be no error and if the obtained
remainder is not 0 then there will be an error that needs to be corrected.
This is so because actually coded bit does not contain error thus syndrome is not
required to be calculated.
Now, let us check for error polynomial. So, consider the error table given below where
we have assumed a single error in each of the bits of the code:
So, now using the syndrome for error polynomial formula:
We will determine, the erroneous bit. Consider the generator polynomial G(X) = X 3 +
X + 1 and dividing each error polynomial with it.
We will get,
S=X≠0
This means the received codeword contains an error. From the tabular representation,
it is clear that X has an error code [0100000]. Thus, this represents an error in the
second bit of the received code.
Hence, by using the same approach we can perform encoding and decoding using
cyclic code.
Parity Check
Parity check is done by adding an extra bit, called parity bit to the data to make
number of 1s either even in case of even parity, or odd in case of odd parity.
While creating a frame, the sender counts the number of 1s in it and adds the parity bit
in following way
In case of even parity: If number of 1s is even then parity bit value is 0. If number of
1s is odd then parity bit value is 1.
In case of odd parity: If number of 1s is odd then parity bit value is 0. If number of 1s
is even then parity bit value is 1.
On receiving a frame, the receiver counts the number of 1s in it. In case of even parity
check, if the count of 1s is even, the frame is accepted, otherwise it is rejected. Similar
rule is adopted for odd parity check.
Parity check is suitable for single bit error detection only.
Checksum
In this error detection scheme, the following procedure is applied
Data is divided into fixed sized frames or segments.
The sender adds the segments using 1’s complement arithmetic to get the sum. It then
complements the sum to get the checksum and sends it along with the data frames.
The receiver adds the incoming segments along with the checksum using 1’s
complement arithmetic to get the sum and then complements it.
If the result is zero, the received frames are accepted; otherwise they are discarded.
Cyclic Redundancy Check (CRC)
Cyclic Redundancy Check (CRC) involves binary division of the data bits being sent
by a predetermined divisor agreed upon by the communicating system. The divisor is
generated using polynomials.
Here, the sender performs binary division of the data segment by the divisor. It then
appends the remainder called CRC bits to the end of data segment. This makes the
resulting data unit exactly divisible by the divisor.
The receiver divides the incoming data unit by the divisor. If there is no remainder, the
data unit is assumed to be correct and is accepted. Otherwise, it is understood that the
data is corrupted and is therefore rejected.
Logic Gates
Logic gates play an important role in circuit design and digital systems. It is a building
block of a digital system and an electronic circuit that always have only one output.
These gates can have one input or more than one input, but most of the gates have two
inputs. On the basis of the relationship between the input and the output, these gates
are named as AND gate, OR gate, NOT gate, etc.
There are different types of gates which are as follows:
AND Gate
This gate works in the same way as the logical operator "and". The AND gate is a
circuit that performs the AND operation of the inputs. This gate has a minimum of 2
input values and an output value.
Y=A AND B AND C AND D……N
Y=A.B.C.D……N
Y=ABCD……N
Logic Design
Truth Table
OR Gate
This gate works in the same way as the logical operator "or". The OR gate is a circuit
which performs the OR operation of the inputs. This gate also has a minimum of 2
input values and an output value.
Y=A OR B OR C OR D……N
Y=A+B+C+D……N
Logic Design
Truth Table
NOT Gate
The NOT gate is also called an inverter. This gate gives the inverse value of the input
value as a result. This gate has only one input and one output value.
Y=NOT A
Y=A'
Logic Design
Truth Table
NAND Gate
The NAND gate is the combination of AND gate and NOT gate. This gate gives the
same result as a NOT-AND operation. This gate can have two or more than two input
values and only one output value.
Y=A NOT AND B NOT AND C NOT AND D……N
Y=A NAND B NAND C NAND D……N
Logic Design
Truth Table
NOR Gate
The NOR gate is the combination of an OR gate and NOT gate. This gate gives the
same result as the NOT-OR operation. This gate can have two or more than two input
values and only one output value.
Y=A NOT OR B NOT OR C NOT OR D……N
Y=A NOR B NOR C NOR D……N
Logic Design
Truth Table
XOR Gate
The XOR gate is also known as the Ex-OR gate. The XOR gate is used in half and full
adder and subtractor. The exclusive-OR gate is sometimes called as EX-OR and X-OR
gate. This gate can have two or more than two input values and only one output value.
Y=A XOR B XOR C XOR D……N
Y=A⨁B⨁C⨁D……N
Y=AB'+A'B
Logic Design
Truth Table
XNOR Gate
The XNOR gate is also known as the Ex-NOR gate. The XNOR gate is used in half
and full adder and subtractor. The exclusive-NOR gate is sometimes called as EX-
NOR and X-NOR gate. This gate can have two or more than two input values and only
one output value.
Y=A XNOR B XNOR C XNOR D……N
Y=A⊖B⊖C⊖D……N
Y=A'B'+AB
Logic Design
Truth Table
Boolean Algebra
Boolean Algebra is used to analyze and simplify the digital (logic) circuits. It uses
only the binary numbers i.e. 0 and 1. It is also called as Binary Algebra or logical
Algebra. Boolean algebra was invented by George Boole in 1854.
Rule in Boolean Algebra
Following are the important rules used in Boolean algebra.
Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW.
Complement of a variable is represented by an overbar (-). Thus, complement of
variable B is represented as . Thus if B = 0 then = 1 and B = 1 then = 0.
ORing of the variables is represented by a plus (+) sign between them. For example
ORing of A, B, C is represented as A + B + C.
Logical ANDing of the two or more variable is represented by writing a dot between
them such as A.B.C. Sometime the dot may be omitted like ABC.
Boolean Laws
There are six types of Boolean Laws.
Commutative law
Any binary operation which satisfies the following expression is referred to as
commutative operation.
Commutative law states that changing the sequence of the variables does not have any
effect on the output of a logic circuit.
Associative law
This law states that the order in which the logic operations are performed is irrelevant
as their effect is the same.
Distributive law
Distributive law states the following condition.
AND law
These laws use the AND operation. Therefore they are called as AND laws.
OR law
These laws use the OR operation. Therefore they are called as OR laws.
INVERSION law
This law uses the NOT operation. The inversion law states that double inversion of a
variable results in the original variable itself.
De Morgan's Theorems
De Morgan has suggested two theorems which are extremely useful in Boolean
Algebra. The two theorems are discussed below.
Theorem 1
The left hand side (LHS) of this theorem represents a NAND gate with inputs A and
B, whereas the right hand side (RHS) of the theorem represents an OR gate with
inverted inputs.
This OR gate is called as Bubbled OR.
Theorem 2
The LHS of this theorem represents a NOR gate with inputs A and B, whereas the
RHS represents an AND gate with inverted inputs.
This AND gate is called as Bubbled AND.
Table showing verification of the De Morgan's second theorem −
From the above table it is clear that minterm is expressed in product format and
maxterm is expressed in sum format.
Sum of minterms –
The minterms whose sum defines the Boolean function are those which give the 1’s of
the function in a truth table. Since the function can be either 1 or 0 for each minterm,
and since there are 2^n minterms, one can calculate all the functions that can be
formed with n variables to be (2^(2^n)). It is sometimes convenient to express a
Boolean function in its sum of minterm form.
Here the left side of the equation represents the output Y. So we can state equation no.
1
The output will be high (1) if A = 1 or BC = 1 or both are 1. The truth table for this
equation is shown by Table (a). The number of rows in the truth table is 2 n where n is
the number of input variables (n=3 for the given equation). Hence there are 2 3 = 8
possible input combination of inputs.
Karnaugh-map or K-map
The Boolean theorems and the De-Morgan's theorems are useful in manipulating the
logic expression. We can realize the logical expression using gates. The number of
logic gates required for the realization of a logical expression should be reduced to a
minimum possible value by K-map method. This method can be done in two different
ways, as discussed below.
Sum of Products (SOP) Form
It is in the form of sum of three terms AB, AC, BC with each individual term is a
product of two variables. Say A.B or A.C etc. Therefore such expressions are known
as expression in SOP form. The sum and products in SOP form are not the actual
additions or multiplications. In fact they are the OR and AND functions. In SOP form,
0 represents a bar and 1 represents an unbar. SOP form is represented by .
Given below is an example of SOP.
The above expression can be implemented with three AND gates in first stage and one
OR gate in second stage as shown in figure.
If bubbles are introduced at AND gates output and OR gates inputs (the same for NOR
gates), the above circuit becomes as shown in figure.
Now replace OR gate with input bubble with the NAND gate. Now we have circuit
which is fully implemented with just NAND gates.
Any logic function can be implemented using NOR gates. To achieve this, first the
logic function has to be written in Product of Sum (POS) form. Once it is converted to
POS, then it's very easy to implement using NOR gate. In other words any logic circuit
with OR gates in first level and AND gates in second level can be converted into a
NOR-NOR gate circuit.
F = (X+Y) . (Y+Z)
The above expression can be implemented with three OR gates in first stage and one
AND gate in second stage as shown in figure.
If bubble are introduced at the output of the OR gates and the inputs of AND gate, the
above circuit becomes as shown in figure.
Now replace AND gate with input bubble with the NOR gate. Now we have circuit
which is fully implemented with just NOR gates.
Minimization Technique
There are several methods for simplification of Boolean logic expressions. The
process is usually called logic minimization and the goal is to form a result which is
efficient. Two methods we will discuss are algebraic minimization and Karnaugh
maps. For very complicated problems the former method can be done using special
software analysis programs. Karnaugh maps are also limited to problems with up to 4
binary inputs. The Quine–McCluskey tabular method is used for more than 4 binary
inputs.
Introduction of K-Map (Karnaugh Map)
In many digital circuits and practical problems we need to find expression with
minimum variables. We can minimize Boolean expressions of 3, 4 variables very
easily using K-map without using any Boolean algebra theorems. K-map can take two
forms Sum of Product (SOP) and Product of Sum (POS) according to the need of
problem. K-map is table like representation but it gives more information than
TRUTH TABLE. We fill grid of K-map with 0’s and 1’s then solve it by making
groups.
Steps to solve expression using K-map-
1. Select K-map according to the number of variables.
2. Identify minterms or maxterms as given in problem.
3. For SOP put 1’s in blocks of K-map respective to the minterms (0’s elsewhere).
4. For POS put 0’s in blocks of K-map respective to the maxterms(1’s elsewhere).
5. Make rectangular groups containing total terms in power of two like 2,4,8 ..(except 1)
and try to cover as many elements as you can in one group.
6. From the groups made in step 5 find the product terms and sum them up for SOP form.
SOP FORM :
1. K-map of 3 variables –
POS FORM :
1. K-map of 3 variables –
Circuit Diagram
Full Adder
Full adder is developed to overcome the drawback of Half Adder circuit. It can add two one-bit
numbers A and B, and carry c. The full adder is a three input and two output combinational circuit.
Block diagram
Truth Table
Circuit Diagram
Half Subtractors
Half subtractor is a combination circuit with two inputs and two outputs (difference and borrow). It
produces the difference between the two binary bits at the input and also produces an output
(Borrow) to indicate if a 1 has been borrowed. In the subtraction (A-B), A is called as Minuend bit
and B is called as Subtrahend bit.
Truth Table
Circuit Diagram
Full Subtractors
The disadvantage of a half subtractor is overcome by full subtractor. The full subtractor is a
combinational circuit with three inputs A,B,C and two output D and C'. A is the 'minuend', B is
'subtrahend', C is the 'borrow' produced by the previous stage, D is the difference output and C' is
the borrow output.
Truth Table
Circuit Diagram
Multiplexers
Multiplexer is a special type of combinational circuit. There are n-data inputs, one output and m
select inputs with 2m = n. It is a digital circuit which selects one of the n data inputs and routes it to
the output. The selection of one of the n inputs is done by the selected inputs. Depending on the
digital code applied at the selected inputs, one out of n data sources is selected and transmitted to
the single output Y. E is called the strobe or enable input which is useful for the cascading. It is
generally an active low terminal that means it will perform the required operation when it is low.
Block diagram
Multiplexers come in multiple variations
2 : 1 multiplexer
4 : 1 multiplexer
16 : 1 multiplexer
32 : 1 multiplexer
Block Diagram
Truth Table
Demultiplexers
A demultiplexer performs the reverse operation of a multiplexer i.e. it receives one input and
distributes it over several outputs. It has only one input, n outputs, m select input. At a time only
one output line is selected by the select lines and the input is transmitted to the selected output line.
A de-multiplexer is equivalent to a single pole multiple way switch as shown in fig.
Demultiplexers comes in multiple variations.
1 : 2 demultiplexer
1 : 4 demultiplexer
1 : 16 demultiplexer
1 : 32 demultiplexer
Block diagram
Truth Table
Decoder
A decoder is a combinational circuit. It has n input and to a maximum m = 2n outputs. Decoder is
identical to a demultiplexer without any data input. It performs operations which are exactly
opposite to those of an encoder.
Block diagram
Code converters
BCD to seven segment decoders
Nixie tube decoders
Relay actuator
2 to 4 Line Decoder
The block diagram of 2 to 4 line decoder is shown in the fig. A and B are the two inputs where D
through D are the four outputs. Truth table explains the operations of a decoder. It shows that each
output is 1 for only a specific combination of inputs.
Block diagram
Truth Table
Logic Circuit
Encoder
Encoder is a combinational circuit which is designed to perform the inverse operation of the
decoder. An encoder has n number of input lines and m number of output lines. An encoder
produces an m bit binary code corresponding to the digital input number. The encoder accepts an n
input digital word and converts it into an m bit another digital word.
Block diagram
Priority encoders
Decimal to BCD encoder
Octal to binary encoder
Hexadecimal to binary encoder
Priority Encoder
This is a special type of encoder. Priority is given to the input lines. If two or more input line are 1
at the same time, then the input line with highest priority will be considered. There are four input
D0, D1, D2, D3 and two output Y0, Y1. Out of the four input D3 has the highest priority and D0 has the
lowest priority. That means if D3 = 1 then Y1 Y1 = 11 irrespective of the other inputs. Similarly if
D3 = 0 and D2 = 1 then Y1 Y0 = 10 irrespective of the other inputs.
Block diagram
Truth Table
Logic Circuit
Sequential Circuits
In our previous sections, we learned about combinational circuit and their working. The
combinational circuits have set of outputs, which depends only on the present combination of
inputs. Below is the block diagram of the synchronous logic circuit.
The sequential circuit is a special type of circuit that has a series of inputs and outputs. The outputs
of the sequential circuits depend on both the combination of present inputs and previous outputs.
The previous output is treated as the present state. So, the sequential circuit contains the
combinational circuit and its memory storage elements. A sequential circuit doesn't need to always
contain a combinational circuit. So, the sequential circuit can contain only the memory element.
Difference between the combinational circuits and sequential circuits are given below:
Combinational Circuits Sequential Circuits
1) The outputs of the combinational circuit The outputs of the sequential circuits depend
depend only on the present inputs. on both present inputs and present
state(previous output).
2) The feedback path is not present in the The feedback path is present in the sequential
combinational circuit. circuits.
4) The clock signal is not required for The clock signal is required for sequential
combinational circuits. circuits.
5) The combinational circuit is simple to design. It is not simple to design a sequential circuit.
Types of Sequential Circuits
Asynchronous sequential circuits
The clock signals are not used by the Asynchronous sequential circuits. The asynchronous circuit
is operated through the pulses. So, the changes in the input can change the state of the circuit. The
asynchronous circuits do not use clock pulses. The internal state is changed when the input variable
is changed. The un-clocked flip-flops or time-delayed are the memory elements of asynchronous
sequential circuits. The asynchronous sequential circuit is similar to the combinational circuits with
feedback.
Synchronous sequential circuits
In synchronous sequential circuits, synchronization of the memory element's state is done by the
clock signal. The output is stored in either flip-flops or latches(memory devices). The
synchronization of the outputs is done with either only negative edges of the clock signal or only
positive edges.
Clock Signal and Triggering
Clock signal
A clock signal is a periodic signal in which ON time and OFF time need not be the same. When ON
time and OFF time of the clock signal are the same, a square wave is used to represent the clock
signal. Below is a diagram which represents the clock signal:
A clock signal is considered as the square wave. Sometimes, the signal stays at logic, either high
5V or low 0V, to an equal amount of time. It repeats with a certain time period, which will be equal
to twice the 'ON time' or 'OFF time'.
Types of Triggering
These are two types of triggering in sequential circuits:
Level triggering
The logic High and logic Low are the two levels in the clock signal. In level triggering, when the
clock pulse is at a particular level, only then the circuit is activated. There are the following types of
level triggering:
Positive level triggering
In a positive level triggering, the signal with Logic High occurs. So, in this triggering, the circuit is
operated with such type of clock signal. Below is the diagram of positive level triggering:
Negative level triggering
In negative level triggering, the signal with Logic Low occurs. So, in this triggering, the circuit is
operated with such type of clock signal. Below is the diagram of Negative level triggering:
Edge triggering
In clock signal of edge triggering, two types of transitions occur, i.e., transition either from Logic
Low to Logic High or Logic High to Logic Low.
Based on the transitions of the clock signal, there are the following types of edge triggering:
Positive edge triggering
The transition from Logic Low to Logic High occurs in the clock signal of positive edge triggering.
So, in positive edge triggering, the circuit is operated with such type of clock signal. The diagram
of positive edge triggering is given below.
Q Q STAT
’ E
1 0 Set
0 1 Reset
Under normal conditions, both the input remains 0. The following is the RS Latch with NAND
gates:
Gated SR Latch –
A Gated SR latch is a SR latch with enable input which works when enable is 1 and retain the
previous state when enable is 0.
Gated D Latch –
D latch is similar to SR latch with some modifications made. Here, the inputs are complements of
each other. The letter in the D latch stands for “data” as this latch stores single bit temporarily.
The design of D latch with Enable signal is given below:
The truth table for the D-Latch is shown below:
Advantages of Latches:
1. Easy to Implement: Latches are simple digital circuits that can be easily implemented using
basic digital logic gates.
2. Low Power Consumption: Latches consume less power compared to other sequential circuits
such as flip-flops.
3. High Speed: Latches can operate at high speeds, making them suitable for use in high-speed
digital systems.
4. Low Cost: Latches are inexpensive to manufacture and can be used in low-cost digital systems.
5. Versatility: Latches can be used for various applications, such as data storage, control circuits,
and flip-flop circuits.
Disadvantages of Latches:
1. No Clock: Latches do not have a clock signal to synchronize their operations, making their
behavior unpredictable.
2. Unstable State: Latches can sometimes enter into an unstable state when both inputs are at 1.
This can result in unexpected behavior in the digital system.
3. Complex Timing: The timing of latches can be complex and difficult to specify, making them
less suitable for real-time control applications.
The maximum possible groupings of adjacent ones are already shown in the figure. Therefore,
the simplified expression for next state Qt+1�+1 is
Q(t+1)=S+R′Q(t)�(�+1)=�+�′�(�)
D Flip-Flop
D flip-flop operates with only positive clock transitions or negative clock transitions. Whereas, D
latch operates with enable signal. That means, the output of D flip-flop is insensitive to the changes
in the input, D except for active transition of the clock signal. The circuit diagram of D flip-flop is
shown in the following figure.
This circuit has single input D and two outputs Qt� & Qt�’. The operation of D flip-flop is
similar to D Latch. But, this flip-flop affects the outputs only when positive transition of the clock
signal is applied instead of active enable.
The following table shows the state table of D flip-flop.
D Qt + 1t + 1
0 0
1 1
Therefore, D flip-flop always Hold the information, which is available on data input, D of earlier
positive transition of clock signal. From the above state table, we can directly write the next state
equation as
Qt+1�+1 = D
Next state of D flip-flop is always equal to data input, D for every positive transition of the clock
signal. Hence, D flip-flops can be used in registers, shift registers and some of the counters.
JK Flip-Flop
JK flip-flop is the modified version of SR flip-flop. It operates with only positive clock transitions
or negative clock transitions. The circuit diagram of JK flip-flop is shown in the following figure.
This circuit has two inputs J & K and two outputs Qt� & Qt�’. The operation of JK flip-flop is
similar to SR flip-flop. Here, we considered the inputs of SR flip-flop as S = J Qt�’ and R =
KQt� in order to utilize the modified SR flip-flop for 4 combinations of inputs.
The following table shows the state table of JK flip-flop.
J K Qt+1�+1
0 0 Qt�
0 1 0
1 0 1
1 1 Qt�'
Here, Qt� & Qt+1�+1 are present state & next state respectively. So, JK flip-flop can be used for
one of these four functions such as Hold, Reset, Set & Complement of present state based on the
input conditions, when positive transition of clock signal is applied. The following table shows
the characteristic table of JK flip-flop.
Present Inputs Present State Next State
J K Qt� Qt+1�+1
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
By using three variable K-Map, we can get the simplified expression for next state,
Qt+1�+1. Three variable K-Map for next state, Qt+1�+1 is shown in the following figure.
The maximum possible groupings of adjacent ones are already shown in the figure. Therefore,
the simplified expression for next state Qt+1�+1 is
Q(t+1)=JQ(t)′+K′Q(t)�(�+1)=��(�)′+�′�(�)
T Flip-Flop
T flip-flop is the simplified version of JK flip-flop. It is obtained by connecting the same input ‘T’
to both inputs of JK flip-flop. It operates with only positive clock transitions or negative clock
transitions. The circuit diagram of T flip-flop is shown in the following figure.
This circuit has single input T and two outputs Qt� & Qt�’. The operation of T flip-flop is same
as that of JK flip-flop. Here, we considered the inputs of JK flip-flop as J = T and K = T in order to
utilize the modified JK flip-flop for 2 combinations of inputs. So, we eliminated the other two
combinations of J & K, for which those two values are complement to each other in T flip-flop.
The following table shows the state table of T flip-flop.
D Qt+1�+1
0 Qt�
1 Qt�’
Here, Qt� & Qt+1�+1 are present state & next state respectively. So, T flip-flop can be used for
one of these two functions such as Hold, & Complement of present state based on the input
conditions, when positive transition of clock signal is applied. The following table shows
the characteristic table of T flip-flop.
Inputs Present State Next State
T Qt� Qt+1�+1
0 0 0
0 1 1
1 0 1
1 1 0
From the above characteristic table, we can directly write the next state equation as
⇒Q(t+1)=T⊕Q(t)⇒�(�+1)=�⊕�(�)
Q(t+1)=T′Q(t)+TQ(t)′�(�+1)=�′�(�)+��(�)′
The output of T flip-flop always toggles for every positive transition of the clock signal, when input
T remains at logic High 11. Hence, T flip-flop can be used in counters.
In this chapter, we implemented various flip-flops by providing the cross coupling between NOR
gates. Similarly, you can implement these flip-flops by using NAND gates.
Digital Registers
Flip-flop is a 1 bit memory cell which can be used for storing the digital data. To increase the
storage capacity in terms of number of bits, we have to use a group of flip-flop. Such a group of
flip-flop is known as a Register. The n-bit register will consist of n number of flip-flop and it is
capable of storing an n-bit word.
The binary data in a register can be moved within the register from one flip-flop to another. The
registers that allow such data transfers are called as shift registers. There are four mode of
operations of a shift register.
Serial Input Serial Output
Serial Input Parallel Output
Parallel Input Serial Output
Parallel Input Parallel Output
Bidirectional Shift Register
If a binary number is shifted left by one position then it is equivalent to multiplying the
original number by 2. Similarly if a binary number is shifted right by one position then it is
equivalent to dividing the original number by 2.
Hence if we want to use the shift register to multiply and divide the given binary number,
then we should be able to move the data in either left or right direction.
Such a register is called bi-directional register. A four bit bi-directional shift register is
shown in fig.
There are two serial inputs namely the serial right shift data input DR, and the serial left shift
data input DL along with a mode select input (M).
Block Diagram
Operation
S.N. Condition Operation
1 With M = 1 − Shift right operation If M = 1, then the AND gates 1, 3, 5 and 7 are
enabled whereas the remaining AND gates 2, 4,
6 and 8 will be disabled.
The data at DR is shifted to right bit by bit from
FF-3 to FF-0 on the application of clock pulses.
Thus with M = 1 we get the serial right shift
operation.
2 With M = 0 − Shift left operation When the mode control M is connected to 0
then the AND gates 2, 4, 6 and 8 are enabled
while 1, 3, 5 and 7 are disabled.
The data at DL is shifted left bit by bit from FF-
0 to FF-3 on the application of clock pulses.
Thus with M = 0 we get the serial right shift
operation.
Universal Shift Register
A shift register which can shift the data in only one direction is called a uni-directional shift
register. A shift register which can shift the data in both directions is called a bi-directional shift
register. Applying the same logic, a shift register which can shift the data in both directions as well
as load it parallely, is known as a universal shift register. The shift register is capable of performing
the following operation −
Parallel loading
Left Shifting
Right shifting
The mode control input is connected to logic 1 for parallel loading operation whereas it is
connected to 0 for serial shifting. With mode control pin connected to ground, the universal shift
register acts as a bi-directional register. For serial left operation, the input is applied to the serial
input which goes to AND gate-1 shown in figure. Whereas for the shift right operation, the serial
input is applied to D input.
Block Diagram
Digital Counters
Counter is a sequential circuit. A digital circuit which is used for a counting pulses is known
counter. Counter is the widest application of flip-flops. It is a group of flip-flops with a clock signal
applied. Counters are of two types.
Asynchronous or ripple counters.
Synchronous counters.
Asynchronous or ripple counters
The logic diagram of a 2-bit ripple up counter is shown in figure. The toggle (T) flip-flop are being
used. But we can use the JK flip-flop also with J and K connected permanently to logic 1. External
clock is applied to the clock input of flip-flop A and Q A output is applied to the clock input of the
next flip-flop i.e. FF-B.
Logical Diagram
Operation
S.N Condition Operation
.
1 Initially let both the FFs be in the reset state QBQA = 00 initially
2 After 1st negative clock edge As soon as the first negative clock edge
is applied, FF-A will toggle and QA will
be equal to 1.
QA is connected to clock input of FF-B.
Since QA has changed from 0 to 1, it is
treated as the positive clock edge by FF-
B. There is no change in QB because FF-
B is a negative edge triggered FF.
QBQA = 01 after the first clock pulse.
3 After 2nd negative clock edge On the arrival of second negative clock
edge, FF-A toggles again and QA = 0.
The change in QA acts as a negative
clock edge for FF-B. So it will also
toggle, and QB will be 1.
QBQA = 10 after the second clock pulse.
4 After 3rd negative clock edge On the arrival of 3rd negative clock
edge, FF-A toggles again and
QA become 1 from 0.
Since this is a positive going change,
FF-B does not respond to it and remains
inactive. So QB does not change and
continues to be equal to 1.
QBQA = 11 after the third clock pulse.
5 After 4th negative clock edge On the arrival of 4th negative clock
edge, FF-A toggles again and
QA becomes 1 from 0.
This negative change in QA acts as clock
pulse for FF-B. Hence it toggles to
change QB from 1 to 0.
QBQA = 00 after the fourth clock pulse.
Truth Table
Classification of counters
Depending on the way in which the counting progresses, the synchronous or asynchronous counters
are classified as follows −
Up counters
Down counters
Up/Down counters
Synchronous Sequential Circuits in Digital Logic
Synchronous sequential circuits are digital circuits that use clock signals to determine the timing of
their operations. They are commonly used in digital systems to implement timers, counters, and
memory elements.
1. In a synchronous sequential circuit, the state of the circuit changes only on the rising or falling
edge of the clock signal, and all changes in the circuit are synchronized to this clock. This
makes the behavior of the circuit predictable and ensures that all elements of the circuit change
at the same time, preventing race conditions and making the circuit easier to design and debug.
2. Synchronous sequential circuits can be implemented using flip-flops, which are circuits that
store binary values and maintain their state even when the inputs change. The output of the flip-
flops is determined by the current inputs and the previous state stored in the flip-flops, and the
next state is determined by the state transition function, which is a Boolean function that
describes the behavior of the circuit.
3. In summary, synchronous sequential circuits are digital circuits that use clock signals to
determine the timing of their operations. They are commonly used in digital systems to
implement timers, counters, and memory elements and are essential components in digital
systems design.
Steps to solve a problem:
1. Draw the state diagram from the problem statement or from the given state
table. Example: Serial Adder. The functioning of serial adder can be depicted by the following
state diagram. X1 and X2 are inputs, A and B are states representing
carry.
2. Draw the state table. If there is any redundant state then reduce the state
table.
3. Select state assignment i.e. assign binary numbers to the states according to total number states.
Also decide the memory element (flip-flops) for the circuit. A -> 0 B -> 1 4. Replace the
assignments in the state table to obtain Transition
table:
5. Separate the output table from the transition
table.
z = x1x’2y+x’1x2y’+x1x2y+x1x’2y’
6. Excitation table for the flip-flop is obtained from the transition table using the output of flip-
flops.
This article is contributed by Kriti Kushwaha
Please write comments if you find anything incorrect, or you want to share more information about
the topic discussed above.
Advantages of Synchronous Sequential Circuits:
1. Predictable behavior: The use of a clock signal makes the behavior of a synchronous sequential
circuit predictable and deterministic, which is important for real-time control applications.
2. Synchronization: Synchronous sequential circuits ensure that all elements of the circuit change
at the same time, preventing race conditions and making the circuit easier to design and debug.
3. Timing constraints: The timing constraints in a synchronous sequential circuit are well-defined,
making it easier to design and test the circuit.
4. Easy to implement: Synchronous sequential circuits can be implemented using flip-flops, which
are simple and widely available digital components.
Disadvantages of Synchronous Sequential Circuits:
1. Clock skew: Clock skew is a timing error that occurs when the clock signal arrives at different
flip-flops at different times. This can cause errors in the operation of the circuit.
2. Timing jitter: Timing jitter is a variation in the arrival time of the clock signal that can cause
errors in the operation of the circuit.
3. Complex design: The design of synchronous sequential circuits can be complex, especially for
large systems with many state transitions.
4. Power consumption: The use of a clock signal increases the power consumption of a
synchronous sequential circuit compared to asynchronous sequential circuits.
Disadvantages –
Some asynchronous circuits may require extra power for certain operations.
More difficult to design and subject to problems like sensitivity to the relative arrival times of
inputs at gates. If transitions on two inputs arrive at almost the same time, the circuit can go into
the wrong state depending on slight differences in the propagation delays of the gates which are
known as race condition.
The number of circuit elements (transistors) maybe double that of synchronous circuits. Fewer
people are trained in this style compared to synchronous design. Difficult to test and debug.
Their output is uncertain.
The performance of asynchronous circuits may be reduced in architectures that have a complex
data path. Lack of dedicated, asynchronous design-focused commercial EDA tools.
Unpredictable behavior: The lack of a clock signal makes the behavior of asynchronous
sequential circuits unpredictable, which can make them harder to design and debug.
Timing constraints: The timing constraints in asynchronous sequential circuits are more
complex and difficult to specify compared to synchronous sequential circuits.
Complex design: The design of asynchronous sequential circuits can be complex, especially for
large systems with many state transitions.
Limited use: Asynchronous sequential circuits are not suitable for real-time control
applications, where a clock signal is required to ensure predictable behavior.