Professional Documents
Culture Documents
Topics to be covered: Construction and working of a CMOS NOT, NAND and NOR gates.
Building blocks of digital electronic systems – logic gates, flip-flops (SR, D, T, and JK types),
MUX, DEMUX, counters (synchronous and asynchronous types), shift registers (SISO, SIPO,
PISO, PIPO types), encoders, decoders, priority encoders, comparators. Working of DAC and
ADC.
The main advantage of CMOS over NMOS and BIPOLAR technology is the much smaller
power dissipation. Unlike NMOS or BIPOLAR circuits, a Complementary MOS circuit has
almost no static power dissipation. Power is only dissipated in case the circuit actually switches.
This allows integrating more CMOS gates on an IC than in NMOS or bipolar technology,
resulting in much better performance. Complementary Metal Oxide Semiconductor transistor
consists P-channel MOS (PMOS) and N-channel MOS (NMOS).
CMOS Transistor
NMOS
N-channel MOSFET is built on a p-type substrate with n-type source and drain diffused on it. In
NMOS, the majority carriers are electrons. When a high voltage is applied to the gate, the
NMOS will conduct. Similarly, when a low voltage is applied to the gate, NMOS will not
conduct. NMOS are considered to be faster than PMOS, since the carriers in NMOS, which are
electrons, travel twice as fast as the holes.
PMOS
P-channel MOSFET consists P-type Source and Drain diffused on an N-type substrate. Majority
carriers are holes. When a high voltage is applied to the gate, the PMOS will not conduct. When
a low voltage is applied to the gate, the PMOS will conduct. The PMOS devices are more
immune to noise than NMOS devices.
The inverter circuit is as shown in the figure below. It consists of PMOS and NMOS FET. The
input A serves as the gate voltage for both transistors.
The NMOS transistor has an input from Vss (ground) and PMOS transistor has an input from Vdd.
The terminal Y is output.
When a low-level voltage (<Vdd, ~0v) applied to the input terminal (A) of the inverter, the
NMOS is switched OFF and PMOS is switched ON. So the output becomes Vdd or the circuit is
pulled up to Vdd. So output Y=1
When a high voltage (~ Vdd) is given at input terminal (A) of the inverter, the PMOS is OFF and
NMOS is switched ON so the output will be pulled down to Vss. So output Y=0
If either input A or B is logic 0, at least one of the NMOS transistors will be OFF, breaking the
path from Y to Ground. But at least one of the PMOS transistors will be ON, creating a path
from Y to Vdd. Hence, the output Y will be high. If both inputs are high, both of the NMOS
transistors will be ON and both of the PMOS transistors will be OFF. Hence, the output will be
logic low. The truth table of NAND logic gate given in below table.
CMOS Applications: Complementary MOS processes were widely implemented and have
fundamentally replaced NMOS and bipolar processes for nearly all digital logic applications.
The CMOS technology has been used for the following digital IC designs.
Digital electronics deals with the manipulation of numbers. This is achieved by representing
numbers in a digital form and using logic operations to provide the processing needed. To
achieve this there is a large variety of different types of logic gate and digital circuit building
blocks that can be employed.
LOGIC GATES:
A logic gate is an elementary building block of a digital circuit. Most logic gates have two inputs
and one output. At any given moment, every terminal is in one of the two binary conditions low
(0) or high (1), represented by different voltage levels. The logic state of a terminal can change
often, as the circuit processes data. In most logic gates, the low state is approximately zero volts
(0 V), while the high state is approximately five volts positive (+5 V).
There are seven basic logic gates: AND, OR, ExOR, NOT, NAND, NOR, and Ex-NOR.
NOT: The NOT gate is possibly the simplest type of logic gate. It takes a single input
and inverts it. Using this logic gate or logic circuit, a logic "1" becomes logic "0" and a
logic "0" becomes logic "1".
Truth Table
A B
0 1
1 0
AND / NAND: The AND and NAND logic gates are normally viewed together because the
output of one is the inverse of the other. The basic function of this type of logic gate is the same.
AND gate, produces an output of "1" only when both inputs are "1", otherwise it produces a "0".
The NAND type of logic gate produces the inverse of this.
Truth Table
A B C
0 0 0
1 0 0
0 1 0
1 1 1
Truth Table
A B C
0 0 1
1 0 1
0 1 1
1 1 0
OR / NOR: OR gates and NOR gates are another form of logic gate that form one of the basic
building blocks of digital technology. The OR gate gives a logical "1" when one of the either
inputs (or both inputs) is high.
Similarly the NOR gate is the inverse of this and goes low, "0" when one or the either inputs (or
both inputs) is high.
Truth Table
A B C
0 0 0
1 0 1
0 1 1
1 1 1
Exclusive OR / Exclusive NOR: An exclusive OR (or) exclusive NOR type of logic gate is
used where an output change is only required when one of the either input is high or low and not
both.
Truth Table
A B C
0 0 0
1 0 1
0 1 1
1 1 0
Truth Table
A B C
0 0 1
1 0 0
0 1 0
1 1 1
Block Diagram
Sequential Circuit- Sequential circuits are those which are dependent on clock cycles and
depend on present as well as past inputs to generate any output.
Block Diagram –
Flip-Flops
Flip flops are actually an application of logic gates. A flip flop is an electronic circuit with two
stable states that can be used to store binary data. The stored data can be changed by applying
varying inputs. Flip flops can also be considered as the most basic idea of a Random Access
Memory [RAM]. When a certain input value is given to them, they will be remembered and
executed, if the logic gates are designed correctly. A higher application of flip flops is helpful in
designing better electronic circuits.
The most commonly used application of flip flops is in the implementation of a feedback circuit.
As a memory relies on the feedback concept, flip flops can be used to design it.
There are mainly four types of flip flops that are used in electronic circuits. They are
The SET-RESET flip flop is designed with the help of two NOR gates and also two NAND
gates. These flip flops are also called S-R Latch.
The design of such a flip flop includes two inputs, called the SET [S] and RESET [R]. There are
also two outputs, Q and Q‟. The diagram and truth table is shown below.
From the diagram it is evident that the flip flop has mainly four states. They are
S=1, R=0—Q=1, Q’=0 This state is also called the SET state.
In both the states you can see that the outputs are just compliments of each other and that the
value of Q follows the value of S.
The circuit of the S-R flip flop using NAND Gate and its truth table is shown below.
S-R flip flop with NAND gate has four states. They are
S=1, R=0—Q=0, Q’=1 This state is also called the SET state.
In both the states you can see that the outputs are just compliments of each other and that the
value of Q follows the compliment value of S.
If both the values of S and R are switched to 0 it is an invalid state because the values of both Q
and Q‟ are 1. They are supposed to be compliments of each other. Normally, this state must be
avoided.
If both the values of S and R are switched to 1, then the circuit remembers the value of S and R
in their previous state.
Clocked S-R Flip Flop
It is also called a Gated S-R flip flop. The problems with S-R flip flops using NOR and NAND
gates is the invalid state. This problem can be overcome by using a bi-stable SR flip-flop that can
change outputs when certain invalid states are met, regardless of the condition of either the Set or
the Reset inputs. For this, a clocked S-R flip flop is designed by adding two NAND gates to a
basic NAND Gate flip flop. The circuit diagram and truth table is shown below.
Clk S R Q State
0 X X No change Memory
1 0 0 No change Memory
1 0 1 Q=0 Reset
1 1 0 Q=1 Set
1 1 1 Invalid Not Used
In this circuit, the output is changed (i.e. the stored data is changed) only when you give an
active clock signal. Otherwise, even if the S or R is active the data will not change.
D Flip Flop
D flip flop is actually a slight modification of the clocked SR flip-flop. From the figure you can
see that the D input is connected to the S input and the complement of the D input is connected
to the R input. The D input is passed on to the flip flop when the value of CP is „1‟.
Clock D Qn+1
0 X 0
1 0 0
1 1 1
In a D flip flop, the output can be only changed at the clock edge, and if the input changes at
other times, the output will be unaffected.
The change of state of the output is dependent on the rising edge of the clock. The output (Q) is
same as the input and can only change at the rising edge of the clock.
J-K Flip-flop
A J-K flip flop can also be defined as a modification of the S-R flip flop. The only difference is
that the intermediate state is more refined and precise than that of a S-R flip flop.
The behavior of inputs J and K is same as the S and R inputs of the S-R flip flop. The letter J
stands for SET and the letter K stands for CLEAR.
When both the inputs J and K have a HIGH state, the flip-flop switch to the complement state.
So, for a value of Q = 1, it switches to Q=0 and for a value of Q = 0, it switches to Q=1.
The input condition of J=K=1, gives an output inverting the output state. However, the outputs
are same when one tests the circuit practically.
Clk J K Qn+1
0 X X Memory
1 0 0 Memory
1 1 0 1
1 0 1 0
1 1 1 Qn (Compliment of Qn)
T Flip Flop
A T flip flops is like JK flip-flop. These are basically single input version of JK flip flops. This
modified form of JK flip-flop is obtained by connecting both inputs J and K together. This flip-
flop has only one input along with the clock input.
These flip-flops are called T flip-flops because of their ability to complement its state (i.e.)
Toggle, hence the name Toggle flip-flop.
Truth Table
Clk T Q n+1
0 X Qn(Memory)
1 0 Qn(Memory) as J=0 & K=0
1 1 Qn (Compliment of Qn) Toggling state
as J=1 & K=1
Multiplexer
Multiplexer is a logic circuit that gives single output by accepting multiple data input.
Multiplexer consists of the control signal or data select input that determine which input is
connected to the output, and also to increase the amount of data that can be sent over a network
within certain time. It is also called a data selector. It is referred to as many to one circuit due to
its ability to select the single output from multiple inputs.
The figure below shows the circuit of a MUX including input, output and control signals.
It works as a multi-position switch which is digitally controlled by the control signals. Here, the
select lines determine which input will get switched to output among several inputs. As we can
see in the figure shown above that n input signal is fed to a MUX, containing m control signals.
However, only 1 data source is transmitted to output.
A relation exists between the input and select lines which is noteworthy and is given by:
2m = n
where: m is the select lines and n is the input lines
We can have several configurations of multiplexer depending on input lines and the control
signal applied to it.
Consider a 4 to 1 multiplexer that consists of 4 input signals along with 2 control signals, in
order to provide a single output.
Here, 4 input bits applied to the MUX are D0, D1, D2, D3 and the control signals are „a‟ and „b‟.
So, any data input can be transmitted to output on changing the level of the control signal.
4:1 Multiplexer
The truth table for the multiplexer is shown below. Let us consider 4 separate cases in order to
understand the variation in output by controlling the level of control signals.
Case 1: Consider that both the applied control signals „a‟ and „b‟ are low i.e., 0. In such a
condition due to the presence of NOT gate inputs I1 and I2 of only AND gate 1 is high. So, if the
input bit of D0 is high then the output is high and if the input of D0 is low then AND gate
generates its output as 0.
Thus, with control signal level 00 only A1 is enabled and all others get disable hence output
achieved is the reflection of data bit associated with A1.
Case 2: When control signal „a‟ is low and „b‟ is high then it causes AND gate 2 to be enabled as
I1 and I2 of A2 will be high. So, input bit D1 decides the output of A2. If D1 is high, the output
will be 1 otherwise 0.
Case 3: Now consider that level of control signal „a‟ is high and that of „b‟ is low. This enables
only AND gate 3 as inputs I1 and I2 of A3 is high in this condition. So, applied input bit D2 will
provide the desired bit at the output.
Case 4: Let us now consider the case when the level of both the applied control signals is high or
1. Then due to this only gate, A4 gets enabled while all others get disabled. Due to this, the
output will be the result of applied input D3.
Demultiplexer
De-multiplexer is also a logic device with one input and multiple output lines. It switches a
single input to several outputs. Here also control signal plays a major role by deciding the output
to which the input is to be passed. It is also known as data distributor as it allows a single input to
be distributed among multiple outputs.
DEMUX configuration is as shown below that have only one input but „m‟ control and „n‟ output
lines.
Consider a 1:4 de-multiplexer consisting of data bit D, with 2 control signals „a‟ and „b‟.
Here, Z0, Z1, Z2, Z3 are the 4 output provided by the de-multiplexer.
As already explained that for a particular value of control signal only a single AND gate is
enabled while all others get disabled.
Counter is a device which stores (and sometimes displays) the number of times a particular
event or process has occurred, often in relationship to a clock signal. Counters are used in digital
electronics for counting purpose, they can count specific event happening in the circuit. For
example, in UP counter a counter increases count for every rising edge of clock. Not only
counting, a counter can follow the certain sequence based on design. They are designed with the
help of flip flops.
1. Asynchronous Counter
In asynchronous counter universal clock is not used, only first flip flop is driven by main clock
and the clock input of rest of the counters is driven by output of previous flip flops. This can be
understood by following diagram-
It is evident from timing diagram that Q0 is changing as soon as the falling edge of clock pulse is
encountered, Q1 is changing when falling edge of Q0 is encountered (because Q0 is clock pulse
for second flip flop), Q2 is changing when falling edge of Q1 is encountered (because Q1 is clock
pulse for third flip flop) Q3 is changing when falling edge of Q2 is encountered (because Q2 is
clock pulse for fourth flip flop). In this way ripples are generated through Q0, Q1, Q2, Q3 hence it
is also called RIPPLE counter.
2. Synchronous Counter
Synchronous counter has one global clock which drives each flip flop so output changes in
parallel. The one advantage of synchronous counter over asynchronous counter is, it can operate
on higher frequency than asynchronous counter as it does not have cumulative delay because of
same clock is given to each flip flop.
Shift registers are categorized into types majorly by their mode of operation, either serial or
parallel. There are four (4) basic types of shift registers:
Serial in – Serial out shift registers are shift registers that streams in data serially (one bit per
clock cycle) and streams out data too in the same way, one after the other.
1. At the first clock pulse, the data at “data in” will be present at the Stage A output.
2. After the second pulse stage A data is transferred to stage B output, and data at “data
in” is transferred to stage A output.
3. After the third clock pulse, stage C is replaced by stage B output; stage B is replaced
by stage A output; and stage A is replaced by data present at “data in”.
4. After the fourth clock, the data which was first present at “data in” is at stage D output.
5. The “first in” data is “first out” as it is shifted from “data in” to “data out”.
These types of shift registers are used for the conversion of data from serial to parallel. The data
comes in one after the other per clock cycle and can either be shifted or replaced or be read off
at each output. This means when the data is read in, each read in bit becomes available
simultaneously on their respective output line (QA to QD for the 4-bit shift register shown below).
3. Parallel in – Serial out Shift Register
For this type of shift register, the data is supplied in parallel, for example consider the 4-bit shift
register shown below.
This register can be used to store and shift a 4-bit word, with the write/shift (WS) control input
controlling the mode of operation of the shift register. When the WS control line is low (Write
Mode), data can be written and clocked in via DA to DD. To shift the data out serially, the WS
control line is brought HIGH (Shift mode), the register then shifts the data out on clock input.
For parallel in – parallel out shift register, the output data across the parallel outputs appear
simultaneously as the input data is fed in.
The input data at each of the input pins from DA to DD are read in at the same time when the
device is clocked and at the same time, the data read in from each of the inputs is passed out at
the corresponding output (from QA to QD).
Encoders and Decoders
Binary code of N digits can be used to store 2N distinct elements of coded information. This is
what encoders and decoders are used for. Encoders convert 2N lines of input into a code of N
bits and Decoders decode the N bits into 2N lines.
Encoders: An encoder is a combinational circuit that converts binary information in the form
of a 2N input lines into N output lines, which represent N bit code for the input. For simple
encoders, it is assumed that only one input line is active at a time.
As an example, let‟s consider Octal to Binary encoder. As shown in the following figure, an
octal-to-binary encoder takes 8 input lines and generates 3 output lines.
Truth Table:
D7 D6 D5 D4 D3 D2 D1 D0 X Y Z
22 21 20
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1 0 1
0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
As seen from the truth table, the output is 000 when D0 is active; 001 when D1 is active; 010
when D2 is active and so on.
Implementation –
From the truth table, the output line Z is active when the input octal digit is 1, 3, 5 or 7.
Similarly, Y is 1 when input octal digit is 2, 3, 6 or 7 and X is 1 for input octal digits 4, 5, 6 or 7.
Hence, the Boolean functions would be:
X = D4 + D5 + D6 + D7
Y = D2 +D3 + D6 + D7
Z = D1 + D3 + D5 + D7
Hence, the encoder can be realized with OR gates as follows:
One limitation of this encoder is that only one input can be active at any given time. If more than
one input is active, then the output is undefined. For example, if D6 and D3 are both active, then,
our output would be 111 which is the output for D7. To overcome this, we use Priority Encoders.
Another ambiguity arises when all inputs are 0. In this case, encoder outputs 000 which actually
is the output for D0 active. In order to avoid this, an extra bit can be added to the output, called
the valid bit which is 0 when all inputs are 0 and 1 otherwise.
Priority Encoder –
A priority encoder is an encoder circuit in which inputs are given priorities. When more than one
input is active at the same time, the input with higher priority takes precedence and the output
corresponding to that is generated.
Implementation –
It can clearly be seen that the condition for valid bit to be 1 is that at least any one of the inputs
should be high. Hence,
V = D0 + D1 + D2 + D3
Decoders: A decoder does the opposite job of an encoder. It is a combinational circuit that
converts n lines of input into 2n lines of output.
Let‟s take an example of 3-to-8 line decoder.
Truth Table –
X Y Z D0 D1 D2 D3 D4 D5 D6 D7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
Implementation –
D0 is high when X = 0, Y = 0 and Z = 0. Hence, the decoder can be realized with Not and AND
gates as follows:
D0= X‟ Y‟ Z‟
D1 = X‟ Y‟ Z
D2 = X‟ Y Z‟
D3 = X‟ Y Z
D4 = X Y‟ Z‟
D5 = X Y‟ Z
D6 = X Y Z‟
D7 = X Y Z
Comparator
Digital or Binary Comparators are made up from standard AND, NOR and NOT gates that
compare the digital signals present at their input terminals and produce an output depending
upon the condition of those inputs.
For example, along with being able to add and subtract binary numbers we need to be able to
compare them and determine whether the value of input A is greater than, smaller than or equal
to the value at input B etc.
The digital comparator accomplishes this using several logic gates that operate on the principles
of Boolean Algebra. There are two main types of Digital Comparator available and these are.
1. Identity Comparator – an Identity Comparator is a digital comparator with only one
output terminal for when A = B, either A = B = 1 (HIGH) or A = B = 0 (LOW)
2. Magnitude Comparator – a Magnitude Comparator is a digital comparator which has
three output terminals, one each for equality, A = B greater than, A > B and less
than A < B
The purpose of a Digital Comparator is to compare a set of variables or unknown numbers, for
example A (A1, A2, A3, …. An, etc) against that of a constant or unknown value such as B (B1,
B2, B3, …. Bn, etc) and produce an output condition or flag depending upon the result of the
comparison.
For example, a magnitude comparator of two 1-bits, (A and B) inputs would produce the
following three output conditions when compared to each other.
A>B A is greater than B
A=B A is equal to B
A<B A is less than B
Then the operation of a 1-bit digital comparator is given in the following Truth Table.
Inputs Outputs
B A A>B A=B A<B
0 0 0 1 0
0 1 1 0 0
1 0 0 0 1
1 1 0 1 0
Analog to Digital Converter
Analog to digital converter is a converter which converts the analog (continuously variable)
signal to digital signal. This is an electronic integrated circuit which directly converts the
continuous form of signal to discrete form. It can be expressed as A/D or A-to-D or A-D or
ADC. The input (analog) to this system can have any value in a range and are directly measured.
But for output (digital) of an N-bit A/D converter, it should have only 2N discrete values.
ADC Process
There are mainly two steps involved in the process of analog to digital conversion. They are
From the above table we can observe that only one digital value is used to represent the whole
range of voltage in an interval. Thus, an error will occur and it is called quantization error. This
is the noise introduced by the process of quantization. Here the maximum quantization error is
Application of ADC: ADCs are used in Computers, Cell phones, Microcontrollers, Digital
signal processing, Digital storage oscilloscopes, Scientific instruments etc.
Digital to Analog Converter (DAC)
Digital to Analog Converter (DAC) is a device that transforms digital data into an analog signal.
A DAC can reconstruct sampled data into an analog signal with precision. The digital data may
be produced from a microprocessor, Application Specific Integrated Circuit (ASIC), or Field
Programmable Gate Array (FPGA), but ultimately the data requires the conversion to an analog
signal in order to interact with the real world.
In the voltage domain, that is if the input signals are voltages, the addition of the binary bits can
be achieved using the inverting summing amplifier shown in the above figure.
The input resistors of the op-amp have their resistance values weighted in a binary format. When
the logic circuit receives binary 1, the switch connects the resistor to the reference voltage. When
the logic circuit receives binary 0, the switch connects the resistor to ground. All the digital input
bits are simultaneously applied to the DAC.
The DAC generates analog output voltage corresponding to the given digital data signal. For the
DAC the given digital voltage is b3 b2 b1 b0 where each bit is a binary value (0 or 1).
The output voltage produced at output side is
V0=R0/R (b3+b2/2+b1/4+b0/8) Vref