Professional Documents
Culture Documents
Dicd Spectrum
Dicd Spectrum
2022
EDITION
DIGITAL IC DESIGN
[Electronics and Communication Engineering]
B.Tech (R20) (JNTU-Kakinada)
Salient Features
Book Contents Exclusively Prepared for JNTU University
Conforming to the Latest R20 Curriculum Prescribed by the (JNTU-K)
Including Model Question Papers with Solutions as Per Latest Exam Pattern
Including Guess Papers with Solutions as Per Latest Exam Pattern
Subject Dealt in a Simple and Easy to Understand Language
Exhaustive Coverage of Topics from Examination Point of View
Unit-wise FAQs and IQs
Focus on Mid Exams along with Externals
Maximum Questions were Asked from SIA Books in Final Exams, Many Students
Scored High Marks in All Subjects After Studying from SIA Books
Books for B.Tech (ECE) II-Year II-Sem (R20)(JNTU-K)
- Electronic Circuit Analysis
- Digital IC Design
- Analog Communications
Despite every effort taken to present the book without errors, some errors might have crept in.
We do not take any legal responsibility for such errors and omissions.
However, if they are brought to our notice, they will be corrected in the next edition.
Printed at:
SIA Publishers & Distributors Pvt. Ltd.,
Shed No. C-8/2, IDA Uppal, Hyderabad-39.
MAIN BRANCH PUTLI BOWLI KOTI S.R.NAGAR A.S. RAO NAGAR KOMPALLY
94 Bus Stop, Putli Bowli, Lane Beside Gokul Chat, Beside HDFC Bank, Opp: Malabar Gold & Diamonds Store
Opp. to Osmania Medical College Gate (HYD) Opp. Women’s College Road (HYD) Gajalaxmi Estates (HYD) Main Road (Sec-bad) Inter/Degree College
040 - 66447999 040 - 6641 5999 040 - 6614 5999 040 - 3510399 9 +91 9949963281
+91 91001 23113 +91 99638 98569 +91 89193 45411 +91 98857 82211
DIGITAL IC DESIGN
ECE B.Tech. II-Year II-Sem. ( JNTU - Kakinada )
CONTENTS
Introduction to the Subject
MODEL QUESTION PAPERS WITH SOLUTIONS (As Per Latest External Exam Pattern)
1.1 VHDL 2
1.1.5 Generic, Process, If, Case & Loop Statements Q14 - Q21 13
2.1 Parallel Binary Adder, Carry Look Ahead Adder, BCD Adder Q1 - Q10 50
4.3 CMOS Logic Circuits : CMOS NOR Gate, CMOS NAND Gate Q11 - Q13 194
The table below illustrates the complete idea about the subject, which will be helpful to plan and score good marks in the
end examinations.
1. Hardware Description Lan- In this unit, you will study about HDL based digital design, VHDL hardware
guages description language program structure, types, constants and arrays, functions
and procedures, libraries and packages, structural design elements, dataflow
design elements, behavioural design element and synthesis.
2. Combinational Logic Design In this unit, you will study qualitative approach of designing and modeling
of combinational logic circuits such as adders, multiplexers, ALU, digital
comparators, parity generators, code converters and priority encoders with
relevant digital ICs using HDL.
3. Sequential Logic Design In this unit, you will study qualitative approach of designing and modeling of
sequential logic circuits such as registers and counters with relevant digital ICs
using HDL. It also includes different synchronous and asynchronous sequential
circuit and hazards in sequential circuits.
4. Combinational MOS Logic This unit deals with construction and working of different combinational
Circuits MOS logic circuits, generalized NOR and NAND structures with multiple
inputs along with transient analysis, CMOS logic circuit, AOI and OAI gates,
Pseudo-nMOS gates, CMOS full-adder circuit,CMOS transmission gates and
complementary pass-transistor logic.
5. Sequential MOS Logic This unit explains design of different sequential MOS logic circuits, latch
Circuits circuits, flip-flops, CMOS latches, Schmitt trigger and principles of pass
transistor circuits.
It is sincerely hoped that this material will satisfy the expectations of students and at the same time helps them to
score maximum marks in exams.
Suggestions for improvement of the material from our esteemed readers will be highly appreciated and incorporated
in our forthcoming editions.
Syllabus
UNIT-1
HARDWARE DESCRIPTION LANGUAGES
VHDL: Introduction to VHDL, Entity declaration, Architecture, Data-flow, Behavioral and structural style
ofmodelings, Datatypes, Dataobjects, configurationdeclaration, Package, Generic, Operatorsandidentifiers,
PROCESS,IF, CASE & LOOPstatements, VHDL libraries.
VERILOG HDL: Introduction to Verilog HDL, Data types, Data operators, Module statement, Wire statement,
If-elsestatement, Case-endcasestatement, Verilog syntax and semantics (qualitative approach)
UNIT-2
COMBINATIONAL LOGIC DESIGN: Parallel binary adder, Carry look ahead adder, BCD adder, Multiplexers
anddemultiplexers and their use in combinational logic design, ALU, Digital comparators, Parity generators,
Codeconverters, Priority encoders. (Qualitative approach of designing and modeling the mentioned
combinationallogiccircuits with relevant digital ICs using HDL)
UNIT-3
SEQUENTIAL LOGIC DESIGN: Registers, Applications of shift registers, Ripple or a synchronous counters,
Synchronous counters, Synchronous and a synchronous sequential circuits, Hazards in sequential circuits.
(Qualitative approach of designing and modeling the mentioned sequential logic circuits with relevant digital
ICs using HDL)
UNIT-4
COMBINATIONAL MOS LOGIC CIRCUITS: Introduction, MOS logic circuits with depletion nMOS loads:
Two-inputNOR gate, Generalized NOR structure with multiple inputs, Transient analysis of NOR gate, Two-
input NANDgate, Generalized NAND structure with multiple inputs, Transient analysis of NAND gate, CMOS
logic circuits:CMOS NOR2 gate, CMOS NAND2 gate, Complex logic circuits, Complex CMOS logic gates,
AOI and OAIgates, Pseudo-nMOS gates, CMOS full-adder circuit, CMOS transmission gates (Pass Gates),
Complementarypass-transistorlogic.
UNIT-5
SEQUENTIAL MOS LOGIC CIRCUITS: Introduction, behavior bistable elements, SR latch circuit, Clocked
latch andflip-flop circuits: Clocked SR latch, Clocked JK latch, Master-slave flip-flop, CMOS D-latch and Edge-
triggeredflip-flop, Schmitt trigger circuit, Basic principlesof pass transistor circuits.
MID - 1 & 2 M.1
MID - 1 & 2
OBJECTIVE TYPE &
ESSAY QUESTIONS WITH KEY
OBJECTIVE TYPE
UNIT - 1
1. ________ symbol identifies a system task. [ ]
(a) / (b) $
(c) # (d) %
2. The higher level of design description next to circuit level is __________ level. [ ]
(a) Switch level (b) Gate level
(c) Data flow level (d) Behavioural level.
3. Any program written to test a design description is, [ ]
(a) Module (b) Stimulus module
(c) Test bench (d) All of the above
4. Functions are used in all programming languages is known as [ ]
(a) Subroutines (b) Level
(c) Programs (d) Languages
5. In verilog, the system task used for controlling system is [ ]
(a) $ display (b) $ monitor
(c) $ finish (d) All of the above
6. The two groups of data types are, [ ]
(a) Variable and et data type (b) Wire and tri-data type
(c) Integer (d) Real
7. The two types of numbers used in verilog are [ ]
(a) Decimal and real (b) Integer and real
(c) Base form and real (d) None of the above
8. In order to increase readability of a digital design, __________ are written in a verilog code. [ ]
(a) Programs (b) Functions
(c) Operands (d) Comments
9. White space characters are used to separate [ ]
(a) Numbers (b) Keywords
(c) Identifiers (d) Integers
10. When a string of ASCII characters are used as an operand in an expression, it is treated as, [ ]
(a) Real number (b) Octal number
(c) Binary number (d) None of the above
KEY
1. (b) 2. (b) 3. (d) 4. (a) 5. (c)
6. (a) 7. (b) 8. (d) 9. (b) 10. (c)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
MID - 1 & 2 M.3
UNIT - 2
1. Multiplexers are also known as, [ ]
(a) Data finder (b) Data deselectors
(c) Data selector (d) None of the above
2. The ripple carry adder requires a significant amount of time to complete the addition step,
and the time delay experienced during the process is referred to as _____ (or) _____. [ ]
(a) Carry propagation delay (b) Inter-stage carry delay
(c) Both a & b (d) None
3. To overcome this limitation of ripple carry adder and accelerate the addition process, a new technique
called _________ is implemented. [ ]
(a) Look ahead-carry addition (b) Carry addition
(c) BCD adder (d) Multiplexer
4. The problem of subtraction is changed into a problem of addition by using _____ representations. [ ]
(a) 10’s complement (b) Adder
(c) 9’s complement (d) 1’s and 2’s complement
5. An 8:1 multiplexer is available in the form of _____ & _____ IC’s. [ ]
(a) 74157 & 74158 (b) 74151 & 74152
(c) 74151 & 74157 (d) None
6. IC 74181 is used as _____. [ ]
(a) ALU (b) comparator
(c) Adder (d) Subtractor
7. 74 × 85 IC is a _____ bit MSI comparator and to design a 16-bit comparator _____ number
of 74 × 85 comparators has to be cascaded. [ ]
(a) 4-bit, 5 (b) 16-bit, 1
(c) 4-bit, 4 (d) 8-bit, 4
8. The 74180 has dual functions; it can be used as a _____ as well as a _____. [ ]
(a) Parity generator, Priority encoder (b) Parity checker, Priority encoder
(c) Parity generator, Parity checker (d) None
9. In BCD-to-binary converter using IC 74185A, the _____ of the binary input skips (bypasses)
the converter and appears as the _____of BCD output.
(a) LSB, LSB (b) LSB,MSB
(c) MSB,LSB (d) MSB,MSB
10. An IC 74148 is used as _____ [ ]
(a) Octal-to-Binary Priority Encoder (b) Decimal-to-BCD Priority Encoder
(c) BCD-to-Binary Converter (d) None
11. Which of the following is not an arthmetic circuit? [ ]
(a) 4 - bit comparator (b) 16 - bit BCD adder
(c) Ripple carry adder (d) BCD to 7 segment code converter
KEY
1. (c) 2. (a) 3. (d) 4. (b) 5. (a)
6. (c) 7. (c) 8. (a) 9. (a) 10. (a)
11. (d)
UNIT - 3
1. Parallel access shift register performs, [ ]
(a) Parallel to serial conversion
(b) Serial to parallel conversion
(c) Parallel to parallel conversion
(d) Both (a) and (b)
2. ______ counter counts only in one direction (i.e., either up or down). [ ]
(a) Up-down counter
(b) Single mode counter
(c) Multi mode counter
(d) None of the above
3. A 4-bit ring counter is also known as, [ ]
(a) Universal register
(b) Parallel register
(c) Circular shift register
(d) None of the above
4. LFSR is also known as [ ]
(a) Maximum length sequence generator
(b) Minimum length sequence generator
(c) Shift circular register
(d) Johnson counter
5. Moebius counter is also called as [ ]
(a) Ring counter
(b) Twisted-ring counter
(c) Johnson counter
(d) Both (b) and (c)
6. The glitch free outputs are present in ____________ counter. [ ]
(a) Johnson
(b) Ring
(c) Twisted-ring
(d) None
7. 74 × 163 is a synchronous 4-bit binary ____________ counter with active-low load and clear inputs [ ]
(a) MSI
(b) Ring
(c) Johnson
(d) None
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
MID - 1 & 2 M.5
8. Specialized ____________ functions are used for data encryption and decryption. [ ]
(a) Combinational
(b) Arithmatic
(c) Sequential
(d) None
9. In sequential circuits, output depends on, [ ]
(a) Present input and future output
(b) Present input and output
(c) Present input and past output
(d) Present input only
10. Which of the following are true about sequential circuits? [ ]
(a) Input signals can effect memory elements
(b) Circuits are simple to design
(c) Speed of operation is limited
(d) All of the above
11. Asynchronous sequential circuits use , [ ]
(a) Timer delay latches
(b) Gate devices
(c) Memory elements
(d) All of the above
(a) Tabular
(c) Transition
14. Which of the following are the major fundamentals for VHDL [ ]
(c) Concurrency
(c) Architecture
(a) in
(b) Buffer
(c) Out
(d) inout
17. The common package declarations can be shared by many design units by using [ ]
(b) Constants
(c) Functions
19. In __________ description, the circuits are represented interms of flow of data and elements. [ ]
(a) Behavioral
(b) Structural
(a) Name-identifier
(b) Number
(a) Scalar
(b) Composite
(c) Access
(d) File
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
MID - 1 & 2 M.7
22. ______ data type indicates the files that are present in host environment. [ ]
(a) Access
(b) Composite
(c) File
(d) Scalar
23. Which of the following are the example of a signal object? [ ]
(a) Signal CLOCK:BIT;
(b) signal DATABUS:BIT VECTOR (0 to 15);
(c) Both (a) and (b)
(d) type BIT_FILE
24. Which of the following is true about basic identifier? [ ]
(a) Character must begin with a letter but, should not end with an underscore
(b) Character cna be both upper case and lower case letter
(c) It should not contain two underscore characters.
(d) All of the above
25. A library consists of [ ]
(a) Shared Designs
(b) Shared implementations
(c) Shared declarations
(d) All of the above
26. STD library includes, [ ]
(a) Basic definitions
(b) Type of VHDL language
(c) Utilities for text
(d) Both (a) and (b)
27. In IEEE.STD_LOGIC_1164.ALL ; ALLmeans, [ ]
(a) Use all definitions of file
(b) Use all variables of file
(c) Use all constants of file
(d) All of the abpve.
28. The process of associating a design entity and an architecture to a component instance is known as, [ ]
(a) Binding
(b) Component installation
(c) Component declaration
(d) Package declaration
35. The process of automatic transformation of higher level abstraction to a lower level abstraction
is known as. [ ]
(a) Synthesis
(b) Translation
(c) Minimization
(d) Optimization
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
MID - 1 & 2 M.9
36. Which of the following are the functions of logic synthesizer? [ ]
(a) Translation
(c) Latches
KEY
1. (d) 2. (b) 3. (c) 4. (a) 5. (d)
11. (d) 12. (b) 13. (a) 14. (d) 15. (a)
16. (b) 17. (c) 18. (a) 19. (c) 20. (d)
21. (a) 22. (c) 23. (c) 24. (d) 25. (d)
26. (a) 27. (a) 28. (a) 29. (b) 30. (a)
31. (a) 32. (d) 33. (b) 34. (d) 35. (a)
UNIT - 4
1. The _________ is a simplified drawing that encompasses useful information about the relative arrangement [ ]
of transistors and their interconnections.
(a) stick-diagram
(b) Layout
(d) None
2. A straightforward way for determining the best gate ordering is the _________ technique. [ ]
(b) Euler-path
(d) None
3. _______ &________ , are critical voltage points for combinational logic circuits [ ]
c. VOL, or Vth
(d) NONE
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
MID - 1 & 2 M.11
7. In two-input CMOS NAND gate, The nMOS-network contains ________ [ ]
(a) 3
(b) 2
(c) 4
(d) NONE
10. Two nMOS transistors linked in series and having the same gate voltage act as if they were one nMOS [ ]
transistor with _________.
11. ______ path is described as an unbroken path that crosses every edge (branch) of the graph exactly once [ ]
(d) NONE
12. In Complex Boolean functions, driver transistors connected in parallel carry-out _____ operations [ ]
(a) NOT
(b) AND
(c) OR
(d) NONE
(a) NOT
(b) AND
(c) OR
(d) NONE
KEY
1. (a) 2. (b) 3. (c) 4. (a) 5. (d)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
MID - 1 & 2 M.13
UNIT - 5
1. ____________ is the minimum delay between negative S & R (in S-R latch) for them to be considered
non simultaneous. [ ]
(a) Recovery time
(b) Propagation time
(c) Delay time
(d) Access time
2. The basic bistable element circuit is also referred as [ ]
(a) 1-bit memory cell
(b) 3-bit memory cell
(c) 2-bit memory cell
(d) None
3. Latches and flip flops are ____________ elements [ ]
(a) Mono stable
(b) Bistable
(c) Astable
(d) None
4. _____ is often used to analyse the performance and to define the operation of SR latch. [ ]
(a) State table
(b) Flow table
(c) Primitive table
(d) Transition table
5. _______ describes a synchronous sequential machine. [ ]
(a) FSM
(b) ASM
(c) Both (a) and (b)
(d) None of the above
6. Finite state machines are of ______ types. [ ]
(a) Three
(b) Two
(c) Four
(d) Five
7. In Mealy machine, outputs are functions of present _________ and _________. [ ]
(a) Input, Output
(b) Input state
(c) State, Output
(d) Output, input
KEY
1. (a) 2. (a) 3. (b) 4. (d) 5. (a)
6. (b) 7. (b) 8. (a) 9. (c) 10. (b)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
MID - 1 & 2 M.15
UNIT - 1
Q1. With suitable block diagram explain about the design flow of VHDL. (Refer Unit-1, Q2)
Q2. Explain the VHDL program file structure with the syntax of a VHDL entity declaration and
architecture definition. (Refer Unit-1, Q4)
Q3. Explain the difference in program structure of VHDL and any other procedural language.
Give an example. (Refer Unit-1, Q5)
Q4. Explain in detail about the various abstraction levels in VHDL. (Refer Unit-1, Q8)
Q5. What are the different data objects supported by VHDL? Explain scalar types with
suitableexamples. (Refer Unit-1, Q11)
Q6. Explain various data types supported by VHDL and give necessary examples. (Refer Unit-1, Q10)
Q7. Explain various types of operators used in VHDL. (Refer Unit-1, Q12)
Q8. With suitable example, explain PROCESS statement in VHDL. (Refer Unit-1, Q16)
Q10. List out the differences between variable assignment statement and signal assignment
statement with example. (Refer Unit-1, Q18)
Q12. Explain IF, exit, next, assertion, report and null statements. (Refer Unit-1, Q21)
Q14. Discuss the binding. Discuss the binding between entity and components. (Refer Unit-1, Q24)
Q15. Write a process based VHDL program for the prime-number detector of 4-bit input and
explain the flow using logic circuit. (Refer Unit-1, Q31)
Q16. Write a VHDL program for comparing 8 bit unsigned integers. (Refer Unit-1, Q32)
Q17. Explain different levels of design descriptions in verilog. (Refer Unit-1, Q38)
Q18. Explain identifiers and keywords used in verilog HDL. (Refer Unit-1, Q42)
Q20. Write the syntax for the following constructs and give one example for each relevant to
behavioral verilog HDL modeling,
Q21. Write the syntax for the following constructs and give one example for each relevant
to behavioral Verilog HDL modeling,
Q22. Write the syntax for the following constructs and give one example for each relevant to
behavioral verilog HDL modeling,
UNIT - 2
Q1. Explain the implementation of N-bit binary adder using full adders. (Refer Unit-2, Q1)
Q2. Explain the operation of a Look ahead carry generator. (Refer Unit-2, Q3)
Q3. Draw the circuit of a 4-bit ripple carry adder circuit and explain how it is different from
look-a-head carry circuit. Give the equation for C1 to C4 for a look-ahead carry adder
circuit. (Refer Unit-2, Q4)
Q4. Write VHDL code for 4-bit look ahead carry generator along with circuit diagram. (Refer Unit-2, Q5)
Q5. Write a VHDL code to implement binary adder subtractor. (Refer Unit-2, Q7)
Q6. Design full subtractor circuit and write a VHDL code for implementation of full subtractor. (Refer Unit-2, Q8)
Q7. Using a process statement write a VHDL source code for 4 to 1 multiplexer. (Refer Unit-2, Q14)
Q8. What is multiplexer? Draw the logic diagram of 8 to 1 line multiplexer. (Refer Unit-2, Q15)
Q9. With the help of logic diagram explain 74×157 multiplexer. Write the data flow style
VHDL program for this IC. (Refer Unit-2, Q19)
Q10. What is ALU? Draw the block diagram of 74181ALU and Explain. (Refer Unit-2, Q22)
Q11. Discuss about the implementation of comparator using digital IC. (Refer Unit-2, Q26)
Q12. Explain about comparator and design a 16-bit comparator using 74×85 IC’s.
Write VHDL program. (Refer Unit-2, Q28)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
MID - 1 & 2 M.17
Q13. Design a 24-bit comparator using 74×682 ICs and explain the functionality of the circuit.
Also implement VHDL source code in data flow style. (Refer Unit-2, Q31)
Q14. Draw the logic diagram of IC 74180 parity generator checker and explain its operation
with the help of a truth table. (Refer Unit-2, Q36)
Q15. Draw the block diagram of IC 74185A binary-to-BCD converter and Explain. (Refer Unit-2, Q39)
Q16. Design a 2 to 4 decoder circuit. Give its entity declaration behavioural model.
Also draw the waveform giving relation between its inputs and outputs. (Refer Unit-2, Q42)
UNIT - 3
Q1. Discuss the logic circuit of 74×377 register. Write a VHDL program for the same in
structural style. (Refer Unit-3, Q7)
Q3. Give the VHDL programs for different type of shift register. (Refer Unit-3, Q10)
Q4. Draw the circuit of a bidirectional shift register with parallel loading using 2 to 4 line
decoder and D-flip-flops. (Refer Unit-3, Q12)
Q5. Draw and explain the working of shift left register. (Refer Unit-3, Q13)
Q6. Write a VHDL code for an n-bit left-to-right shift register using ‘FOR’ loop. (Refer Unit-3, Q15)
Q7. Draw and explain 4-bit universal shift register. (Refer Unit-3, Q17)
Q8. Write down truth table, VHDL code for the 4 bit register with parallel load.
Also draw the circuit and output waveform. (Refer Unit-3, Q18)
Q9. Design a self-correcting 4-bit, 4-state ring counter with a single circulating 0 using
IC 74LS194. (Refer Unit-3, Q21)
Q10. Write a VHDL program for 16-bit barrel shifter for left circular shift only? (Refer Unit-3, Q23)
Q11. Design a 4 bit synchronous binary even counter and write its behavioural mode. (Refer Unit-3, Q31)
Q12. Discuss about the working of Johnson counter using 74 LS194. (Refer Unit-3, Q33)
Q13. Explain the operation of a 4-bit synchronous binary counter with the required diagram
and waveforms. (Refer Unit-3, Q42)
Q14. Give a VHDL code for a 4-bit up counter with enable and clear inputs. (Refer Unit-3, Q43)
Q15. What are the capabilities and limitations of finite state machines? (Refer Unit-3, Q52)
Q18. Draw the logic diagram of Melay model & explore its operation with examples. (Refer Unit-3, Q58)
Q19. Draw the logic diagram of Moore model & explore its operation with examples. (Refer Unit-3, Q59)
Q20. What are the Moore and Mealy machines? Compare them. (Refer Unit-3, Q60)
Q21. Give the comparison between synchronous sequential and asynchronous sequential
circuits. (Refer Unit-3, Q67)
UNIT - 4
Q1. Draw the two input NOR gate logic circuit with depletion nMOS loads and Explain. (Refer Unit-4, Q2)
Q2. Explain how to calculate VOH and VOL for two input NOR gate Logic Circuits with
Depletion nMOS Loads. (Refer Unit-4, Q3)
Q3. Draw the two input NAND gate logic circuit with depletion nMOS loads and Explain. (Refer Unit-4, Q7)
Q4. Explain how to calculate VOH and VOL for Two input NAND gate Logic Circuits with
Depletion nMOS Loads. Also calculate drain current when the output voltage is VOL. (Refer Unit-4, Q8)
Q5. Draw the two input CMOS NOR gate logic circuits and Explain its operation. (Refer Unit-4, Q11)
Q6. Explain how to calculate switching threshold for two input NOR gate using CMOS
Logic Circuits. (Refer Unit-4, Q12)
Q7. Explain about Implementation of Complex Boolean functions using nMOS Logic Circuits. (Refer Unit-4, Q15)
Q8. Explain about Implementation of Complex Boolean functions using CMOS Logic Circuits. (Refer Unit-4, Q16)
Q9. Explain about problem of constructing a minimum-area layout for the complex CMOS
logic gate. (Refer Unit-4, Q17)
Q11. What is CMOS transmission gate? Explain its operation. (Refer Unit-4, Q22)
Q12. Explain the DC analysis of the CMOS transmission gate. (Refer Unit-4, Q23)
Q13. Explain about the equivalent resistances of the three operating regions of the
transmission gate. (Refer Unit-4, Q24)
Q14. Explain about Complementary Pass-Transistor Logic (CPL). (Refer Unit-4, Q27)
UNIT - 5
Q1. Explain bistability principle. (Refer Unit-5, Q2)
Q2. Explain the operation of CMOS bistable element and its transient analysis. (Refer Unit-5, Q3)
Q3. Explain the operation of an SR latch using NOR gates. Implement it with CMOS design. (Refer Unit-5, Q4)
Q4. What is the advantage of JK latch over SR latch. Explain the operation of clocked
JK-latch. (Refer Unit-5, Q8)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
MID - 1 & 2 M.19
Q5. Explain master-slave JK latch in detail. (Refer Unit-5, Q10)
Q6. Explain the working of an edge-triggered CMOS master-slave D flip-flop with neat
diagram. (Refer Unit-5, Q13)
Q7. Mention the basic principle of a pass transistor circuit. (Refer Unit-5, Q20)
Q8. Explain the logic 1 transfer in a pass transistor circuit. (Refer Unit-5, Q21)
Q9. Explain the logic 0 transfer in a pass transistor circuit. (Refer Unit-5, Q23)
Q10. Explain charge storage charge leakage at the soft node X during the inactive clock
cycle in an nMOS pass transistor. (Refer Unit-5, Q24)
s
lu tio
n
DIGITAL IC DESIGN
(Electronics and Communication Engineering)
Time: 3 Hours Max. Marks: 75
Answer any five Questions, one Question from Each Unit
All Questions Carry Equal Marks
---
1. (a) Explain the VHDL program file structure with the syntax of a VHDL entity declaration and architecture
definition. (Unit-1 / Q4)
(b) Explain various data types supported by VHDL and give necessary examples. (Unit-1 / Q10)
(or)
2. (a) Discuss the binding. Discuss the binding between entity and components. (Unit-1 / Q24)
3. (a) Explain the operation of a Look ahead carry generator. (Unit-2 / Q3)
(b) What is multiplexer? Draw the logic diagram of 8 to 1 line multiplexer. (Unit-2 / Q15)
(or)
4. (a) What is meant by arithmetic comparison circuits? Design 4 bit comparator circuit using logic gates and
write a VHDL code for implementation of 4-bit comparator. (Unit-2 / Q29)
(b) Explain in brief about the need of code converters. (Unit-2 / Q37)
5. (a) Discuss the logic circuit of 74×377 register. Write a VHDL program for the same in structural style.
(Unit-3 / Q7)
(b) Design a self-correcting 4-bit, 4-state ring counter with a single circulating 0 using IC 74LS194.
(Unit-3 / Q21)
(or)
7. Draw the two input NOR gate logic circuit with depletion nMOS loads and Explain. (Unit-4 / Q2)
(or)
8. (a) Explain how to calculate switching threshold for two input NOR gate using CMOS Logic Circuits.
(Unit-4 / Q12)
(b) Write short notes on Pseudo-nMOS gate. (Unit-4 / Q19)
(or)
10. (a) Explain the logic 1 transfer in a pass transistor circuit. (Unit-5 / Q21)
(b) Consider the monostable multivibrator circuit drawn in figure below. Calculate the output pulse width.
VT(dep) = –2V
VT(enh) = 1 V
y = 0.
5V
1nF Vout
(Unit-5 / Q18)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
Model Question Papers with Solutions MP.3
s
lu tio
n
DIGITAL IC DESIGN
(Electronics and Communication Engineering)
Time: 3 Hours Max. Marks: 75
Answer any five Questions, one Question from Each Unit
All Questions Carry Equal Marks
---
1. (a) With suitable block diagram explain about the design flow of VHDL. (Unit-1 / Q2)
(or)
2. (a) What are the different data objects supported by VHDL? Explain scalar types with suitable
examples. (Unit-1 / Q11)
(b) Explain the port connection rules in a module instantiation? (Unit-1 / Q40)
3. (a) Write VHDL code for 4-bit look ahead carry generator along with circuit diagram. (Unit-2 / Q5)
(or)
4. (a) Explain about comparator and design a 16-bit comparator using 74×85 IC’s. Write VHDL program.
(Unit-2 / Q28)
(b) Draw the block diagram of IC 74184 BCD-to-binary converter and explain its use as one and half decade
BCD-to-binary converter. (Unit-2 / Q38)
5. (a) Give the VHDL programs for different type of shift register. (Unit-3 / Q10)
(b) Design a 4 bit synchronous binary even counter and write its behavioural mode. (Unit-3 / Q31)
(or)
6. (a) What are the Moore and Mealy machines? Compare them. (Unit-3 / Q60)
(b) Explain in detail about state reduction in Asynchronous sequential circuits. (Unit-3 / Q79)
7. (a) Explain how to calculate VOH and VOL for two input NOR gate Logic Circuits with Depletion nMOS Loads.
(Unit-4 / Q3)
(b) Consider the depletion load nMOS NOR2 gate shown in figure with the following parameters: mnCox = 25
mA/V2, VT0.driver = 1.0V, VT0.load = – 3.0 V, g = 0.4 V1/2, and |2fF| = 0.6 V. The transistor dimensions are given
as (W/L)A = 2, (W/L)B = 4, and (W/L)load = 1/3. The power supply voltage is VDD = 5V. Calculate the output
voltage levels for all four valid input voltage combinations. (Unit-4 / Q4)
8. (a) Draw and explain the layout for CMOS NOR and NAND gates. (Unit-4 / Q14)
(b) Explain implementation of full adder using CMOS logic circuits. (Unit-4 / Q21)
9. Explain the operation of an SR latch using NOR gates. Implement it with CMOS design. (Unit-5 / Q4)
(or)
10. (a) Explain the logic 0 transfer in a pass transistor circuit. (Unit-5 / Q23)
(b) Draw the schematic circuit of a D flip-flop with positive edge triggering using NAND gates. Give its timing
diagram and explain its operation. (Unit-5 / Q14)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
Model Question Papers with Solutions MP.5
s
lu tio
n
DIGITAL IC DESIGN
(Electronics and Communication Engineering)
Time: 3 Hours Max. Marks: 75
Answer any five Questions, one Question from Each Unit
All Questions Carry Equal Marks
---
1. (a) Explain the difference in program structure of VHDL and any other procedural language.
Give an example. (Unit-1 / Q5)
(b) Explain about variable assignment statement, signal assignment statement, wait statement. (Unit-1 / Q17)
(or)
2. (a) Design the logic circuit and write a structural style VHDL program for the following function.
NS, Z
PS
X=0 X=1
A B, 0 E, 0
B E, 0 D, 0
C D, 1 A, 0
D C, 1 E, 0
E B, 0 D, 0
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
Model Question Papers with Solutions MP.7
s
lu tio
n
DIGITAL IC DESIGN
(Electronics and Communication Engineering)
Time: 3 Hours Max. Marks: 75
Answer any five Questions, one Question from Each Unit
All Questions Carry Equal Marks
---
1. (a) Explain in detail about the various abstraction levels in VHDL. (Unit-1 / Q8)
(or)
2. (a) Write a VHDL program for comparing 8 bit unsigned integers. (Unit-1 / Q32)
(b) Write Verilog code using case statement for any one example. (Unit-1 / Q49)
3. (a) Using a process statement write a VHDL source code for 4 to 1 multiplexer. (Unit-2 / Q14)
(b) Design an 8-bit ALU circuit using 74LS181 IC’s and write its VHDL code. (Unit-2 / Q23)
(or)
4. (a) Draw the logic diagram of IC 74180 parity generator checker and explain its operation with the help of a
truth table. (Unit-2 / Q36)
(b) Explain about IC 74148 and its use as Octal-to-Binary priority encoder. (Unit-2 / Q41)
5. (a) Write down truth table, VHDL code for the 4 bit register with parallel load. Also draw the circuit and output
waveform. (Unit-3 / Q18)
(b) Give a VHDL code for a 4-bit up counter with enable and clear inputs. (Unit-3 / Q43)
(or)
6. (a) Give the comparison between synchronous sequential and asynchronous sequential circuits.
(Unit-3 / Q67)
(b) Discuss the hazards in asynchronous sequential circuits and the methods to eliminate them.
(Unit-3 / Q84)
7. (a) Explain how to calculate VOH and VOL for Two input NAND gate Logic Circuits with Depletion nMOS Loads.
Also calculate drain current when the output voltage is VOL. (Unit-4 / Q8)
(b) Draw the two input CMOS NOR gate logic circuits and Explain its operation. (Unit-4 / Q11)
(or)
9. Explain the working of a basic CMOS D-latch with neat diagram. (Unit-5 / Q9)
(or)
10. (a) Illustrate the CMOS implementation of Schmitt trigger. (Unit-5 / Q15)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
D
r s & is t r i b u
he
R20
li s
to r
Jawaharlal Nehru Technological University, Kakinada S
SIA Pu b
ES
-1
s
GU
R
B.Tech. II Year II Semester Examinations PE
PA
DIGITAL IC DESIGN t
d
P v t. L
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
Guess Papers with Solutions GP.3
D
r s & is t r i b u
he
li s
to r
S
SIA Pu b
ES
-2
s
GU
R
B.Tech. II Year II Semester Examinations PE
PA
DIGITAL IC DESIGN t
d
P v t. L
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
Guess Papers with Solutions GP.5
D
r s & is t r i b u
he
R20
li s
Jawaharlal Nehru Technological University, Kakinada
to r
S
SIA Pu b
ES
-3
s
GU
R
B.Tech. II Year II Semester Examinations PE
PA
DIGITAL IC DESIGN t
d
P v t. L
1. (a) List out the differences between variable assignment statement and signal assignment statement with
example.
(b) Design the logic circuit and write a data-flow style of VHDL program for the following function,
(or)
(b) Write the syntax for the following constructs and give one example for each relevant to behavioral Verilog
HDL modeling,
Refer Unit-2, Q7
(or)
(or)
Refer Unit-5, Q3
(or)
10. (a) Consider the monostable multivibrator circuit drawn in figure below. Calculate the output pulse width.
VT(dep) = –2V
VT(enh) = 1 V
k’ =20 µA/V2
y = 0.
5V
1nF Vout
(b) Explain charge storage charge leakage at the soft node X during the inactive clock cycle in an nMOS pass
transistor.
Refer Unit-5, Q24
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
Guess Papers with Solutions GP.7
D
r s & is t r i b u
he
li s
to r
S
SIA Pu b
ES
-4
s
GU
R
B.Tech. II Year II Semester Examinations PE
PA
DIGITAL IC DESIGN t
d
P v t. L
1. (a) Explain with an example the syntax and the function of if statement.
Refer Unit-1, Q19
(b) Write a process based VHDL program for the prime-number detector of 4-bit input and explain the flow
using logic circuit.
Refer Unit-1, Q31
(or)
2. (a) Explain about identifiers and keywords used in verilog HDL.
Refer Unit-1, Q42
(b) Explain different levels of design descriptions in verilog.
Refer Unit-1, Q38
3. (a) What is BCD? Explain how to perform BCD Addition.
Refer Unit-2, Q9
(b) Design a 24-bit comparator using 74×682 ICs and explain the functionality of the circuit. Also implement
VHDL source code in data flow style.
Refer Unit-2, Q31
(or)
4. Design a 2 to 4 decoder circuit. Give its entity declaration behavioural model. Also draw the waveform giving
relation between its inputs and outputs.
Refer Unit-2, Q42
5. (a) Design a self-correcting 4-bit, 4-state ring counter with a single circulating 0 using IC 74LS194.
Refer Unit-3, Q21
(b) Design a 4-bit binary synchronous counter using 74×74.
Refer Unit-3, Q49
(or)
6. (a) Draw the logic diagram of Moore model & explore its operation with examples.
Refer Unit-3, Q59
(b) Describe master-slave D flip-flop as an asynchronous circuit.
Refer Unit-3, Q76
DIFF.
NWELL
P+
POLY
GND MET-1
(b) Explain the working of a basic CMOS D-latch with neat diagram.
Refer Unit-5, Q12
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 1
UNIT
Hardware Description
1 Languages SI
A GROUP
Syllabus
VHDL : Introduction to VHDL, Entity declaration, Architecture, Data-flow, Behavioral and structural style of modelings,
Data types, Data objects, Configuration declaration, Package, Generic, Operators and identifiers, PROCESS, IF, CASE &
LOOP statements, VHDL libraries.
VERILOG HDL: Introduction to Verilog HDL, Data types, Data operators, Module statement, Wire statement, If-else
statement, Case-end case statement, Verilog syntax and semantics (qualitative approach)
Learning Objectives
C VHDL
Program structure of VHDL
Data-Flow, Behavioral and Structural Style of modellings
Data types, Data objects, Operators and identifiers
Statements such as, GENERIC, PROCESS, IF, CASE and LOOP
VHDL Libraries
C Verilog HDL
Design flow of Verilog HDL
Comparison between VHDL and Verilog HDL
Data-Flow, Behavioral and Structural Style of modellings
Data Types, Data Operators
Statements such as, MODULE, WIRE, IF-ELSE and CASE.
Introduction
HDL is acronym for hardware description language, which describes the hardware of digital systems in textual form. Digital
systems can be represented in the form of documentation, which can be understood by human and also computers. Logic
diagrams, digital circuits, Boolean expressions can be represented using HDL. The orientation of HDL is specially towards
describing the hardware structures and behavior. To describe hardware for the purpose of simulation, modeling testing,
design and documentation HDLs are used. In this unit we will study the basics of VHDL and Verilog HDL.
1.1 VHDL
1.1.1 Introduction to VHDL
Q1. Explain in brief the evolution of VHDL and men- The first step is the “design concept”, where we need to
tion the capabilities of the language. have a complete picture of the device under consideration and
Ans: the specifications required to achieve the device properties.
VHDL is an acronym for very high speed integrated The second step is “initial design”. Where we need
to have a design entry by using the VHDL (language) code.
circuits hardware description language. This language was first
Signals in the circuit are represented as variables in the source
introduced in 1981 for the Department of Defense (DoD) under code and logic functions are expressed by assigning values to
the VHSIC program. In 1983 IBM, Texas instruments and these variables. Hence, VHDL code is a combination of plain
intermetrics started to develop this language. In 1985, VHDL 7.2 text and may utilize any text editor.
version was released. In 1987 IEEE standardized the language. The third step is “simulation/verification”. Here, we check
The language has been through a few revisions, and you will come whether the designed circuit functions are expected or not. The
across this in the VHDL community. Currently, the most widely VHDL code can be simulated by using “test benches” which
used version is the 1987 (std 1076-1987) version, the language automatically apply inputs and compares with the desired outputs.
referred to as VHDL 93. VHDL 93 (Adopted in 1994 of course) If the design is correct then we have to move to the final
is fairly new and is still in the process of replacing VHDL 87. step called “successful design”. But when the design is wrong
we move to an intermediate step called “redesign”.
VHDL was originally designed to serve two major
objectives, Where we modify the old design to achieve the given
objective i.e., desired output and again move to the simulation
(i) It is used for documentation of large digital designs. to verify the outputs. This process is continued until we achieve
(ii) VHDL incorporates features for showing the perfor- the correct design.
mance of a digital circuit. The next step of the process is logic synthesis, which is used
This permits to use VHDL as an input to software pro- to translate the design described in a design-entry method (Usually,
grams, which are used to simulate the circuit operation. Further, a program in VHDL or verilog) into a physically realizable circuit.
it is used in design entry in CAD systems. The CAD tools syn- The same tool is also used to optimize the circuit. When the design-
thesize the VHDL code into a hardware unit that performs the entry progresses through the initial synthesis tools, logic equations,
operation described by the code. In addition to being used for that describe the logic functions needed to realize the circuit, are
each of these purposes, VHDL can be used to take three differ- automatically generated. Usually the logic equations generated
by the initial synthesis tools are not in the optimal form. As these
ent approaches for describing hardware. These three different
expressions mirror the designer’s input to the CAD tools, it is hard
approaches are the structural, data flow and behavioral methods
for a designer to generate optimal results by hand, particularly for
of hardware description. Most of the time a mixture of the three
large circuits. Usage of optimization techniques produces logic
methods is employed. equations that are not only correct functionally but are optimized
Q2. With suitable block diagram explain about the (enhanced/improved) for design goals such as cost, speed, and
design flow of VHDL. technology of implementation. The process of optimization is
performed after functionally correct design is obtained, because
Ans: (Model Paper-2, Q1(a) | Oct./Nov.-19, Set-1, Q3(a) M[7])
optimization performed before the acquisition of functionally
The VHDL design flow consists of basic sequence of steps correct design does not serve any purpose.
that are performed to achieve a successful design as shown in figure. Q3. List and explain the VHDL requirements.
Design Cncept
Ans:
Initial Design Department of Defence (DoD) imposed certain criteria
(which were not met by other HDLs) as basic requirements for
Simulation Re Design
VHDL. The eight major requirements of VHDL are,
(i) Concurrency
Is (ii) Support for design hierarchy
design
Correct?
(iii) Library support
(iv) Sequential statement
Yes No (v) Generic design
Successful Design (vi) Type declarations and usage
(vii) Use of subprograms
Logic Synthesis
(viii) Timing control.
Figure (ix) Structural Specification
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 3
(i) Concurrency: Concurrency is defined as the
1.1.2 Entity Declaration, Architecture, Configu-
simultaneous execution of functions such as transfer of
ration Declaration, Package
statements, description of components and component
instantiation. VHDL must be designed in such a way Q4. Explain the VHDL program file structure with
that the large and small units in the system are made the syntax of a VHDL entity declaration and
simultaneously active, in order to perform concurrent architecture definition.
operations. (Model Paper-1, Q1(a) | March-21, Set-1, Q3(a) M[7])
(ii) Support for Design Hierarchy: Generally, a design (or)
involves for interface description and definition of
Explain the VHDL program file structure and
operations of separate system parts. The entire system
explain the same with the syntax of a VHDL
requires number of descriptions for a given interface
entity declaration and architecture definition.
description. To overcome this limitation, VHDL was
developed with design hierarchy, wherein a divide and Oct./Nov.-20, Set-1, Q3(a) M[7]
conquer technology is introduced. The technique divides (or)
a multi level system into subsystems with descriptions With the help of block diagram explain the
being defined using behavioural or structural modelling. program structure for VHDL.
The division is further carried out till the basic unit of
design is obtained. Oct./Nov.-19, Set-2, Q3(b) M[7]
(or)
(iii) Library Support: VHDL must support a standard
library with user and system defined primitives and What is package body? Explain with example.
descriptions. The language must provide an appropriate Oct./Nov.-19, Set-2, Q3(a) M[7]
method to access different libraries of the system. (Refer only Package body)
(iv) Sequential Statements: The language must support a (or)
sequential internal operation carried out after dividing
Write short note on package declaration.
the system into concurrent components. This can be
accomplished by employing various constructs (such Oct./Nov.-19, Set-3, Q1(a) M[7]
as case, if then else, loop). (Refer only Package Declaration)
(v) Generic Design: VHDL must permit a generic Ans:
description such that it is configurable at any size, physical Block diagram of program structure
characteristics, timing, loading and environmental
The program structure of VHDL is as shown in figure.
conditions. In other words, besides input and output
influence of other physical characteristics such as Entity Declaration
ambient temperature, loading of components are also
taken into consideration. For instance, a 7400 logic Architecture
family NAND gate way involves many series such as,
LS, F, ALS which are functionally identical and differ Configuration Declaration
only in their timing and loading characteristics.
Package Declaration
(vi) Type Declarations and Usage: Type declaration and
its usage is another requirement which is imposed on Package Body
VHDL by DoD. The hardware description provided
by the language (besides bit or boolean) must include Figure
integer, floating, point, enumerate types and user-defined The program structure of VHDL contains,
types. The system-defined and user-defined types must
(i) Entity declaration
be included in the library of environment along with
their transparent availability to the users. (ii) Architecture
(vii) Use of Subprograms: Subprograms such as functions (iii) Configuration declaration
and procedures must be included in the VHDL language. (iv) Package declaration
(viii) Timing Control: The language must assign timings at (v) Package body.
all levels of designing. It must be capable of delaying the (i) Entity Declaration: An entity is a basic block of
actual assignment values (for a finite time) by scheduling VHDL code that provides the specification of input
all the signal values. and output signals and modes of a hardware module.
(ix) Structural Specification: The another requirement It also provides the interface between the device and
imposed on VHDL by DoD is of structural specification other external peripherals. Entity is modeled by an
i.e., it should employ constructs for representing entity declaration and a architecture body. The entity
decomposition of structural hardware at every level. declaration demonstrates the external view of the entity.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 5
The various elements in the configuration declaration are, Example of Package Body
Configuration name : It is a user defined name that Package body packbd is
specifies the configuration for the entity name function mean (x, y, z: REAL) return REAL is
Block_configuration : In this section, the ports which begin
are to be binded are declared.
return (x + y + z) / 3.0;
(iv) Package Declaration
end mean
Package declaration is a mechanism employed in VHDL
to store some common declarations like types, procedures, end packbd;
functions etc. These common declarations can be shared by Q5. Explain the differences in VHDL program
many design units by using “library” and “use” clauses. structure with any other language with the help
Syntax of an example. March-21, Set-2, Q3(a) M[7]
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 7
Q7. Explain the use of packages. Give the syntax A package body contains the hidden details of a package
and structure of a package in VHDL. like a function body.
Ans: There may be some declarations in the package body
also. The items declared here are local i.e., their scope
The definitions of different objects that can be used in is restricted within the package body and these items
other programs is stored in a file called package. cannot be made visible in other design units.
A package can be used in any number of other programs The syntax of a package body is as shown below.
and any number of times. The kinds of objects a package can package body package_name is
include are, package_body_item_declarations
(i) Sub-programs subprogram bodies
(ii) Types subprogram declarations
(iii) Subtypes
(iv) Constants
(v) Signals end package body package_name;
(vi) Variables 1.1.3 Data-Flow, Behavioral and Structural
(vii) Files Style of Modellings
(viii) Alias Q8. Explain in detail about the various abstraction
levels in VHDL. Model Paper-4, Q1(a)
(ix) Components
(or)
(x) Attributes
Write the basics in VHDL programming using
(xi) Disconnections structural and data flow modeling.
(xii) Use clauses. Oct./Nov.-20, Set-1, Q3(b) M[7]
A package can have two main parts. (Refer excluding Topic: Behavioural Description)
1. Package declaration (or)
Explain about dataflow design elements of
2. Package body.
VHDL. Oct./Nov.-18, Set-3, Q3(a) M[7]
1. Package Declaration: A package declaration consists of (Refer only Topic: Data Flow Description)
a set of objects declarations to be shared by many design
(or)
units.
Explain data-flow design elements of VHDL.
The objects in a package can be accessed by including Oct./Nov.-16, Set-2, Q3(b)
a “use” clause at the beginning of the program file.
(Refer only topic 2)
Example: Use IEEE.std_logic_1164.all; Ans:
“ieee” is the library which contains the package named There are three basic levels of abstraction (i.e.,
std_logic_1164. The suffix “all” is used to access all the representation or description) in VHDL namely,
definitions contained in the package. 1. Behavioural description
Example of Package Declaration 2. Data flow description
package packs1 is 3. Structural description.
type ARM is (ADD, SUB, MUL, DIV); 1. Behavioural Description
type MVL is (‘X’, ‘0’, ‘3’); Behavioral style of VHDL modelling maps the
relationship between inputs and outputs and uses sequential
Subtype ARM_MVL is ARM range ADD to MUL; statements to execute the code. It describes the behaviour of
component AND2 output with respect to variations in input irrespective of type of
components used. Since the sequential statements are used, the
port(A, B in MVL; C: out MVL)
order in which the statements are written is very important and
end component; hence, this style is also termed as algorithmic style of VHDL
end pack1; modelling. The main behavioral element is “process”.
Process
2. Package Body: A package body is an optional. Until a
package declaration contains subprogram declarations A set of collection of statements that are sequentially
or deferred constant declarations a package body is not executed with other concurrent statements is known as process.
necessary. Process is used to declare “variables” only.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 9
(i) Component Declaration: Component declaration in 2. Composite types
architecture section is same as entity declaration of entity A composite type includes a group of data elements.
section wherein, every individual component is declared This type is divided into two types,
with its unique name_identifier, its number and type of
(i) Array type
input and output ports. This done in the declarative part
of architecture body, here the keyword COMPONENT (ii) Record type
along with name of a component is used. (i) Array type
(ii) Component Instantiation: Component instantiation It is formed by grouping data elements of similar type.
is the next part of architecture body wherein all the Example
declared components are instantiated. In other words, For Array type declaration
component instantiation is the mapping among the type address_word is array (0 to 63) of bit;
actual and formal ports of entity and components. Here,
type data_word is array (7 down to 0) of STD_
the PORT MAP statements are used in the executable
section of architecture body. ULOGIC;
For object declarations
Q9. What is behavioral modeling?
variable ROM_ADDR : ROM;
Ans:
signal ADDRESS_BUS : ADDRESS_WORD;
The most significant style employed by industries (ii) Record Type
to enable the design of huge number of chips is known as
behavioral It is formed by grouping data elements of similar or
different types.
modeling.
Example
The various features of behavioral modeling are, For record type declaration
1. Behavioral modeling analyzes the functionality of a TYPE pin-type is range 0 to 10;
design.
TYPE module is
2. It describes the input-output model of a logic unit. record
3. It conceals the information about its physical size : integer range 20 to 200;
implementation and low-level internal architecture. critical_dly : time
1.1.4 Data Types, Data Objects, Operators and no_inputs : pin_type;
Identifiers no_outputs : pin_type;
Q10. Explain various data types available in VHDL. end record;
March-21, Set-4, Q3(b) M[7]
Assigning data elements to record object using
aggregates
(or)
Example
Explain various data types supported by VHDL Variable nand_comp : module;
and give necessary examples. Model Paper-1, Q1(b) nand_comp : = (50,20 ns, 3,2)
Ans: 3. Access Types
The various data types supported by VHDL are as follows, The data element that belong to access types act as
pointers to dynamically created objects.
1. Scalar types
Examples
2. Composite types
For array declaration
3. Access types (i) type ptr is access MODULE;
4. File types. (ii) type FIFO is array (0 to 63, 0 to 7) of BIT;
1. Scalar Types (iii) type FIFO_ptr is access FIFO;
The data elements of scalar types are represented in a 4. File Types
sequential manner. These are divided into four types File data type indicates the files that are present in host
namely, environment.
Syntax
(i) Enumeration
Type file_type_name is file of type_name;
(ii) Integer
Examples
(iii) Physical (i) type vectors is file of BIT_VECTOR;
(iv) Floating point (ii) type names is file of STRING;
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 11
type MY_WORD is range 4 to 6; Units
INDEX is an integer type having the values from 0 to nA; --- (base unit) nano-ampere
15. DATA_WORD is a subtype of WORD_LENGTH µA: = 100 nA; --- micro ampere
that includes the integer values ranging from 15 through µA: = 1000 µA; --- milli-ampere
0. The position of each value of an integer type is the
value itself. Amp: = 1000 mA; --- ampere
end units;
Values belonging to an integer type are called Integer
literals. Subtype Filter_CURRENT is CURRENT range 10 µA
to 5 mA;
Example
CURRENT is a physical quantity that contains values
56349 6E2 0 98 – 71 – 28 from 0 nA to 109 nA. Nano-ampere is the base unit and all others
INTEGER is the only pre-defined integer type of the are derived units. The position number of value is the number
language and it must cover the range from –(231 – 1) to of base units represented by that value.
+ (231 – 1). Values of a physical type are called physical literals. This
3. Floating Point Types can be written either as integer or floating point literal followed
by the unit nano for example, “10 nA” is a physical literal.
It has a set of values in a given range of real numbers.
Examples of floating point declarations are, The only predefined physical type is TIME, and range of
its base values must at least be –(231 – 1) to (231 – 1). There is
type ITL_VOLTAGE is range –5.5 to –1.4; a predefined physical subtype, DELAY_LENGTH, represents
type REAL_DATA is range 0.0 to 31.9; non-negative time values. The type TIME and subtype DELAY_
Example of an object declaration is LENGTH declarations appear in package STANDARD.
variable LENGTH : REAL_DATA range 0.0 to 15.9; Q12. Explain various types of operators used in VHDL.
Ans: (Model Paper-2, Q1(b) | March-21, Set-3, Q3(b) M[7])
....
The different operators present in the VHDL are,
variable L1, L2, L3 : REAL_DATA range 0.0 to 15.9;
1. Logical operators
LENGTH is a variable object of type REAL_DATA takes
2. Relational operators
real values in the range 0.0 through 15.9 only. The range
constraint was specified in the variable declaration itself. 3. Arithmetic operators
4. Concatenation operators
The range bounds specified in the floating point
type declaration must be constants or locally static 5. Shift and rotate operators.
expressions. 1. Logical Operators
Floating point literals are values of a floating point type. The logical operators in the VHDL programming are,
Example (a) AND: ‘AND’ operator is used to perform logical
AND operation between two operands.
16.260.0 0.002 3 – 1.4 – 2
Example: C = A AND B;
Floating point literals differ from integer literals by the
(b) OR: ‘OR’ operator is used to perform logical ‘OR’
character dot (.).
operation (i.e., addition) between two operands.
Floating point literals can also be expressed in an
Example: C = A OR B;
exponential form. The exponent represents a power of
10 and exponent value must be integer. (c) NAND: It is used to perform logical NAND
operation between two operands.
Example
Example: C = A NAND B;
62.3E – 2 5.0E+2
(d) NOR: It is used to perform logical NOR (i.e., OR
The only pre-defined floating point type is REAL. It must followed by NOT) between two operands.
at least cover the range −1.0E38 to +1.0E38, and should Example: C = A NOR B;
provide at least six decimal digits of precision.
(e) XOR: It is used to perform logical XOR operation
4. Physical Types between two operands.
A physical type contains values that represent Example: C = A XOR B;
measurement of physical quantity like time, length, (f) XNOR: It is used to perform logical XNOR
voltage or current. Its values are expressed as integer operation between two operands.
multiples of a base unit.
Example: C = A XNOR B;
Example of a physical type declaration. (g) NOT: It is used to logically invert the data.
type CURRENT is range 0 to 1E9 Example: NOT A, NOT B etc.
(a) Equality (=): It is used to check the equalance of (d) Shift Right Arithmetic: It is used for arithmetic right
operands (or) to specify the data to the operands. shift.
Example: A = 110, A = B etc. Example: B = A SRA 1;
B = 101. Rotate operators are used to shift bits from one end to
(b) Inequality (/=): It is used to specify the inequalance another end
of the operands. (i) Rotate Left: It is used for left rotation.
Example: B/= ‘010’.
Example: B = A ROL 2;
(c) Greater than: It is used to assign the greater values
(ii) Rotate Right: It is used for right rotation.
(or) to check the greater values.
Example: A > B. Example: B = A ROR 2;
(d) Less than (<): It is used to compare whether it is Q13. Discuss identifiers in VHDL.
less (or) not. Ans:
Example: A < B.
An identifier refers to the name given to the entities such
(e) Greater than or Equal to: as data objects, data types, operators etc.
Example: A > = B. VHDL supports two types of identifiers. They are,
C > = C. etc. 1. Basic identifiers
(f) Less than or Equal to: 2. Extended identifiers
Example: A < = B 1. Basic Identifiers
B < = C etc.
A basic identifier comprises a series of one or more
3. Arithmetic Operators character. The character can be an upper case letter, a lower
Arithmetic operators are used to do arithmetic operations case
like addition, subtraction, multiplication and division. letter or a special character i.e., “underscore”.
Addition + Example: C = A + B Rules For Basic Identifiers
Subtraction – Example: C = A – B
(i) The character in basic identifier must begin with a letter
Multiplication * Example: C = A * B. but, it should not end with an underscore.
Division / Example: C = A/B. (ii) The character can contain both upper case letter and
4. Concatenation Operators lower case letter.
The concatenation operator is used perform concatenate (iii) They must not contain two underscore characters
two or more vectors to create a large vector. together.
Example: D = A & B. Examples
C = D & A etc. (i) P3c4
5. Shift and Rotate Operators (ii) Select signal
The shift operators are used to shift the one bit into 2. Extended Identifier
another bit. There are logical and arithmetic shifts are
available in VHDL. They are, An extended identifier comprises a series of characters
enclosed between two back slashes. The characters can be
(a) Shift Left Logical (SLL): It is used for logical left shift.
letters, digits and special characters such as ., !, @, ‘ and $. It
Example: B = A SLL 1; is case sensitive.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 13
Example
\ – 25 \
In identifiers, comments can be written anywhere within a description. The different symbols used for describing comments
are as follows.
Symbol Description
Ans:
Generics
A generic mechanism is a general means for passing data to an entity. The information given to the entity can be of any
type supported by VHDL.
Why would a designer wish to send information to an entity? The most evident, and usually the most used, piece of
information that is passed to an entity is the time it takes for the rising and falling delays of the device that is being modelled.
Generics can also be used to send any user-defined data kinds, such as load capacitance, resistance, and so on. Further, Generics
can be used to pass in synthesis parameters such as datapath width, signal widths, and so on.
The information supplied to an entity is instance-specific. In other words, the data value is specific to the instance to which
the data is being delivered. So, the designer can give different values to the same thing in his or her project at different times.
The data that is provided at an instance is always static. After the model is developed (connected to the simulator), the data
remains constant during the simulation. During a simulation run, information cannot be allocated to generics. The information
included in generics supplied into a device instance or a module can be utilized to change the simulation results, but the results
cannot change the generics.
ENTITY and2 IS
GENERIC (rise,fall:TIME;Load:INTEGER);
c : OUT BIT);
END and2;
This entity lets the designer specify the device’s rise and fall delays, as well as the amount of loading it has on its output.
When the model has this information, it can figure out how to model the AND gate in the design correctly.
Ans:
The statements which are declared inside the process statements are termed as sequential statements. These are usually
employed with behavioral style.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 15
1. Wait On Example
The syntax is , Process
Wait on sensitivity-list ; begin
When the wait statement executes, it stops the execution x < = input ;
of the process and resumes its execution when any event occurs
on the signals in the sensitivity list. If the wait statement occurs wait for 10 ns ;
at the end of the process, then the process gets executed from y<=x;
the beginning. end process ;
Example
Initially, when the wait statement executes, the process
(i) Process stops its execution for 10 ns. After 10 ns, the execution will be
Variable X, Y, Z : INTEGER resumed.
begin Effects of Wait For 0 ns
X : = A and B ; Wait for ‘0’ ns indicates to wait the process for one delta
Y : A nand C ; cycle.
wait on A,B,C Example
Z : = B or C ; Pro`cess
end process ; begin
In the above example, when the wait statement is wait on input ;
executed, it stops the execution of the remaining statements in
x < = input ;
the process. Whenever an event occurs on A, B or C then the
remaining statements in process starts their execution. wait for ‘0’ ns ;
(ii) Wait Until y<=x;
The syntax is, end process
Wait until boolean-expression ; The above example is illustrated in the following
When the wait statement is executed, it stops the figure.
execution of the process statements. It evaluates the boolean
expression value and if it is true, then resumes the execution of
the process or else it waits until the expression becomes true.
Example
Process input
variable X, Y : INTEGER
begin
X : = A + 10 ;
A:=A+1; x
Wait until A = 15 ;
Y : = B +10 ; Wait for
‘0’ ns (10 + D)
end process
In the above example, when the wait statement is
executed, it stops the execution of the remaining statements. y
It checks for the expression and if it is true, then it resumes
the execution of the remaining statements or else it stops the 10 10 + D 10 + 2D
execution.
(iii) Wait For Figure
The syntax is, Q18. List out the differences between variable
assignment statement and signal assignment
Wait for time-expression ;
statement with example.
When the wait statement is executed, it stops the
execution of the remaining statements in the process. It waits Ans: Oct./Nov.-19, Set-2, Q4(b) M[7]
for the time specified in the time-expression and resumes its The differences between variable and signal assignment
execution after the time gets elapsed. statements are tabulated below.
Example: For answer refer Unit-1, Q17, Topic: Example: For answer refer Unit-1, Q17, Topic: Signal
Variable Assignment (Refer only Example). Assignment (Refer only Example).
Q19. Explain IF statement in VHDL with example. Give the comparisons between CASE and IF statement.
Oct./Nov.-19, Set-3, Q4(b) M[7]
(or)
Explain with an example the syntax and the function of if statement.
Ans:
IF statement
The selection of the if statement is based on the boolean evaluation of the conditions. If all the conditions are not available
there is an absence of else results in implicit memory.
Syntax
if boolean_expression then sequential_statement
end if;
if boolean_expression then sequential_statement
else sequential statement;
end if;
if boolean _expression then sequential_statement
else boolean_expression then sequential;
end if;
Example
Process(N)
Variable N1 : INTEGER;
begin
N1 : = Conv_INTEGER (N) ;
if N1 = 1 or N1 = 2 then F < = ‘1’1 ;
elseif N1 = 3 or N1 = 5 or N1 = 7 or N1 = 11 or N1 = 13 then F < = ‘1’ ;
else F < = ‘0’
end if;
end process;
Comparison
The comparison between if and case statement in VHDL is that, selection of if statement depends on the Boolean evaluation
of the conditions whereas, the selection of case statement depends on the Boolean expression.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 17
Q20. Explain the following terms in Behavioral (ii) Null statement
Modeling : For answer refer Unit-1, Q21 Topic: Null statement
(i) Case statement, (iii) Loop statement
(ii) Null statement Loop statements allow the user to execute a sequence of
(iii) Loop statement. statements several times.
(Model Paper-4, Q1(b) | March-21, Set-1, Q4(a) M[7]) In VHDL, there are three types of loop statements. They
are,
(or)
1. For loop
Explain the structure of various LOOP statements
2. While loop
in VHDL with examples. March-21, Set-4, Q3(a) M[7]
3. Simple loop.
(Refer only Loop statement)
1. For Loop
(or)
The statements are repeated number of times specified
Explain CASE statement in VHDL with example. by a count in the ‘For’ loop.
Oct./Nov.-19, Set-2, Q4(a) M[7]
Syntax
(Refer only case statement) [label] for counter in range loop
(or) statements sequence
Explain the structure of various LOOP statements end loop[label];
in VHDL with examples. Oct./Nov.-18, Set-1, Q3(a) M[7] Example
(Refer only Loop statement) To compute squares of integer value between 1 and 10.
Ans: for i in 1 to 10 loop
(i) Case statement Square (i) < = i × i;
‘Case statement’ is a simple construct used to execute end loop;
a single statement from many alternatives, the selection of the
Iteration of count is of type integer by default. Initially,
statement depends on the expression.
i value is 1, then after each iteration i is incremented by 1 and
Syntax continues till it reaches 10 and gets terminated from the loop.
Case expression is 2. While Loop
when choices = > sequential_statements In while loop, statements in the loop body are repeated
. until a condition specified become false.
Syntax :
.
[label] while condition loop
.
statement sequence
when others = > sequential_statements
end loop[label];
end case;
In this, the condition is tested before each execution of
In the above syntax, the expression should be a discrete the loop. If condition is true the sequence of statements executed
value or of 1-D array type. The choice can be a single value or with in loop. If condition is false loop terminates.
multiple values separated by a vertical bar ‘‘’. The “when others”
Example
clause may be optional and it must be at the last.
To count the rising edges of clock signal while level
Example
signal is 1.
Process(N)
Process
begin variable count: integer = 0;
Case CON_INTEGER is begin
when 1 = > F < = ‘1’; wait until clock = ‘1’;
when 2 = > F < = ‘1’; while level = ‘1’ loop
when 3/5/7/11/13 = > F < = ‘1’; count: = Count + 1;
when others = > F < = ‘0’; wait until clock = ‘0’;
end case; end loop;
end process; end process
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 19
Example Syntax
entity DFF is report string_expression
Port (D,clk : in BIT ; Q, NOTQ : out BIT); [severity expression];
end DFF Example
Architecture examine-Times of DFF is if CLR = ‘z’ then
Constant HLD-TIME :TIME = 10 ns ;
report “Signal CLR possess high impedance”;
Constants SETUP-TIME :TIME = 5 ns ;
Null Statement
begin
A null statement specifies that no action should be
process (D, CLK) performed and proceed to the next statement. It is mostly
Variable previousevent on D, previous event used in ‘if’
on CLK : TIME;
and ‘case’ statements to omit some conditions.
begin
Example
....examine for hold time :
Case operation is,
if D’ EVENT then
When “00” = > output : = A or B
asset Now = 0ns or
When “01” = > output : = A and B
(Now-previous event on CLK) > = HLD_TIME
report “HLD time very small!” When “10” = > output : = A nand B
severity FAILURE ; When other = > null ;
prevoiusevent on D : = Now ; end case
end if ; The above example is limited to perform only some of
...examine for setup time : the logical operations while others are blocked.
if CLK = 1 and CLK’EVENT then 1.1.6 VHDL Libraries
assert NOW = 0 ns or (Now_previousevent on D Q22. Explain about the following,
> = SETUP_TIME report “Setup time every short !”
(i) Packages with syntax
Severity FAILURE
(ii) Libraries with syntax.
previousevent on CLK : = Now ;
Ans: Oct./Nov.-18, Set-4, Q3(a) M[7]
end if ;
... Behaviour of D flipflop : 1. Packages
if CLK = ‘1’ and CLK’ EVENT then For answer refer Unit-1, Q7.
Q<=D; 2. Libraries
NOTQ < = not D ; The VHDL compiler stores all the information related
end if ; to the design and utilities in a location known as library. It
stores the result of a VHDL model after analyzing it for no
end process ; errors. The primary use of the library is to promote the sharing
end examine-TIMES ; of previously compiled designs for future VHDL descriptions
In the above example, ‘EVENT is a predefined attribute and in subsequent simulation applications.
and its value will be true if any event occurs on it at times; when A library consists of following four segments,
the value of attributes are evaluated. ‘Now’ is also a predefined
(i) Package (shared declarations)
function whose function is to determine the current simulation
time. The sensitivity list of process is D and CLK. So, whenever (ii) Entity (shared designs)
an event occurs on ‘D’ or on ‘CLK’, the process starts its (iii) Architecture (shared implementations of design)
execution. If the event is occurred on D, then the assertion is
examined and determines whether the differences between the (iv) Configuration (shared versions of design)
current simulation time and the last simulation time are higher Basically, there are two classes of VHDL libraries
than the hold-time. If it is less, then a message is generated as namely, work library and resource libraries.
failure and the severity level will be returned to simulator. Work Library: This library is the default working
Report Statement library which stores the results of current analysis.
A statement that is employed to display a message is Resource Libraries: These libraries are used only for
termed as report statement. Report statement is same as assertion referencing during simulation and analysis (i.e., these
statement but there is no assertion check is required. cannot be written or edited).
In VHDL, library clause is employed to make the library (Refer only Topic: Binding between Entity and
name or logical name of designed libraries visible. Library Component)
clause never make design units visible. Ans:
SYNTAX Binding
Library list_of_logical_library_names; Bindings in VHDL can be defined as the process of
associating a design entity and an architecture to a component
Example
instance. Each component must be bounded inorder to complete
1. Library IEEE a design for simulation or synthesis purposes.
2. Library NMOS Binding of components can be indicated either by default
or by explicit representation. Basically, there are three possible
3. Library PMOS
ways for accomplishing component binding in VHDL. They are,
USE Clause Default binding – Solving component configuration
In VHDL, USE clause is employed to import all the default.
declarations falling under the package. USE clause possess two Configuration specification – Binding information is
forms. They are, specified in the architecture itself.
1. First Form Configuration declaration – Binding information is
specified separately from the architecture.
USE library_name.primary unit_name;
Binding between Entity and Component
This form enables the specified primary unit name from
the specified design library to be referenced in the design. The binding between the entity and component depends
upon their names. If the names of entity and component are
Example same, then the component is automatically bounded to the entity.
Library ECL; Example
USE ECL.AND; Entity andgate is
Configuration....is port(I1, I2 : in std_logic;
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 21
port (A, B : in std_logic;
sum, cout : out std_logic);
end ent;
architecture arch of ent is
component andgate
---------
---------
end component;
begin
---------
end arch;
Here entity name and component name both are and gate. So, these entity and component are bounded automatically.
Q25. List out the differences between VHDL functions and procedures with example.
Oct./Nov.-19, Set-4, Q3(b) M[7]
(or)
Explain the difference between function and procedure supported by VHDL. Give the necessary examples.
Oct./Nov.-16, Set-2, Q3(a)
(or)
What is subprogram? Give the syntax of VHDL functions. Oct./Nov.-19, Set-4, Q3(a) M[7]
Functions Procedures
1. In functions, the values of parameters that are 1. In procedures, the values of parameters that are passed
passed remain constant. can be changed.
2. It consists of a return statement. 2. It may or may not have a return statement.
3. In function a single value is returned. 3. In procedures multiple output values are produced.
4. The values of objects passed in functions 4. The values of objects passed in procedures is badly
remains unaffected. affected
5. These are invoked by expression. 5. These are invoked by statements.
Q26. Design the logic circuit and write a structural style VHDL program for the following function.
F(A) = πp, q, r, s (1, 3, 4, 5, 6, 7, 9, 12, 13, 14).
Ans:
The given boolean function is,
F(A) = πp, q, r, s (1, 3, 4, 5, 6, 7, 9, 12, 13, 14)
The given function is in Product of Sum (POS) form and hence, it can also represented in Sum of Product (SOP) form as,
F(A) = Σp, q, r, s (missing terms in given pos form)
∴ F(A) = Σp, q, r, s (0, 2, 8, 10, 11, 15)
On applying Karnaugh map to above boolean expression, we get,
pq rs 00 01 11 10
00 1 1
0 1 3 2
qs
01
4 5 7 6
11 1 15
12 13 14
10 1 1 1
8 9 11 10
prs
Figure (1)
Thus, the simplified boolean expression is,
∴ F ( A) = q s + prs
Logic Circuit
The logic circuit for the above simplified boolean expression is shown in figure (2).
p q r s
s
qs
q
F(A) = q s + prs
prs
Figure (2)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 23
VHDL Code in Structural Style Thus, the simplified boolean expression is,
The structural style of VHDL program for the simplified F(Q) = BD + B D = B D
boolean expression i.e.,
Logic Circuit
F(A) = q s + prs is shown below.
The logic circuit for the above simplified boolean
library IEEE; expression is shown in figure (2),
use IEEE.STD_LOGIC_1164.all; A B C D
entity FunF is B
port(p, q, r, s: in STD_LOGIC; FA: out STD_LOGIC); BD
4 5 7 6
01 1 1 1
ABC
12 13 15 14
11 1 1
8 9 11 10
10 1 1 1
D
F(P) = A BC + BC + D
Figure
VHDL Code in Data Flow Style
The data flow style of VHDL program for the simplified boolean function is mentioned below,
library IEEE;
use IEEE . STD_LOGIC_1164.all;
entity function is
port (A, B, C, D : in STD_LOGIC;
F : out STD_LOGIC);
end function;
architecture function_1 of function is
begin
F < = ((NOT A) AND (B) AND (NOT C)) OR ((NOT B) AND (C)) OR ((NOT D))
end function_1;
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 25
Q29. Design the logic circuit and write a data-flow style of VHDL program for the following function,
F(Y) = ΣA,B,C,D (1, 4, 5, 7, 12, 14, 15) + d (3, 11).
Ans:
The given boolean function is,
F(Y) = ΣA,B,C,D (1, 4, 5, 7, 12, 14, 15) + d (3, 11)
The above boolean function can be simplified using 4-variable K-map as,
CD AD
AB 00 01 11 10
0 1 3 2
00 1 x
4 5 7 6
01 1 1 1
BCD
12 13 15 14
11 1 1 1 ABC
8 9 11 10
10 x CD
F(Y) = ABC + BC D + A D + CD
Figure
VHDL Code in Data Flow Style
The data flow style of VHDL program for the simplified boolean function is mentioned below,
library IEEE;
use IEEE . STD_LOGIC_1164.all;
entity function is,
port (A, B, C, D : in STD_LOGIC;
F : out STD_LOGIC);
end function;
architecture function_1 of function is
begin
F < = ((A) AND (B) AND (C)) OR ((B) AND (NOT C) AND (NOT D)) OR ((NOT A) AND (D)) OR ((C) AND (D));
end function_1;
= (ab + a b) c + (ab + a b) c
= (ab + a b) c + (ab . a b) c
(
= a b c + a b c + (a + b) . (a + b ) c )
= a b c + a b c + [ a a + a b + ab + b b ]c
= a b c + a b c + [ a b + ab]c [ x. x = 0]
∴ F(x) = a b c + a b c + a b c + abc
The logic diagram of given function is,
a
b F(x)
c
Data Flow
Entity function is,
Port(a, b, c : in STD_LOGIC; F: OUT STD_LOGIC);
end function;
Architecture data_flow of function is,
begin
F <= (a and NOT b and NOT c) OR (NOT a and b and NOT c) OR (NOT a and NOT b and c) OR (a and b and c);
end data_flow;
Q31. Write a process based VHDL program for the prime-number detector of 4-bit input and explain the flow
using logic circuit.
Ans: Oct./Nov.-18, Set-2, Q3(b) M[7]
4-bit Prime-number Detector: In a 4-bit prime number detector, the 4-bits produce 16-input combinations (i.e., from 0 – 15)
among which 1, 2, 3, 5, 7, 11 and 13 are the possible prime numbers i.e.,
f = Σm (1, 2, 3, 5, 7, 11, 13)
If A, B, C and D are the 4-inputs, the Karnaugh-map for possible prime numbers is shown in figure (1),
CD
00 01 11 10
AB
0 1 3 2
00 1 1 1 A BC
4 5 7 6
01 1 1 AD
12 13 15 14
11 1 BC D
8 9 11 10
10 1 BCD
BCD
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 27
Thus, the simplified boolean expression is,
f (A, B, C, D) = A B C + A D + BC D + B CD
The logic circuit for the 4-bit prime detector can be obtained by implementing the above boolean expressions using logic
gates as shown in figure (2).
A B C D
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 29
In the first phase, the architecture of the design is described in behavioral level, which is the highest abstraction level. This
level does not specify the design implementation. At every level, the design descriptions are verified for their functionality by a
simulation tool. After simulation, the behavioral description is converted to a RTL description using an algorithmic synthesis tool.
This is an automated design process that interprets the behavioral level description of a desired behaviour and creates hardware
that implements the behaviour. The Register Transfer Level (RTL) specifies the flow of data between registers and the processing
of data by the design. Further, the design is simulated and forwarded on to the next level.
In the next level, the RTL description is converted to a gate level description using a logic synthesis tool. The logic synthesis
tool generates a net list of logic gates that are required for implementing the total design.
Once the logic synthesis process is finished, the next step is to implement a logic network with the available gate level
net list. After implementation, the logic of the network is verified by carrying out simulation. If the logic is found correct, then
circuits are designed using the cell library.
During the next level, all the components are assembled. Once the assembling is completed, simulation is carried out for
verifying its electrical parameters and the logic. Now the design is carried on to the next phase i.e., physical design. Here conver-
sion of cell instances and their wirings into corresponding pattern of silicon is carried out. In other words, layout is done. In the
final stage, the layout is inspected and thus forwarded to the production unit where a silicon test chip is produced.
The levels in which the above design is carried out, is provided by verilog HDL. Here, the step by step design is implemented
by identifying the relation between each level and linking them through appropriate verilog code as each level has its own style
and reserved words. Also, there are various switch constructs for MOSFETs available in verilog HDL that makes it popular to
be used in VLSI design.
Q35. Compare VHDL and verilog HDL.
Ans:
VHDL and verilog HDL are two hardware description languages. These languages are designed to understand the behaviour
and hardware structure of a model. The comparison between VHDL and verilog HDL is as follows,
VHDL Verilog HDL
1. VHDL is a hardware description language employed Verilog HDL is a hardware description language used to
to model digital system at various levels, i.e., ranging define hardware at various levels i.e, gate level, register
from algorithm level to gate level. transfer level and algorithmic level.
2. Functions and procedure are assembled in a same Functions and procedure are assembled in a separate system
package. files.
3. VHDL language is unable to understand easily, as it Verilog HDL language is easy to understand.
is strongly typed.
4. It is difficult to compile. It is easy to compile.
5. In VHDL, data type used is user defined. In verilog HDL, data type used is not user defined and is
very simple to use.
6. In VHDL, the generate statement replicates a number The concept of structural replication is not possible in
of identical instances for the design unit and connect verilog.
them properly.
7. Compiled entities, architecture packages and The concept of library and package is not available or used
configurations are saved in libraries to manage many in verilog.
design projects.
8. VHDL enables concurrent procedures calls. Verilog HDL enables task calls.
9. Extensive set of operations are available in VHDL. Predefined unary and extensive set of operations are
available in verilog HDL.
10. It is not case sensitive. It is case sensitive language.
endmodule
The higher level of design description next to circuit level is the gate level. At this level, a digital circuit is described in
terms of basic gates like and, or, nand, nor, xor and xnor. All the basic gates are available as ‘primitives’ in verilog. Primitives are
general modules that are predefined in verilog. They can be incorporated (instantiated) directly in other modules. More complex
circuits can be modeled by repeated and successive instantiation of the ‘primitives’.
For instance, design description for a 2-to-1 multiplexer as shown in figure (2) at gate level is,
i1 y1
Out
i0 i0 y0
2-to-1
MUX Out
i1
S0n
S0
S0
Select pin
Block diagram Logic diagram
Figure (2): 2-to-1 Multiplexer
Program
module mux 2_to_1 (out, i0, i1, s0); //module of 2_to_1 multiplexer
output out; //declaration of output from I/O diagram
input i1, i0; //declaration of input from I/O diagram
input s0; //declaration of input from I/O diagram
wire s0n; //declaration of internal wire
Gate level description
endmodule
a e
b g1 g
c f
d
begin
if(reset = = 0) q<=0;
else if(set = = 0) q<=1;
else q<=data;
end
endmodule
Design of a digital circuit in behavioral level resembles a program written in ‘C’ language.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 33
Q39. Explain the components of a verilog module A module may or may not contain all the above
with block diagram. components and no rule is followed in the order of their
(or) placement although, a module should begin with a keyword
‘module’, end with ‘end module’ statement and should have a
What are the basic components of a module? module name.
Ans:
Block Diagram Showing Components of Verilog Module
Module
‘Module’ is a keyword from where a verilog code starts.
It is assigned a name and contains input and output terminals
known as ports.
Ports
The three kinds of ports are,
1. Input Ports
These are entry terminals from where input data enters
a module.
2. Output Ports
These are exit terminals from which data is sent out of
a module.
3. Inout Ports
There are two way terminals from which data enters at
some point of time and exits at some other points of time.
A module may contain any number of input ports,
output ports, inout ports and even no ports as it is decided by
the function given to a module.
A module contains various components as shown in
figure,
Module name(ports list);
(keyword)
Declaration of ports(if present); Figure: Module Components
Parameter declarations(if any);
Q40. Explain the port connection rules in a module
Wires declarations
instantiation?
regs declarations
Ans: Model Paper-2, Q2(b)
Data flow statements(such as assign)
A port provides connectivity between the modules which
Lower level modules instantiation
are connected by name or by ordered list.
Behavioral statements
A port has two parts in a module. They are,
(such as always and initial blocks)
1. Internal module
Declaration of
2. External module
Tasks and functions
endmodule statement When these modules are instantiated within other
modules, then port connection rules are used.
(keyword)
The width of internal and external modules must be same.
The definition of a module starts only with ‘module’
keyword, followed by a module name, list of ports, their declarations, In verilog, unconnected ports are also allowed.
parameters declaration. Note that a module communicates with the Example
outside environment only through its ports.
Module fulladd (sum, a, b, c - out, C-in);
As shown in figure a module contains the following five
components. They are, fulladd fa0 (SUM, A, B, C_IN);
1. Declaration of variables Here, output port is not connected.
2. Data flow statements The three types of ports and verilog keywords used are,
3. Lower level module instantiation 1. Input port – Input
4. Behavioral statements 2. Output port – Output
5. Tasks and functions. 3. Bidirectional port – Inout
Net
Net Inout
External
Input Output module
Internal module
10b
b5 These are not decimal numbers since
d8 they include alphabets.
–20c
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 35
(b) Base Form
It is possible to represent numbers in various formats namely,
(i) Binary form (Base of 2)
(ii) Decimal form (Base of 10)
(iii) Octal form (Base of 8)
(iv) Hexadecimal form (Base of 16).
The format to represent such numbers is given below with an example.
– 4 b 1 01 1
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 37
Some of the keywords are listed below, 3. Registers
1. module – A module is defined starting with this 1. Register datatypes are the variables that are used
keyword to store the data.
2. endmodule – The definition of a module ends with this 2. The variables present in the procedural blocks are
keyword register datatypes.
The register datatype is represented with “reg”.s
3. begin – A set of statements in a block start with
this keyword The default initialization value of register data type is
garbage value (i.e., unknown value ‘x’).
4. end – A set of statements within a block are
terminated using this keyword Example
reg x, y; // single bit variable register
5. if – Verifying the conditional statement.
reg [15 : 0]; // 16-bit variable register.
1.2.2 Data Types, Data Operators 4. Vectors
Q43. Explain about different data types used in 1. The vectors are declared using net data type or
verilog HDL. register data type.
2. The range of vectors is represented by two digits
Ans:
enclosed between two square brackets separated
Different data types used in verilog are, by a colon.
1. Value Set The representation of vector is as shown in figure.
The four basic states of value set in verilog HDL are,
1. Logic zero i.e., ‘0’ b[0]
Circuit 1 Circuit 2
2. Logic one i.e., ‘1’ b[1]
3. Unknown logic value i.e., ‘x’ b[2]
b[3]
4. High impedance state i.e., ‘z’
Where,
4-bit vector
Logic ‘0’ and logic ‘1’ are complement to each other. Part vectors
When high impedance state is present at the input of a Figure: Representation of Vectors
gate, then its function is same as that of ‘x’ i.e., unknown logic
value. Examples of vectors are,
wire [2 : 0]x; /* x is a net type of vector containing 3
2. Nets
bits referred as x[2], x[1], x[0]*/
A link (connection) between different circuits is reg [10 : 5]z; /* z is a reg type of vector containing 6 bits
represented by net data type. It transfers the signal value that it referred as z[10], z[a], z[8], z[7], z[6] and z[5]*/
drives to the circuit it is driven by when no driver is connected
The integer to the left colon represents MSB and to the
to the net, it takes ‘z’ logic value. There are two keywords to
right of colon represents LSB.
declare nets.
The two types of vectors are,
Wire
1. Signed quantities (or) vectors
It is used to declare a simple net that connects two 2. Unsigned quantities (or) vectors
circuits. It supports connection of single output that
Signed vectors are represented using the keyword
drives the net.
“signed”.
Example Vectors that are not represented as signed are assumed
wire x; //x is a net of 1 bit as unsigned vectors.
wire x = 1'b1 //x is a net of 1 bit assigned as logic 1. 5. Integer
Tri Integer is a keyword used to declare integers. It is a reg
data type that can store signed numbers. This data type
It declares a simple net and the number of signal outputs is mostly used to declare counter variables.
that can drive a net can be greater than one.
Example
Example integer count; /*count is a variables that can be store
tri out; //out is a net integer values*/
A part from wire and tri data types other net types are initial
wand, wor, tri, triand, trior, trireg etc. count = –3;
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 39
The corresponding ASCII values of individual characters are,
v – 118 – 0 1 1 1 0 1 1 0
e – 101 – 0 1 1 0 0 1 0 0
r – 114 – 0 1 1 1 0 0 1 0
i – 105 – 0 1 1 0 1 0 0 1
l – 108 – 0 1 1 0 1 1 0 0
o – 111 – 0 1 1 0 1 1 1 1
g – 103 – 0 1 1 0 0 1 1 1
\ The binary values are,
01110110 01100100 01110010 01101001 01101100 01101111 and 01100111.
Q44. Explain defparam and localparam keywords.
Ans: Model Paper-3, Q2(b)
Defparam: This is the keyword used to change parameter values in any module instance in the design. This approach can use
hierarchical name of the module instance to override parameter values.
Usage of defparam to override parameter values in module instances is given in below verilog code.
module hello_world; //A module is defined as hello_world
parameter id_num=0; //A module identification number is defined as zero
initial
$display(“Displaying hello_world id number = %d”, id_num);
//displaying “Displaying hello_world id number” with defined value i.e., zero
endmodule
module top; //top-level module is defined
defparam W1.id_num = 1, W2.id_num = 2; //defparam statement is used to change id_num from zero to 1 and 2
hello_world W1( ); //one hello_world module is instantiated
hello_world W2( ); //another hello_world module is instantiated
endmodule
In the above example, initially a module is defined by hello_world then a parameter id_num is declared with zero. Further,
two module instances W1 and W2 are instantiated of hello_world type, then their respective id_num values are changed to 1 and
2 using the defstatement. Following output is obtained after simulation of above verilog code.
Output
Displaying hello_world id number = 1
Displaying hello_world id number = 2
Localparam
One of the parameters defined in verilog is localparam.
A localparam is constant i.e., similar to a parameter. The value of localparam cannot be changed with the help of defparam
statement or by any other method.
In other words, the values that do not require any alterations are declared as localparam. Overwriting of the values can be
prevented with the help of localparam. When one module is instantiated over another module, the passage of values for different
data types is not possible.
Syntax
localparam name = value;
Example
1. Localparam depth = width * 10;
2. localparam size = 8;
Q45. Explain different types of operators used in the verilog HDL.
Ans:
The different types of operators used in verilog HDL are,
Unary Operators: Unary operators are associated with a single operand. The operand is proceeded by the unary operator and the
result of operation is stored in the same operand. The list of unary operators with examples are given in table (1).
Let A = 1 0 0 1 0 0 1 1, B = 1
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 41
The few points to be noted are,
The two operands are treated as two numbers by the arithmetic operators thus outputs the numerical value.
Operands that are declared as net or reg type are assumed as unsigned numbers.
Operands declared as real or integer types may be treated as signed numbers.
If any of the operands contains value 0, then the result of operation would be zero.
If any of the operands contains value x or z, then the result of operation will be the value x.
Arithmetic Operators
Table (3) shows various arithmetic operators.
Let, A = 1 0 1 0
B=0001
Arithmetic Operators Operator Name Example Result
+ Addition A+B 1011
– Substraction A–B 1001
* Multiplication A*B 1010
/ Division A/B 1010
% Modulus A%B 0000
** Power A ** B 1010
Table (3): Arithmetic Operators
In the table (3), the modulus % operator returns the remainder result of division between two operands.
The few points to be noted are,
When the division operation is performed between two integer numbers, then the result contains only integer part truncat-
ing the fractional part.
The arithmetic operation performed on the operands that contains the values x or 2 results in the value x.
The result of a modulus operation contains a negative number if its first operand is negative.
Logical Operators
Table (4) contains various logical operators.
Let, A =100
B=0010
Logical Operator Operator Name Example Result
&& Logical AND A&&B 1
|| Logical OR A||B 1
~ Bitwise logical
negation ~A 0110
& Bitwise logical AND A&B 0000
| Bitwise logical OR A|B 1011
^ Bitwise logical XOR A∧B 1011
~ ∧ or ∧ ~ Bitwise logical XNOR A~∧B 0100
>> Logical right shift A >> B 0010
<< Logical left shift A << B 0100
Table (4): Logical Operators
The operands can be either variables or expressions associated with variables.
If one of the operands contain value x or 2, then the result of operation also contains a value x.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 45
if syntax Q51. Write the syntax for the following constructs
if(<expression>) true_statement; and give one example for each relevant to
behavioral verilog HDL modeling,
if-else syntax
(i) assign-deassign construct
if(<expression>) true_statement;
(ii) Repeat construct
else false_statement;
(iii) for loop.
When the number of statements to be executed (in a if
Ans:
or if-else construct) are more than one then they are grouped
using the keywords ‘begin’ and ‘end’. (i) assign-deassign Construct
“if” Statement Syntax for Multiple Statements In assign-deassign construct the keywords assign
and deassign are used to express the first type of procedural
if(condition or expression)
continuous assignment. The left-hand side of procedural
begin continuous assignments can only be a register or a concatenation
statement1; of registers. It cannot be a part or bit select of a net or an array
of registers. The procedural continuous assignments override
statement2; the effect of regular procedural assignments. These assignments
end are normally used for controlled periods of time.
“if-else” Statement Syntax for Multiple Statements Syntax
if(condition or expression) ----
begin assign variable = value;
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-1 (Hardware Description Languages) 47
Q1. Explain the VHDL program file structure with the syntax of a VHDL entity declaration and
REPEATED
architecture definition. 5
(March-21, Set-1, Q3(a) M[7] | Oct./Nov.-20, Set-1, Q3(a) M[7] | Oct./Nov.-19, Set-2, Q3(b) M[7]) TIMES
Ans: Refer Q4. (Oct./Nov.-19, Set-2, Q3(a) M[7] | Oct./Nov.-19, Set-3, Q1(a) M[7])
Q2. Explain the difference in program structure of VHDL and any other procedural language.
REPEATED
Give an example.
2
TIMES
Ans: Refer Q5. (Oct./Nov.-18, Set-1, Q3(b) M[7] | March-21, Set-2, Q3(a) M[7])
REPEATED
3
TIMES
Ans: Refer Q8. (Oct./Nov.-20, Set-1, Q3(b) M[7] | Oct./Nov.-18, Set-3, Q3(a) M[7] | Oct./Nov.-16, Set-2, Q3(b))
Q4. What are the different data objects supported by VHDL? Explain scalar types with suitable
REPEATED
examples. 4
(Oct./Nov.-16, Set-1, Q2(a) | Oct./Nov.-19, Set-1, Q3(b) M[7]) TIMES
Ans: Refer Q11. (Oct./Nov.-19, Set-3, Q3(b) M[7] | Nov.-15, Set-1, Q2(a))
REPEATED
(i) Case statement (ii) Null statement (iii) Loop statement. 4
TIMES
(March-21, Set-1, Q4(a) M[7] | March-21, Set-4, Q3(a) M[7])
Ans: Refer Q20. (Oct./Nov.-19, Set-2, Q4(a) M[7] | Oct./Nov.-18, Set-1, Q3(a) M[7])
Q6. Explain IF, exit, next, assertion, report and null statements.
REPEATED
(Oct./Nov.-18, Set-3, Q4(a) M[7] | March-21, Set-2, Q4(b) M[7] 4
TIMES
Ans: Refer Q21. (Oct./Nov.-20, Set-1, Q4(b) M[7] | Oct./Nov.-19, Set-4, Q4(a) M[7])
Q7. Discuss the binding. Discuss the binding between entity and components.
REPEATED
2
TIMES
Ans: Refer Q24. (Oct./Nov.-18, Set-2, Q3(a) M[7] | March-21, Set-1, Q1(b) M[7])
Q8. With suitable block diagram explain about the design flow of VHDL.
Ans: Refer Q2. Important Question
Q9. Explain various data types supported by VHDL and give necessary examples.
Ans: Refer Q10. Important Question
Q12. Explain about variable assignment statement, signal assignment statement, wait statement.
Ans: Refer Q17. Important Question
Q13. List out the differences between variable assignment statement and signal assignment statement with
example.
Ans: Refer Q18. Important Question
Q15. Write a process based VHDL program for the prime-number detector of 4-bit input
and explain the flow using logic circuit.
Ans: Refer Q31. Important Question
Q20. Write the syntax for the following constructs and give one example for each relevant to
behavioral verilog HDL modeling,
(i) initial construct
(ii) always construct
(iii) wait construct.
Ans: Refer Q47. Important Question
Q21. Write the syntax for the following constructs and give one example for each relevant
to behavioral Verilog HDL modeling,
(i) The case statement
(ii) if and if-else constructs.
Ans: Refer Q50. Important Question
Q22. Write the syntax for the following constructs and give one example for each relevant to
behavioral verilog HDL modeling,
(i) assign-deassign construct
(ii) repeat construct
(iii) for loop.
Ans: Refer Q51. Important Question
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 49
2 Design SI
A GROUP
Syllabus
COMBINATIONAL LOGIC DESIGN
Parallel binary adder, carry look ahead adder, BCD adder, Multiplexers and demultiplexers and their use in combinational logic
design, ALU, Digital comparators, Parity generators, Code converters, Priority encoders. (Qualitative approach of designing and
modeling the mentioned combinational logic circuits with relevant digital ICs using HDL)
Learning Objectives
C How carry look ahead adder overcomes the drawbacks of Parallel binary adder.
C Special Integrated circuits that are designed to perform the functions of ALU.
Introduction
The traditional methods of designing combinational circuits, which involve simplification and realization through the use of gates,
enabled us to integrate complex functions and make them available in the form of integrated circuits (MSI). Numerous devices
are available in the form of IC’s; these include multiplexers, de-multiplexers, adders, parity generators/checkers, priority
encoders, decoders, and comparators. This unit introduces these complex integrated circuits and their use in combinational
system design. The difficult, lengthy, and time-consuming simplification approaches are no longer required when using these
ICs in system design. Therefore, the system design becomes easier. Also, the total cost of the system is lower because these
ICs drastically cut the number of IC packages that need to be made. Furthermore, having fewer cable connections to the
outside world makes the system more reliable. In order to get the most out of these ICs, the designer needs to learn more
about how they work, what options they have, and what they can’t do.
2.1 Parallel Binary Adder, Carry Look Ahead Adder, BCD Adder
Q1. Explain the operation of a ripple carry adder. (Model Paper-2, Q3(b) | March-21, Set-3, Q5(b))
(or)
Explain the implementation of N-bit binary adder using full adders.
Ans:
We can design adders for n-bit numbers using half-and full-adder circuits (that are used for adding two one-bit binary
values). Figure (a) illustrates an n-bit binary adder that is used for the addition of two n-bit binary numbers. The circuit contains
“n” full-adder circuits that accept two n-bit binary numbers as inputs and produce an (n + 1)-bit binary number as the sum. Figure
(b) illustrates the block diagram of the n-bit Binary Adder.
Bn – 1 An – 1 Bn – 2 An – 2 B1 A1 B0 A0
Cn – 2 C1 C0
Cn – 1 Sn – 1 Sn – 2 S1 S0
A Input B Input
An – 1 An – 2 A A Bn – 1 Bn – 2 B B
1 0 1 0
Cn – 1 Sn – 1Sn – 2 S1 S0
Output
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 51
C7 S7 S6 S5 S4 C3 S3 S2 S1 S0
a
bb
bb
bb
bb
bb
bb
bb
bb
bb
bb
bb
`
bb
bb
bb
bb
bb
bb
bb
bb
bb
bb
bb
_
SUM
Figure (c): Two 4-Bit Adders are Combined to Form an 8-Bit Adder in a Cascade
Q2. Design 8-bit ripple carry adder using full adder and write the VHDL code to implement the 8-bit ripple
carry adder.
Ans:
The block diagram of an 8-bit ripple carry adder using full adder is shown in figure,
B8 A8 B7 A7 B6 A6 B5 A5 B4 A4 B3 A3 B2 A2 B1 A1
C7 C6 C5 C4 C3 C2 C1
Cout FA8 FA7 FA6 FA5 FA4 FA3 FA2 FA1 Cin = 0
S8 S7 S6 S5 S4 S3 S2 S1
Figure
The Cin (carry in) for the 1st full adder is zero.
C1, C2,....,C7 are the carry inputs to the full adders FA1, FA2,....., FA8 respectively. The truth table of a full adder is shown
in table below.
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Table
The corresponding expressions for sum and carry out are obtained as,
Sum = A B Cin + A B Cin + A B Cin + ABCin
Sum = A ⊕ B ⊕ Cin ... (1)
Cout = A B Cin + A B Cin + AB Cin + ABCin
Cout = (A ⊕ B)Cin + AB ... (2)
For the first adder FA1, the Cin = 0 thus equations (1) and (2) are reduced to,
Sum = A ⊕ B
Cout = AB
(or)
Write the disadvantages in implementation of n-bit binary adder using full adders. Oct./Nov.-16, Set-4, Q6(a)
(or)
Explain the working of carry look ahead adder and its advantages. Oct./Nov.-16, Set-4, Q6(b)
Ans:
Disadvantages in Implementation of N-bit Binary Adder
In order to create the n-bit binary adder, it is necessary for the carry to ripple along the line of cascaded adders, from the
LSB to MSB position. In other words, the carry output of each full adder is fed into the carry input of the next adder. Each stage
creates sum and carry outputs only when there is input carry in the preceding stage. As a result, the n-bit binary adder experiences
delay during the addition operation, which is referred to as ‘‘carry propagation delay (or) inter-stage carry delay.’’
To overcome this limitation and accelerate the addition process, a new technique called “Look ahead-carry addition” is
implemented. This technique makes use of two new functions “Carry generation” and “Carry propagation”.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 53
Carry Look Ahead Adder
The Carry look-ahead adder incorporates additional circuitry to enhance its speed and make the addition process independent
of the number of bits. The added circuitry implements two new functions: “Carry generation” and “Carry propagation,” which
are both described in detail below.
Pi A B C C +1 Condition
Ai
Bi Si 0 0 0 0
0 0 1 0 No Carry
0 1 0 0 Generate
Gi 0 1 1 1
1 0 0 0 No Carry
Ci 1 0 1 1 Propogate
Ci – 1 1 1 0 1 Carry
1 1 1 1 Generate
C4
P3
G3
C3
P2
G2
P1
G1 C2
C1
Figure (b): Carry Generation-Circuit-of-Carry-Look-ahead-Adder
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 55
INPUTS
MINEND (A)
SUBTRAHEND (B)
(IN 2’s complement (form)
Adder A + (– B)
OVERFLOW
MSB of Yes
MSB of Yes No
A = MSB SUM = MSB of Sn – 1 = 1?
of – B? A = MSB of
No
-B?
No UNDERFLOW
Yes
No MSB
of SUM (Sn – 1)
= 0?
Yes
OUTPUT OUTPUT
RESULT NEGATIVE (In 2’s RESULT
complement form) POSITIVE
C2 C1 C0
Full Adder Full Adder Full Adder
Full Adder
Cin
Cout S3 S2 S1 S0
Figure (2): A Binary Adder-Subtractor Circuit
The circuit has 4 full adders because we’re working with 4-bit numbers. There is a control line K that has a binary value
of 0 or 1, indicating whether the operation is addition or subtraction.
If the value of the Control line K is 1, the output of EX-OR gate is B0', which is the complement of B0. As a consequence,
the operation would be written as A + (B0'). Now, for two integers A and B, the 2’s complement subtraction is provided by the
expression A + B'. This means that when K is 1, the four-bit numbers are being subtracted from each other. Similarly If the value
of K is zero, the output of EX-Or gate is B0. In this case, the operation is A + B, which is a straightforward binary addition. This
indicates that when K= 0, the four-bit integers are being added.
As illustrated in the figure, the first full adder receives its input directly. The input carry Cin is given directly from the
control line, and A0, which is the least significant bit of A is also directly given to the first full adder. The Output of EX-OR gate
(i.e.., EX-OR of B0 and K) is used as the third input. Sum/Difference (S0) and Carry (C0) are the two outputs produced.
The least significant portion of the sum/difference is recorded as the sum/difference S0. After that, C0 is serially given to
the second full adder as one of its inputs. The second, third, and fourth full adders all get direct inputs from A1, A2, and A3. The
second input is the output of EX-Or gate, that is, B1, B2, and B3 EXORed with K, which is then sent to the second, third, and
fourth full adders, respectively. A serial transfer of the carry values C1, C2 is made to the succeeding full adder, which uses them
as one of its inputs. The total carry to the sum/difference is represented by C3. S1, S2, and S3 are recorded in order to create the
outcome with S0.
Ans:
VHDL Code for 4-bit Adder / Subtractor is as follows
--FULL ADDER
library ieee;
use ieee.std_logic_1164.all;
entity Full_Adder is
port( X, Y, Cin : in std_logic;
sum, Cout : out std_logic);
end Full_Adder;
architecture bhv of Full_Adder is
begin
sum <= (X XOR Y) XOR Cin;
Cout <= (X and (Y or Cin)) or (Cin and Y);
end bhv;
--4 bit Adder Subtractor
library ieee;
use ieee.std_logic_1164.all;
entity addsub is
port( K: in std_logic;
A,B : in std_logic_vector(3 downto 0);
S : out std_logic_vector(3 downto 0);
Cout, OVERFLOW : out std_logic);
end addsub;
architecture struct of addsub is
component Full_Adder is
port( X, Y, Cin : in std_logic;
sum, Cout : out std_logic);
end component;
signal C1, C2, C3, C4: std_logic;
signal TMP: std_logic_vector(3 downto 0);
begin
TMP(0)<= K XOR B(0); -- when K=1 the adder/subtractor performs subtraction
TMP(1)<= K XOR B(1); -- when K=0 the adder/subtractor performs addition
TMP(2)<= K XOR B(2);
TMP(3)<= K XOR B(3);
FA0:Full_Adder port map (A(0),TMP(0),K, S(0),C1);
FA1:Full_Adder port map (A(1),TMP(1),C1, S(1),C2);
FA2:Full_Adder port map (A(2),TMP(2),C2, S(2),C3);
FA3:Full_Adder port map (A(3),TMP(3),C3, S(3),C4);
OVERFLOW <= C3 XOR C4 ;
Cout <= C4;
end struct;
--A port map maps signals in architecture to ports on an instance within that architecture. In this case it maps to Full adder.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 57
Q8. Design a full subtractor with logic gates and write VHDL data flow program for the implementation of
the above subtractor. (Model Paper-3, Q3(a) | March-21, Set-1, Q5(a))
(or)
Design full subtractor circuit and write a VHDL code for implementation of full subtractor.
Ans: The truth table for a full subtractor is shown below.
A B C D Bi
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
Table
Q D = A – (B + C)
Where, ‘Bi’ stands for BORROW and ‘D’ stands for DIFFERENCE.
Difference
D = A B C + A B C + A B C + ABC
= A ( B C + B C ) + A ( B C + BC)
= A (B ⊕ C) + A ( B ⊕ C )
∴D =A ⊕ B ⊕ C
Borrow
Bi = A B C + A B C + A BC + ABC
= A ( B C + B C ) + BC (A + A )
= A B C + A B C + BC
= A B C + B (C + C A )
= A B C + B (C + A )
= C + BC + B A
= C ( B + A)+BA
= C (B + A ) + B A
= BC + A C + A B
Therefore, the full subtractor circuit is as shown in figure (1).
A B C
Bi
D <= (A XOR B XOR C); 1. Add the BCD digits together as if they were conventional
Bi <= ((B AND C) OR (NOT A AND C) OR (NOT binary numbers.
A AND B)); 2. It is a valid BCD digit if the sum is 9 or less and no carry
end process; was created.
end F_S1; 3. If the addition yields a carry, the amount is incorrect,
Q9. What is BCD? Explain how to perform BCD and to obtain correct value we must add 0110 (6) to the
Addition. sum produced.
Ans: 4. If the result is more than nine, the result is incorrect, and
BCD is acronym for binary coded decimal. In this to obtain correct value we must add 0110 (6) to the sum
coding system each of the ten decimal digits (numbers) 0 -9 are produced.
represented by a four bit equivalent binary number as illustrated This procedure should be repeated for each BCD digit.
in table (1). In BCD, we can only utilize the binary numbers
0000-1001, which correspond to the decimal equivalents of 0-9 The addition of BCD values can be accomplished with
in the decimal equivalents. If a number has two decimal digits, the help of the 4-bit binary adder IC (7483). In this case, if the
its equivalent BCD will be an eight digit binary number obtained four-bit output produced is not a valid BCD digit, or if a carry
by replacing each decimal digit with its BCD equivalent. This C3 is produced, then decimal 6(0 11 0 binary) must be added to
is illustrated in table (1) for the numbers 10 to 15. For a clearer the sum in order to obtain the right result. A 1-digit BCD adder
understanding, decimal 45 is represented in BCD as of 0100 is depicted in Figure (1). It is possible to cascade BCD adders
0101. In BCD notation, the binary codes 10 to 15, i.e. 1010, in order to add numbers with multiple digits by connecting the
1011, 1100, 1101, 1110, and 1111, are prohibited (invalid). carry-out of one step to the carry-in of the following stage.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 59
BCD Inputs
A B
A3 A2 A1 A0 B3 B2 B1 B0
4-bit Adder (AD1) C–1
Logic 0
C3 S3 S2 S1 S0
Logic 0
A'3A'2 A'1 A'0 B'3 B'2 B'1 B'0
4-bit Adder (AD2) C'–1
C3 S'3 S'2 S'1 S'0
Ones
Tens
BCD Outputs
inputs and routes it to a single output. The block diagram of a 74150 16:1 Multiplexer Inverted input
multiplexer with n input lines and one output line can be seen Table (1): Multiplexers available in IC’s
in Figure (1). The input chosen (for connection to the output)
Advantages
in a multiplexer is controlled by a set of select inputs. A set of
m select inputs, such that 2m = n, is needed to select one of n The following are some of the benefits of using
multiplexers:
inputs for connection to the output. Depending on the digital
code used at the select inputs, one of n data sources is chosen 1. It is not necessary to simplify the logic phrase.
and delivered to a single output channel. An enable input (G) is 2. It reduces the number of IC packages.
usually included to aid in cascading, and it is usually active-low,
3. The logic design process has been simplified.
meaning it carries its designated function when it is LOW.
Q12. Design a 2 to 1 multiplexer with logic gates and
I0 also write a VHDL code for it.
I1
Ans:
I2
Inputs n:1 The block diagram representation of 2 × 1 multiplexer
I3 Y
Multiplexer is as shown in figure (1).
Output
In–1
x0
G
2×1 y
MUX
Sm-1 S2 S1 S0 x0
Select inputs
Figure (1): 2 × 1 Multiplexer
Figure (1): Block Diagram of Multiplexer
2 × 1 multiplexer circuit consists of two inputs, one out-
Its output, Y, is calculated as follows put and one selection line. The truth table of 2 × 1 multiplexer
Y = G . [ S m – 1. S m – 2 ... S 1. S 0 .I0 + S m – 1. S m – 2 ... S 1.S0 .I1 + .... is as shown in below table.
+ Sm – 1.Sm – 2 ...S1. S 0 .In – 2 + Sm –1.Sm – 2 ...S1.S0 .In – 1] s y
In digital design, Multiplexer is one of the most 0 x0
extensively used standard logic circuits and is conveniently 1 x1
used as a logic element in the design of combinational circuits.
Table
Due to its frequent application, it has been built as an MSI
integrated circuit and is commercially available in a variety of From the above truth table, the Boolean expression for
configurations, like 2:1, 4:1, 8:1, and 16:1 multiplexers. Table 2 × 1 mux is obtained as,
(1) illustrates the standard 2:1, 4:1, 8:1 and 16:1 ICs available. y = x0 s + x1s
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 61
The logic diagram of 2 × 1 multiplexer is as shown in figure (2).
x0
s y
x1
x1
4×1 y
x2
x3
s0 s1
Figure (1)
s0, s1 are the selection inputs, based on the selection input the output data is selected, that is illustrated in the following
truth table.
s1 s0 y
0 0 x0
0 1 x1
1 0 x2
1 1 x3
Table
s1
x0
x1
x2
x3
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 63
begin For S2 = 0, S1 = 0, S0 = 0, Y = I S S S
0 2 1 0
Process (w, x, y, z, S0, S1) is
For S2 = 0, S1 = 0, S0 = 1, Y = I S S S
begin 1 2 1 0
P <= w; For S2 = 0, S1 = 1, S0 = 1, Y = I S S S
3 2 1 0
els if (S0 = ‘1’ and S1 = ‘0’) then
For S2 = 1, S1 = 0, S2 = 0, Y = I S S S
P <= x; 4 2 1 0
P <= y; For S2 = 1, S1 = 1, S0 = 0, Y = I S S S
6 2 1 0
else P <= z;
For S2 = 1, S1 = 1, S0 = 1, Y = I S S S
end if; 7 2 1 0
end process; The expression for the output (Y) can be written as
end behaviour; S2 S1 S0 I0 + S2 S1S0 I1 + S2 S1 S0 I2 + S2 S1S0 I3 +
Y =
Q15. What is multiplexer? Draw the logic diagram of S2 S1 S0 I4 + S2 S1S0 I5 + S2 S1 S0 I6 + S2 S1S0 I7
8 to 1 line multiplexer.
Ans: (Model Paper-1, Q3(b) | Oct./Nov.-19, Set-3, Q5(a))
The implementation of 8 × 1 MUX requires 4-input
Multiplexer eight AND gates, three NOT gates and an OR gate. Each of the
For answer refer Unit-2, Q11, (Refer upto figure (1)). inputs I0, I1, I2, ...I7 are applied to the AND gates A0, A1, A2, ...
A 8 × 1 multiplexer is a combinational circuit that A7. The logic circuit for 8 × 1 multiplexer can be obtained by
consists of eight input lines (i.e., I0, I1, I2, ... I7), three selection implementing the output expression as shown in figure (2).
lines (S0, S1 and S2) and one output line Y. The block diagram
I0
of 8 × 1 multiplexer is shown in figure (1). A0
I0
I1 I1
I2 A1
I3 8×1 yY
I4 mux
MUX
I5 I2
I6
A2
I7
EN
I3
A3
S2 S1 S0
1 0 1 I5
S2
1 1 0 I6 S1
S0 E
1 1 1 I7
Table: Truth Table Figure (2): Logic Circuit of 8 × 1 MUX
s1
s0
x4
x5
4×1
x6
x7
4×1 y
x8
x9
4×1 s2 s3
x10
x11
x12
x13
4×1
x14
x15
Figure: 16 × 1 Multiplexer
VHDL Code
LIBRARY ieee;
USE ieee.std_logic_1164.all;
LIBRARY work;
USE work.MUX4TO1 _ package.all;
ENTITY MUX16to1 IS
PORT (x : IN STD_LOGIC_VECTOR (0 to 15);
s : IN STD_LOGIC_VECTOR (3 DOWN TO 0);
y : OUT STD_LOGIC);
END MUX16to1;
ARCHITECTURE struct of MUX16to1 IS
SIGNAL K : STD_LOGIC_VECTOR (0 to 3);
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 65
BEGIN
M1 : MUX4to1 PORT MAP (x(0), x(1), x(2), x(3), s(1 DOWN TO 0), k(0));
M2 : MUX4to1 PORT MAP (x(4), x(5), x(6), x(7), s(1 DOWN TO 0), k(1));
M3 : MUX4to1 PORT MAP (x(8), x(9), x(10), x(11), s(1 DOWN TO 0), k(2));
M4 : MUX4to1 PORT MAP (x(12), x(13), x(14), x(15), s(1 DOWN TO 0), k(3);
M5 : MUX4to1 PORT MAP (m(0), m(1), m(2), m(3), s(3 DOWN TO 2), y);
END struct;
Q17. Draw the logic diagram, logic symbol of 74 × 151.
Ans: 74 × 151 is a Medium Scale Integrated (MSI) multiplexer which selects 1 output for eight inputs i.e., it is an 8:1 MUX.
The logic diagram and symbol of 74 × 151 are shown in figure (1) and (2) respectively,
(7)
EN_L
(4)
A
(3)
B
(2)
C
(1)
D (5) M_OUT
(6) M_OUT_L
(15)
E
(14)
F
(13)
G
(12)
H
(11)
S0
(10)
S1
(9)
S2
2B
2X begin
3A
process (S, A, B)
3B
3X
begin
4A with S select X < = A when “0”;
4X
4B B when “1”;
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 67
The design is shown in the figure.
74 ×× 151
7
XA0 EN
11
XA1 10 A
XA2 B
9
C 5
4 Y
X0 3 D0
X1 D1 6 XO0_L
2 Y
X2 D2
1
X3 15 D3
X4 D4
14
X5 D5
13
X6 D6
12
X7 D7 U2
74 ×× 151
7
EN
11
A
10
B
9
C 5
4 Y
X8 D0
3
X9 2
D1 6 XO1_L
D2 Y
X10 1
X11 D3
15
X12 D4
14
X13 D5
13
X14 D6
12
X15 D7 U3 1 ½ 74 × 20
½74×139
74 × 2 6
1 4 74 ×× 151 4 Xout
XEN_L 1G 1Y0
5 5 U6
1Y1
2 1Y2 6 7 EN
XA3 1A
3 1Y3 7 11 A
XA4 1B
10 B
U1 9 5
C Y Y
4 D0
X16 6 XO2_L
X17 3 D1 Y Y
X18 2 D2
1 D3
X19
X20 15 D4
X21 14 D5
13 D6
X22
12 D7 U4
X23
74 ×× 151
7
EN
11
A
10
B
9
C 5
4 Y
X24 D0
3
X25 D1 6 XO3_L
2 Y
X26 D2
1
X27 D3
15
X28 D4
14
X29 D5
13
X30 D6
12 U5
X31 D7
The output of respective multiplexers are given to OR gate (1/2 74 × 20) that produces the output Xout.
Dn – 1
Sm – 1 Sm – 2 S0
Select inputs
Figure (1): Block Diagram of Demultiplexer
As illustrated in figure (1), there are n output lines and m select lines, such that n = 2m. The input data Di will show up
on the output line specified by the select inputs S0….Sm – 1. For instance, the data will be displayed on the D4 output line, if the
decimal equivalent of the select inputs is 4. The logic I level should be connected to the data input line.
This device, on the other hand, is available as an MSI Integrated Circuit and may be used to create combinational
circuits in a convenient manner. Table (1) illustrates the available standard demultiplexer ICs there description and output. Few
of the ICs can be used as both Demultiplexers and Decoders.
Integrated circuit number Description Output
Dual 1:4 Demultiplexer Inverted input
74139
(2-line-to-4-line decoder)
Dual 1:4 Demultiplexer 1 Y-Inverted input
74155
(2-line-to-4-line decoder) 2Y-Same as input
Dual 1:4 Demultiplexer Open collector
74156 (2-line-to-4-line decoder) 1 Y-Inverted input
2Y-Same as input
1:8 Demultiplexer Inverted input
74138
(3-line-to-8-line decoder)
1:16 Demultiplexer Same as input
74154
(4-line-to-16-line decoder)
1:16 Demultiplexer Same as input
74159
(4-line-to-16-line decoder) Open-collector
Table (1): Multiplexers available in IC’s
2.3 ALU
Q22. What is ALU? Draw the block diagram of 74181ALU and Explain.
Ans:
ALU is an acronym for Arithmetic Logic Unit, and is the heart of any microprocessor. The ALU is a combinational
circuit that is extremely popular and frequently utilized since it is capable of performing both arithmetic and logical operations
on a pair of bit operands. In an ALU, a group of function select inputs are used to perform the required operation.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 69
A 0 – A3 F0 – F3
Cn + 4 Carry output
B0 – B3 74181 ALU A = B Equality Output
G = Generate Output
P = Propagate Output
Cn Carry Input
Open-Collector Output
0 0 0 0 0 F= A F=A F = A PLUS 1
1 0 0 0 1 A+B F=A+B F = (A + B) PLUS 1
2 0 0 1 0 F=0 F = MINUS 1 (2’s COMPL) F = (A + B ) PLUS 1
3 0 0 1 1 F = AB F = A PLUS A B F = ZERO
4 0 1 0 0 F= B F = (A + B) PLUS A B F = A PLUS AB PLUS 1
5 F = A5 B F = A MINUS B MINUS 1 F = A MINUS B
0 1 1 0
6 F = A B MINUS 1 F =AB
0 1 1 1 F =A B
7 F = A PLUS AB F = A PLUS AB PLUS 1
1 0 0 0 F= A+B
8
1 0 0 1 F=A5B F = A PLUS B F = A PLUS B PLUS 1
9
1 0 1 0 F=B F = (A + B ) PLUS AB F = (A + B ) PLUS AB PLUS 1
10
F = AB F = AB MINUS 1 F = AB
11 1 0 1 1
F=1 F = A PLUS A* F = A PLUS A PLUS 1
12 1 1 0 0
F=A+B F = (A + B) PLUS A F = (A + B) PLUS A PLUS 1
13 1 1 0 1
F=A+B F = (A + B ) PLUS A F = (A + B ) PLUS A PLUS 1
14 1 1 1 0
F=A F = A MINUS 1 F=A
15 1 1 1 1
In order to cascade the 74181, you must connect the carry-out of one-stage to the carry-in of a subsequent stage.
Implementation of an 8-bit ALU Circuit using 74LS181 IC’s: A 74LS181 IC is a 4-bit Arithmetic Logic Unit (ALU), which
performs 16-bit arithmetic/logical operations on two 4-bit operands.
An 8-bit ALU circuit can be implemented by cascading two 74LS181 ICs that performs 16-bit arithmetic/logical operations
on two 8-bit operands as shown in figure below.
Cout
S0 – S3 S0 – S3 Cout G G2
M M P P2
x4 A0
x5 A1 F0 Z4
x6 A2 74LS181
(ALU2) F1 Z5
x7 A3
y4 B0 F2 Z6
y5 B1
y6 B2 F3 Z7
y7 B3 Cin A=B AL = BL
Cout
S0 – S3 G G1
M P P1
x0 A0 F0 Z0
x1 A1 74LS181
x2 A2 F1 Z1
(ALU1)
x3 A3 F2 Z2
y0 B0
y1 B1 F3 Z3
y2 B2
y3 B3 Cin A=B AH = BH
Figure
In the above figure, the mode and select inputs of ALU1 and ALU2 are connected in parallel such that the synchronization
between operating modes as well as the functions performed by both the ICs is maintained. The Cin of ALU 1 is connected to
ground. Inorder to have the carry propagation from one stage to next stage, Cout of ALU 1 is connected to Cin of ALU 2. The Cout
of ALU 2 represents the final carry. The functions performed by 8-bit ALU are shown in below table.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 71
Inputs Function
S3 S2 S1 S0 M = 0 (Arithmetic) M = 1 (Logic)
0 0 0 0 Z = x – 1 + Cin Z = x'
0 0 0 1 Z = (x.y) –1 + Cin Z = x' + y'
0 0 1 0 Z = (x.y') – 1 + Cin Z = x' + y
0 0 1 1 Z = 1 1 1 1 + Cin Z=1111
0 1 0 0 Z = x + (x + y') + Cin Z = x'.y'
0 1 0 1 Z = (x.y) + (x + y') + Cin Z = y'
0 1 1 0 Z = x – y – 1 + Cin Z = x y'
0 1 1 1 Z = x + y' + Cin Z = x + y'
1 0 0 0 Z = x + (x + y) + Cin Z = x'.y
1 0 0 1 Z = x + y + Cin Z=x y
1 0 1 0 Z = (x.y') + (x + y) + Cin Z=y
1 0 1 1 Z = x + y + Cin Z=x+y
1 1 0 0 Z = x + x + Cin Z=0000
1 1 0 1 Z = (x.y) + x + Cin Z = x.y'
1 1 1 0 Z = (x.y') + x + Cin Z = x.y
1 1 1 1 Z = x + Cin Z=x
Table
VHDL Code
The VHDL code for 4-bit ALU (74 × 381 IC) chip is mentioned below,
Library IEEE;
Use IEEE.STD_LOGIC_1164.ALL;
Use IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity ALU is,
Port (S : IN STD_LOGIC_VECTOR(2 downto 0);
AB: IN STD_LOGIC_VECTOR(3 downto 0);
F : OUT STD_LOGIC_VECTOR(3 downto 0);
CIN: IN STD_LOGIC);
End ALU;
Architecture ALU_arch of ALU is,
Begin
Process (S, A, B)
Begin
CASE S is
WHEN “000” F “0000”;
WHEN “001” F B – A – 1 + CIN;
WHEN “010” F A – B – 1 + CIN;
WHEN “011” F A + B + CIN;
WHEN “100” F A XOR B;
WHEN “101” F A OR B;
WHEN “110” F A AND B;
WHEN OTHERS F “1111”;
END CASE
END Process;
END ALU_arch;
S0 2
S
S0 1 S
S0
S
S0 S1
S
S1 S
S1
S
S1 S2
S
S2 J S
S2 J
S
S2
C IN K
CIN K
X
X8
X
X4 X
X0
X0
X0 Y
Y8
Y
Y4 Y
Y0 74 × 381
Y
Y0 X
X9
X
X5 X
X1
X
X1 Y
Y9 Z
Z8
Y
Y5 Z
Z4 Y
Y1 Z
Z0
Y
Y1 Z
Z0 X
X10 Z
Z9
X
X6 Z
Z5 X
X2 Z
Z1
X
X2 Z
Z1 Y
Y10 Z
Z10
Y
Y6 Z
Z6 Y
Y2 Z
Z2
Y
Y2 Z
Z2 X
X11 Z
Z11
X
X7 Z
Z7 X
X3 Z
Z3
X
X3 Z
Z3 Y
Y11
Y
Y7 Y
Y3
Y
Y3
Z(15 – 0)
74×381
C
C0
C
C1 C
C2
C
C0 C
C3
J
J0
K
K0
J
J1 74×182
K
K1
J
J2
K
K2
J
J
J3
K
K
K3
Figure
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 73
VHDL Code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity ALU_16 bit is
port(A, B : in STD_LOGIC_VECTOR (15 down to 0);
S : in STD_LOGIC_VECTOR (2 down to 0);
EN : in STD_LOGIC;
F : out STD_LOGIC_VECTOR (15 down to 0));
end ALU_16 bit;
architecture ALU_16 bit_arch of ALU_16 bit is
begin
if(EN = = ‘1’) then
case S is
when “000” => F <= A AND B;
when “001” => F <= A OR B;
when “010” => F <= A XOR B;
when “011” => F <= NOT A;
when “100” => F <= A + B;
when “101” => F <= A – B;
when “110” => F <= A * B;
when “111” => F <= A/B;
when others => F <= “xxxxxxxxxxxxxxxx”;
end case;
end if;
and ALU_16 bit_arch;
2.4 Digital Comparators
Q25. What is a comparator? Draw and explain the structure and working of a comparator.
Ans: A digital circuit that compares two binary words is called as comparator.
The 1-bit comparator can be built using Exclusive OR and Exclusive NOR gates.
The 1-bit comparator using Exclusive OR is shown in figure (1).
x z (Difference of x and y)
F
y
Figure (1)
In the above comparator, the output z is the difference of inputs x and y.
The n-bit comparators are called as parallel comparators.
4-bit Equality Comparator: Logic diagram of 4-bit equality comparator is shown in figure (2).
A0
B0
A1
B1
Output
A2
B2
A3
B3
Figure (2)
G4
G3 G2 G1 G0
1 bit comp. 1 bit comp. 1 bit comp. 1 bit comp.
L3 L2 L1 L0
L4
Figure (3)
The 4-bit magnitude comparators perform comparison of straight binary or BCD codes. These devices are fully expandable
to any number of bits without external gates.
2 ALTBin ALTBout 7
3 AΕQBin AΕQBout 6
4 AGTBin AGTBout 5
10 A0
9 B0
12 A1 74 × 85
11 B1
13 A2
14 B2
15 A3
1 B3
Figure (4)
The 74 × 85 is a 4-bit magnitude comparator that can be expanded to almost any length. It compares two 4-bit binary,
BCD or other monotonic codes and presents the three possible magnitude results at the outputs.
The magnitude comparator comes under combinational circuits which performs comparison of magnitudes of any two
numbers and produces an output based on the comparison, whether the number is equal, greater or lesser than the other number
(i.e., A = B, A > B or A < B).
Let A0 and B0 are the inputs to be compared by a single-bit magnitude comparator as shown in figure(1).
A0 A0 > B0
Single-bit magnitude
comparator A0 = B0
B0 A0 < B0
Figure (1)
Consider, A = A3 A2 A1 A0 and B = B3 B2 B1 B0 are the two 4-bit numbers that are tho be compared using an IC7485 (a
4-bit magnitude comparator). It generates one output as a result of comparison i.e., either A = B, or A > B, or A < B.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 75
The pin diagram of 4-bit magnitude comparator (IC7485) is shown in figure (2).
B2 VCC
A2 A3
(A=B)OUT B3
(A>B)IN 7485 (A>B)OUT
(A<B)IN (A<B)OUT
(A=B)IN B0
A1 A0
GND B1
Figure (2)
The input pins, i.e., (A < B)1N, (A = B)1N, (A > B)1N are meant for cascading. To realize an 8-bit comparator, cascading of
two 4-bit comparators is done as shown in figure (3).
Figure
The resultant cascaded comparator compares two 8-bit numbers, i.e., A7 A6 A5 A4 A3 A2 A1 A0 and B7 B6 B5 B4 B3 B2 B1 B0.
The the lower order comparator, the cascading input pins are connected as follows,
1. The cascading input (=) is connected to + 5 V (i.e., HIGH).
2. The cascading inputs (< and >) are connected to ground (i.e., LOW).
The truth table of 4-bit comparator IC is shown below.
A3 > B2 × × × × × × 1 0 0
A3 < B3 × × × × × × 0 1 0
A3 = B3 A2 > B2 × × × × × 1 0 0
A3 = B3 A2 < B2 × × × × × 0 1 0
A3 = B3 A2 = B2 A1 > B1 × × × × 1 0 0
A3 = B3 A2 = B2 A1 > B1 × × × × 0 1 0
A3 = B3 A2 = B2 A1 > B1 A0 > B0 × × × 1 0 0
A3 = B3 A2 = B2 A1 > B1 A0 > B0 × × × 0 1 0
A3 = B3 A2 = B2 A1 > B1 A0 > B0 1 0 0 1 0 0
A3 = B3 A2 = B2 A1 > B1 A0 > B0 0 1 0 0 1 0
A3 = B3 A2 = B2 A1 > B1 A0 > B0 0 0 1 0 0 1
2 ALTBin ALTBout 7
3 AΕQBin AΕQBout 6
4 AGTBin AGTBout 5
10 A0
9 B0
12 A1 74 × 85
11 B1
13 A2
14 B2
15 A3
1 B3
Figure (1)
The 12-bit comparator using 74 × 85 IC is shown in figure (2).
2 ALTBin ALTBout 7 XLTY4 ALTBout XLTY8 ALTBin ALTBout XLTY
3 AEQBin AEQBout 6 XEQY4 AEQBout XEQY8 AEQBin AEQBout XEQY
4 AGTBin 5 XGTY4 XGTY8 XGTY
AGTBout AGTBout AGTBin AGTBout
a0 a4 a8
A0 A4 A8
b0 b4 b8
a1 B0 a5 B4 a9 B8
b1 A1 b5 A5 b9 A9
a2 B1 74 × 85 a6 B5 a10 B9 74 × 85
b2
A2 b6
A6 b10
A10
a3 B2 a7
B6 a11
B10
b3
A3 b7
A7 b11
A11
B3 B7 B11
A(11 : 0)
B(11 : 0)
Figure (2)
The outputs of each 74 × 85 IC are,
AGTBout = (A > B) + (A = B). AGTBin
AEQBout = (A = B) . (AEQBin)
ALTBout = (A < B) + (A = B) . ALTBin
Here, is the above equations ‘A’ stands for A3 to A0 and ‘B’ stands for B3 to B0.
Q28. Explain about comparator and design a 16-bit comparator using 74×85 IC’s. Write VHDL program.
Ans: (Model Paper-2, Q4(a) | Oct./Nov.-18, Set-2, Q5(b) M[7])
For answer refer Unit-2, Q25 (Refer only 1st Paragraph).
16 bit Comparator using 74×85 ICs
74 × 85 IC is a 4-bit MSI comparator, so in order to design a 16-bit comparator four 74 × 85 comparators has to be cascaded.
The logic symbol for 74 × 85, 4-bit comparator is shown in figure (1).
2 ALTBin ALTBout 7
3 AΕQBin AΕQBout 6
4 AGTBin AGTBout 5
10 A0
9 B0
12 A1 74 × 85
11 B1
13 A2
14 B2
15 A3
1 B3
Figure (1)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 77
The 16-bit comparator using 74 × 85 IC is shown in figure (2).
74×85
Figure (2)
The outputs of each 74 × 85 IC are,
AGTBout = (A > B) + (A = B). AGTBin
AEQBout = (A = B) . (AEQBin)
ALTBout = (A < B) + (A = B) . ALTBin
In the above equations ‘A’ stands for A3 to A0 and ‘B’ stands for B3 to B0.
VHDL Code
Library ieee;
Use ieee_std_1164.all;
entity comp1 is
port(A, B: in STD_LOGIC;
EQ, GT: out STD_LOGIC);
end comp1;
architecture comp16_archi of comp16 is
component comp1
port(A, B: in STD_LOGIC;
EQ, GT: out STD_LOGIC);
end comp1;
signal EQ16, GT16: STD_LOGIC;
signal SEQ, SGT: STD_LOGIC_VECTOR (16 down to 0);
SEQ(16) <= ‘1’; SGT(16) <= ‘0’;
U1 : for i <= ‘1’ generate
U2 : comp1 port map(A (1 + i * 16) down to i * 1), B(1 + i * 16 down to i * 1), EQ1(i), GT1 (i));
SEQ(i) <= SEQ(i + 1) and EQ16 (i);
SGT(i) <= SGT(i + 1) or (SEQ(i + 1) and GT16 (i));
end generate;
EQ <= SEQ(0);
GT <= SGT (0);
end comp16_archi;
Q29. What is meant by arithmetic comparison circuits? Design 4 bit comparator circuit using logic gates and
write a VHDL code for implementation of 4-bit comparator.
Ans: Model Paper-1, Q4(a)
A2
B2
A1 A>B
B1
A0
B0
A3
B3
A2
B2
A=B
A1
B1
A0
B0
A3
B3
A2
B2
A1 A<B
B1
A0
B0
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 79
A < B : OUT STD_LOGI);
END COMPARE;
ARCHITECTURE Behaviour of compare IS
BEGIN
A = B < = ‘1’ WHEN A = B ELSE ‘0’;
A > B < = ‘1’ WHEN A > B ELSE ‘0’;
A < B < = ‘1’ WHEN A < B ELSE ‘0’;
END Behaviour.
Q30. Write a VHDL code to implement the following,
(i) 1 bit comparator
(ii) 12 bit comparator using 1 bit comparator.
Ans:
(i) VHDL Program for 1-bit Comparator
Library ieee;
Use ieee_std_1164.all;
entity comp1 is
port(A, B: in STD_LOGIC;
EQ, GT: out STD_LOGIC);
end comp1;
architecture comp1_archi of comp1 is
begin
EQ <= ‘1’ when A = B else ‘0’;
GT <= ‘1’ when A > B else ‘0’;
end comp1_archi;
(ii) 12-bit Comparator using 1-bit Comparator
Library ieee;
Use ieee_std_1164.all;
entity comp1 is
port(A, B: in STD_LOGIC;
EQ, GT: out STD_LOGIC);
end comp1;
architecture comp12_archi of comp12 is
component comp1
port(A, B: in STD_LOGIC;
EQ, GT: out STD_LOGIC);
end comp1;
signal EQ11, GT11: STD_LOGIC;
signal SEQ, SGT: STD_LOGIC_VECTOR (11 down to 0);
SEQ(11) <= ‘1’; SGT(11) <= ‘0’;
U1 : for i <= ‘1’ generate
U2 : comp1 port map(A (1 + i * 11) down to i * 1), B(1 + i * 11 down to i * 1), EQ1(i), GT1 (i));
SEQ(i) <= SEQ(i + 1) and EQ11 (i);
SGT(i) <= SGT(i + 1) or (SEQ(i + 1) and GT11 (i));
end generate;
EQ <= SEQ(0);
GT <= SGT (0);
end comp12_archi;
There is a concept known as parity, in which an additional bit known as the parity-bit is added to a binary word in
order to make the number of 1’s in the new word generated even (even parity) or odd (odd parity). The additional bit, known
as the parity bit, is added to each coded (binary) word for detection of errors.
The parity check detects the erroneous code at the receiving end if there is just one error. Also, parity check will
detect the incorrect code if an odd number of bits are transmitted incorrectly, but not if an even number of bits are received
incorrectly. The parity check method can only detect errors in the received word.
Using gates, we can make circuits that generate parity bits, as well as check the parity of a word. Due to the widespread
use of this circuit, an 8-bit parity generator/checker was developed and is made available in the form of an integrated circuit
(MSI chip) 74180. Figure (a) illustrates the block diagram of the 74180 parity generator/checker, which includes eight parity
inputs (designated A through H) and two cascade inputs. The two possible outputs are denoted as “Σeven” and “Σodd”.
Table 6.10 outlines the functions that it performs.
A
B
C
D
Parity Inputs
E EVEN
F 74180 Outputs
G ODD
H
EVEN
Cascading Inputs
ODD
D1
D2
D3
D4
D5
D6
P
D7
Dn 2
Dn 1
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 83
The truth table of an n-bit odd parity generator circuit is shown in table (1).
Table (1)
The truth table for a 3-bit odd parity generator (i.e., n = 3) is shown in table (2).
A B C Output (P)
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0
During the transmission of data, odd parity generator circuit is used to detect the errors.
Parity check
Transmitted bit - 0 1 0 0 odd
Received bit - 0 0 0 0 even
As the received bit parity is even, the transmitted bit is not received properly and a trAns:mission error has occurred.
Q34. Design an n-bit input odd parity generator using daisy-chain structure.
Ans:
An odd-parity generator circuit will generate the output as ‘1’ or ‘0’, in order to make the total number of 1’s in the entire
group of digits, including parity bit an odd number i.e., if n inputs are considered, n + 1 (n inputs and 1 parity bit) input digit
should contain odd number of 1’s.
The function table of n-bit input odd parity generator circuit is shown in table (1 ).
Table (1)
For simplicity, consider n = 4. As we know the possible number of input combinations for a n-bit binary digit is 2n, the
number of input combinations for n = 4 is 24 = 16. With the help of the truth table, the parity bit for the 16 input combinations is
shown in table (2).
A B C D Output (P)
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0
0 0 1 1 1
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 0 0
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 1
1 1 0 1 0
1 1 1 0 0
1 1 1 1 1
Table (2)
Simplification of the parity function using k-map is shown in figure (1).
CD
00 01 11 10
AB
00 1 0 1 0
01 0 1 0 1
11 1 0 1 0
10 0 1 0 1
= [( A ⊕ B) ⊕ C ]D + [( A ⊕ B) ⊕ C ]D
= [( A ⊕ B ) ⊕ C ] . D = [(( A ⊕ B) ⊕ C ) ⊕ D]
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 85
Thus from the above boolean expression, the logic diagram for 4-bit odd parity generator can be drawn as shown in figure (2).
P
C
D
Daisy-chain structure
Figure (2): 4-bit Odd Parity Generator
Similarly the structure for 8-bit odd parity generator is shown in figure (3).
D7
D6
D5
D4
D3
D2
D1
P
D0
Daisy-chain structure
Figure (3): 8-bit Odd Parity Generator
Hence the logic diagram for n-bit odd parity generator is as shown in figure (4).
D0
D1
D2
D3
P
Dn 1
Daisy-chain structure
Figure (4): n-bit Odd Parity Generator Circuit using Daisy Chain Structure
Q35. What are parity generator checker circuits? Explain the 9-bit odd/even parity generator.
Ans:
Parity Generator/Checker Circuits: Parity generator/checker circuits are very useful in error-detection and error correction
codes (i.e., during the trAns:mission of binary data, error detection can be done using parity bit.) The receiver checks for errors in
the message trAns:mitted including the parity. Parity bit is generally called an extra bit which is included with a binary message
to make the number either odd or even. The information or data along with the parity bit is trAns:mitted and at the receiving side,
this data will be checked for any possible errors. When the checked parity does not correspond with the bit trAns:mitted, then an
error is detected. The parity bit generated by the circuit in the trAns:mitter is called a parity generator. Parity checker is a circuit
that checks the parity in the receiver.
D (11)
(5)
E (12) EVEN
F (13)
G (1)
(2) (6)
H ODD
I (4)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 87
The logic symbol of 9-bit odd parity checker is as shown in figure (2).
A 8 5 ΣEven
B 9
74180
C 10 6 ΣOdd
D 11
E 12
F 13
G 1
H 2
Figure (1)
The various functions performed by IC 74180 are,
1. Even Parity Generation: In the even parity generation, the four data bits are added using three EX-OR gates and the sum
will be the parity bit as shown in figure (2).
D0
D1
Original Parity
Data (P)
D2
D3
D0
D1
Original Parity
Data (P)
D2
D3
Figure (3): Odd Parity Generator
3. Even Parity Checker: In the even parity checker, the received four data bits are added using three EX-OR gates and the
sum will be again EX-ORED with even parity bit to obtain error bit (E) (i.e., E = 1 = Error, E = 0 = No error) as shown in
figure (4).
As illustrated in figure (2), the binary inputs are applied to input terminals A through E and the output terminals Y1, Y2,
Y3, Y4, Y5, Y6 are used to access the BCD output. The Y7 and Y8 terminals are never used to access BCD outputs and are set to
logic 1. Further, same as BCD-to-binary converter, the LSB of the binary input skips (bypasses) the converter and appears as the
LSB of BCD output.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 91
Q40. What are the drawbacks of ordinary digital encoders? How are they over come using priority encoders?
Explain Decimal-to-BCD Priority Encoder using IC 74147.
Ans: Model Paper-3, Q4(b)
One of the main drawbacks of ordinary digital encoders is that it would produce an error at its output if more than one input
is active at a given time. It generates an undefined combination of outputs, if the two inputs are logic 1 simultaneously. Consider
the following illustration: When we set two inputs D1 and D2 to logic “1” and make them both HIGH, the resulting output is “11,”
which is a binary number that differs from the real input present.
By “prioritizing” the levels of each input pin, this problem can be solved quickly and easily. As a result, if many logic
level “1” inputs are present at the same time, the actual output code will only correspond to the input with the highest designation
priority. A Priority Encoder, or P-encoder for short, is the name given to this type of digital encoder. Priority encoders are available
in the form of MSI integrated circuits. One such IC is explained below.
Decimal-to-BCD Priority Encoder using IC 74147: This sort of encoder encodes decimal digits into 4-bit BCD outputs in the
same way as a conventional decimal to BCD encoder does. However, it has an additional feature that allows you to set priority.
That means the BCD output is produced corresponding to the highest priority of a decimal digit appearing on the inputs irrespective
of all other inputs
1
2
A
3
4 B
BCD Inputs
Decimal Inputs 5 74147 C
6
D
7 (MSB)
8
9
Digital circuits that require entry of large binary words manually, such as those used in medical devices, frequently employ
the octal code at their inputs. For this purpose, the priority encoder 74148 integrated circuit (IC) was developed.
Figure (a) illustrates the block Diagram of IC 74148 Octal-to-Binary Priority Encoder. Active-low inputs and outputs are
also available on this circuit. To handle multiple inputs, cascade circuits employ the enable input and carry output, both of which
are active-low as well. By taking use of this facility, it is possible to create an encoder that converts from hexadecimal to binary
code, which is also a very important circuit due to the ubiquitous use of hexadecimal code in computers, microprocessors, and
other electronic devices. It is convenient to utilize priority encoders in computers, microprocessors, and other electronic devices
to handle priority interruptions.
0
1
A
2 Binary Outputs
3 B (Active-Low)
Octal Inputs
(Active-Low) 4 74148 C
5 (MSB)
6
7 GS Carry Outputs
Enable Input (Active-Low)
(Active-Low) EO
Outputs Outputs
EI 0 1 2 3 4 5 6 7 C B A GS EO
1 × × × × × × × × 1 1 1 1 1
0 0 1 1 1 1 1 1 1 1 1 1 0 1
0 × 0 1 1 1 1 1 1 1 1 0 0 1
0 × × 0 1 1 1 1 1 1 0 1 0 1
0 × × × 0 1 1 1 1 1 0 1 0 1
0 × × × × 0 1 1 1 1 0 0 0 1
0 × × × × × 0 0 1 1 0 0 0 1
0 × × × × × × 1 0 1 1 1 1 1
0 × × × × × × × 1 0 1 0 0 1
0 1 1 1 1 1 1 1 1 1 1 1 1 0
Table (1): Copy Table 6.19 Truth Table of 74148 Pageno: 269
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 93
Q42. Design a 2 to 4 decoder circuit. Give its entity declaration behavioural model. Also draw the waveform
giving relation between its inputs and outputs.
Ans: Oct./Nov.-18, Set-1, Q4(a) M[7]
2 to 4 Line Decoder
2 to 4 decoder consists of 2-input lines, 4 output lines and one enable (En) line. It is used to decode 2-bit information. The
decoder circuits can have two output modes either active high or active low. The representation of 2 to 4 line decoder is as shown
in figure (2).
x0 y0
x1 y1
Input 2× 4 Output
Decoder y2
En y3
En
x1
x0
y3 y2 y1 y0
USE ieee.std_logic_1164.all; 0 0
(b) Input waveform
ENTITY dec2to4 IS
END IF;
END PROCESS;
END Behaviour;
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-2 (Combinational Logic Design) 95
REPEATED
3
TIMES
Ans: Refer Q3. March-21, Set-4, Q5(a) | Oct./Nov.-16, Set-4, Q6(a) | Oct./Nov.-16, Set-4, Q6(b)
Q2. Write VHDL code for 4-bit look ahead carry generator along with circuit diagram.
REPEATED
3
TIMES
Ans: Refer Q5. (March-21, Set-1, Q5(b) March-21, Set-4, Q5(b) | Oct./Nov.-18, Set-4, Q5(a))
Q3. Explain the implementation of N-bit binary adder using full adders.
Q4. Draw the circuit of a 4-bit ripple carry adder circuit and explain how it is different from look-a-head carry
circuit. Give the equation for C1 to C4 for a look-ahead carry adder circuit.
Q6. Design full subtractor circuit and write a VHDL code for implementation of full subtractor.
Q7. Using a process statement write a VHDL source code for 4 to 1 multiplexer.
Q9. With the help of logic diagram explain 74×157 multiplexer. Write the data flow style VHDL program for
this IC.
Q10. What is ALU? Draw the block diagram of 74181ALU and Explain.
Q12. Explain about comparator and design a 16-bit comparator using 74×85 IC’s. Write VHDL program.
Q13. Design a 24-bit comparator using 74×682 ICs and explain the functionality of the circuit. Also implement
VHDL source code in data flow style.
Q15. Draw the block diagram of IC 74185A binary-to-BCD converter and Explain.
Q16. Design a 2 to 4 decoder circuit. Give its entity declaration behavioural model. Also draw the waveform
giving relation between its inputs and outputs.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 97
UNIT
Sequential Logic Design
3 SI
A GROUP
Syllabus
SEQUENTIAL LOGIC DESIGN: Registers, Applications of shift registers, Ripple or asynchronous counters,
Synchronous counters, Synchronous and asynchronous sequential circuits, Hazards in sequential circuits.
(Qualitative approach of designing and modeling the mentioned sequential logic circuits with relevant digital ICs
using HDL)
Learning Objectives
Introduction
Sequential logic circuit is the one whose output depends on the present input as well as on the previous output. It contains
atleast one memory element to store the binary information. Some of the sequential circuits include, flip-flops, registers and
counters.
Counters are useful subsystems in digital electronic circuits used to count or measure the number of clock pulses. They are a
special form of synchronous sequential circuits whose state depends on count held by flip-flops in the circuit.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 99
Need For Register
1. Registers are used to store the binary information temporarily in digital system.
2. They help in understanding the operation of digital computers and microprocessors.
3. They build an important link, between main digital systems and inputs, output channels in computers and microprocessor.
Q2. Explain in detail about shift registers.
Ans:
Shift Register
A register capable of shifting its binary information in one or both directions is called a shift register. Shift register consists
of a chain of flip-flops which are cascaded with output of one flip-flop connected to the input of the next flip-flop. A clock pulse
is given to all the flipflops which activates the shift from one stage to the next.
The simplest shift register is that which contains only one type of flip-flop as shown in the figure (1) i.e., 4 D flip-flops.
SI SO
D D D D
Serial Serial
Input Output
C inputs to
C C C C CLK D-flipflop
Shift
Control
CLK
Figure (1): 4-bit Shift Register Figure (2)
The output of given flip-flop is connected to the D input of the flip-flop at its right where each clock pulse shifts the contents
of the register one bit position to the right. The serial input determines what goes into the left most flip-flop during the shift. The
serial output is taken from the output of the right most flip-flop. Sometimes, it is necessary to control the shift so that it occurs
only with certain pulses, but not with others. This can be done by connecting the clock through an AND gate with an input that
controls the shift as shown in figure (2).
Applications of Shift Register
Primary use of shift register is temporary data storage and bit manipulations.
1. Delay Line
A serial-in serial-out shift register can be used to introduce time delay ∆t in digital signals. The time delay can be given
as,
1
∆t = N ×
fc
Where, N is the number of stages (i.e., flip-flops) and fc is the clock frequency.
Thus, an input pulse appears at the output delay by ∆t. The amount of delay can be controlled by the clock frequency or
by the number of flip-flops in the shift register.
2. Serial-to-Parallel Converter
A serial-in parallel-out shift register can be used to convert data in serial form to the parallel form.
3. Parallel-to-Serial Converter
A parallel-in serial-out shift register can be used to convert data in parallel form to the serial form.
4. Shift Register Counter
A shift register can also be used as a counter by connecting the serial output back to the serial input. Because of such a
connection, special specified sequences are produced as the output. The most common shift register counters are the ring
counter and the Johnson counter.
Figure (1)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 105
VHDL Code for 74 × 174 IC
Library IEEE;
Use IEEE.STD_LOGIC_1164. all;
Entity 74 × 174 reg is
Port (D : in STD_LOGIC_VECTOR(6 downto 1);
CLK, CLR_L : in STD_LOGIC;
Q : out STD_LOGIC_VECTOR (6 downto 1));
End 74 × 174 reg;
Architecture behaviour of 74 × 174 reg is
Signal CLR : STD_LOGIC;
begin
Process (CLR_L, CLR, CLK)
begin
CLR Ü NOT CLR_L;
if (CLR = ‘1’) then
Q Ü ‘0’;
elsif (CLK’event and CLK = ‘1’) then
Q Ü D;
End if;
End process;
End behaviour;
Q9. Explain different types of shift registers.
Ans: April/May-13, Set-3, Q7(b)
Types of Shift Registers: Basically, shift registers are categorized into four different types. They are,
1. Serial-in serial-out shift register 2. Serial-in parallel-out shift register
3. Parallel-in serial-out shift register 4. Parallel-in parallel-out shift register.
1. Serial-In Serial-Out (SISO) Shift Register
The circuit diagram of serial-in-serial-out shift register is as shown in figure (1).
D 3 D2 D1 D0 D3 Q3 D2 Q2 D1 Q1 D0 Q0
Clock
Figure (1): Serial-In Serial-Out Shift Register
v Initially, all flip-flops are cleared and data is entered serially bit by bit from the left most flip-flop i,e., from D-FF4.
v When the clock pulse is applied, the content of the register is shifted by one position to the right.
In the same way for each clock pulse data moves to the next flip-flop by one position and serial output is obtained at the
right most flip-flop i.e., D-FF1 after four clock pulses.
2. Serial-In Parallel-Out (SIPO) Shift Register: The circuit diagram of a 4-bit serial-in-parallel-out shift register is shown
in figure (2).
Q1 Q2 Q3 Q4
Serial in D1 Q1 D2 Q2 D3 Q3 D4 Q4
Clock
Clear
Figure (2): Serial-In Parallel-Out Shift Register
G4 G1 G5 G2 G6 G3
D1 Q1 D2 Q2 D3 Q3 D4 Q4
FF1 FF2 FF3 FF4
CLK
Q0 Q1 Q2 Q3
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 107
Q10. Give the VHDL programs for different type of Parallel In-Serial Out (PISO)
shift register. Model Paper-2, Q5(a) library IEEE;
(or)
Use IEEE.STD _ LOGIC _ 1164. ALL;
Write VHDL code for 4-bit Serial-In Parallel-Out
register. Oct./Nov.-19, Set-3, Q6(b) M[7] Use IEEE.STD _ ARITH. ALL;
(Refer Only SIPO Shift Register) Use IEEE.STD _ LOGIC _ UNSIGNED. ALL;
Ans: entity PISOregister is
The VHDL code fof different types of shift registers are Port (C : in STD _ LOGIC;
as follows, S : in STD _ LOGIC;
Serial In-Serial Out (SISO)
P1 : in STD _ LOGIC _ VECTOR (7 downto 0);
Library IEEE;
S0 : Out STD _ LOGIC);
Use SISOregister is
port (C : in STD _ LOGIC; end PISOregister;
S1 : in STD _ LOGIC _ VECTOR (7 downto 0); architecture Behaviral of PISOregister is
S0 : OUT STD _ LOGIC _ VECTOR (7 downto 0); Signal tmp : std _ logic _ vector (7 downto 0);
end SISOregister; begin
Architecture Behavioral of SISOregister is
if S = '1' then
Signal tmp : std _ logic vector (7 downto 0);
tmp < = P1;
begin
Process (C) elsif (c' event and c = '1') then
begin S0 < = tmp (7);
if (c' event and c = ‘1') then for i in 6 downto 0 loop
for i in 0 to 6 loop tmp (i+1) < = tmp (i);
tmp (i + 1) < = Si(i);
end loop;
end loop ;
end if;
tmp (0) < = S1(6);
end if ; end process;
S0 < = tmp ; end Behavioral;
end Behavioral Parallel In-Parallel Out (PIPO)
Serial In-parallel Out (SIPO) library IEEE;
library IEEE;
Use IEEE.STD _ LOGIC _ 1164. ALL;
Use IEEE.STD _ LOGIC _ 1164. ALL;
Use IEEE.STD _ ARITH. ALL;
Use IEEE.STD _ ARITH. ALL;
Use IEEE.STD _ LOGIC _ UNSIGNED. ALL; Use IEEE.STD _ LOGIC _ UNSIGNED. ALL;
entity SIPOregister is entity SIPOregister is
Port (C : in STD _ LOGIC; Port (C : in STD _ LOGIC;
S1 : in STD _ LOGIC; P1 : in STD _ LOGIC _ VECTOR (7 downto 0);
P0 : Out STD _ LOGIC _ VECTOR (7 downto 0));
P0 : Out STD _ LOGIC _ VECTOR (7 downto 0));
end SIPOregister;
end PIPOregister;
architecture Behavioral of SIPOregister is
Signal tmp : std _ logic _ vector (7 downto 0); architecture behavioral of PIPOregister is
begin begin
Process (C) Process (C)
begin begin
if (c' event and c = '1') then if (c' event c = ‘1’) then
tmp < = tmp (6 downto 0) & S1;
P0 < = P1;
end if;
end process; end if;
P0 < = tmp; end process;
end Behavioral; end behavioral;
Figure: 74 × 166 IC
74 × 166 IC is an 8-bit parallel-in serial-out shift register with an asynchronous clear input.
When SH/LD = 1, the device perform shift operation otherwise (i.e., SH/LD = 0) it loads new data. The two clock inputs
CLK and CLKINH are connected as clock input to the internal flip-flops. The parallel data loaded from A to H appears at output
QH serially.
Q12. Draw the circuit of a bidirectional shift register with parallel loading using 2 to 4 line decoder and D-flip-
flops.
Ans: Oct./Nov.-18, Set-1, Q6(b) M[7]
The circuit diagram of bidirectional shift register with parallel load using 2 to 4 liner decoder and D-flip-flops is illustrated
in figure below.
Parallel inputs
0
2:4 1
Decoder 2
3
SL1 SL0
Serial data in Serial data in
for right-shift for left-shift
D A QA DB QB DC QC DD QD
A B C D
CP
QA QB QC QD
Parallel outputs
Figure: Bidirectional Shift Register with Parallel Load using 2 to 4 Linear Decoder and d-flip-flops
Q13. Draw and explain the working of shift left register.
Ans: April/May-19, Set-3, Q6(b)
Shift Left Register
The register which shifts the bits from right to left direction is called shift left register. The circuit diagram of shift left
register is as shown in figure (1).
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 109
Data
After the fourth clock pulse, the last bit ‘B3’ = 0 is entered
Q1 D1 Q2 D2 Q3 D3 Q4 D4 Data
out in
from DFF4, by shifting the previous bits to its succeeding flip-
D-FF1 D-FF2 D-FF3 D-FF4 flops. Thus, all four bits are stored in register. The status of
register after fourth shift is as shown in figure (5).
Before Fourth Shift
CLK
0 1 1 0 0
0 0 0 1
1 1
0 0
Figure (2) Q2
For second clock pulse, the data stored at D4 is shifted
to D3 and at the same time second bit ‘B1’ (i.e., ‘1’) is entered 1 1
0 0
into D4. Therefore, the status of the bits after second shift is as Q1
shown in figure (3).
Figure (6)
Before Second Shift
Q14. Draw and explain the working of shift right
0 0 0 1 1 register.
Ans:
After Second Shift
Shift Right Register
0 0 1 1 A shift register, which shifts the bits from left to right
direction is known as shift right register. The circuit diagram
Figure (3)
of shift right register is as shown in figure (1).
After the third clock pulse, the Q4 bit is shifted to Q3 and
Q3 bit is shifted to Q2 and new bit ‘B2’ (i.e., 0) is entered into Data D1 Q1 D2 Q2 D3 Q3 D4 Q4 Data
D4. The status of register after third shift operation is shown in input output
figure (4). D-FF1 D-FF2 D-FF3 D-FF4
Before Third Shift
0 0 1 1 0
1 Figure (5)
0 0 0 0
The timing diagram of shift right register is shown in
After First Shift figure (6).
1 2 3 4
1 0 0 0
Clock
Figure (2)
After second clock pulse, the data stored at D1 is shifted
to D-FF2 and B2 bit is entered from D-FF1. The status of the
register is shown in figure (3).
Data in
Before Second Shift
1 1 0 0 0
1 1 0 0 Q1
Figure (3) Q3
After third clock pulse, the bit Q2 is shifted to next flip-flop Q4
and Q1 bit is shifted to Q2 and new bit B1 (i.e., B1 = 1) is entered
into register. The status of register is shown in figure (4). Figure (6)
Q15. Write a VHDL code for an n-bit left-to-right shift register using ‘FOR’ loop. Model Paper-3, Q5(a)
(or)
Write down the VHDL code for an n-bit left to right shift register. Oct./Nov.-19, Set-2, Q6(b) M[7]
Ans: The VHDL code for an n-bit left-to-right shift register using ‘FOR’ loop is given below,
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY lrshiftn IS
GENERIC (N : INTEGER : = 8);
PORT (R : IN STD_LOGIC_VECTOR(N – 1 DOWNTO 0);
Clock : IN STD_LOGIC;
L, w : IN STD_LOGIC;
Q : BUFFER STD_LOGIC_VECTOR(N – 1 DOWNTO 0));
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 111
END lrshiftn;
ARCHITECTURE Behavior OF lrshiftn IS
BEGIN
PROCESS
BEGIN
WAIT UNTIL Clock’ EVENT AND Clock = ‘1’;
IF L = ‘1’ THEN
Q <= R;
ELSE
Genbits : FOR i IN 0 TO N-2 LOOP
Q(i) <= Q(i + 1);
END LOOP;
Q(N – 1) < = W;
END IF;
END PROCESS;
END Behavior;
Q16. Draw a 4 bit bi-directional shift register logic diagram and explain its operation.
Ans: Nov-10, Set-4, Q6(b)
A4 B4 A3 B3 A2 B2 A1 B1
C4 C3 C2 C1
D4 Q4 D3 Q3 D2 Q2 D1 Q1
Clock
CLR
Figure
In figure, mode control (M) is used for performing either right shift or left shift for the given data. When M = 0, the data
is left shifted. When M = 1, the data is right shifted.
Operation
Case (i)
v When M = 1, the AND gates A4, A3, A2 and A1 are enabled, whereas B4, B3, B2 and B1 are disabled. The output of each OR
gate is applied to the respective D-flip-flop.
v When the clock = 1 and DR = 1, the data bits are shifted one place to right. Thus, the circuit acts as shift right register.
Case (ii)
v When M = 0, the AND gates B4, B3, B2, and B1 are enabled whereas A4, A3, A2 and A1 are disabled. The output of each
OR gate is applied to the respective D input of each flip-flop.
v When clock = 1 and DL = 1, the data bits are shifted one place to left. Thus, this circuit acts as shift left register.
Universal shift register is defined as a register which has both right and left shifting functions along with parallel load
capability.
4-bit Universal Shift Register: The diagrammatic arrangement of a 4-bit universal shift register is shown in figure. It consists
of four D-flipflops and four multiplexers. Where S1 and S0 acts as two common selection inputs to the four multiplexers. When
S1S0 = 00, the input at pin 0 in each multiplexer is selected and when S1S0 = 01, the input at pin 1 in each multiplexer is selected,
and similarly for the other two inputs. Table shows the selection inputs control of the register operation.
Parallel inputs
I3 I2 I1 I0
Serial
input Serial
for input
shift-right for
shift-left
3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
S1
4×1 4×1 4×1 4×1
S0 MUX MUX MUX MUX
f f f f
Clock
D D D D
Clear
Q Q Q Q
Q3 Q2 Q1 Q0
Parallel outputs
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 113
+5 V
R 74 × 194
11 CLK
CLOCK
1 CLR
10 Wired as
S1 a shift-lett
9
RESET S0 shift register
(LOAD) 7 LIN
6 D QD 12
Q0
5 C QC 13
Q1
4 A QB 14 Q2
3 LIN QA 15
Q3
2
UT
Figure (1)
The logic diagram of 74 × 194 IC is shown in figure (2).
DSR DA DB DC DC DSL
(2) (3) (4) (5) (6) (7)
(9)
S0
S1(10)
(11)
CLK
CLR
(1)
R R0 R R0 R R0 R R0
CP CP CP
S Q S Q S Q S Q
(15) (14) (13) (12)
QA QB QC QD
Figure (2)
The 74 × 194 IC is called universal shifter register, because its contents can be shifted in either of the two directions (left
or right) depending on the control input. It has four parallel inputs i.e., DA, DB, DC, DD and two control inputs i.e., S0, S1. When
control inputs are S0 = 1 and S1 = 1, data presents at input i.e., (DA – DD) is shifted to output i.e., (QA – QD).
When S0 = 1 and S1 = 0, during 0 → 1 transition of clock. Shift-right takes place and serial data bit is applied at the DSR
(Shift-right serial input)
When S0 = 0 and S1 = 1, during 0 → 1 transition of clock shift - left takes place and serial data bit is applied at the DSL
(shift-left serial input).
Reset (clear) × 0 × × × × × 0 0 0 0
� 1 1 0 × 0 × QB QC QD 0
Shift-left
� 1 1 0 × 1 × QB QC QD 1
� 1 0 1 0 × × 0 QA QC QC
Shift-right
� 1 0 1 1 × × 1 QA QB QC
Parallel load � 1 1 1 × × Dn DA DB DC DD
Table (1)
Select Inputs
Register operation
S1 S0
0 0 No change
0 1 Shift right
1 0 Shift left
1 1 Parallel load
Table(2)
VHDL Code
LIBRARY ieee;
USE ieee.std-logic-1164.all;
ENTRY univ-sr IS
PORT (CLR, S1, S0, CLK : IN STD-LOGIC;
LIN, RIN, A,B,C,D : IN STD-LOGIC;
QA, QB, QC, QD : OUT STD-LOGIC);
END univ-sr;
ARCHITECTURE Behavior OF Univ-sr IS
AQ = Qreg(3), QB = Qreg(2), Qc = Qreg (1), QD = Qreg (0)
SIGNAL Qreg : STD-LOGIC-VECTOR (3 down to 0);
BEGIN
PROCESS (CLR, CLK)
BEGIN
IF (CLK’ event and CLK = ‘0’) THEN
IF CLR = ‘0’ THEN
Qreg < = ‘0’;
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 115
Q19. Design a 4-Bit, 4-State Ring Counter With Circulating 1 Using IC 74194.
Ans:
The figure (1) illustrates the 4-bit, 4-state ring counter with circulating 1.
+5 V
R
74 × 194
11
CLOCK CLK
1
RESET_L CLR wired as a
10 S1 shift-left
9 shift register
S0
7 LIN
6 12
D QD Q0
5 13
C QC Q1
4 14
B QB Q2
3 15
A QA Q3
2 74 × 04
RIN
1 2
U1
Q3_L U2
Figure (1)
In the circuit, IC 74194, a universal shift register performs left shift operation on the contents loaded in it. The content,
0001 is loaded into the register when the input is RESET. It the RESET is denied, IC left shifts, the bits in it for each clock pulse.
To perform left shift, the input LIN is Connected to Q3 so that next states will be 0010, 0100, 1000, 0001...
The figure below represents the timing diagram of 4-bit, 4-state ring counter.
CLOCK
RESET
Q0
Q1
Q2
Q3
STATE S1 S2 S3 S4 S1 S2
Figure (2)
Since, a ring counter is not robust, it may go to 0000 states and stays forever. If the input state is changed i.e., two 1s are
given (for ex: 0101), then the counter counts for incorrect number of cycles. The figure below shows the state diagram of 4-bit
ring counter of 16 states.
0001
0000
0010 1000
0011 0111
0101
0100
0110 1001 1110 1011
1111 1101
1010 1100
Figure (3)
From the figure, it is clear that, out of 16 states, 12 are abnormal states. In order to avoid this case, self correcting counters
are used.
R
74 × 194
11
CLOCK CLK
1
CLR
10 wired as a
S1 shift-left
RESET 9 S0 shift register
(load)
7
LIN
6 12
D QD Q0
5 13
C QC Q1
4 14
B QB Q2
3 15
A QA Q3
2
RIN 1 74 × 27
2 12
U1 13
ABC0 U2
0001 0000
0010 1000
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 117
Q21. Design a self-correcting 4-bit, 4-state ring counter with a single circulating 0 using IC 74LS194.
Design of a Self-correcting 4-bit, 4-state Ring Counter with a Single Circulating ‘0’ using 74 x 194
+5 V
R
74 × 194
11
CLOCK CLK
1
CLR
10 wired as a
S1 shift-left
RESET 9
S0 shift register
(load)
7
LIN
6 12
D QD Q0
5 13
C QC Q1
4 14
B QB Q2
3 15
A QA Q3
2
RIN 1 74 × 10
2 12
U1 13
ABC1_L U2
Figure (1)
A self-correcting counter is designed so that all abnormal states have transitions leading to normal states. If something
unexpected happens, counter or state machine should enter into a “Safe” state. The logic diagram of a self-correcting 4-bit, 4-state
ring counter with a single circulating ‘0’ using 74 × 194 is shown in figure (1). This is a most convenient way to design a self-
correcting ring counter.
The state diagram for a self-correcting ring counter with a single circulating ‘0’ is shown in figure (2).
0111
1110 1011
1101
Figure (2)
Q22. Discus in brief about 8-bit, 8-state Johnson counter and 4-bit, 8-state self-correcting Johnson counter.
Ans:
A counter which the complemented serial output of an n-bit shift register is Fed back to the serial input is known as Johnson
counter. It is also called as trusted ring counter and Mobius counter. It consists of 2n states.
R
74 × 194
11
CLOCK CLK
1
RESET_L CLR wired as a
10 S1 shift-left
9 shift register
S0
7 LIN
6 12
D QD Q0
5 13
C QC Q1
4 14
B QB Q2
3 15
A QA Q3
2 74 × 04
RIN
1 2
U1
Q3_L U2
CLOCK
RESET
Q0
Q1
Q2
Q3
STATE S1 S2 S3 S4 S5 S6 S7 S8 S1 S2 S3
Figure (2)
The table below represents the states of 4-bit Johnson counter
State name Q3 Q2 Q1 Q0
S1 0 0 0 0
S2 0 0 0 1
S3 0 0 1 1
S4 0 1 1 1
S5 1 1 1 1
S6 1 1 1 0
S7 1 1 0 0
S8 1 0 0 0
Table
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 119
Usually, an n-bit Johnson counter contains 2n–2n
abnormal states. Similar to simple ring counter, Johnson counter is also
robust to The hardware problems. So, self-correcting 4-bit, 8-state Johnson counter is built as shown in figure (3).
+5 V
R
74 × 194
11
CLOCK CLK
1
RESET_L CLR wired as a
10 shift-left
S1
9 shift register
S0
7
LIN
6 12
D QD Q0
5 C 13
QC Q1
4 14
B QB Q2
3 15
A QA Q3
2 2 74 × 02
RIN 1
3
U1
U2
74 × 04
1 2
Q3_L U3
LOAD
Figure (3): Logic Symbol of 4-bit, 8-state Self Correcting Johnson Counter
This circuit eliminates abnormal states by loading 0001 as next state, when the counter reaches 0000 state.
Q23. Write a VHDL program for 16-bit barrel shifter for left circular shift only?
Ans: Oct./Nov.-19, Set-1, Q5(a) M[7]
VHDL program for 16 bit barrel shifter for left circular shift only is given below.
Library IEEE;
use IEEE. STD_LOGIC_1164.ALL;
use IEEE. STD_arith.all;
Entity barrelleft is
port (Din: in STD_LOGIC_VECTOR(15 downto 0);
S: in STD_LOGIC_VECTOR (3 downt 0);
Dout: out STD_Logic_Vector (15 downto 0))
end barrelleft;
architecture behaviour of barrelleft is
Subtype DATAWORD is STD_LOGIC_VECTOR (15 downto 0);
Variable N:Integer
Variable TEMPD:DATAWORD;
begin
process (Din, S)
N: = CONV_INTEGER(S);
for i IN 1 to N loop
TEMPD: = TEMPD (14 downto 0) & TEMPD (15);
end loop;
Dout < = TEMPD;
end process
end behaviour;
--SHIFT LEFT [0] [0] [0] [0] Step 1 : Determine the number of flip-flops required the number
of flip-flops used to generate a given sequence can be determined
-- [0] [0] [0] [sil] as follows
when “01” = > (a) Find the number of 1’s in the sequence
temp < = d; (b) Find the number of 0’s in the sequence
temp (3 downto 1) < = temp (2 downto 0); (c) Select the maximum value from both. Then,
the number of flip-flops ‘n’ selected using the
temp (0) < = sil; condition,
q < = temp; max (0’s, 1’s) £ 2n – 1
--SHIFT RIGHT [0] [0] [0] [0] Step 2 : State assignment
-- [sir] [0] [0] [0] Assign unique states corresponding to each bit in
the given sequence such that the flip-flop representing least
when “10” = >
significant bit generates the given sequence.
temp < = d; Step 3 : Draw the state diagram and derive the excitation table
temp (2 downto 0) < = temp (3 downto 1); for the counter.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 121
Step 4 : Obtain the simplified Boolean expression for each flip- Step 3 : k-map simplification for Din
flop input and circuit output functions using k-maps.
Q1Q0
Step 5 : Sketch the logic diagram using the simplified
Q3Q2 00 01 11 10
expressions.
00 × × × × Q
2. Sequence Generator using shift Registers 3
Q0 Q1 Qn \y = Q +Q +Q
Qn – 1 0 1 3
Step 5 : Draw the logic diagram
y Next state decoder The logic diagram of sequence generator to generate the
sequence is as shown in figure (4).
Figure (2)
Here, the initial state is 1101. Hence, the inputs are,
The output of next state decoder is a function of QA, QB
.... Qn. It decodes the output of shift register and generates the A = 1, B = 1, C = 0, D = 1.
given sequence.
Example : Design a sequence generator to generate the
sequence 1101011 by shift register method.
Solution : The given sequence is 1101011.
Step 1 : Determine the number of flip flops from the condition.
N £ 2n – 1
7 £ 2n – 1 < 2n
Þ 8 < 2n Þ n ³ 3
Figure (4)
Let, n = 4
Step 2 : State assignment 3.2 Ripple Aysnchronous Counters, Syn-
of
The functional table of the sequence is shown in table chronous Counters
below. Q26. Explain synchronous and ripple counters.
Compare their merits and demerits.
Clk Q0 Q1 Q2 Q3 y
Ans:
1 1 1 1 0 1
Counter
2 1 1 1 1 0
A sequential circuit which counts the number of clock
3 0 1 1 1 1 pulses is known as ‘counter’.
4 1 0 1 1 0 Synchronous Counter
5 0 1 0 1 1 A counter is said to be synchronous if individual clocks
6 1 0 1 0 1 of all the flipflops are connected i.e., in synchronous counter a
change in clock pulse can bring a change in flipflops input.
7 1 1 0 1 1
Asynchronous Counter
1 1 1 1 0 1
A counter is said to be asynchronous if all the clocks of
2 1 1 1 1 0 all the flip flops are not connected. The output of first flip-flop
is fed as clock pulse to next flip-flop. Asynchronous counter is
3 0 1 1 1 1
also known as ripple counter.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 123
K-Map for Reset ‘R’
QC QD
QA QB 00 01 11 10
00
0 1 3 2
01
4 5 7 6
11 × × × × Q AQ C
12 13 15 14
10 × 1
8 9 11 10
∴ R = QA QC
Thus, from the K-map equation, it can be analyzed that, the feedback is given from second to fourth flip flop. For active-
high reset, QA QC is given to clear terminal and for active-low reset QA QC is connected to CLR of all the T flipflops.
5. Draw the logic diagram
Using JK Flip Flop
The J and K inputs can be connected to either to logic 1(high) or to the outputs of next flip flops as shown in
figure (1).
R
Logic 1
1
(high)
JA QA JB QB JC QC JD QD
CLR FF1
KB CLR QA KB CLR QB KC CLR QC KDCLR QD
Figure (1)
Timing Diagram
The LSB, QA of binary ripple counter is complemented for every clock pulse and QA changes its state from 1 to 0. Since
the complemented output of first flip flop (F0) is connected to the clock input of the second flip-flop (F1). This flip-flop changes
it state from 1 to 0 and so on for other higher order bits of a ripple counter. The wave form of 4 bit ripple counter is shown in
figure (2).
Input B R1 R2 S1 S2
Reset inputs Set inputs
Figure (1)
The IC is made up of four flip-flops that are internally connected to form a mod-2 and mod-5 counters. Which can be used
together or separately. The fli-flop FFA is a mod-2 counter but the flip-flops FEB, FFC and FFD together from a mod-5
counter. The flip-flop is cleared by connecting reset inputs R1 and R2 to logic 1. At a logic 1 level, both set inputs S1 and
S2 set the counter to 1001.
2. Groups Asynchronous Counter ICs: The 4-bit ripple binary counter ICs 7493, 74293 and divide-by-12 counter IC7492
come under this category. The basic internal structure is illustrated in figure (2).
Ouputs
(MSB)
QA QB QC QD
Input B R1 R2
Reset inputs
Figure (2)
The function of these ICs is similar to that of IC 7490. The only difference is that IC7492 ha only reset inputs. Also, the
mod-6 counter does not count in binary order.
Table below shows the sequence of the mod-6 counter.
QD QC QB
0 0 0
0 0 1
0 1 0
1 0 0
1 0 1
1 1 0
Table: Sequence of Mod-6 Counter
These ICs are used for frequency division rather than counting operation.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 125
3. Group C Asynchronous Counter ICs
The preset table BCD counters 74196 and 74196 (mod-5) and 4-bit binary counters 74177 and 74197 (mod-8) come under
this category. The basic internal structure is illustrated in figure (3).
Outputs
QA QB QC QD (MSB)
Preset inputs
Figure (3)
The counter is cleared when CLR = 0 setting load input to logic 0 stops the counter and loads the binary number available
at the present inputs into the counter. By connecting load and clear inputs to logic 1, the circuit can be used as up counter.
The preset table 4-bit counters can be used as variable mod-n counter. The modulus of such counter is given by n = 15
binary number present at the preset inputs).
Q29. Design a normal mod-12 counter using IC 74161.
Ans:
The block diagram of mod-12 counter using 74161 is as shown in figure and the function table or these ICs are given
in figure. There are two independent enable inputs in this IC, denoted by the letters ENT and ENP. Asynchronous counting is
terminated, when either of these inputs is set to logic 0. Hence, we set these inputs are set to logic 1 figure. The ripple carry (RC)
output switches from logic 0 to logic, when the counter reaches its highest count. In this case, the highest count is 1011.
QA QB QC QD
Pulses CK
ENT 74161
Logic 1
ENP Load Cr
PA PB PC PD Logic 1
Figure: Mod-12 Counter Using IC 74161
The circuit is intended to be used for standard up-counting operations alone (last row of function table). The Cr terminal
is connected to the QD and QC outputs using a NAND gate, which clears the counter when the output reaches 1100, as seen here.
The mod-12 counter has a range of states ranging from 0000 to 1011. The functional table of IC 74161 is illustrated in table (1).
Load L ENP ENT Cr CK Mode
0 × × 1 ↑ Preset
1 0 1 1 × Stop count
1 × 0 1 × Stop count, disable RC
× × × 0 • Reset to zero
1 1 1 1 ↑ Up count
Table: Functional Table
SPECTRUM ALL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS
126 DIGITAL IC DESIGN [JNTU-KAKINADA]
Q30. Write the design steps of synchronous counters.
Ans:
The design procedure of synchronous counters for any given count sequence and modulus is as follows,
1. Makes use of the formula n 2N and calculate the required number of flip flops.
2. Count sequence should be written in the tabular form.
3. By making use of excitation table or truth table of flip flops find those inputs of flip flops which are available from the
present state to the next state.
4. Construct Karnaugh map for each input provided to the flip flop which is expressed in terms of flip flop outputs and the
input variables.
5. Now simplify the Karnaugh map to get the reduced form of expression.
6. For minimized expressions the circuit can be designed by using flip flops and other gates.
Q31. Design a 4 bit synchronous binary even counter and write its behavioural mode;.
Ans: (Model Paper-2, Q5(b) | Oct./Nov.-16, Set-2, Q7)
0
14
12 2
10 4
8 6
Qn Qn+1 J K
0 0 0 ×
0 1 1 ×
1 0 × 1
1 1 × 0
Table (1)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 127
The excitation table for 4-bit synchronous even counter using JK flip-flops can be obtained from table (1) as shown in table (2).
Present State Next State Flip-flop Excitation Inputs
QA QB QC QD Q *A Q *B Q *C Q *D JA KA JB KB JC KC JD KD
0 0 0 0 0 0 1 0 0 × 0 × 1 × 0 ×
0 0 0 1 × × × × × × × × × × × ×
0 0 1 0 0 1 0 0 0 × 1 × × 1 0 ×
0 0 1 1 × × × × × × × × × × × ×
0 1 0 0 0 1 1 0 0 × × 0 1 × 0 ×
0 1 0 1 × × × × × × × × × × × ×
0 1 1 0 1 0 0 0 1 × × 1 × 1 0 ×
0 1 1 1 × × × × × × × × × × × ×
1 0 0 0 1 0 1 0 × 0 0 × 1 × 0 ×
1 0 0 1 × × × × × × × × × × × ×
1 0 1 0 1 1 0 0 × 0 1 × × 1 0 ×
1 0 1 1 × × × × × × × × × × × ×
1 1 0 0 1 1 1 0 × 0 × 0 1 × 0 ×
1 1 0 1 × × × × × × × × × × × ×
1 1 1 0 0 0 0 0 × 1 × 1 × 1 0 ×
1 1 1 1 × × × × × × × × × × × ×
Table (2): Excitation Table
4. The minimal expressions for JA, RA, JB, KB, JC, KC, JD and KD can be obtianed using k-maps as described below.
For JA For KA
QCQD QCQD
QAQB QAQB
00 01 11 10 00 01 11 10
00 × × 00 × × × ×
0 1 3 2 0 1 3 2
01 × 5 × 7 16 QBQC 01 × 4 × 5 × 7 ×6 QBQC
4
11 × 12 × 13 × 15 ×14 11 × 13 × 15 114
12
10 × × × × 10 × ×
8 9 11 10 8 9 11 10
` J A = K A = A B QC
For JB For KB
QCQD QCQD
QAQB QAQB
00 01 11 10 00 01 11 10
00 × × 1 00 × × × ×
0 1 3 2 0 1 3 2
01 × × 5 × 7 ×6 QC 01 × 5 × 7 16 QC
4 4
11 × 12 × 13 × 15 ×14 11 × 13 × 15 114
12
10 × × 1 10 × × × ×
8 9 11 10 8 9 11 10
` J B = K B = QC
00 1 × × × 00 × × × 1
0 1 3 2 0 1 3 2
01 1 × 5 × 7 ×6 1 01 × × 5 × 7 16 1
4 4
11 1 12 × 13 × 15 ×14 11 × 12 × 13 × 15 114
10 1 × × × 10 × × × 1
8 9 11 10 8 9 11 10
` JC = KC = 1
For JD For KD
Q CQ D Q CQ D
QAQB QAQB
00 01 11 10 00 01 11 10
00 × × 00 × × × ×
0 1 3 2 0 1 3 2
01 × 5 × 7 01 × 4 × 5 × 7 ×6
4 6
11 × 13 × 15 11 × 12 × 13 × 15 ×14
12 14
10 × × 10 × × × ×10
8 9 11 10 8 9 11
` J D = K D = 0
The synchronous binary even counter is implemented using negative edge trigged JK flipflops with the help of obtained
minimal expressions which is as shown in figure (2).
QC
QB
1 0
JA QA JB QB JC QC JD QD
KA QA KB QB KC QC KD QD
Clock
Figure (2)
The behavioural style of VHDL code for 4 bit synchronous binary even counter is mentioned below:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
entity evencounter_4bit is
port ( clk : in STD_LOGIC;
reset : in STD_LOGIC;
dout : out STD_LOGIC_VECTOR(3 downto 0) );
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 129
end evencounter_4bit; The truth table of twisted ring counter is shown in table.
architecture evencounter_4bit_arch of evencounter_4bit is Q0 Q1 Q2 Q3 After Clock Pulse
begin 0 0 0 0 0
process (clk, reset)
1 0 0 0 1
variable m : std_logic_vector (3 downto 0) := “0000”;
1 1 0 0 2
begin
1 1 1 0 3
if (reset=’1’) then
m:= “0000”; 1 1 1 1 4
the last stage is connected to the D input of the first stage. This The circuit diagram of 4-bit Johnson counter (or) twisted
feedback arrangement produces a unique sequence of states. ring counter using IC74LS194 is shown in figure (1).
+5 V
R
74 × 194
•
11
CLOCK CLK
Figure (1): Logic Diagram of 4-bit Twisted Ring Counter Using 1
RESET_L CLR wired as a
D-flip-flops 10 S1 shift-left
9 shift register
Before applying the clock pulses, clear the output of all S0
the flip-flops to 0000 i.e., Q3 Q2 Q1 Q0 = 0000. 7 DSL
6 Q0 12
v Since the output of last stage, Q4 = 0, Q 4 = 1 is fed to D0. D
5 C Q1 13
4 14
v At the end of first falling edge of clock, Q0 = 1 and Q1 B Q2
15
3
= Q2 = Q3 = 0. A Q3
2 74 × 04
DSR
v For next clock pulse, Q0 = Q2 = 1 and Q2 = Q3 = 0. 1 2
Q3_L
v The counter counts the sequence for the next clock pulses
and it is repeated after states. Figure (1)
Q0
Q1
Q2
Q3
STATE S1 S2 S3 S4 S5 S6 S7 S8 S1 S2 S3
Figure (2)
The output state-table consisting of 8-states (2N) is shown below.
State name Q3 Q2 Q1 Q0
S1 0 0 0 0
S2 0 0 0 1
S3 0 0 1 1
S4 0 1 1 1
S5 1 1 1 1
S6 1 1 1 0
S7 1 1 0 0
S8 1 0 0 0
Table
Q34. Draw the logic diagram of 74 x 163 binary counter and explain its operation.
Ans:
74 × 163 is a synchronous 4-bit binary counter. It has clear and load inputs, both of active-low type, two enables EN1, EN2,
both should be logic ‘1’ for normal operation of counter. It has four load inputs LA, LB, LC, LD. When LD pin is made logic ‘0’
then outputs Q0, Q1, Q2, Q3, gets values of LA, LB, LC, LD respectively. ‘C0’ is output pin which goes high to indicate count
over (i.e., Maximum count reached).
Logic symbol of 74 × 163 IC is shown in figure (1).
74 × 163
CLOCK CLK
CLR
LD
ENP
ENT Q0
Q1
LA
Q2
LB
Q3
LC
LD
CO
Figure (1)
TheWARNING:
internal logic diagram of 74 of
Xerox/Photocopying × 163 IC isisas
this book shown inact.
a CRIMINAL figure (2).found guilty is LIABLE to face LEGAL proceedings.
Anyone
UNIT-3 (Sequential Logic Design) 131
CLK
LD P1
P2
CLR
P3
LA D0
D Q Q0 (LSB)
CLK
P4
P5
Q0
LB D1
P2 D Q1
CLK
P6
P8
Q1
LC D2
D Q2
P9
CLK
P10
Q2
LD D3
D Q3 (MSB)
CLK
Q3
C0
EN 1
EN 2
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 133
Q37. Design an excess-3 decimal counter using 74 × 163 and explain the operation.
Ans: 74 × 163 is a synchronous 4-bit binary counter as shown in figure (1) ,
Figure (1)
Excess-3 decimal counter can be designed using three 74 × 163 binary counters.
Three 74 × 163 binary counters are cascaded to obtain excess-3 decimal counter as shown in figure (2) below,
Figure (2)
A0, B0, C0 and D0 are the inputs to the excess-3 decimal counter whose corresponding outputs are QA2, QB2, QC2 and QD2.
The truth table is given in table below,
Inputs
Outputs
A B C D QA2 QB2 QC2 QD2
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
1 0 1 0 1 1 0 1
1 0 1 1 1 1 1 0
1 1 0 0 1 1 1 1
1 1 0 1 × × × ×
1 1 1 0 × × × ×
1 1 1 1 × × × ×
Table: Truth Table
SPECTRUM ALL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS
134 DIGITAL IC DESIGN [JNTU-KAKINADA]
Q38. Write a VHDL code for excess-3 decimal counter using IC 74163.
Ans:
LIBRARY ieee;
USE ieee.std-logic-1164.all;
USE ieee.std-logic-unsigned.all
ENTITY excess-3IS
PORT (CLK, CLR, LD, EM1, EN2 : IN STD-LOGIC;
D : IN UNSIGNED (3 down to 0);
Q : OUT UNSIGNED (3 down to 0);
RCO : OUT STD-LOGIC);
END excess-3;
ARCHITECTURE excess-3-arch of excess-3 IS
SIGNAL IQ : UNSIGNED (3 down to 0)
BEGIN
PROCESS (CLK, EN2, IQ)
BEGIN
IF CLK' event AND CLK= ‘1’ THEN
IF CLR = ‘0’ THEN IQ < = (others = >’0’);
ELS IF LD = ‘0’ THEN IQ < = D;
ELSIF (EN2 and EN1) = ‘1’ AND (IQ = 12) THEN
IQ < = (‘0’, ‘0’, ‘1’, ‘1’);
ELSIF (EN2 and EN1) = ‘1’ THEN IQ < = IQ + 1;
END IF;
IF (IQ = 12) and (ENT = ‘1’) THEN RCD< = ‘1’;
ELSE RCO < = ‘0’;
END IF
Q < = IQ;
END PROCESS;
END excess-3;
Q39. Explain about modulo-6 counter with synchronous reset.
Ans:
The graphical symbol of a modulo-6 counter with synchronous reset is shown in figure (1).
Figure (1)
The AND gate in the figure in used to clear inputs of the flip-flop once the ‘110’ state is reached. The parallel load feature
of the counter is used to reset its contents when the count reaches 5.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 135
In this type of counters, output of one flip-flop is connected as clock input to the next flip-flop. Initially, all the flip-flops
of the counter are reset (i.e., ‘000’). When the first clock pulse is applied its output Q0 shifts from 0 to 1. Thus, the process of
counting begins. A mod-6 counter consists of truncated sequence i.e., it can count from 000 to 101. Once the counter reaches
110, the outputs Q0 and Q2 of flip-flops are connected to AND gate. This gate is used to decode the count and resets the flip-flops
back to ‘0001’. The truth table of mod-6 decade counter is shown in table below,
Clock Q2 Q1 Q0
0 0 0 0
1 0 0 1
2 0 1 0
3 0 1 1
4 1 0 0
5 1 0 1
Table
Figure (2)
Figure (2) represents the timing diagram of a modulo-6 counter with synchronous reset.
Q40. Write a VHDL program to design a modulo-6 counter.
Ans: Oct../Nov.-16, Set-4, Q7(a)
VHDL code for synchronous mod-6 counter,
LIBRARY IEEE;
USE IEEE. STD_LOGIC_1164.ALL;
USE IEEE. STD_LOGIC_unsigned. ALL;
ENTITY Counter3 IS
PORT(
CLK : IN STD_LOGIC;
Resetn : IN STD_LOGIC;
Setn : IN STD_LOGIC;
Q: INOUT STD_LOGIC_VECTOR (2 DOWNTO 0)
);
END Counter 3;
ARCHITECTURE Synch_Cntr OF Counter3 IS
BEGIN
PROCESS(CLK, Resetn, Setn)
VARIABLE Qtemp: STD_LOGIC_VECTOR (2 DOWNTo 0);
BEGIN
IF Resetn = ‘0’ THEN
Qtemp : = “000”;
ELSIF Setn = ‘0’ THEN
Qtemp : = “111”;
ELSIF CLK = ‘1’ AND CLK’ event THEN
IF Qtemp < 5 THEN
Qtemp : = Qtemp + 1;
Q < = ‘000’ AFTER 2ns;
END IF;
END PROCESS;
END ASYNCH _Glitch;
A counter is said to be synchronous, when a single clock pulse is connected simultaneously to all the flip-flops. A 4-bit
synchronous counter requires four flip-flops and two AND gates. The circuit diagram of a 4- bit synchronous counter using JK
flip-flop is shown in figure (1).
Table
The timing diagram of a 4-bit synchronous counter is shown in figure (2).
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Q0
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
Q1
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
Q2
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
Q3
Figure (1): 3-bit Binary Ripple Down Counter Using Positive-edge Triggered Flip-flops
Figure (1) depicts the 3-bit binary ripple down counter using positive-edge triggered flip-flops. Here, the output of each
flip-flop is connected to the clock input of next flip-flop. The truth table of 3-bit binary ripple down counter is shown in table (i),
State
Clock Pulse
Q2 Q1 Q0
0 1 1 1
1 1 1 0
2 1 0 1
3 1 0 0
4 0 1 1
5 0 1 0
6 0 0 1
7 0 0 0
8 1 1 1
Table
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 139
Initially consider that all the flip-flops are reset. Then, we get the counter output as 111 because ‘T’ flip-flop gives the
complement of input as output. As soon as first positive clock pulse is applied, flip-flop FF0 is enabled. And, the output ‘Q0’
changes from 1 to 0 which doesn’t affect the next flip-flop FF1. Thus, the output of FF1 remains ‘1’ output of FF2 remains ‘1’.
The counter output becomes 110. When the second positive clock pulse is applied output of the flip-flop ‘FF0’ (i.e, Q0) changes
from ‘0’ to 1. This output ‘Q0’ enables the next flip-flop ‘FF1’. Then, the output of ‘FF1’ changes from ‘1’ to ‘0’ and doesn’t affect
its next flip-flop. Thus, the output of FF2 remains same. The counter output becomes 101.
In the similar manner, for subsequent clock pulses, counter counts till ‘000’ and comes back to its initial state 111. Then
the same process gets repeated. The timing diagram is as shown in figure (2).
Figure (2): Timing Diagram of 4-bit Binary Ripple Down Counter (using Positive Triggered Flip-flops)
Q45. Write a VHDL code for a down-counter.
Ans:
The VHDL code for a down-counter is given below,
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY downcnt IS
GENERIC (modulus : INTEGER : = 8);
PORT (Clock, L, E : IN STD_LOGIC;
Q : OUT INTEGER RANGE 0 TO modulus – 1);
END downcnt;
ARCHITECTURE Behavior OF downcnt IS
SIGNAL Count : INTEGER RANGE 0 to modulus – 1;
BEGIN
PROCESS
BEGIN
WAIT UNTIL (Clock’ EVENT AND Clock = ‘1’);
IF L = ‘1’ THEN
Count <= modulus – 1;
ELSE
IF E = ‘1’ THEN
Count <= Count – 1;
END IF;
END PROCESS;
Q <= Count;
END Behavior;
4. Connect the AND gates such that Q output is given to clock pulse of next flipflop for up counter and output is given
to clock pulse of next flipflop for down counter.
The counter resets automatically, i.e., for up counter, when it comes to the last count i.e., 1 1 1 1, the next count goes to
0000 with carry 1.
1111
+ 1
1000
CY
As carry is not considered here, again the count starts from ‘0 0 0 0’.
In the similar manner, for down counter 0000 minus 1 gives 1 1 1 1 with borrow 1 which is not considered.
The 4-bit up/down ripple counter with negative clock pulse is as shown in the figure (i),
up /down
J0 J1 J2 J3 Q3
Q0 Q1 Q2
CLK CLK CLK CLK
Q0 Q1 Q2
K0 K1 K3 K3 Q3
1 (high)
J0 Q0 J1 Q1 J2 Q2 J3 Q3
K0 K1 K2 K3 Q3
1 (high)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 141
Let the present count be 5 = 0 1 0 1. The first flipflop with J0 = K0 = 1 as inputs, always toggles the present state (since clock
is enabled) and all other flipflops are enabled only when 1 → 0 transition of the clock occurs (since negative clock pulse is given).
Thus,
As 1 → 0 transition occurred 0 is toggled to 1 i.e.,
As 0 → 1 transition is occurred in Q1, the state remains same i.e.,
As 1 → 1 transition of Q2 does not enables the clock of Q3, the output remains same
Thus, 0 1 1 0 is the output which is equivalent to 6. The count takes place in forward direction and acts as up counter.
Case (ii)
If up /down = 1, the asynchronous counter shown in figure (i) can be rearranged as shown in figure (iii).
Q0 Q1 Q2 Q3
J0 Q0 J1 Q1 J2 Q2 J3 Q3
K0 Q0 K1 Q1 K2 Q2 K3 Q3
1 (high)
Figure (iii)
Let the present count be 12 – 1100.
As, the transition depends on the complement of output consider, (1100)c = 0011
The MSB bit toggles, as the first flipflop inputs are J0 = k0 = 1 and clock is enabled i.e.,
As there is 1 → 0 transition in Q0 , the present state of output toggles i.e.,
The 0 → 0 transition in Q 2 , the present state of Q 2 is toggled.
The 1 → 0 transition in Q1 disables the clock of Q3 .
Thus, the output remains same i.e.,
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 143
74 × 169 end counter;
2
CLK
architecture archi of counter is
1
UP/DN signal temp: std_logic_vector (3 downto 0);
9
7 LD begin
10 ENP process(c, CLR)
ENT 14
3 QA begin
A
4 13
B QB if (CLR = ‘1’) then
5 12
C QC temp < = “0000”;
6 11
D QD elseif (‘c’ event and c = ‘1’) then
15
RCO if (U_D = ‘1’) then
Ans:
The 74 × 74 is a positive edge-triggered D-flip-flop with preset and clear inputs. The logic symbol of 74 x 74 IC is shown
in figure (1).
4
2 5
D Q
3 6
Clock
CLR Q
1
Figure (1)
Design of 4-bit Synchronous Counter Using 74 × 74
Initially, the excitation table for D-flip-flop can be written as,
Qn Qn+1 D
0 0 0
0 1 1
1 0 0
1 1 1
Table (1)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 145
The state transition table for 4-bit synchronous counter is shown in table (2).
Present state Next State Input
Q0 Q1 Q2 Q3 Q+0 Q+1 Q+2 Q+3 D3 D2 D1 D0
0 0 0 0 0 0 0 1 0 0 0 1
0 0 0 1 1 00 0 0 0 1 0
0 0 1 0 1 10 0 0 0 1 1
0 0 1 1 0 00 1 0 1 0 0
0 1 0 0 0 10 1 0 1 0 1
0 1 0 1 1 00 1 0 1 1 0
0 1 1 0 1 10 1 0 1 1 1
0 1 1 1 0 01 0 1 0 0 0
1 0 0 0 0 11 0 1 0 0 1
1 0 0 1 1 01 0 1 0 1 0
1 0 1 0 1 11 0 1 0 1 1
1 0 1 1 0 01 1 1 1 0 0
1 1 0 0 0 11 1 1 1 0 1
1 1 0 1 1 01 1 1 1 1 0
1 1 1 0 1 11 1 1 1 1 1
1 1 1 1 0 00 0 0 0 0 0
Table (2)
The inputs to the D-flip-flop are simplified using K-map,
For D3 For D2
Q0 Q2
Q2Q3
QoQ1 00 01 11 10
0 1 3 2
Q2Q3
00 QoQ1 00 01 11 10
4 5 7 6 0 1 3 2
01 1 Q 0 Q1Q 2 Q 3 00 1
12 13 15 14 4 5 7 6
11 1 01 1 1 1
1 1
8 9 11 10 Q1 Q 2 12 13 15 14
10 1 1 1 1 11 1 1 1
8 9 11 10
10 1 1 Q1 Q 3
Q 0 Q1
Q0 Q3 Q1Q 2 Q 3 Q QQ
0 1 3
Q2Q3 Q 2 Q 3 Q3
\ D1 = Q 2 Q3 + Q 2 Q3 = Q 2 5 Q3 ∴ D0 = Q3
D3 Q3
Q3
D2 Q2
Q2
D1 Q1
Q1
D0 Q0
Q0
Figure (2)
I/P Combinational
O/P
circuit
Memory
element
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 147
Example: Counters, Registers
Depending on the timing of signals, sequential circuits are classified as two types. They are,
1. Synchronous sequential circuit
2. Asynchronous sequential circuit.
1. Synchronous Sequential Circuit
A circuit is said to be synchronous circuit if its output depends on the input signals only at discrete interval of time i.e.,
memory device will undergo a change only at a discrete time interval. These circuits use flipflops as their memory device
for storing the binary information. A timing element known as clock generator is needed for synchronization and provides
a periodic pulse train signals.
Synchronous sequential circuit are also called as clocked-sequential circuits. If more than one flipflop is used, then they
have a common clock pulse. These circuits are simple to design and have limited speed of operation due to time delay.
At the time of unclock, the change input is simultaneous for clocked sequential circuits as shown in figure (2).
No incoming arcs
(v) Strongly Connected Machine
The machines in which input sequence exists for each
pair of states Xi, Xj ... and takes the machine from one
state to another, are called strongly connected machines.
Q52. What are the capabilities and limitations of finite
state machines?
Ans: April-18, Set-4, Q7(b) M[5]
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 149
Since all the variables are with respect to present state, Q54. Write short notes on the following with suitable
the equation (1) can be written as, examples.
D1(t + 1) = D1W + D2W ... (2) (i) State diagram
(ii) State table
D2(t + 1) = D1W ... (3)
(iii) State assignment.
and the output can be expressed algebraically as,
(Model Paper-1, Q6(a) | Oct./Nov.-18, Set-1, Q7(b) M[7])
z(t) = [D1(t) + D2(t)] W (t)
(or)
⇒ z(t) = [D1 + D2] W ... (4) Explain the terms state diagram and state table
∴ Equations (2), (3) and (4) represent the state equations with suitable example. April-18, Set-1, Q7(b) M[7]
of sequential circuit. (Refer Only Topics (a) and (b)
D1(t + 1) = D1W + D2W Ans:
D2(t + 1) = D1W (a) State Diagram: A state diagram is defined as the
diagrammatic representation of the performance of a sequential
z = (D1 + D2) W circuit. It is shown in figure (1).
State Table
The state equations can be implemented in a table called
state table. The state table has four columns namely current state
(or present state), input, next state and output.
If the sequential circuit has x-flip-flops and y input then
the number of rows in a state table are 2x+y. Under the present
state and input column, the binary number from 0 to 2x+y–1 are
listed and the next state contains x columns, one for each flip-
flop. State table for the clocked sequential circuit in figure (1)
is as shown in table below.
Present State Input Next State Output
Figure (1)
D1 D1 W D1 D2 z
In figure (1), the circles indicate the state of the sequential
0 0 0 0 0 0 circuit. Each circle consists of binary number, which represents the
0 0 1 0 1 0 specific state of the sequential circuit. The circles are connected
0 1 0 0 0 1 by means of two direct lines i.e., one line connects the two circles,
0 1 1 1 1 0 indicating the change in state whereas the other line connects the
1 0 0 0 0 1 circle itself indicating that the next state is similar to the present
1 0 1 1 0 0 state. Over the direct lines there are two binary digits separated by
1 1 0 0 0 1 the symbol ‘/’. The digit prior to the symbol indicates the input
1 1 1 1 0 0 value, which results in transformation of state and the digit after
the symbol indicates output value during the transition.
Table: State Table
Example: The Moore state diagram is shown in figure (2).
State Diagram
The graphical representation of state table is known as
state diagram. In state diagram, each state is indicated by a circle
and state transition due to clock trigger is represented by solid
lines. The state diagram is as shown in figure (2).
1|0
Figure
The state table can be obtained as shown in table.
Next State Output
Present State
x=0 x=1 x=0 x=1
00 00 10 0 0
10 11 10 0 1
Figure (3)
11 01 11 0 0
We can assign the binary values by following the set of
01 01 00 0 0
rules for state assignment. Basically there are two rules for state
assignments. They are, Table
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 151
Step-2: Total number of states must be reduced using state The total output Y is dependent on the preceding
reduction technique. position’s carry as well as the current inputs. In the LSB (b0)
Step-3: If the represented states are in alphabetical form then binary position, both the input bits are zero and the output is also zero;
values must be assigned to each state in the state table. in the next position, i.e., b1 the sum of one and one is zero and
a carry ‘1’ is generated; in the next position b2, the two 1’s,
Step-4: In this step, the total number of flip-flops that are together with the carry 1 from b1 position are added, resulting
required to design the circuit are to be determined. in the sum bit Y = 1 and carry = 1; and so on. Now in the design
Step-5: Based on the obtained data, the type of flip-flop must we need a memory device to track the carry input. This means
be chosen. the memory encompasses two states, 0 and 1, that correspond
to carry = 0 and 1, respectively. From the foregoing discussion,
Step-6 : From the obtained state table, the circuit excitation and
we create a state transition and output table as follows:
output tables must be derived.
Step-7 : Circuit output functions and flip-flop input functions Present Inputs Next State
Output
must be derived using K-map or any other method. State PS(Q) X1 X2 NS(Q*)
Step-8: Finally, by using the circuit output functions and flip-flop 0 0 0 0 0
input function obtained in step-7, sketch the logic diagram. 0 0 1 0 1
Q56. Explain the state equivalence and machine 0 1 0 0 1
equivalence with reference to sequential machines. 0 1 1 1 0
Ans: Oct./Nov.-19, Set-2, Q7(a) M[7] 1 0 0 0 1
State Equivalence: While constructing the state diagram for 1 0 1 1 0
the finite state machine, there is a possibility of existence of 1 1 0 1 0
redundant states i.e., the states that defines the same function. State
1 1 1 1 1
equivalence is a diagram which doesn’t contain redundant states.
Table (1): State Transition and Output Table for Serial
Let us assume Si and Sj are the two states of the machine
Adder
‘M’. These two states are called equivalent, if there exist same
output sequence for all the possible input sequences irrespective From the above transition and output table using k-map
of the initial state. we derive inputs and outputs for D-flip flop. The k-maps are
illustrated in figure (1).
If an input W = 0 is applied to a FSM which is in state ‘Si’,
Q Q
it transits to state ‘Sp’. Then ‘Sp’ is called 0-successor of state ‘Si’. x1x2 0 1 x1x2 0 1
Similarly, if W = 1 is applied to FSM in state ‘Si’, it 00 00 1
transits to state ‘Sq’. Then ‘Sq’ is called 1-successor of ‘Si’.
01 1 01 1
Machine Equivalence: Consider two machines M1 and M2. These
11 1 1 11 1
two machines are equivalent when for every state in M1, there
is corresponding equivalent state in machine M2 and vice versa. 10 1 10 1
If the machine has no equivalent states then it is called
minimal or reduced form. Figure (1): K-maps for Flip-flop Input D and Output Y
The logic expression for D and Y are,
For every machine ‘M’ there exist corresponding
minimal machine M* which is equivalent to machine ‘M’. D = X1X2 + X1Q + X2Q
Q57. Design a serial adder circuit to add two binary Y = X1 X2 Q + X1X2 Q + X1X2 Q + X1 X2
numbers using D-flip flops. From the above input and output expressions the circuit
Ans: We have all done decimal addition with paper and pencil. of serial adder is as shown in figure (2).
Binary numbers are added serially in a similar manner. Starting
from the LSD, digits in the same significant position are added,
accompanied with a carry formed by adding digits from the
preceding significant position. This is as explained below.
Let us call the two binary inputs to be added as X1 and X2.
Inputs X1 and X2 are applied successively. Now if we presume
X1 = 10010110 and X2 = 11011110, then the output Y is,
b2 b1 b0
X1 = 1 0 0 1 0 1 1 0
X2 = 1 1 0 1 1 1 1 0
Y = 10 1 1 1 0 1 0 0 Figure (2): Serial Adder Circuit Using D-FLIP FLOP
AB AB AB Y Y y1 y2 Y1 Y2 Y1 Y2 z
a a c 0 0 0 0 0 0 0 1 0
b b a 0 0 0 1 0 1 1 0 0
c d c 0 1 1 0 1 0 1 1 0
d b d 0 0 1 1 1 1 0 0 1
Table: State Table for Mealy Model Table: State Table
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 153
The corresponding state diagram is shown in figure (2).
x Serial
Input binary adder z output
sequences y (binary)
clock
00/z = 0 01/z = 0
01/z = 1 A B 10/z = 0
10/z = 1 11/z = 1
Initial
state 00/z = 1
Figure (2): State Diagram of Serial Binary Adder
At node B, the sum bit is the addition of input combination of bits along with the previous carry. For combination 00, the sum
bit is 0 + 1 = 1, with carry bit = 0 which indicates state A, hence state is changed from B to A. For all other combinations, i.e 01, 10,
11, carry is generated and there is no change in the state. The state table of a Mealy serial binary adder is shown in table (1)
Present state Next state Output (Z)
Inputs (xy) Inputs (xy(
00 01 10 11 00 01 10 11
A
A A A B 0 1 1 0
(Initial state)
B A B B B 1 0 0 1
0 0 0 0 1 0 1 1 0
1 0 1 1 1 1 0 0 1
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 155
The corresponding circuit using above expressions is Let,
shown in figure (3). A0 = 00
x z A1 = 01
Full B0 = 10
y
adder Y y
D Q And B1 = 11
Carry-out
Then the corresponding state assigned table is given in
table (2).
Clock Q Present Next State (Y2 Y1)
Output
State
00 01 10 11 (Z)
Reset y2 y1
00 00 01 01 10 0
Figure (3): Circuit for the Serial Adder Mealy FSM 01 00 01 01 10 1
10 01 10 10 11 0
Q62. Explain in detail about Moore-type FSM for serial
11 01 10 10 11 1
adder.
Table (2): State-assigned Table
Ans:
On solving the state assigned table, the next-state and
The state diagram for Moore-type serial adder FSM is output expressions are,
shown in figure (1).
Reset
Y1 = m ⊕ n ⊕ y2
00 Y2 = mn ⊕ my2 ⊕ ny2
A0 |s = 0
Z = y1
01 11
Where,
10
00 Y1 = Sum
00
01 01 Y2 = Carry-out
10 A1 |s = 1 B0 |s = 0 10
01 Z = Output signal.
11 10
00 The corresponding circuit of above expressions is shown
11
in figure (2).
B1 |s = 1
Sum-bit Y1 y1
m D Q s
11 n Full
adder Carry-out
Figure (1): State Diagram of Moore-type Serial Adder FSM
Q
From figure (1), the state table using state diagram is
given in table (1),
A0 A0 A1 A1 B0 0
A1 A0 A1 A1 B0 1 Clock Q
B0 A1 B0 B0 B1 0
B1 A1 B0 B0 B1 1 Reset
Table (1): State Table Figure (2): Circuit for the Moore-type Serial Adder FSM
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 157
Clock : IN STD_LOGIC;
Q : BUFFER STD_LOGIC_VECTOR(N – 1 DOWNTO 0);
END COMPONENT;
SIGNAL QA, QB, Null_in : STD_LOGIC_VECTOR(length – 1 DOWNTO 0);
SIGNAL s, Low, High, Run : STD_LOGIC;
SIGNAL Count : INTEGER RANGE 0 to length;
SIGNAL State_type IS (G, H);
SIGNAL y : State_type;
BEGIN
Low <= ‘0’; High <= ‘1’;
ShiftA : shiftrne GENERIC MAP (N => length)
PORT MAP (A, Reset, High, Low, Clock, QA);
ShiftB ; shiftrne GENERIC MAP (N => length)
PORT MAP (B, Reset, High, Low, Clock, QB);
Adder FSM : PROCESS (Reset, Clock)
BEGIN
IF Reset = ‘1’ THEN
y <= G;
ELSIF Clock EVENT AND Clock = ‘1’ THEN
CASE y IS
WHEN G =>
IF QA(0) = ‘1’ AND QB(0) = ‘1’ THEN y <= H;
ELSE y <= G;
END IF;
WHEN H =>
IF QA(0) = ‘0’ AND QB(0) = ‘0’ THEN y <= G;
ELSE y <= H;
END IF;
END CASE;
END IF;
END PROCESS AdderFSM;
WITH y SELECT
s <= QA(0) XOR QB(0) WHEN G,
NOT (QA(0) XOR QB(0) WHEN H;
Null_in <= (OTHERS => ‘0’);
ShiftSum : shiftrne GENERIC MAP (N => length)
PORT MAP (Null_in, Reset, Run, s, Clock, Sum);
Stop : PROCESS
BEGIN
WAIT UNTIL (Clock’ EVENT AND Clock = ‘1’);
IF Reset = ‘1’ THEN
Count <= length;
ELSIF Run = ‘1’ THEN
Count <= Count – 1;
END IF;
END PROCESS;
Run <= ‘0’ WHEN Count = 0 ELSE ‘1’ ; -- stops counter and ShiftSum
END Behavior;
a7 a0 D3 D2 D1 D0
L
Counter
E
L
0 W Q 3 Q2 Q1 Q0
1 E
Adder
b7 b0 FSM
Run
L 0 0
0 W
1 E
L
W
E
Clock
reset
Sum7 Sum0
Figure (1): Synthesized Circuit from the Code
50.0 ns 100.0 ns 150.0 ns 200.0 ns 250
Reset
Clock
A 2D
B A5
Sum 00 80 40 20 90 48 A4 D2
y G H G H G H G
Ans: In Mealy model, the state diagram has the states equal to the number of bits in the given input sequence. Since the given
sequence 1001 has 4-bits,. four states a, b, c, d are considered. The state diagram is as shown in figure (1).
1/0 1/1
0/0
1/0 0/0 0/0
a b c d
1/0
0/0
Figure (1) : State Diagram
When state a is zero, it remains in same state with zero output, otherwise, it shifts to state b with zero output. When b is
zero, it shifts to state c with zero output, otherwise, it remains in same state with zero output. When c is zero, it shifts to state d
with zero output, otherwise, it returns to state b with zero output. When d is zero, it shifts to state a with zero output, otherwise,
it shifts to state b with one as output.
State Table: The State table of the state diagram for sequence 1001 is shown in table (1).
Next State Output
Present State
x=0 x=1 x=0 x=1
a a b 0 0
b c b 0 0
c d b 0 0
d a b 0 1
Table (1)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 161
Design of Mealy Sequence Detector that Detects the Sequence of 1001: Two D-flip-flops are required for four states.
Assign the states as,
a = 00; b = 01; c = 10; d = 11
Excitation Table: The excitation table of sequence 1001 is shown in table (2).
Present State Input Next State Flipflop Inputs Output
A B X A* B* DA DB Z
0 0 0 0 0 0 0 0
0 0 1 0 1 0 1 0
0 1 0 1 0 1 0 0
0 1 1 0 1 0 1 0
1 0 0 1 1 1 1 0
1 0 1 0 1 0 1 0
1 1 0 0 0 0 0 0
1 1 1 0 1 0 1 1
Table (2): Excitation Table
Then, the simplified Boolean expression for flip-flop inputs can be obtained by using three variable K-map as,
For DA For DB For Z
BX BX BX
A 00 01 11 10 A 00 01 11 10 A 00 01 11 10
1 0
0 0 0 0 0 0 1 1 0 0 0 0 0
1 1 0 0 0 1 1 1 1 0 1 0 0 1 0
DA = AB'X' + A'BX' DB = X' + AB' Z = ABX
The logic diagram for implementation of 1001 sequence detector using D-flip-flops is as shown in figure (2).
X
DA QA A
clock A'
Q 'A
DB QB B
clock B'
Q 'B
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 163
Q69. Explain the analysis of fundamental mode circuits.
Ans: Fundamental mode circuits are classified into two types,
1. Circuits without latches
2. Circuits with latches.
Consider fundamental mode circuit shown in figure (1).
X1
External Next state Q1 Output
inputs logic Q2 logic
X2
(a)
Next state
X1
logic
X2
X2
Q1 Output
Q1
logic
Q2
X1
X1
Q1
Q2
X1
X2 X2
Q1
X1
Q2
Q2
X2
Q2
(b)
Figure (1)
There are no explicit memory elements in this circuit, which consists solely of gates. The next-sate logic circuit has two
feedback pathways from Q1 and Q2. Using this feedback, a sequential circuit can be created by introducing delays. It should be
noticed that feedback in the gate circuit creates a memory elements latch.
v Determine the states and their associated state variables. There are two types of inputs states, the input state and the input
state variables. The input state is made up of the level signals X1, X2 from external sources.
v Memory components combined outputs are known as secondary or internal states and these variables are referred to as
secondary state variables (or simply secondary states).
v Internal variables Q1 and Q2 are sued here because there are no explicit elements. The entire state is made up of the input
and secondary states (Q1, Q2, X1, X2) combined. The value of Y is the variable that is returned as a result of the computation.
v The logic circuit of the next-state logic block is used to determine the equations for the next secondary state
Q1+ = X1 X 2 + X4 X2 Q2 + X2 Q1 Q 2
Q 2+ = X1X2 Q 1 + X1Q2 + X2 Q2
Y = X1 ⊕ Q1 ⊕ Q2
v When X1, X2 input -state variables occur, the circuit transitions to the next secondary state These logic equations are used
to crate the state table displayed in table below.
v The total state Q1, Q2 X1, X2 is stable if the next secondary state is the same as the current state, i.e., Q1+ = Q1 and Q 2+ =
Q2. Otherwise, its prone to instability. A table showing the next total state’s stability is also included.
00 00 01 00 10
01 00 11 01 11
11 00 11 01 11
10 00 10 10 10
Table
v In asynchronous sequential circuits, flow tables are usually preferred to transition table.
v The flow table corresponding to above transition table is shown below.
Input state
Stable state
Present internal X1X2
state Q 1Q 2 00 01 11 10
a a ,0 b, 0 a ,1 d, 1
b a, 1 c, 0 b ,0 c, 0
Output
c a, 0 c ,0 b, 1 c ,1
Unstable state
d q, 1 d ,1 d ,0 d ,0
Table
Q70. Explain the step wise procedure for analyzing an asynchronous sequential circuit with SR latches.
Ans:
Consider an SR latch using NAND gates and NOR gates as shown in figure (1).
R
S Qn
Qn
Qn Qn
R S
SR-Latch using NAND Gates SR Latch using NOR Gates
Figure (1)
The next state equation of equation of figure (1) is given by,
Q+ = S + RQ
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 165
The transition table of SR latch is shown in figure (2). The characteristics equations of latches are given by,
SR Q1+ = S1 + R1Q1 = X2 + X3 + X4 Q1 ... (6)
Q 00 01 11 10
Q 2+ = S2 + R2 Q2
0 0 0 0 1
= Q1X1 + X4 + Q1X3 .Q2
1 = Q 1X1 + X4 ( Q1X3) Q2
1 0 0 1
= Q1X1 + X4 (Q1 + X3) Q2
Figure (2) Q 2+ = Q1X1 + Q1Q2 X4 + Q2 X3 X4 ... (7)
Q+ = S + RQ The transistion table canbe developed using equations
v From the transition table of SR flip-flop, the circuit (5), (6) and (7).
entes the stable state when SR changes from 11 to 00. Since, only one input vairbale is allowed at each time,
v The circuit enters the stable state j if S first. the columns are for each input variable only. The row contains
v The circuit entes the stable state k if R fist changes to 0. a combination of state variables S1, S2, S3 and S4.
Q71. Explain pulse mode circuits in asynchronous The transition table of figure (1) is shown in table (1).
sequential circuits. Input
variables
Ans: Present
Puse Mode Circuits state Q Q X1 X2 X3 X4
1 2
In pulse-mode circuits, an input pulse canbe applied 00 01, 0 10, 0 10, 0 00, 1 Output
/occured only when the circuit is in stable state and the variables
anypulse is not applied at the other input.. When an input pulse 01 01, 0 11, 0 10, 0 00, 0
is transition from one stable state to other state. It allows the
circuit to receivers another input pusle. 11 11, 0 11, 0 11, 0 00, 0 Next state
value
For a pulse-mode asyhchronous circut, the number of
columns in the next-state table is equal to the number of input 10 10, 0 10, 0 10, 0 00, 0
terminals.
Consider a pulse-mode circuit logic diagram illustrated Table (1): Transition Table
in figure (1). The flow table of figure (1) is given in table (2).
Input
X2 S1 variables
X3 Q1 Present
FF1 state Q Q X1 X2 X3 X4
R1 1 2
X4 Q1
S0 S1, 0 S 3, 0 S 3, 0 S0, 1
F
S1 S1, 0 S 2, 0 S 3, 0 S0, 0
X1
Q2
Q1 S2 S2, 0 S 2, 0 S 2, 0 S0, 0
FF2
X4
Q2 S3 S2, 0 S 3, 0 S 3, 0 S0, 0
Q1
X3 Table (2): Flow Table
Q72. Explain the step wise procedure for analyzing
X4 an asynchronous sequential circuit with SR
Y
Q2 latches.
Figure (1) Ans:
The excitation and output equations are, Procedure for Analysis: The various steps involved in the
analysis of asynchronous sequential circuit with SR latch are
S1 = X2 + X3 ... (1)
as follows,
R1 = X4 ... (2) Step (i): In the first step, latch outputs are labelled with Yi and
S2 = X1 Q1 ... (3) the corresponding external feedback paths with yi (where
i = 1, 2 ... k).
R2 = X4 + Q1X3 ... (4)
Step (ii): In the next step, the Boolean functions for Si and Ri
Y = X4 Q2 ... (5) inputs are determined.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 167
x x x
y1y2 0 1 y1y2 0 1 y1y2 0 1
00 00 00 00 00 00 00 00 00
01 11 01 11 01 11
11 10 11 11 11 10
10 10 10 10 10 01
01 01 01 11
11 11 11 11
10 10 10 10
Noncritical Race: A noncritical race occurs when the order in which internal state variables that are changed does not alter the
final stable state.
Example
y y
x1 x2 x1 x2
0 1 0 1
00 00 11 00 00 11
01 11 01 01
11 11 11 01
10 11 10 11
Q75. Describe gated ‘D’ latch as an asynchronous circuit. Model Paper-1, Q6(b)
Ans: The basic requirement of asynchronous sequential circuit is met when the input signals including clock on D latch do
not vaary simultaneously.
The circuit diagram of asynchronous gated D latches shown in figure (1).
D
Y y
Q
C
Figure (1)
Present Next State Output From figure (1), the output of D-flip flops can be
state CD = 00 01 10 11 expressed as,
y Y Y Y Y Q Ym = CD + C ym + ymD ; for Master …(1)
0 0 0 0 1 0 Ys = C ym + C ys + ym ys ; for Slave …(2)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 169
The state diagram for the flow table is shown in figure (2).
CD
11
0X
S1/0 S3/0 11
X0 10
0X 0X
11
0X
10 S2/1 S4/1
10 X1
Figure
∴ Maximal compatibles are (a, c, d), (b, e, f), (a, b).
Step 3: To Obtain Minimal Collection of Compatibles
In this step, the compatible sets are chosen such that they cover all the states and are closed (closed covering condition).
The closure condition is satisfied if there are no implied states or those states are included within the set.
The smaller collection of compatibles which satisfy the above step is,
(a, c, d), (b, e, f )
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 171
The above combination is used for reducing the flow The corresponding flow table of initial state diagram is
table as mentioned in table (2). illustrated in table (1).
Next State
Present Output
state z
DN = 00 01 10 11
A A B C - 0
Table (2): Reduced Flow Table
Here, a, c, d are merged into a single row a and similarly B D B - - 0
b, e, f states to b.
C A - C - 1
Q79. Explain in detail about state reduction in
Asynchronous sequential circuits.
D D E F - 0
Ans: Model Paper-2, Q6(b)
Note: For proper understanding refer vending-machine E A E - - 1
controller
Asynchronous sequential circuits can be easily F A - F - 1
implemented if number of states are reduced. State reduction
is a two-step process and is described as follows, Table (1) : Initial flow Table
1. Partitioning Procedure The reduction of flow table is as follows,
The following steps are required to reduce the state table, Step-1: Grouping the states those are at same position and have
Step-1: Group the states those are at same position having same same outputs for all input conditions.
outputs for all input conditions. P1 = (AD) (B) (CF) (E)
Step-2: Check the next states in each block of partition P1 belong Step-2: Checking the states in each block of P1 belong to same
to same block of P1 or not. If they differ, split the states. block of P1 or not. If they differ, states are splitted.
Step-3: Check the next states in each block of partition P2 belong For DN = 00 input,
to same block of P2 or not. If they differ, split the states. (A, D) has next states (A, D) which belong to same block
Step-4: If the states in partition P3 are equivalent. Then replace of P1. So, they are not splitted.
the state in flow table. For DN = 01 input,
Example: (A, D) has next states (B, E) which belongs to different
blocks of P1. So they are partitioned as,
Consider an initial state diagram of Moore model of
simple vending-machine controller as shown in figure (1). P1 = (A) (D) (B) (CF) (E)
For DN = 10 input,
(A, D) has next states (C, F) which belong to same block
of P1. So they are not partitioned.
∴ P1 = (A) (D) (B) (CF) (E)
Step-3: Checking the states in each block of P2 belongs to P2
or not. If they differ, states are splitted.
For DN = 0 input,
(C, F) has next state (A, A) which belong to same block
of P2. So, they are not splitted.
For DN = 10 input
(C, F) has next states (C, F) which belong to same block
of P2. So, P3 = P2
Step-4: Since, P3 = P2 the states C, F are equivalent i.e., C =
Figure (1) : Initial State Diagram F. Thus, the state F is replaced by state C.
E A E - - 1
A A H B - 0
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 173
Merge diagram represents that Example
(i) Row A and H can be merged. The figure (1) represents the state diagram of an arbiter,
(ii) Row B and F can be merged.
(iii) Rows D and E can be merged.
(iv) Row, C cannot be merged with any state.
The merging of the compatible pairs is (A,H), (B,F,G)
and (D,E) is shown in figure (3).
B C
A D
D A D B D 1 A 1 2 4 - 00
B 1 2 4 3 01
Table (4) : Reduced Flow Table
Q80. Explain the concept of transition diagrams in C 1 2 4 5 10
asynchronous sequential circuits.
Ans: Table (2): Reduced Flow Table
The diagrams which represent all the transitions of a From the flow table (2), it is observed that the label 1
for A, 2 and 3 for B, 4 and 5 for C states indicate the transitions
specific truth table are known as transition diagrams. These are
for respective input valuation. The corresponding transition
responsible providing the perfect state assignments. An easy
diagram for the flow table is shown in figure (2)
way of illustrating these diagrams is discussed below.
C = 10
A state for transition diagram includes all the state
transitions of respective state for every input estimation. while
representing a transition diagram, it is to be noted that the 1, 4 2, 4
hamming distance between the transitions must be ‘1’ irrespective
of their orientation. In flow table, each transition may pass through A = 00 B = 01
or more stable states,for every input estimation. These transitions 1, 2
can be uniquely labelled as 1, 2, ... Figure (2) Transition Diagram
NS, O/P
B = 01 PS
A = 00 X=0 X=1
1, 2, 4
A B, 0 E, 0
Figure (3) Complete Transition Diagram
B E, 0 D, 0
In the flow table (2), there are similar encircled labels
which indicates the alternative paths to the states. From example, C D, 1 A, 0
for r1r2 = 00, all the three states (A,B,C) are indicated with D C, 1 E, 0
label 1 i.e., state A can be reached either from state B or C. The
E B, 0 D, 0
transition from B to A or C to A involves only the change in
one state variable. So,this transition is of no use. Because of Table (1)
the presence of diagonal path, this transition diagram cannot be The given table can be retabulated as shown in table(2).
inserted on two dimensional cube.
X=0 X=1
Since, the transitions from B to C and C to B have PS
NS Output NS Output
alternative paths via A, the path CB can be removed and the
resultant state diagram is as shown in figure (4). A B 0 E 0
C = 10 B E 0 D 0
C D 1 A 0
1, 4, 2 D C 1 E 0
E B 0 D 0
A = 00 B = 01 Table (2)
1, 2, 4
The following steps are required to reduce the state table.
Figure (4) Final Transition Diagram Step 1
Grouping the states that have same output for all input
The corresponding modified flow table is as shown in
conditions.
table (3)
P1= (A, B, E) (C, D)
Step 2
Check the next states in each block of P1 belongs to same
blocks of P1 or not. If they differ, split the states.
For X = 0 Input
v (A, B, E) and (C, D) has next states (B, E, B) and (D,
C) which belongs to same block of P1. So, they are not
Table (3) partitioned.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 175
For X = 1 Input Ans:
v (A, B, E) has next states (E, D, D) which belongs to Given state table is,
different blocks of P1. So, they are spitted as, (A)(B, E)
NS, O/P
v (C, D) has next states (A, E) which belongs to same block PS
of P1. So, they are not partitioned. X=0 X=1
P2 = (A) (B, E) (C, D) a f, 0 b, 0
Step 3
b d, 0 c, 0
Check the next states in each block of P2 belongs to
same block of P2 or not. If they differ, split the states. c f, 0 e, 0
For x = 0 Input d g, 1 a, 0
v (A); (B, E) and (C, D) has next states (B), (E, B) and (D,
C) which belongs to same block of P2. So, they are not e d, 0 c, 0
partitioned. f f, 1 b, 1
For x = 1 Input
g g, 0 h, 1
v (A), (B, E) has next states (E), (D, D) which belongs to
same block of P2. So, they are not partitioned. h g, 1 a, 0
v (C, D) has next states (A, E) which belongs to different Table (1)
blocks of P2. So, they are splitted as,
The given state table can be retabulated as shown in
P3 = (A) (B, E) (C) (D)
table (2),
Hence, the equivalent state is B = E. E is the redundant
state and can be eliminated from the table and also it can be X=0 X=1
replaced by state B. PS
NS, Output NS Output
\ The corresponding reduced machine is as shown in
table (3). a f 0 b 0
NS,O/P b d 0 c 0
PS c f 0 e 0
X=0 X=1
A B, 0 B, 0 d g 1 a 0
B B, 0 D, 0 e d 0 c 0
C D, 1 A, 0 f f 1 b 1
D C, 1 B, 0 g g 0 h 1
Table (3) h g 1 a 0
Q82. Reduce the number of states in the state table, Table (2)
and tabulate the reduced state table and give
proper assignment. The following steps are required to reduce the state table,
Step-1
NS, Z
PS Grouping the states that have same outputs for all input
X=0 X=1 conditions.
A F, 0 B, 0 P1 = ( , b, c, e, g) (d, h) (f)
B D, 0 C, 0 Step-2
C F, 0 E, 0 Check the next states in each block of P1 belong to same
block of 1 or not. If they differ, split the states.
D G, 1 A, 0
For X = 0 Input
E D, 0 C, 0
v (a, b, c, e, g) has next states (f, d, f, d, g) which belongs
F F, 1 B, 1
to different blocks of P1. So, they are splitted as,
G G, 0 H, 0 (a, c) (b, e) (g)
H G, 1 A, 0 v (d, h); (f) has next states (g, g) and (f) which belongs to
Oct./Nov.-19, Set-2, Q7(b) M[7] same block of P1. So, they are not partitioned.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 177
Q84. Discuss the hazards in asynchronous sequential (ii) Static-0 Hazard: Static-0 hazard refers to the output
circuits and the methods to eliminate them. state of a circuit which is supposed to stay at logic ‘0’
Ans: Model Paper-4, Q6(b) level, suddenly switches to logic ‘1’ for a short duration
(glitch) and returns to logic ‘0’ level.
Hazards: The small spike or glitch (sudden and temporary fault
This hazard occurs POS realization i.e., OR-AND or
for a short duration) at the output of asynchronous sequential
NOR-NOR realization.
circuits due to the propagation delay is called hazard. Hazard
causes a temporary false value at the output resulting in v The SR latch using NAND gates can be set or reset by
malfunctioning of circuit. transient 0 signal on either S or R inputs. When S
and R are both 1 at the same time, the state of the circuit
The hazard that occurs in combinational part of an
does not change. Hence, a transient 1 signal does not
asynchronous sequential circuit. are of two types. They are,
effect the circuit. Hence, circuit before NAND latch
1. Static hazards does not need to be free of static-0 hazards, but it must
2. Dynamic hazards avoid static-1 hazards.
1. Static Hazards: A static hazard occurs when a signal v The hazard free asynchronous circuit using 2 level OR-
is supposed to stay in one particular logic but changes AND or NOR-NOR realization for a NAND SR latch
to another logic. is illustrated in figure (3).
There are two types of static hazards. They are,
(i) Static-1 Hazard: Static-1 hazard refers to the output
state of a circuit which is supposed to stay at logic ‘1’
level, suddenly switches to logic ‘0’ for a short duration
(glitch) and returns to logic ‘1’ level.
This hazard occurs in SOP realization i.e., AND-OR or
NAND-NAND realization.
v A transient 1 is signal on either S or R input can trigger
the SR latch using NOR gates to set or reset, respectively.
v A transient 0 signal does not change the state of the circuit
Figure (3)
when S = R = 0. As a result combinational logic circuit
2. Dynamic Hazard: Dynamic hazard occurs when a signal
that goes before the input terminals of an SR latch does
has to change from 1 → 0 or 0 → 1. It involves a short
not need to be free of static-1 hazards, but it needs to be
oscillation before the signal settles down to another level.
free of static-0 hazard. 1 1
1
The hazard-free asynchronous circuits using 2-level
AND-OR or NAND-NAND realization is illustrated in 0 0 0
(a) Static-1 hazard (b) Static-0 hazard (c) Dynamic hazard
figure (2).
Figure (1): Types of Hazards
3. Essential Hazard
v The essential hazards are due to the unequal delays that
exist along the different paths that carry the same signal
to different destinations in the circuit.
v Essential hazard is caused when the delay of the inverter
circuit is more than the delay of the feedback path.
v These errors caused in the signals cannot be corrected
by adding gates (or) implementing the circuitry using
latch as in static hazards.
v These hazards can be corrected only by making some
Figure (2) adjustments in the path delay that cause errors.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-3 (Sequential Logic Design) 179
Q1. Discuss the logic circuit of 74×377 register. Write a VHDL program for the same in structural style.
REPEATED
2
TIMES
Ans: Refer Q7. (Oct./Nov.-19, Set-1, Q6(a) M[7] | Nov.-15, Set-1,Q7(b))
REPEATED
3
TIMES
Ans: Refer Q17. (April/May-19, Set-4, Q6(b) | April/May-13, Set-3, Q7(a) | April-12, Set-2, Q7(b))
Q3. Give a VHDL code for a 4-bit up counter with enable and clear inputs.
REPEATED
2
TIMES
Ans: Refer Q43. (Oct./Nov.-18, Set-3, Q6(b) M[7] | Nov.-15, Set-2, Q7(b)
REPEATED
(i) State diagram 2
TIMES
(ii) State table
(iii) State assignment.
Ans: Refer Q54. (Oct./Nov.-18, Set-1, Q7(b) M[7] | April-18, Set-1, Q7(b) M[7])
Q5. Give the comparison between synchronous sequential and asynchronous sequential circuits.
REPEATED
3
TIMES
Ans: Refer Q67. (April/May-19, Set-1, Q6(a) | May/June-15, Set-4, Q1(e) M[4] | April/May-13, Set-2, Q7(b))
Q7. Give the VHDL programs for different type of shift register.
Ans: Refer Q10. Important Question
Q8. Draw the circuit of a bidirectional shift register with parallel loading using 2 to 4 line decoder and D-flip-
flops.
Ans: Refer Q12. Important Question
Q10. Write a VHDL code for an n-bit left-to-right shift register using ‘FOR’ loop.
Ans: Refer Q15. Important Question
Q11. Write down truth table, VHDL code for the 4 bit register with parallel load. Also draw the circuit and
output waveform.
Ans: Refer Q18. Important Question
Q12. Design a self-correcting 4-bit, 4-state ring counter with a single circulating 0 using IC 74LS194.
Ans: Refer Q21. Important Question
Q13. Write a VHDL program for 16-bit barrel shifter for left circular shift only?
Ans: Refer Q23. Important Question
Q14. Design a 4 bit synchronous binary even counter and write its behavioural mode.
Ans: Refer Q31. Important Question
Q16. Explain the operation of a 4-bit synchronous binary counter with the required diagram and waveforms.
Ans: Refer Q42. Important Question
Q17. What are the capabilities and limitations of finite state machines?
Ans: Refer Q52. Important Question
Q18. Explain the state equivalence and machine equivalence with reference to sequential machines.
Ans: Refer Q56. Important Question
Q19. Draw the logic diagram of Melay model & explore its operation with examples.
Ans: Refer Q58. Important Question
Q20. Draw the logic diagram of Moore model & explore its operation with examples.
Ans: Refer Q59. Important Question
Q21. What are the Moore and Mealy machines? Compare them.
Ans: Refer Q60. Important Question
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 181
UNIT
Combinational MOS
4 Logic Circuits SI
A GROUP
Syllabus
COMBINATIONAL MOS LOGIC CIRCUITS : Introduction, MOS logic circuits with depletion nMOS loads:
two-inputNOR gate, generalized NOR structure with multiple inputs, transient analysis of NOR gate, two-input
NANDgate, generalized NAND structure with multiple inputs, transient analysis of NAND gate, CMOS logic
circuits:CMOS NOR2 gate, CMOS NAND2 gate,complex logic circuits, complex CMOS logic gates, AOI and
OAIgates, Pseudo-nMOS gates, CMOS full-adder circuit,CMOS transmission gates (Pass Gates), complementary
pass-transistor logic.
Learning Objectives
C Realization of two input NOR gate using MOS logic circuits with depletion nMOS loads.
C Generalized NOR structure with multiple inputs, transient analysis of NOR gate.
C Realization of two input NAND gate using MOS logic circuits with depletion nMOS loads.
C Generalized NAND structure with multiple inputs, transient analysis of NAND gate.
C CMOS logic circuits: Realization of two input NOR gate and NAND gate using CMOS Logic.
C Realization of Complex logic circuits using CMOS Logic, complex CMOS logic gates, AOI and OAI gates.
C Different methods to realize Boolean functions such as Pseudo-nMOS gates, CMOS transmission gates (Pass Gates),
complementary pass-transistor logic.
Introduction
Combinational logic circuits, often known as gates, are the fundamental building blocks of all digital systems. These circuits
carry out Boolean operations on multiple input variables and generate the outputs as Boolean functions of the input variables.
In this unit, we will look at the static and dynamic properties of a variety of combinational MOS logic circuits.
The first important category of combinational logic circuits to be introduced in this unit is the nMOS depletion-load gates.
The incorporation of nMOS depletion load circuits in this section is mostly informative, with the goal of drawing attention to
the load idea, which is still commonly employed in many areas of digital circuit design. We will begin by looking at simple
circuit designs such as two-input NAND and NOR gates, and then we will broaden our scope to include more typical situations
of multiple-input circuit topologies. A similar approach will be used to present the CMOS logic circuits in the subsequent
sections. A detailed examination of the design of complicated logic gates, which permits the implementation of complex
Boolean functions involving numerous variables, will be undertaken. CMOS transmission gates and transmission gate logic
circuits will be the last things we talk about in the unit.
4.1 Introduction, MOS Logic Circuits with Deplection NMOS Loads: Two Input NOR Gate, Generalized
NOR Structure with Multiple Inputs, Transient Analysis of NOR Gate
Q1. Draw the general block diagram of a combinational logic circuit and Explain.
Ans:
As illustrated in figure (1), a combinational logic circuit or gate, executing a Boolean function can be described as a multiple-
input/single-output system and is the most common description of this sort of logic circuit. Node voltages, referred to the ground
potential, are used to represent all input variables. In accordance with positive logic practice, a high voltage of VDD can be used
to represent the logic value “1,” and a low voltage of 0 can be used to represent the logic value “0.” The overall parasitic device
capacitances in the circuit, as well as the interconnect capacitance components observed by the output node, are represented by
the capacitance CL of the output node. The dynamic operation of the logic gate is largely reliant on the output load capacitance.
VDD
V1
V2 Combinational
V3 Logic Circuit Vout
Vn Cload
Figure (1) depicts the circuit of two-input NOR gate design using MOS transistors. Figure (2) shows the logic symbol of
the two-input NOR gate as well as the truth table related to it.
VDD
(W/L)Load
Vout
(W/L)A (W/L)B
VA VB
Figure (1): The Circuit of Two-Input NOR Gate using MOS Transistors
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 183
VA VB Vout
A low low high
Z =A+B
B low high low
high low low
high high lower
Figure (2): The Logic Symbol of the Two-Input NOR Gate and the Truth Table
The two enhancement-type nMOS driver transistors connected in parallel carry-out the Boolean NOR function as follows:
1. When either of the input voltage VA or VB is at the logic-high level, the appropriate driver transistor switches on and creates
a conducting channel between the output node and the ground. As a result, the output voltage turns low that is to VOL. This
is illustrated in figure (3). VOL is the minimum output voltage when the output is at logic “0”
2. When both VA and VB are high, two parallel conducting routes are formed between the output node and the ground, yielding
the same outcome that is low (VOL). This is illustrated in figure (3).
3. On the contrary, when both VA and VB are low, both driver transistors stay turned off that is both the driver transistors acts
as open circuit. Consequently, the depletion type nMOS transistor, which is acting as load, raises the voltage at the output
node to logic high that is to VOH. This is illustrated in figure (4). VOH is the maximum output voltage when the output is at
logic “1”.
VDD VDD VDD
Depletion Type
NMOS Load
Figure (3): Equivalent Circuit of Two Input NOR Gate using MOS Transistor for Different values of VA = VB
VDD
VA VB
Low Low
Figure (4): Equivalent Circuit of Two Input NOR Gate using MOS Transistor for Different values of VA = VB = Low
VDD
(W/L)load
Vout
(W/L)A (W/L)B
VA VB
Figure (1): The Circuit Two-Input NOR Gate using MOS Transistors
Calculation of VOH
Figure (1) depicts the circuit of two-input NOR gate design using MOS transistors. The driver transistors are turned off
and do not conducts any drain current when both input voltages VA and VB are less than the appropriate driver threshold voltage.
Under this condition, the load device, which operates in the linear region, also have zero drain current. Then the linear region
current equation for load becomes
kn, load RS V
. S2 VT.load (VOH ) . (VDD – VOH ) – (VDD – VOH ) 2WW = 0
ID,load = ... (1)
2 T X
VOH = VDD is the solu tion obtained for this equation.
Calculation of VOL
The output low voltage VOL must be calculated by considering three different scenarios, i.e., three possible input voltage
combinations, which result in a conducting path from the output node to the ground. The three cases are,
(i) VA = VOH VB = VOL
(ii) VA = VOL VB = VOH
(iii) VA = VOH VB = VOH
The NOR circuit diminishes to a simple nMOS depletion-load inverter during first two cases,i.e.., (i) and (ii), respectively.
When the threshold voltages of the two driver transistors is same (VTO,A = VTO,B = VTO). Then the ratio of driver-to-load of equivalent
inverter can be calculated as,
For case (i), when the driver transistor A is ON, the ratio is
JW N
kdriver. A k' n.driver KK OO
kR = = L L PA ... (2)
kload JK W NO
k' n.load K O
L L Pload
For case (ii), when the driver transistor B is ON, the ratio is
JW N
kdriver.B k' n.driver KK OO
kR = = L L PB ... (3)
kload JK W NO
k' n.load K O
L L Pload
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 185
The output low voltage level VOL in both cases is found by using the following equation,
JK k N
load O
VOL = VOH – VT0 – (VOH – VT0) 2 – KKK O. V (V ) 2 ... (4)
kdriver OO T.load OL
L P
The output low voltage (VOL) values calculated for case (i) and case (ii) will be same, when the (W/ L) ratios of both drivers
transistors are same, i.e., (W/L)A = (W/L)B.
In the third case, in which both driver transistors are turned ON, the saturated load current equals the sum of the two linear-
mode driver currents of the first and second cases.
ID.load = ID.driverA + ID.driverB ... (5)
k 2 k R V k R 2 V
load VT.load (VOL) = driver.A SS2 (VA – VT0) VOL – VOL
2 W
W + driver.B SS2 (VB – VT0) VOL – VOLWW ... (6)
2 2 T X 2 T X
Because, VA = VB = VOH, that is the gate voltages of both driver transistors are the same. This means that we can figure
out an equivalent driver-to-load ratio for the NOR structure. Therefore, the NOR gate with both inputs connected to a logic-high
voltage is substituted by an nMOS depletion-load inverter circuit with a driver-to-load ratio equal to equation (7).
SRSJK W NO JK W NO WVW
kdriver.A + kdriver.B k' n.driver SSK L OA + K L OBWW
kR = = TL J P N L P X ... (7)
kload W
k' n.load KK OO
L L Pload
In this situation, the output voltage level is
2
JK kload NO 2
VOL = VOH – VT0 – _VOH – VT0i – KK O V (V ) ... (8)
K kdriver.A + kdriver.B OO . T.load OL
L P
Q4. Consider the depletion load nMOS NOR2 gate shown in figure with the following parameters: mnCox = 25
mA/V2, VT0.driver = 1.0V, VT0.load = – 3.0 V, g = 0.4 V1/2, and |2fF| = 0.6 V. The transistor dimensions are given
as (W/L)A = 2, (W/L)B = 4, and (W/L)load = 1/3. The power supply voltage is VDD = 5V. Calculate the output
voltage levels for all four valid input voltage combinations.
Ans: Model Paper-2, Q7(b)
Given,
mn Cox = 25 mA/V2
VT0,driver = 1.0V
VT0,load = –3.0 V
g = 0.4 V2
|2fF| = 0.6 V
(W/L) A = 2
(W/L)B = 4
1
(W/L)load =
3
VDD = 5V
We need to find output voltage levels VOH and VOL for all four valid input combinations.
VOH = ? and VOL = ? When any of the input is high
and VOL = ? When both inputs are high.
The expressions for VOH and VOL for different input combinations are as follows.
(i) When both the inputs are low the output is high and it is equal to VDD i.e.,
Vout = VOH = VDD ... (1)
\ VOH = 5V ... (2)
2 K k
J NO 2
VOL = VOH – VT0,driver – _VOH – VT0, driver i – KKK load OOO VT0, load _VOLi ... (3)
kdriverA
L P
2 K k
J NO 2
VOL = VOH – VT0,driver – _VOH – VT0, driver i – KKK load OOO VT0, load _VOLi ... (4)
kdriverB
L P
(iii) When both the inputs are High
To evaluate ‘VOL’ we need to find the values of VT0,driver, kload , kdriver,A & kdriver,B
VT,load , VT0,load
m n Cox –6
KKJ W NOO = 25 × 10 × ]4g = 50 × 10–6
kdriver,B =
L
L PB 2 2
2 K
J kload NO 2
VOL = VOH – VT0,driver – _VOH – VT0, driver i – KKK OV _V i ...(5)
kdriverA + kdriverB OO T0, load OL
L P
VOL, when VA is high is obtained using equation (3) as
JK 4.1 × 10 –6 NO 2
VOL,A = (5 – 1) – (5 – 1) 2 – KK O
–6 O (–3)
L 25 × 10 P
VOL = 4 – 16 – 1.475 = 4 – 14.524
\ VOL,A = 0.189 V
\ VOL,B = 0.011 V
VOL when both the inputs are high is obtained using equation (5) as
JK 4.1 × 10 –6 NO
2
VOL = (5 – 1) = (5 – 1) 2 – KK –6
O
–6 O –3
L 25 × 10 + 50 × 10 P
J 4.1 ON
K
=4– 16 – KK OO 9 = 4 – 16 – 0.492
L 75 P
\ VOL = 0.062 V
Therefore, the output voltage levels for different input combinations is
VOH = 5V, VOL, A = 0.189 V, VOL,B = 0.011 V, VOL = 0.062 V
Q5. Explain the generalized NOR structure with multiple inputs.
Ans:
Figure (1) illustrates the generalized n-input NOR gate that encompasses n-parallel driver transistors. In this circuit the
current ID flowing through the load transistor is the sum of currents supplied by the driver transistors that are turned ON. In other
words, when the gate voltage across the driver transistors input is greater than the threshold voltage VT0, the corresponding driver
transistor will conduct and supplies current to the load.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 187
VDD
Vout
ID
(W/L)load
Vout
Vin (W/L)eq
Vout
(W/L)A (W/L)B
VA VB
Figure (1): The Circuit of Two-Input NOR Gate using MOS Transistors
VDD
Cgd,load
Csb,load
Vout
Cwire
Cgd,A Cdb,A Cgd,B Cdb,B
VA VB
Vout
Cload
VA VB
Figure (3): Single Lumped Capacitance Placed between the Output Terminal and the Ground
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 189
The capacitances shown in figure (2) can be combined into a single lumped capacitance and is placed between the output
terminal and the ground as shown in figure (3). The value of this combined load capacitance, Cload is calculated as
Cload = Cgd.A + Cgd.B + Cgd.load + Cdb.A + Cdb.B + Csb.load + Cwire ... (1)
Equation (1) is valid for both single-input switching and concurrent switching. In other words, even though just one input
is active and all other inputs are low, the load capacitance is always present at the output terminal. It does not matter if only one
input is active and the rest aren’t. The expression for Cload is remains valid. This simple truth must be taken into consideration
when performing analyses with the equivalent inverter circuit of n-input NOR gate. The load capacitance at the output terminal
of the NOR gate equivalent inverter is always greater than the lumped load capacitance of a real inverter which has the same
dimensions. As a result, the NOR gate and the corresponding inverter have virtually identical static (DC) characteristics. However,
the NOR gate’s actual transient response will be slower than the equivalent inverters.
4.2 Two Input NAND Gate, Generalized NAND Structure with Multiple Inputs, Transient Analysis
of NAND Gate
Q7. Draw the two input NAND gate logic circuit with depletion nMOS loads and Explain. Model Paper-3, Q7
Ans: Figure (1) depicts the circuit of two-input NAND gate design using MOS transistors. Figure (2) shows the logic symbol
of the two-input NOR gate as well as the truth table related to it.
VDD
(W/L)Load
Vout
(W/L)A
VA
(W/L)B
VB
Figure (1): The Circuit of Two-Input NAND Gate using MOS Transistors
VA VB Vout
A low low high
Z = A$B
B low high high
high low high
high high low
Figure (2): The Logic Symbol of the Two-Input NAND Gate and the Truth Table
The two enhancement-type nMOS driver transistors connected in series carry-out the Boolean NAND function as follows:
1. When both the input voltage VA and VB is at the logic-high level, than only the series connected driver transistor turn ON
and creates a conducting channel between the output node and the ground. As a result, the output voltage turns low that
is to VOL. This is illustrated in figure (3). VOL is the minimum output voltage when the output is at logic “0”.
2. When either of the input voltage VA or VB is at the logic-low level, the corresponding driver transistor turns OFF and acts
as open circuit. As a result, the depletion type nMOS transistor, which is acting as load, raises the voltage at the output
node to logic high that is to VOH. This is illustrated in figure (4). VOH is the maximum output voltage when the output is at
logic “ 1”
High
Figure (4): Equivalent Circuit of Two-Input NAND Gate for different values of VA and VB
Q8. Explain how to calculate VOH and VOL for Two input NAND gate Logic Circuits with Depletion nMOS
Loads. Also calculate drain current when the output voltage is VOL.
Ans: Model Paper-4, Q7(a)
Calculation of VOH
In the two-input NAND gate logic circuit, when any of the two inputs of the driver transistors is at logic 0 or LOW, the
output is at logic 1 or HIGH. Under this condition, the driver transistors act as open circuits, and no current flows through the
circuit. Further, the load device, which operates in the linear region, also has a zero drain current. Then the linear region current
equation for load becomes
kn,load R V
ID,load = . SS2 VT , load (VOH ) . (VDD – VOH ) – (VDD – VOH ) 2WW = 0 ... (1)
2 T X
VOH = VDD is the solution obtained for this equation.
Calculation of VOL
For two input NAND gates, a deeper analysis is required for the calculation of the logic-low voltage VOL.The output of the
NAND gate is equal to VOL when both of its inputs are at VOH as shown in figure (1). From the figure, it is evident that the three
transistors are connected in series, so the drain current flowing through them is the same.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 191
i.e., ID.load = ID.driverA = ID.driverB ... (1)
kload 2 kdriver.A RS 2 W V
V _V i = S2 _V – V iV – V DS .AW
2 T.load OL 2 T GS.A T.A DS.A X
kdriver.B RS V
= S2 _V – V iV – V DS.BWW
2
... (2)
2 T GS.B T.B DS.B X
VDD
(W/L)load
Vout = VOL
VA = VOH (W/L)A
VB = VOH (W/L)B
Figure (1): NAND Gate with Both of its Inputs Set to the Logic-High State
Since the input to both the driver transistors is VOH, it is apparent that their gate-to-source voltages are nearly equal to VOH.
Therefore, the drain-to-source voltages of both driver transistors can then be calculated using equation (2) as
2
JK k NO 2
VDS,A = VOH – VT0 – _VOH –VT0i – KK load OO . VT, load _VOLi ... (3)
K kdriver.A O
L P
J
2 K kload O
N 2
VDS,B = VOH – VT0 – _VOH –VT0i – KKK OO . V _VOLi ... (4)
k O T , load
L driver.B P
If the two driver transistors are similar, i.e. kdriverA = kdriverB = kdriver. The output voltage VOL is the total of the drain-to-source
voltages for both drivers, thus we get the following result:
JK KJ k ON 2O
N
VOL = 2 KKKVOH – VT0 – (VOH – VT0) 2 – KKK load OOO . VT, load _VOLi OOO ... (5)
k
L L driver P P
Calculation of drain current when the output voltage is VOL
In order to calculate the drain current ID flowing through the two input NAND logic circuit the gate terminals of the
two identical enhancement-type nMOS driver transistors are coupled together. Further, to simplify the analysis it is assumed
that VT,A = VT,B = VT,0. Now, whenever both of the driver transistors are operating in the linear region, the drain currents can be
expressed as follows:
kdriver RS 2 V
ID,A = S2 _VGS, A – VT0i VDS, A – V DS, AWW ... (6)
2 T X
kdriver SR V
ID,B = S2 _V – V iV – V DS, BWW
2
... (7)
2 T GS, B T0 DS, B X
Due to the fact that ID,A = ID,B, this current may alternatively be written as
I D, A + I D, B
ID = ID,A = ID,B = ... (8)
2
From equation (6) and equation (7), equation (8) can be written as
kdriver RS 2 V W
S2 _V – V iV _V – VT0i VDS.B – V DS
2
ID = – V DS, A + 2 GSB , BW ... (9)
4 T GS, A T0 DS, A X
SPECTRUM ALL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS
192 DIGITAL IC DESIGN [JNTU-KAKINADA]
Using VGS,A = VGS,B – VDS,B in equation (9), we get For k = 1, 2, 3….n
kdriver SR V VDD
ID = S2 _V – V i (V + V ) – _VDS, A + VDS, B iWW
4 T GS, B T0 DS, A DS, B X
... (10) (W/L)Load
Now if VGS,B = VGS and VDS,A + VDS,B = VDS, then expression
for drain current is,
Vout
kdriver SR 2V
ID = S2 _V – V i V – VDS WW ... (11)
4 T GS T0 DS X
Vin (W/L)eq
From the final equation we conclude that, two nMOS
transistors linked in series and having the same gate voltage act
as if they were one nMOS transistor with keq = 0.5 kdriver.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 193
Q10. Explain the transient analysis NAND gate using MOS transistors.
Ans: The intrinsic parasitic capacitances associated with the NMOS transistors effects the behavior of two input NAND gate
illustrated in figure (1). Figure (2) illustrates the different parasitic capacitances related to nmos transistors.
VDD
(W/L)Load
Vout
(W/L)A
VA
(W/L)B
VB
Figure (1): The Circuit of Two-Input NAND Gate using MOS Transistors
The capacitances shown in figure (2) can be combined into a single lumped capacitance and is placed between the output
terminal and the ground as shown in figure (3). The input voltage conditions determine the value of the lumped capacitance Cload.
For instance, if we presume the input VA is equal to VOH and the other input VB is switching from VOH to VOL. In this situation, both
the output voltage Vout and the internal node voltage Vx will increase and, the value of load capacitance, Cload is calculated as
Cload = Cgd.load + Cgd.A + Cgd.B + Cgs.A + Cdb.A + Cdb.B + Csb.A + Csb.load + Cwire ... (1)
This estimate is fairly conservative as it includes the internal node capacitances into the lumped output capacitance Cload
completely. In practice, cload includes just a small percentage of the total internal node capacitance. The use of excessively cautious
capacitance values in the design will force the designer to increase transistor size to compensate for the large delays expected.
VDD
Cgd, load
Csb,load
Vout
Cwire
Cgd,A Cdb,A
VA
Cgs,A Csb,A
Cgd,B Cdb,B
VB
(W/L)Load
Vout
Cload
(W/L)A
VA
(W/L)B
VB
Figure (3): Single Lumped Capacitance Placed between the Output Terminal and the Ground
4.3 CMOS Logic Circuits : CMOS NOR Gate, CMOS NAND Gate
Q11. Draw the two input CMOS NOR gate logic circuits and Explain its operation.
Ans: Model Paper-4, Q7(b)
The circuit diagram of a two-input CMOS NOR gate is illustrated in Figure (1). The circuit is composed of two networks:
an nMOS-network and a pMOS-network connected in series with each other. The nMOS-network contains nMOS transistors that
are connected in parallel and the pMOS-network contains pMOS transistors that are connected in series Figure (1). The gates of
one nMOS and one pMOS transistor are activated by applying the input voltages VA and VB.
VDD
VDD
M3
VA
M4 pMOS
VB Network
VB
Vout Vout
VA
M1 M2 pMOS
VA Network
VB
Figure (1): The Circuit Diagram of Two-Input CMOS NOR Gate and its Schematic Diagram
1. When either of the input voltages, or both the input voltages, VA or VB is at the logic-high level, the nMOS-network generates
a conducting channel between the output node and the ground and the pMOS network acts as open circuit. As a result, the
output voltage turns low that is to VOL.
2. When both the input voltages VA and VB are at the logic-low level, the pMOS-network generates a conducting path between
the output node and supply voltage VDD and the nMOS network acts as open circuit. As a result, the output voltage turns
high that is to VOH.
The dual or complementary circuit design enables the output to be attracted either to VDD or to ground via a low-resistance
route for any input data combination. None of input combinations creates a DC current route between VDD and ground. Therefore,
we have a totally complementary method of functioning.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 195
Q12. Explain how to calculate switching threshold for two input NOR gate using CMOS Logic Circuits.
Ans: Model Paper-1, Q8(a)
The switching threshold (Vth) is a critical voltage point for CMOS logic circuits. When it comes to circuit design, the CMOS
gate’s switching threshold voltage, Vth, is a critical design factor to be considered. In order to calculate the switching threshold
for the two- input CMOS NOR gate three assumptions are made
2. The transistor sizes in each block are the same, i.e.., (W/L)n,A = (W/L)n,B and (W/L)p,A = (W/L)p,B
3. To keep things simple, the substrate bias effect for pMOS transistors is not taken into consideration.
As per definition, at the point of switching threshold, the output voltage is equal to the input voltage
Since VGS = Vps, it is apparent that the nMOS transistors that are connected in parallel reach the saturation point. Therefore,
the total combined drain current of the two nMOS transistors is
Equation (2) gives the first expression for the switching threshold Vth, which is written as
ID
Vth = VT,n + ... (3)
kn
Inspection of the p-network of the two input NOR gate reveals that one pMOS transistor (M3) operates in the linear region,
while the other pMOS transistor (M4) is in saturation for Vin = Vout. Therefore, the currents flowing through the transistors M3 &
M4 are
k p SR 2 W V
ID3 = S2 (V – V – | VT, p |) VSD3 – V SD 3W ... (4)
2 T DD th X
kp 2
ID4 = (V – V – | VT, p | – VSD3) ... (5)
2 DD th
Both pMOS transistors carry same drain currents, i.e., ID3 = ID4 = ID. Therefore,
kp R 2 VWW = k p (V – V – | V | – V ) 2
SS2 (VDD – Vth – | VT, p |) VSD3 – V SD3 ... (6)
2T X 2 DD th T, p SD3
From Equation (7), we get the second expression for the switching threshold Vth. Combining Equation (2) with Equation
(7), the switching threshold for the CMOS NOR gate is found to be,
1 kp
VT, n + (V – | VT, p |)
2 kn DD
Vth(NOR) =
1 kp
1+
2 kn
Q13. Draw the two input CMOS NAND gate logic circuits and Explain its operation.
Ans:
The circuit diagram of a two-input CMOS NAND gate is illustrated in Figure (1). The circuit is composed of two networks:
an nMOS-network and a pMOS-network connected in series with each other. The nMOS-network contains nMOS transistors that
are connected in series and the pMOS-network contains pMOS transistors that are connected in parallel Figure (1). The gates of
one nMOS and one pMOS transistor are activated by applying the input voltages VA and VB.
2. When both the input voltages VA and VB are at the logic-high level, the nMOS-network creates a conducting path between the
output node and ground and the pMOS network acts as open circuit. As a result, the output voltage turns LOW that is to VOL.
VDD
VDD
kp kp
VA
pMOS
Network
VB
Vout
Vout
kn
VA
nMOS
Vin kn Network
VB
Figure (1): The Circuit Diagram of Two-Input CMOS NOR Gate and its Schematic Diagram
In order to calculate the switching threshold for the two-input CMOS NAND gate we assume that the device sizes in each
network block are identical, that is, with (W/L)n,A = (W/L)n,B and (W/L)p,A = (W/L)n,B. Upon analysis and assessment the switching
threshold for CMOS NAND gate is found as
kp
VT, n + 2 (V – | VT, p |)
kn DD
Vth (NAND) = … (1)
kp
1+2
kn
From equation (1) it is evident that a switching threshold voltage of VDD/2 (for simultaneous switching) is achieved by
setting VT,n = V|T,p| and kn = 4 kp in the CMOS NAND gate as shown in figure (2).
VDD
2kp
Vin Vout
kn/2
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 197
4.4 Complex Logic Circuits, Complex CMOS Logic Gates, AOI and OAI Gates, Pseud - nMOS Gates,
CMOS Full Adder Circuit
Q14. Draw and explain the layout for CMOS NOR and NAND gates. Model Paper-2, Q8(a)
Ans: A layout prototype of a CMOS NOR gate adopting single layer metal and single-layer polysilicon is depicted in figure (1).
In this arrangement, P-type and n-type diffusion regions for pMOS transistors and nMOS transistors are positioned in parallel,
that is, placed next to each other. This makes it easy to route gate signals through two parallel polysilicon lines that run vertically
in the same direction.
VDD VDD
VA M3
M3 M4 n-well
VB M4
Vout OUT
M1 M2
VA M2 VB M2
GND
VA VB
Figure (1): Layout Prototype of a CMOS NOR Gate
Stick diagram representation of the CMOS NOR gate layout seen in figure (1) is as shown in figure (2). In this figure,
rectangles illustrate the diffusion regions, solid lines illustrate metal connections, circles represent the contacts, and crosshatched
strips represent the polysilicon columns. The stick-diagram is a simplified layout drawing that encompasses useful information
about the relative arrangement of transistors and their interconnections.
VDD
WP
OUT
Wn
GND
A B
Figure (2): Stick Diagram of CMOS NOR Gate
A layout prototype of a CMOS NAND gate is similar to NOR gate, that is, it also employs single layer metal and single-layer
polysilicon and is as illustrated in figure (3). In this arrangement also, P-type and n-type diffusion regions for pMOS transistors
and nMOS transistors are positioned in parallel, that is, placed next to each other. This makes it easy to route gate signals through
two parallel polysilicon lines that run vertically in the same direction.
VDD
VDD
VA M3 M4 n-well
M3 VB M4
Vout OUT
VA M1
M1 M2
VB M2
GND
VA VB
Figure (3): layout Prototype of a CMOS NAND Gate
The fundamental circuit topologies and design ideas defined for simple NOR and NAND gates using nMOS logic circuits
can be easily expanded to complex logic gates to realize arbitrary Boolean functions of multiple input variables. One of the most
appealing aspects of nMOS logic circuits is their capacity to realize complex logic functions with a minimal number of transistors.
As an illustration, observe the Boolean function given below.
Z = A (D + E) + BC ... (1)
The above Boolean function is implemented using nMOS depletion-load logic and is as shown in figure (1). Analysis of
the circuit in figure (1) reveals the information given below.
1. Driver transistors connected in parallel carry-out OR operations.
2. Driver transistors connected in series carry-out AND operations.
3. Inherent nature of MOS circuit performs NOT (inverter) operation.
It is easy to execute Boolean OR & AND operations in a nested circuit structure utilizing the design principles described
here for individual inputs and the corresponding driver transistors. As a consequence, we get a circuit topology that is made of
branches that are coupled in series and parallel, as seen in the figure below.
VDD
(W/L)Load
Vout
A (W/L)A B (W/L)B
D E C
(W/L)D (W/L)E (W/L)C
Figure (1): nMOS Complex Logic Gate Realizing the Boolean Function Z
We can use the equivalent inverter method to analyze and design more complex logic gates. Therefore, the equivalent-
driver (W/L) ratio of the pull-down network consisting of five nMOS transistors (figure.1), when all the input variables are at
logic-high, may be calculated as
JW N 1 1
KK OO = + ... (2)
L
L P equivalent 1 1 1 1
+ +
KJ W ON KJ W ON JK W NO JK W NO KJ W ON
KLO KLO KLO K L O +K L O
L P B L P C L P A L PD L PE
To calculate the equivalent-driver (W/L) ratio of the five nMOS driver transistors (figure.1), when all the input variables
are at logic-low, different cases must be taken into consideration; The design purpose is to set the driver and load transistor sizes
in such a way that the complicated logic gate achieves the desired VOL value even in the worst situation. The following ratios are
produced by this design method for the three worst-case situations.
JK W NO JK W NO JW N
K O = K O = 2 KK OO
L
L PA L PD L L L Pdriver
JK W NO JK W NO JK W NO
K O = K O = 2K O ... (3)
L L PA L L PE L L Pdriver
JK W NO KJ W ON JW N
K O = K O = 2 KK OO
L L PB L L PC L L Pdriver
The transistor sizes determined using the above equations ensure that the logic-low output voltage level will be less than
the set VOL for all other input combinations.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 199
Q16. Explain about Implementation of Complex Boolean functions using CMOS Logic Circuits.
Ans: Model Paper-4, Q8(a)
The fundamental circuit topologies and design ideas defined for simple NOR and NAND gates using CMOS logic circuits
can be easily expanded to complex logic gates to realize arbitrary Boolean functions of multiple input variables. One of the most
appealing aspects of CMOS logic circuits is their capacity to realize complex logic functions with a minimal number of transistors.
As an illustration, observe the Boolean function given below.
Z = A (D + E) + BC ... (1)
The initial step in the implementation of the Boolean function is to design the pull-down network, as seen in Figure (1),
which makes use of the fact that NMOS devices in series perform the AND function and NMOS devices in parallel implement the
OR function, as shown in Figure 1. The subsequent step is to use duality in order to derive the pull-up network in a hierarchical
manner.
Z VDD
A B
A D
E
D E C
B C
The PDN network is divided into smaller networks (i.e., subsets of the PDN) that are referred to as sub-nets. Next, the
sub-nets that are in parallel in PDN after applying duality they will be in series. Similarly, the sub-nets that are in series in PDN
after applying duality they will be in parallel. The resulting pull-up network is as shown in figure (2). The implementation of the
complete Boolean function F using CMOS Logic Circuits is illustrated in figure (3). For every possible input combination, there
always exists a path to either VDD or GND.
VDD
A D
B C
A B
D E C
Figure (3): CMOS Complex Logic Gate Realizing the Boolean Function Z
Ans:
In an initial attempt, the polysilicon gate columns are arranged in an arbitrary order as depicted in the stick-diagram layout
of Figure (1). In this, Polysilicon columns must be separated enough to allow for one diffusion-to diffusion separation and two
metal-to-diffusion contacts in the middle of the polysilicon. For this obviously we need significant amount of additional silicon
surface area.
We wish to reduce the number of diffusion-area breaks in both nMOS and pMOS transistors. This ensures that the spacing
between polysilicon gate columns can be reduced, Which in turn reduces the overall horizontal dimension and, thus, the circuit
layout area, saving us space. The number of diffusion breaks can be reduced by changing the sequencing of the polysilicon
columns.
VDD
D S S D S D
pMOS
D S S D
OUT
D S
D nMOS
D S D S D S S
GND
A E B D C
Figure (1): Stick-Diagram Layout of the Complex CMOS Logic Gate, with an Arbitrary Ordering of the Polysilicon Gate Columns
A straightforward way for determining the best gate ordering is the Euler-path technique: identify an Euler path in both
the pull-down graph structure and in the pull-up graph structure with same ordering of input labels. The Euler path is described
as an unbroken path that crosses every edge (branch) of the graph exactly once. Figure (2) shows how to make a common Euler
path for both of our graphs. Identifying a common Euler path in both graphs for n-net and p-net gives a gate ordering that reduces
the number of diffusion breaks and, hence, minimizes the logic- gate layout area. In both situations, the Euler path begins at (x)
and ends at (y).
From figure (2) it is evident that for both graphs there is a common sequence (E - D -A - B - C), that is, Euler path. This
sequence may be used to organize the polysilicon gate columns, resulting in continuous (uninterrupted) p-type and n-type diffusion
regions. Figure (3) illustrates the stick diagram of the revised layout. The polysilicon column separation Δd in this situation will
permit only for one metal-to-diffusion contact. The benefits of this revised layout include more compressed (smaller) layout area,
simplified routing of signals, and subsequently, less parasitic capacitance.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 201
VDD
S D D S
pMOS
D S D S S D
OUT
D S
nMOS
D S S D S D D S
GND
E D A B C
Q18. Explain about AND-OR-INVERT (AOI) and OR-AND-INVERT (OAI) gates in CMOS logic.
Ans:
While there are no strict restrictions on the structure of the pull-down and associated pull-up networks in a complex CMOS
logic gate, designers identify two essential circuit types as subsets of the overall complex CMOS gate structure. The AND-OR-
INVERT (AOI) and OR-AND-INVERT (OAI) gates are subsets of the overall complex CMOS gate structure.
AOI gates are used to implement the Boolean functions in the form of sum-of-product in a single logic step. This is illustrated
in figure (1). The pull-down network of the AOI gate is composed of parallel branches of nMOS driver transistors that are coupled
in series with one another. It is very simple to find the equivalent p-type pull-up network by employing the dual-graph notion.
VDD
Dual pMOS
pull-up Network
A1 Vout
A2
A3
A1 C1
B1
B2 B1
C1 A2 C2
C2 B2
C3 A3 C3
On the other hand, OAI gates are used to implement the Boolean functions in the form of product-of-sum in a single
logic step. This is illustrated in figure (2). The pull-down network of the OAI gate is composed of series branches of nMOS
driver transistors that are coupled in parallel with one another. It is very simple to find the equivalent p-type pull-up network by
employing the dual-graph notion.
Dual pMOS
pull-up Network
Vout
A1
A2 C1
A3
B1 B1 B2
B2
A1 A2 A3
C1
Due to the high space requirements of complicated CMOS gates, high-density designs are difficult to implement because
each input requires two complementary transistors, one nMOS and one pMOS. One method of decreasing the number of transistors
is to employ a single pMOS transistor as the load device and connect its terminal to ground as illustrated in figure (1). In this
way, using the simplified pull-up configuration, the complex gate can be realized with significantly lesser number of transistors.
Obviously, this structure is very similar to depletion-load nMOS logic gates. Hence, the name “Pseudo-nMOS gate.”
VDD
pMOS Transistor
acting as Load
Vout
C1
B1 B2
A1 A2 A3
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 203
Q20. The simplified layout of a CMOS complex logic circuit is given in figure below. Draw the corresponding
circuit diagram, and find an equivalent CMOS inverter circuit for simultaneous switching of all inputs,
assuming that (W/L)p = 15 for all pMOS transistors and (W/L)n = 10 for all nMOS transistors.
D E A B C Z
VDD
DIFF.
NWELL
P+
POLY
GND MET-1
Figure
Ans:
The circuit diagram is obtained by analyzing the layout and is as shown in figure (1).
VDD
D
C
E
B
A
B C
D E A
1 600
= = = 12
1 1 50
+
30 20
JK W NO
\ K O = 12
L L Pn, eq
Similarly, the equivalent-driver (W/L) ratio of the pull-UP network consisting of five pMOS transistors, when all the input
variables are at logic-LOW, is calculated as
JW N 1
KK OO =
L L Pp, eq 1 1 1 1 1
JK W NO + KJ W ON + KJ W ON + JK W ON + KJ W ON
K O K O K O K O K O
L L PD L L PE L L PA L L PB L L PC
1 15
= =
1 1 1 1 1 5
+ + + +
15 15 15 15 15
JK W NO
\ K O =3
L L Pp, eq
Q21. Explain implementation of full adder using CMOS logic circuits.
Ans: Model Paper-2, Q8(b)
A Full adder is a combinational logic circuit, it encompasses three input variables (A, B, and C) and two outputs (Sum &
Carry). The Boolean functions of the full adder are defined as the sum_out and carry_out and are given as
sum_out = A5B5C
= ABC + A B C + A B C + A C B
carry_out = AB + AC + BC
In figure (1), we can see the implementation of the two functions at the gate level. The crucial thing about this circuit is, rather
than performing the two functions independently, we generate the sum output by using the carry-out signal. This implementation
will, in the end, minimize the complexity of the circuit and, as a result, save chip area. Aside from that, two distinct sub-networks
are identified, each of which has a number of gates (outlined with dotted boxes), that are used for the transistor-level implementation
of the full-adder circuit.
A
B carry_out
C
A
B
C
sum
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 205
Figure (2) illustrates the transistor-level design of the CMOS full-adder circuit in CMOS technology. Also take note that
the circuit is comprised of an overall total of 14 nMOS transistors and 14 pMOS transistors, along with two CMOS inverters that
are employed to generate the outputs.
VDD
A B A B C
C VDD
B carry_out
B
C A A
sum
A
C A
B
B C
A B A B C
A0 B0 A1 B1 A2 B2 A7 A7
Figure (3): Block Diagram of a Carry Ripple Adder Chain consisting of Full Adders
4.5 CMOS Transmission Gates (Pass Gates), Complementary Pass Transistor Logic
Q22. What is CMOS transmission gate? Explain its operation.
Ans: Model Paper-3, Q8(b)
CMOS transmission gate (TG) also known as pass gate is a simple switch circuit, which is used as a basic building block in
the design of new class logic circuits. One nMOS and one pMOS transistor are linked in parallel to form the CMOS transmission
gate, and the gate voltages for the two transistors are adjusted to be complimentary to each other. This is illustrated in figure (1).
So the CMOS Transistor Gate (CMOS TG) functions as a bidirectional switch between the nodes A and B, with the switch being
controlled by signal C.
A logic-high on control signal C (that is, one that is equivalent to VDD ) causes both transistors to TURN ON and create a
current route between the nodes A and B that has low resistance. Contrarily, a logic-low on control signal C causes both transistors
to TURN OFF, and there will be an open circuit between the nodes A and B. This is often referred to as the high-impedance state.
A B A B
C
C
C
C
A B A B
C
C
Figure (1): CMOS Transmission Gate Circuit Diagram and Symbols
Further, the nMOS transistor’s substrate terminal is linked to ground, whereas the pMOS transistor’s substrate terminal is
linked to the VDD supply voltage (see figure).Therefore, based on the bias conditions, it is essential to consider the substrate-bias
impact for both transistors. Figure (1) illustrates three more frequently used symbolic representations of the CMOS transmission
gate.
Q23. Explain the DC analysis of the CMOS transmission gate.
Ans:
In order to perform full DC analysis of the CMOS transmission the bias condition illustrated in figure (1) is taken into
account. A steady logic-high voltage, Vin = VDD, is applied to both the input node (A) and the control signal C. Because the control
signal is also logic-high, both transistors are switched on. Alternatively, the output node (B) might be linked to a capacitor, which
would simulate capacitive loading of the succeeding logic stages driven by the transmission gate. We shall now analyze the CMOS
TG’s input-output current-voltage relationship as a function of the output voltage Vout.
0V
ID ISO,p
Vin= VDD Vout
IDS,n
VDD
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 207
This analysis reveals that, based on the output voltage level, the CMOS transmission gate can be operated in three distinct
regions. This regions are illustrated in figure (2) as a function of Vout. The total current flowing through the transmission gate is
equal to the sum of the nMOS drain current and the pMOS drain current, which is given as
ID = IDS,n + ISD,p ... (3)
Region 1 Region 2 Region 3
Vout
|VT,p| (VDD – VT,n) VDD
0V
Figure (2): Operating Regions of CMOS Transmission Gate
VDD – Vout
Req,n =
IDS, n
VDD – Vout
Req,p = ... (4)
ISD, p
Equation (4) gives the equivalent resistance of each transistor in this configuration. The parallel equivalent of these two
resistances, Req,n and Req,p, will equal the total equivalent resistance of the CMOS TG.
Q24. Explain about the equivalent resistances of the three operating regions of the transmission gate.
Ans:
Region 1 Region 2 Region 3
Vout
|VT,p| (VDD – VT,n) VDD
0V
Figure (1) illustrates the three operating regions of CMOS Transmission gate. The equivalent resistance values for the
three operating regions of the transmission gate are as follows:
Region 1
From figure (1) it evident that in region 1 the output voltage Vout is less than the pMOS transistor threshold voltage
|VT,p |, that is, out < |VT,p|. Further, in this regions both the nMOS and pMOS transistors are in saturation. The equivalent resistance
of both the nMOS and pMOS transistor’s for this region is given as,
2 (VDD – Vout)
Req,n = ... (1)
kn (VDD – Vout – VT, n) 2
2 (VDD – Vout)
Req,p = ...(2)
k p (VDD – | VT, p |) 2
It is evident that the nMOS transistor’s source-to-substrate voltage is equal to the output voltage Vout, while the pMOS
transistor’s source-to-substrate voltage is zero. So, in our equivalent resistance calculations for the nMOS transistor, we must
consider the substrate-bias impact.
Req,p Req,n A
F = A S + BS
Req,n Req,p
S
Vout
0 (VDD – VT,n) VDD
Figure (2): CMOS Transmission Gate Equivalent Resistance Figure (1): A Two-Input Multiplexor Circuit Constructed using Two
Displayed as a Function of the Output Voltage CMOS TGs
Figure (2) illustrates how the total equivalent resistance A two-input multiplexor circuit made up of two CMOS
of the Transmission Gate (TG) continues to remain fairly transmission gates is illustrated in figure (1). The multiplexor’s
constant, that is, its value is almost completely independent of operation is relatively simple and easy to understand: When the
the output voltage, but the individual equivalent resistances of control input S is logic high, the bottom TG conducts, and the
the nMOS and pMOS transistors are substantially dependent output equals the input B. The lower TG will switch off if the
on output voltage (VO). This is a much desired attribute of the control signal is low, and the top TG will link the input A to the
CMOS TG. output node.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 209
Q26. Explain the Implementation of the logic XOR function, using two CMOS TGs and two CMOS inverters.
Ans:
Eight transistors are needed to implement the logic XOR operation, which is as shown in figure (1). As demonstrated in
figure (2), the same logic XOR function may be accomplished utilizing only six transistors.
A
F = AB + AB
A F = AB + AB
B F = AB + A C + ABC
VDD A
B B
A
C
A F
B
C
A
Figure (3): Realization of a Three-Variable Boolean Function Using CMOS TG
A large increase in total area may result from the discontinuous n-well architectures of the pMOS transistors and the
diffusion contacts used in TG logic circuits when each CMOS transmission gate is implemented with a complete nMOS-pMOS
pair in the logic circuit. To decrease the silicon space used by TG circuits, the transmission gates can be configured as distinct
nMOS-pMOS pairs, with all pMOS transistors put in a single n-well, as illustrated in figure (4). However, careful consideration
must be given to the routing area necessary to connect the p-type diffusion zones to the input signals.
VDD F
B B A A
Figure (4): To Save Area all pMOS Transistors are Placed into one n-well
Complementary Pass-transistor Logic is a circuit approach that can drastically decrease the complexities of full-CMOS
pass-gate logic circuits (CPL). The primary concept underlying Complementary Pass-transistor Logic is to perform logic opera-
tions using a completely nMOS pass-transistor network rather than a CMOS TG network. This means that every input signal must
be delivered in complimentary form (figure 1); the circuit also creates complementary outputs that may be used by succeeding
CPL stages. So the CPL circuit is composed mostly of complimentary inputs, a nMOS pass transistor logic network that generates
complementary outputs, and CMOS output inverters that restore the output signals to their original state of operation. Figure (1)
depicts the circuit schematics of a CPL NOR2 and a CPL NAND transistor.
A B B A A B B A
B B
B B
AB AB A+B A+B
Figure (1): Circuit Schematics of Complementary Pass-Transistor Logic NAND and NOR Gates
The removal of pMOS transistors from the pass-gate network minimizes the parasitic capacitances related with every
node in the circuit, resulting in a faster operating speed than a full-CMOS equivalent. However, the enhancement in transient
characteristics results in a greater complexity of the process. So as to eradicate the threshold-voltage drop in CPL circuits, the
threshold voltages of the nMOS transistors in pass-gate networks must be decreased to approximately 0V using threshold-adjustment
implants. Besides, this makes the transistors more vulnerable to subthreshold conduction when they’re in off-mode and overall
noise immunity is decreased. Further, the CPL design style is very flexible. By using the same basic pass-transistor structures, a
wide range` of functions can be accomplished.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-4 (Combinational MOS Logic Circuits) 211
A XOR
6 (CPL)
B 4 10,12
A O
B 6
A
B 6
4 10,12
A O
B 6
Figure (1): Circuit Schematics of Complementary Pass-Transistor Logic Based XOR Gate
When it comes to transistor count, CPL circuits do not usually provide a significant benefit over regular CMOS circuits.
A total of 8 transistors are used in each of the NAND and NOR circuits depicted in figure (1). The CPL implementations of the
XOR and XNOR functions have a similar complexity (i.e., transistor count) as the standard CMOS implementations. The similar
remark can be made about the implementation of complete adders using CPL as well. Figure (2) depicts the schematic diagram of
a CPL-based XOR gate in more precision. Cross-coupled pMOS pull-up transistors are employed in this application to accelerate
the output response. The widths of transistors are specified in λ-units.
Important Questions
Q1. Draw the two input NOR gate logic circuit with depletion nMOS loads and Explain.
Q2. Explain how to calculate VOH and VOL for two input NOR gate Logic Circuits with Depletion nMOS Loads.
Q3. Draw the two input NAND gate logic circuit with depletion nMOS loads and Explain.
Q4. Explain how to calculate VOH and VOL for Two input NAND gate Logic Circuits with Depletion nMOS
Loads. Also calculate drain current when the output voltage is VOL.
Q5. Draw the two input CMOS NOR gate logic circuits and Explain its operation.
Q6. Explain how to calculate switching threshold for two input NOR gate using CMOS Logic Circuits.
Q7. Explain about Implementation of Complex Boolean functions using nMOS Logic Circuits.
Q8. Explain about Implementation of Complex Boolean functions using CMOS Logic Circuits.
Q9. Explain about problem of constructing a minimum-area layout for the complex CMOS logic gate.
Q13. Explain about the equivalent resistances of the three operating regions of the transmission gate.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 213
UNIT
Sequential MOS
5 Logic Circuits SI
A GROUP
Syllabus
SEQUENTIAL MOS LOGIC CIRCUITS
Introduction, behavior bistable elements, SR latch circuit, clocked latch and flip-flop circuits: clocked SR latch,
clocked JK latch, master-slave flip-flop, CMOS D-latch and Edge triggered flip-flop, Schmitt trigger circuit, basic
principles of pass transistor circuits.
Learning Objectives
Introduction
Sequential logic circuit is the one whose output depends on the present input as well as on the previous output. It contains
atleast one memory element to store the binary information. Some of the sequential circuits include flip-flops, registers and
counters.
Flip-flops are the memory elements that store or delay certain bits. They depend on previous input stages to retain the
information. Based on information storage and retrieval, there are several types of flip-flops. Some of them are RS, JK,
master slave JK, D, T-flip-flop. The two output signals of flip flop are complement to each other.
5.1 Introduction
Q1. What is a sequential circuit? Give its classification.
Ans:
Sequential Circuit
v The circuit which combines logic gates using storage elements (as feedback
path) to generate a specific output for a specified combination of inputs is
known as sequential circuit. I/P Combinational
O/P
circuit
v This circuit consists of input variables, logic gates, memory elements and
output variables.
v The output at any given instant of time depends not only depends on current Memory
input, but also on past output. element
v The present state and the inputs applied give the output and the next state
of the circuit. Figure (1): Block Diagram of
Figure (1) represents the block diagram of a sequential circuit. Sequential Circuit
The feedback link between the output and the input causes regenerative behaviour in sequential circuits.A basic memory
function describes how regeneration works under specific circumstances.
Regenerative circuits are classified based on their output states as follows,
v Bistable circuits: They have two stable states.
v Monostable circuits: They have one stable state.
v Astable circuits: They have two quasi-stable states.
5.2 Behaviour of Bistable Elements
Q2. Explain bistability principle. According to the bistability principle, if the inverter
Ans: Model Paper-4, Q10(b) gain in the transient region is greater than 1, then ‘A’ and ‘B’
Static memories with positive feedback forms a bistable becomes the two stable operating points and ‘C’ becomes the
circuit. A bistable circuit consists of two stable states i.e., metastable operating point.
‘0’ or ‘1’. The concept of bistability is described using the fol- The V-I characteristics of cascaded inverters is shown
lowing example.
in figure (3).
Consider that, two inverters are cascaded as shown in
figure (1). A
Vi2 = Vo1
Vo2 = Vi1
Figure (1)
B
The V-I characteristics of each inverter is shown in
figure (2). Vi1 = Vo2
Figure (3)
Vo1
Vi2 = Vo1
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 215
A A
Vi2 = Vo1
Vi2 = Vo1
C C
B B
Vi1 = Vo2 Vi1 = Vo2
d d
(a) (b)
Figure (4): Metastable and Stable Operating Points
A small deviation applied at the first inverter is amplified and fed to the second inverter. The deviation is further amplified
and fed back as an input to the first inverter. This results in the moving of operating point away from ‘C’ towards any of the
operating points A (or) B as shown in figure 4(a). Thus ‘C’ is a meta stable (unstable) state.
Consider that, the inverter is made to operate at points A and B with very small loop gain (<1). Then if large deviation
occurs it reduces its size and vanishes. This phenomenon is shown in transfer characteristic curve as shown in figure 4(b).
Thus, the two cross coupled inverters acts as a bistable circuit with two stable states A, B and one metastable state ‘C’.
This circuit acts as a memory element which stores 1 or 0 based on the positions of operating points A and B.
The stored value can be changed by shifting the circuit from operating point A to B or from B to A. This can be accomplished
by making one of the operating point temporarily unstable providing high gain (>1). As trigger pulse is used to change the state
of an inverter.
Q3. Explain the operation of CMOS bistable element and its transient analysis. Model Paper-1, Q9
Ans:
The CMOS two-inverter bistable element is shown in figure (1)(a). At its unstable operating point, it has maximum loop
gain when all four transistors are saturated. The operating modes of the transistors will drastically vary if the initial operating
condition is not changed. Figure (1)(b) illustrates that the output voltages of the two inverters will finally settle at VOH and VOL .
VDD VDD
VOH
VO1
Vi2
Vo1 Vth
Vo2
Vi1 VOL
VOL t
1
vg1
id2 ig2
2
vg2
Figure (2): Small-signal Input and Output Currents of the Inverters
gm Cg d 2 q1 d 2 q1 JK gm NO2
q = & 2 = KKK OOO q1
Cg 1 gm dt 2 dt C
L gP ... (6)
This equation can also be expressed in a more simplified form by using to, the transit time constant as,
d2 q 1 Cg
21 = 2 q1 with to = ... (7)
dt to gm
The time-domain solution of (7) for q1 with initial conditions q1 (0) = Cg . vg1 (0) is given by,
q1(0) – to q1' (0) – t1 q1(0) – to q1' (0) + t1
q1 (t) = e o+ e o ... (8)
2 2
Replacing the gate charge of both inverters with their output-voltage variables i.e., vg1 = vo2 and vg2 = vo1, we get,
1 1 1 1
vo2 (t) = (vo2 (0) – to v o' 2 (0) e – to + (vo2 (0) – to v o' 2 (0) e + to ... (9)
2 2
1 1 1 1
vo1(t) = (v (0) – to v o' 1(0) e – to + (vo1(0) – to v o' 1(0) e + to ... (10)
2 o1 2
For large values of t, the above equations are approximated as,
1 1
vo1(t) . (v (0) + to v o' 1(0) e + to ... (11)
2 o1
1 1
vo2 (t) . (vo2 (0) + to v o' 2 (0) e + to ... (12)
2
Both output voltages grow exponentially in magnitude over time. Both inverters’ output voltages will diverge from their
starting value of Vth to either VOH or VOL depending on the polarity of the initial minor perturbations dvo1 (0) and dvo1(0). In general,
due of the charge-conservation principle, the polarity of the output-voltage perturbation dv01 must always be the polarity of dvo2.
As a result, the two output voltages diverge in different directions. The operational point (vo1 = Vth, vo2 = Vth) is unstable, as seen
in figure (3). Small-signal models at the appropriate operating points can be used to show that the two operating points (vo1 = VOL,
vo2 = VOH) and (vo1 = VOH, vo2 = VOL) are stable.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 217
vo2
vOH
(unstable)
vth
vOL
vo1
vOL vth vOH
2
t=0
t
T
Figure (4): Propagation of a Transient Signal in the Two-Inverter Loop during Settling
During this time, the time-domain behaviour of the output voltage v01 is approximately given as,
vo1(t) 1
= e + to ...(13)
vo1(0)
When a signal travels the loop n times in a time interval T, it is similar to the same signal propagating down a cascaded
inverter chain of 2n inverters.
The loop gain is equal to the combined voltage gain of two cascaded inverters and is expressed as, ...(14)
t
n + t0
A =e
Equation (14) describes the time-domain behaviour of the diverging process until it reaches stable points.
The logic symbol and logic diagram of an SR latch using NOR gates is as shown in figure (1).
R
Qn
S Qn
CP
R Qn
Qn
S
(a) Logic Symbol (b) SR Latch using NOR Gates
Figure (1)
0 0 Qn Qn hold
1 0 1 0 set
0 1 0 1 reset
1 1 0 0 not
allowed
Table (1) : Truth Table of the NOR-based SR Latch Circuit
CMOS NOR-based SR Latch: Consider the operating modes of the four nMOS transistors, M1, M2, M3, and M4, to better
understand the operation of the CMOS SR latch circuit depicted in figure (2).
VDD VDD
Q
Q
S M1 M2 M3 M4 R
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 219
The NOR-based CMOS SR latch circuit can also be CMOS NAND-based SR Latch
realized using two cross-coupled depletion-load nMOS NOR The realization of CMOS NAND-based SR latch using
gates as shown in figure (3). NAND2 gates is illustrated in figure (2). One of each NAND
VDD VDD gate’s inputs is used to cross-couple to the output of the other
NAND gate, while the other input is employed to permit external
Q Q triggering.
VDD VDD
S M1 M2 M3 M4 R
Q Q
Figure (3): Depletion -nMOS NOR-Based SR Latch
Q5. Explain the operation of an SR latch using NAND
gates. Implement it with CMOS design.
S R
Ans:
The logic symbol and logic diagram of an SR latch using
NAND gates is as shown in figure (1). Figure (2): CMOS SR latch using NAND2 gates
S The NAND-based SR latch can also be realized using
Qn
depletion-load nMOS as shown in figure (3).
S Qn
VDD VDD
CP
R Qn
Qn
R
(a) Logic Symbol (b) Logic Diagram Q Q
Figure (1): Depletion-nMOS NOR-Based SR Latch
Working
S R
The NAND-based SR latch has active low inputs S, R
and two complementary outputs Q and Q .
v If S = R = 0, then the latch outputs are undefined.
Figure (3): Depletion-nMOS NAND based SR latch
This state is called indeterminate state or not allowed
condition. 5.4 Clocked Latch and Flip-Flop Circuits-Clocked
v If S = 0 and R = 1, then the latch enters into set mode. SR Latch, Clocked JK Latch, Master-Slave
The output Qn+1 = 1. Here, the output Q = 1 and Q = 0. Flip-Flop
v If S = 1 and R = 0, then the latch enters into reset mode. Q6. Explain the operation of a clocked NOR based
The output Qn+1 = 0. Here, the output Q = 0 and Q = 1. SR-latch with timing diagram. Implement it with
v If S = R = 1, output does not change i.e., Qn+1 = Qn. Here, CMOS gates.
the latch behaves like a cross-coupled bistable element. Ans:
The truth table of SR latch using NAND gates is shown The gate-level logic circuit of a clocked SR latch using
in table (1). NOR gates is as shown in figure (1).
S
S R Qn + 1 Qn + 1 Operation
Q
0 0 1 1 not allowed
0 1 1 0 set CK
1 0 0 1 reset
1 1 Qn hold Q
Qn R
Table (2) : Truth Table Figure (1): Clocked SR Latch Using NOR Gates
Q
Q
R S
CK CK
CK
Q
R
Figure (1): Latch with Active Low Inputs
The output of clocked SR latch changes its states with respect to the inputs on the occurrence of clock pulse.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 221
Working
v When the clock signal is high, the inputs does not affect the output i.e., remains in no change state.
v When the clock signal is low, the following changes occur based on applied inputs.
Case (i): If S = R = 0, output does not change i.e., Qn+1 = Qn.
Case (ii): If S = 0 and R = 1, then the flip-flop enters into reset mode. The output Qn+1 = 0.
Case (iii): If S = 1 and R = 0, then the flip-flop enters into set mode. The output Qn+1 = 1.
Case (iv): If S = R = 1, then the flip-flop outputs are undefined. This state is called indeterminate state.
The gate-level logic circuit of clocked NAND based SR latch with active high inputs and corresponding block diagram is
as shown in figure (2).
S
Q
CK
Q
R
Figure (2): Clocked NAND Based SR Latch with Active High Inputs
The operation is analogous to above stated except that clock must be HIGH for the circuit to respond to change in inputs.
Q8. What is the advantage of JK latch over SR latch. Explain the operation of clocked JK-latch.
Ans:
Advantage of JK latch over SR latch
The major advantage of using JK latch is that it operates in toggle mode (J = K = 1) which is very much important in
counting applications. Whereas, the RS latch does not operate in toggle mode since, R = S = 1 provides ambiguous output.
Clocked JK-latch
The logic symbol and circuit diagram of clocked NAND-based JK latch with active high inputs is as shown in figure (1).
Its gate-level schematic is illustrated in figure (2).
CP JK
Latch
J S Q
NAND
CK
SR
K R Q
Qn
Qn
Figure (1)
v In the above figure, consider that the initial output for input J = K = 1 is 0 (i.e., Qn = 0).
v When a clock signal of pulse width tp is applied to latch, after a time duration of ∆t output changes to Q = 1.
v This interval of ∆t specifies the propagation delay due to the logic gates. If tp > ∆t, then the output changes again from ‘1’
to ‘0’ after another ∆t as shown in figure (2).
v This process continues till the end of the clock pulse, which results in an uncertain value at the output.
v This situation of changing output values is known as race around condition (i.e., output varies from 0 to 1 and 1 to 0).
v This condition can be over come by using master slave JK latch.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 223
CLK tp
Dt
Qn+1
Figure (2)
Clocked NOR based JK-latch: The gate-level schematic of clocked NOR based JK-latch and its CMOS realization using
AOI gates are as shown in figure (3).
VDD VDD
CK
R
K
Q
CK
Q Q
Q K J
J
S
CK CK
(a) Logic Diagram (b) CMOS NOR Based JK Latch using AOI Gates
Figure (3)
Q10. Explain master-slave JK latch in detail. Model Paper-3, Q9
Ans: A master slave JK latch is a combination of two SR latches, with feedback connection from output to input. The first
latch is referred as master and second latch is referred as slave. In this latch, the master latch operates during positive level of
clock cycle and the slave latch operates during negative level of clock cycle.
The operation of JK latch as toggle switch is as shown in figure (2).
J=1 Q CK
JK
CK
Latch
Q Q
K=1
Figure (1): JK Latch as Toggle Switch
The logic diagram of msaster-slave JK latch using NAND gates is as shown in figure (2).
Qm
J S S Qs
NAND NAND
CK
SR Qm SR
Qs
K R R
CK
Figure (2)
Case (i): When J = K = 0 and CLK = 0 (or) 1, both NAND gates of master flipflop are disabled. So the output of master remains
same at the positive clock. Hence, the output of slave remains same at the negative edge of clock and circuit is inactive. Thus,
no change in output, i.e., Qn = Qn+1.
Case (ii): When J = 0, K = 1 and CLK = 1, the master flip-flop enters into reset state, and produces outputs S = 0, R = 1. These
output are fed to the slave flip-flop. When clock signal goes low, the S and R inputs force the slave flip-flop to reset the output
because, slave flip-flop operates only during low clock signal. Therefore, the outputs are Qn+1 = 0 and Q n+1
= 1.
Case (iii): When J = 1, K = 0 and CLK = 1, the master flip-flop enters into set state and produces outputs S = 1, R = 0. But, the
output Qn+1 remains constant because the slave flip-flop is inactive during the high clock. Thus, when clock signal goes low, slave
flip-flop becomes active and set the outputs to Qn = 1 and Q n + 1 = 0.
Case (iv): When J = K = 1 and CLK = 1, the master slave flip-flop enters into toggle state. Thus, the outputs of master flip-flop
toggle between ‘0’ and ‘1’ till the completion of positive level of clock cycle. As soon as the negative level of clock cycle starts,
slave flip-flop takes the outputs of master flip-flop and produces its corresponding outputs i.e., Qn+1 = 1, Q n + 1 = 0.
The timing diagram of master slave it JK flip flop is as shown in figure (3).
CK 0 1 1 0 0 0 1 0 0 1 1 1 0 0 0 1 1
J 0 0 1 1 0 0 0 0 0 0 1 0 0 0 1 1 1 1
0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0
K
0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0
Qm
Qm
1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1
0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0
Qs
Qs
1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 225
Q11. The voltage waveforms shown in Figure below are applied to the nMOS JK master-slave flip-flop shown
in Figure below. With the flip-flop initially reset, show the resulting waveforms at nodes QM. (master
flip-flop output) and Qs (slave flip-flop output).
CK
K
Figure
Ans:
The output QM remains unchanged when clock input is LOW. When clock is HIGH, the truth table of nMOS JK master-slave
flip-flop is as follows,
S R QS (n+1) QM (n+1)
0 0 0/1 QM (n)
0 1 0 QM (n)
0 1 1 0
1 0 0 1
1 0 1 QM (n)
1 1 0 1
1 1 1 0
Table: Truth Table
The corresponding timing waveform is as shown in figure below.
CK
QM
QS
Figure : Timing Diagram
The clocked NOR-based SR latch circuit can be modified to represent the D-latch at the gate level as shown in figure (1).
The circuit has only one input D, which is connected to the latch’s S input. The input variable D is inverted and connected to the
latch’s R input.
D
Q
D Q
CK D-Latch
CK Q
Q
Q
D Q
CK
CK
CK
Figure (2): CMOS Implementation of D-Latch (Version 1)
The TG in the inverter loop is activated by the active-low clock input (CK).
v When CK =1, the input signal is accepted (latched) into the circuit.
v When CK= 0, the state of the inverter loop is unchanged.
The operation of CMOS D-latch circuit can be understood in figure (3) in which CMOS transmission gates are replaced
by simple switches.
D Q
CK = 1
D Q
CK = 0
Figure (3)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 227
Figure (4) illustrates the timing diagram in valid time intervals for the input and output signals.
VDD
CK CK
Q
D Q
CK CK
CK CK
CK CK
CK
CK
CK CK
Figure: CMOS Negative Edge-Triggered Master-Slave D Flip-Flop
The Master-Slave D flip-flop consists of two gated D latches cascaded together. The first latch is considered as Master
that changes its state when clock = 1. The second latch is called as slave that changes its state when clock = 0.
When clock = 1 or high, the master D-latch tracks the D input signal and Qm follows any changes in D.
The slave does not change and hence Qs remains constant.
When clock = 0 or low, the master D-latch stops following the D input signal. The slave starts responding to Qm and changes
its state accordingly. In this, the slave undergoes only one change of state for a clock cycle.
The circuit diagram of a positive edge triggered D flip-flop using NAND gates is illustrated in figure (1).
v If the input D = 0 when clock pulse is not applied, the flipflop will set and D = 0 is stored by the flipflop on the falling
(positive) edge of the clock pulse and Q = 0.
v If the input D = 1 when clock pulse is applied, the flipflop will set and D = 1 is stored by the flipflop on the falling (positive)
edge of the clock pulse and Q = 0 initially.
R Q
CK Q
0 0 1 1 0 0 1 1 0 0 1 1 0 0
CK
0 1 1 1 1 0 0 1 1 1 1 0 0 0
D
0 1 1 1 1 1 1 1 1 1 1 1 1 1
R
S
1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 1 1 1 1 0 0 0 0 1 1 1 1
Q
Figure (2): Timing Diagram
Initially all signal values except S are 0 i.e., (S, R, CK, D) = (1, 0, 0, 0) and Q = 0. In the second phase, D and R both
become 1, while Q remains at 0. This causes gate 2’s output to switch to 0, which then sets the output of the last stage SR latch
to 1. The output of this D flip-flop is 1 when the clock signal is positive. However, as seen in the ninth phase of the waveform
diagram, the negative edge of clock has no effect on Q output.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 229
Similarly, for high-to-low transition Schmitt trigger
5.6 Schmitt Trigger Circuit acts a CMOS inverter with PMOS inverter M2, as a pull-up
Q15. Illustrate the CMOS implementation of Schmitt network and two parallel transistors (M3 and M1), as a pull down
trigger. network. The effective transistor of this inverter configuration is
6kM3 + kM1@
Ans: Model Paper-4, Q10(a) . This shifts the switching threshold in downward
k M2
The CMOS implementation of a Schmitt trigger is shown direction which is equal to VM–.
in figure. Q16. Briefly explain the Schmitt trigger circuit.
M1 M3
M1
M3 Vout
Vy
M2
Vin Vx Vout
M4 VDD
Vz
M6
M5
Vin
Vth– Vth+
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 231
At Vin = 5.0 V:
(i)
M4 and M5 are on, so that the output voltage is Vx = 0 V. The pMOS transistors M1 and M2 are off, and M3 is in saturation,
thus,
1 JW N
k' KK OO (0 – Vy – VT,3)2 = 0
2 L L P3
Vy = –VT,3 = –[VT0,p – 0.4 ( 0.6 + VDD –Vy – 0.6)]
Vy =1.5 [V]
(ii) At Vin = 4.0 V:
M4 is at the edge of turning on, M2 is off, and M3 is in saturation. The output voltage is still unchanged.
(iii) At Vin = 3.0 V:
M1 is on and in saturation region. M3 is also in saturation, thus,
1 JW N 1 JW N
k' KK OO (Vin – VDD – VT0,p )2 = k' KK OO (0 – Vy – VT,3)2
2 L L P1 2 L L P3
[3 – 5 – (–1)]2 = 3 (0 – Vy – [–1 – 0.4 ( 0.6 + 5 – Vy – 0.6)]) 2
On simplification, we get,
Vin = 2.02 V
The gate-to-source voltage of M2 is obtained as,
VGS,2 = 3.0 – 2.02 = 0.98 > VT0,p = –1
which indicates that M2 is still turned off at this point.
(iv) At Vin = 1.5 V:
If M2 is still off, M1 is in the linear region, and M3 is in the saturation region:
1 JW N
k' KK OO (2(Vin – VDD – VT0,p )(Vy – VDD) – (Vy – VDD)2)
2 L L P1
1 JK W NO
k' K O (0 – Vy – VT0,3 )2
2 L L P3
2(1.5 – 5 + 1)(Vy – 5) – (Vy – 5)2
= 3(– Vy – [–1 – 0.4 ( 0.6 + 5 – Vy – 0.6)]) 2
Solving this quadratic equation yields
Vy = 2.79 V
It can be seen that at this point, the pMOS transistor M2 is already turned on. Hence, the output voltage is being pulled up
to VDD. It can be concluded that the lower logic threshold voltage Vth– is approximately equal to 1.5 V.
Q18. Consider the monostable multivibrator circuit drawn in figure below. Calculate the output pulse width.
VT(dep) = –2V
VT(enh) = 1 V
k' =20 µA/V2
y = 0.
5V
1nF Vout
Figure
Model Paper-1, Q10(b)
M4
Vout
Vin M3
M1
M2
Figure
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 233
Ans:
The nMOS Schmitt trigger VTC curve goes from high to low in the forward direction when the input of M3 is VIL, and
goes from low to high in the reverse direction when the input of M3 is Vin . So, these two points for the given circuit configuration
are to be known.
VIL of M3 and M4 Depletion Load Inverter
When Vin = VIL, M3 in saturation and M4 in linear region,
k k
M3 (Vin – VTo) 2 = M4 (2 (0 – VT, 4) (VDD – Vout) – (VDD – Vout) 2) ...(1)
2 2
dVout
Since, = –1
dVin Vin = VIL
k M4
VIL = VT,0 + [V – VDD – VT, 4] ...(2)
kM3 out
Also,
RS 1 VW
VIL = VT,0 – VT,4 SSS k (1 + k ) WWW
S R R W
T X
Thus,
RS kR WW V
S
Vout = VDD + VT,4 SS1 – W
S 1 + kR WW
T X
Where,
k
kR = M3 = 10
k M4
RS 10 VWW
Vout = 5 + (–2) SSS1– = 4.91 V
1 + 10 WW
T X
RS VW
1
VIL = 1 – (–2) SS WW = 1.19 V
S 10 (1 + 10) W
T X
Vin of M1
Since ID, M1 = ID, M2, both M1 and M2 operates in linear region.
k k
M2 _2 _VGS2 – VT0i VDS2 –VDS22i = M1 _2 _VGS1 – VT0i VDS1–VDS12i
2 2
1 2
^2 ]4.91 – 1g 1.19 –1.19 2h = _2 ]5 –1.19 – 1g (Vin –1.19) – (Vin –1.19) 2i
2 2
Vin2 = 8Vin + 12.04 = 0
V+ = Vin = 2.01V
Vin of Depletion Load Inverter (M3 and M4)
M3 is in linear and M4 operates in saturation regions. Following the same steps in calculating VIL. The two equations to
solve VIH and Vout are,
k R V k R V2
M3 SS2 _VIH – VT0i Vout –Vout2WW = M4 SS0 – VT, 4WW ...(3)
2 T X 2 T X
VIH = VT, 0 + 2Vout ...(4)
2VT, 4 4
VIH = VT, 0 – =1+ = 1.73 V
3k R 30
VT, 4
Vout = – = 0.37 V
3k R
Since VG2 = Vout = 0.37 V < 1V, M2 i off, M1 is also off, thus
V– = VIH = 1.73 V
kM3 RS k Figure (1) depicts the basic building block of nMOS dynamic
2V 2
S2 _ 4 – VT0i VOL – VOL WW = M4 _0 – VT, 4i logic circuit. It has an nMOS pass transistor driving the gate of
2 T X 2
another nMOS transistor. Based on the input signal Vin, the pass
VOL = 0.067 V
transistor MP charges up or charges down the parasitic capacitance
VTC Curve Cx. When the clock signal is active (CK = 1). the capacitor either
charges (logic 1 transfer) or discharges (logic 0 transfer).
The VTC curve is illustrated in figure below.
Vout (V)
5 MP Vx
Vin
Cx
CK
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 235
Using these equations, Vx(t) is obtained as,
JK k (V –V ) NO
KK n DD T, n OO t
K 2C x O
Vx (t) = (VDD –VT, n) L J P ... (4)
KK kn (VDD –VT, n) NOO
1 + KK OO t
2C x
L P
Using equation (4), the time variation of the node voltage Vx is plotted as shown in figure (3). From 0 V to large t,
the voltage increases, but not beyond Vmax = (VDD – VT, n). When Vx = Vmax, the pass transistor’s gate-to-source voltage equals
the threshold voltage. As a result, during a logic “1” transfer, the voltage at node X can never reach VDD.
The substrate bias effect for MP can be used to find the real maximum achievable voltage Vmax at node X as,
Vmax = Vx t " 3 = VDD – VT, n
Vx
Vmax = VDD– VT,n
Vmax
t
0
Figure (3)
Thus, the voltage Vx at node X after a logic “1” transfer can be much lower than VDD. Also, using the zero-bias threshold
voltage VT, 0 will reduce the rising time of the voltage Vx. The real charge-up time will be greater than obtained in equation (3)
because the substrate bias effect reduces the drain current of the nMOS transistor.
Q22. Explain the impact of node voltage Vx during logic 1 transfer in a pass transistor circuit.
Ans:
In a pass transistor circuit, during logic 1 transfer the node voltage Vx has an upper limit of Vmax = (VDD – VT,n) which
impacts the circuit design. For instance, consider the following two cases.
1. Case when a logic “1” at the input node (Vin = VDD) is transferred via a cascaded pass transistor chain as shown in figure (1).
(VDD – VT,n1) (VDD – VT,n2) (VDD – VT,n3)
VDD M1 M2 M3 M4
Vmax4 = VDD – VT,n4
V1 V2 V3
Figure (1)
With VDS1 > VGS1 – VT, n1, M1 functions in saturation. As a result, the voltage at node 1 cannot exceed the limit,
Vmax1 = VDD – VT, n1. The second pass transistor M2 functions at the saturation boundary, assuming the pass transistors in
this circuit are similar. Then Vmax2 = VDD – VT, n1 will be the voltage at node 2. The node voltage becomes one threshold
voltage lower than VDD independent of the number of pass transistors in the chain. Also, regardless of the initial voltages,
the steady-state internal node voltages are always one threshold value below VDD .
2. Case when each pass transistor’s output drives the gate of another pass transistor, as shown in figure (2).
M3
VDD +Vmax3 = VDD – VT,n1– VT,n2– VT,n3
M2
VDD +Vmax2 = VDD – VT,n1– VT,n2
VDD M1
+Vmax1 = VDD – VT,n
VDD
Figure (2)
SPECTRUM ALL-IN-ONE JOURNAL FOR ENGINEERING STUDENTS
236 DIGITAL IC DESIGN [JNTU-KAKINADA]
The output of the first pass transistor M1 can approach the limit Vmax1 = VDD – VT, n1 in this case. This voltage is used to drive
the second pass transistor’s gate, which operates in the saturation area. Its gate-to-source voltage cannot exceed VT, n2 therefore
Vmax2 = VDD – VT, n1 – VT, n2 is the upper limit for V2. In this case, a significant voltage drop occurs at every stage.
The voltage drop at each stage can be estimated by considering their respective equivalent substrate bias effect as,
VT, n1 = VT0, n – g ` 2f F + Vmax1 – | 2f F |j ... (1)
Ans: The equivalent circuit for the logic “0” transfer event of a pass transistor circuit is as shown in figure (1). The depletion
load nMOS inverter has no effect on this event.
MP Vx
Vin = 0
ID
Cx
CK
Figure (1)
Assume that the soft node voltage Vx initially equals a logic “1” level, i.e. Vx (t = 0) = Vmax = (VDD – VT, n). The input terminal
is given a logic “0” level (Vin = 0V). At t = 0, the pass transistor’s clock signal moves from 0 to VDD. When the clock signal is
active, thhe drain current flows in opposite direction as when the pass transistor is charged up (logic “1” transfer). That is, the
intermediate node X now corresponds to the MP drain terminal, and the input node to its source terminal. Taking VDS = Vmax and
VGS = VDD, the pass transistor functions in the linear region throughout this cycle since VDS < VGS – VT, n.
The linear pass transistor MP discharges the parasitic capacitor Cx, as,
dV k
–Cx x = n `2 (VDD – VT, n) Vx – V x2j ... (1)
dt 2
2Cx dVx
dt = . ... (2)
kn 2 (VDD – VT, n) Vx – V x2
The nMOS pass transistor’s source voltage if 0 V during this event, hence there is no substrate bias impact for MP
(VT, n =VT0, n). Integrating equation (2) on both sides, we get
JK 1 1 NO
t 2Cx Vx KK O
# dt = – # KK 2 (VDD – VT, n) 2 (VDD – VT, n) OO dV ... (3)
0 kn VDD – VT, n K + OO x
K 2 (VDD – VT, n) – Vx Vx O
L P
RS J 2 (V – V ) – V NVW Vx
Cx SS KK DD T, n xOOOWW
t= ln K ... (4)
kn (VDD – VT, n) SS K Vx OWW
T L PX VDD – VT, n
The fall-time expression for the node voltage Vx can be obtained as,
Cx JK 2 (V – V ) – V NO
DD T, n xO
t= ln KKK OO ... (5)
kn (VDD – VT, n) Vx
L P
Figure (2) shows the fluctuation of the node voltage Vx as a function of time. The voltage lowers from Vmax to 0 V. Unlike
during charge-up, the applied input voltage level (logic 0) can be passed to the soft node unchanged.
Vx
Vmax = VDD– VT,n
Vmax
0 t
Figure (2)
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 237
The fall time of the soft-node voltage Vx is the difference between t10% and t90% which are times at 0.9 Vmax and 0.1 Vmax
respectively, i.e.,
tfall = t10% – t90% ... (6)
The times t10% and t90% are determined from equation (5) as,
Cx JK (2 – 0.9) (V – V ) NO
ln KK
DD T, n O
t90% = O
kn (VDD – VT, n) K 0.9 (VDD – VT, n) O
L P
Cx JK 1.1 NO
t90% = ln K O ... (7)
kn (VDD – VT, n) KL 0.9 OP
Cx J 1.9 N
t10% = ln KKK OOO ... (8)
kn (VDD – VT, n) L 0.1 P
Substituting equations (7) and (8) in equation (6), we get,
Cx
tfall = [ln (19) – ln (1.22)]
kn (VDD – VT, n)
Cx
tfall = 2.74 ... (9)
kn (VDD – VT, n)
Q24. Explain charge storage charge leakage at the soft node X during the inactive clock cycle in an nMOS
pass transistor.
Ans: Model Paper-3, Q10
In an nMOS pass transistor, when clock is LOW, the correct logic level at the soft can be preserved by maintaining sufficient
charge in capacitor Cx despite the leakage currents. Consider the situation during the inactive clock phase as shown in figure (1).
MP Vx
Vin= 0
Ileakage Igate = 0
Cx
CK
Figure (1)
Assume that during the active clock phase, a logic-high voltage level has been passed to the soft node. Now, both Vin and
CLK = 0. The leakage currents connected with the pass transistor will gradually drain the stored charge in C. For the most part,
the gate current of the inverter driver transistor is insignificant.
An nMOS pass transistor with lumped node capacitance Cx is shown in simplified cross-section in figure (2).
VCK = low
Ileakage
Vin = low Vx
Cx
n+ n+
Isubthreshold
p-type Si
Ireverse
Figure (2)
MPass
M1
Vx
CK
Soft Node
3 6 5 6
1 2
4 5 M1 2
Mpass
2 1
1
4
3
CK Diffusion Metal Polysilicon
Figure
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.
UNIT-5 (Sequential MOS Logic Circuits) 239
All dimensions are given in micrometers. The Then, the minimum value of the drain junction
critical material parameters to be used in this capacitance is calculated as,
problem are listed below. Cbottom Csidewall
Cdb,min = +
V V
VT0 = 0.8 V 1 + x.max 1 + x.max
f0 f0sw
g = 0.4 V1/2
4.56 f F 6.0 f F
= + = 4.71 f F
| 2fF | = 0.6 V 3.68 3.68
1+ 1+
0.88 0.95
Cox = 0.065 f F/mm2
C'metal = 0.036 f F/mm2 The minimum value of the total soft-node capacitance
is expressed as,
C'poly = 0.55 f F/mm2
Cx,min = Cgb + Cmetal + Cpoly + Cdb,min
Cj0 = 0.096 f F/mm2
= 0.52 f F + 0.90 f F + 2.42 f F + 4.71 f F
Cj0sw = 0.2 f F/mm
Calculate the work-case holding time. = 8.55 f F
Ans: The amount of the critical charge drop in the soft node,
which will eventually cause a change of logic state, is
The oxide-related (constant) parasitic capacitance
KJ V ON
components ashciated with the soft node are given by, DQcritical = Cx.min $ KKVx, max – DD OO
L 2 P
Cgb = Cox⋅W ⋅ Lmask = 8.55 f F $ (3.68 V – 2.5 V)
= 0.065 f F/mm2 ⋅ (4 mm × 2 mm) = 10.09 f C
= 0.52 f F Assuming that the logic threshold voltage of the next
Cmetal = 0.036 f F/mm ⋅ (5 mm × 5 mm)
2
gate is (VDD/2). The maximum leakage current responsible for
= 0.90 f F charge depletion is given from the MOS characteristics and the
junction diode characteristics as,
Cpoly = 0.055 f F/mm2 ⋅ (36 mm2 × 8 mm2)
Ileakage = Isubthreshold + Ireverse = 0.85 pA
= 2.42 f F
The worst-case (minimum) hold time for the soft node
Next determine the parasitic junction capacitance
using the expression,
associated with the drain-substrate pn-junction of the pass
transistor. Using the zero-bias unit capacitance values given DQcritical 10.09 f C
thold, min = =
here, we get, Ileakage.max 0.85 pA
Vmax = 3.68 V
Important Questions
Q2. Explain the operation of CMOS bistable element and its transient analysis.
Q3. Explain the operation of an SR latch using NOR gates. Implement it with CMOS design.
Q4. What is the advantage of JK latch over SR latch. Explain the operation of clocked JK-latch.
Q6. Explain the working of an edge-triggered CMOS master-slave D flip-flop with neat diagram.
Q10. Explain charge storage charge leakage at the soft node X during the inactive clock cycle in an nMOS
pass transistor.
WARNING: Xerox/Photocopying of this book is a CRIMINAL act. Anyone found guilty is LIABLE to face LEGAL proceedings.