Ahmet Bindal

Electronics for Embedded Systems

Ahmet Bindal

Computer Engineering Department, San Jose State University, San Jose, California, USA

ISBN 978-3-319-39437-4e-ISBN 978-3-319-39439-8

DOI 10.1007/978-3-319-39439-8

Library of Congress Control Number: 2016960287

© Springer International Publishing Switzerland 2017

This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.

The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.

The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, express or implied, with respect to the material contained herein or for any errors or omissions that may have been made.

Printed on acid-free paper

This Springer imprint is published by Springer Nature

The registered company is Springer International Publishing AG

The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland

For my loving wife, Yen Fen…

Preface

This book is written for young professionals, undergraduate and graduate students who have a background in basic circuit theory and want to learn about the circuits used in printed circuit boards and embedded systems. My teaching method in this textbook caters towards a lot of schematics, block diagrams and examples at the expense of text because I believe in engineers are “shape-oriented” people and learn from figures, charts and diagrams.

The book has nine chapters. Chapter 1 analyzes the first-order passive RC and RL circuits and the second-order passive RLC circuits encountered in all Printed Circuit Boards (PCB). The general understanding of passive circuits also establishes a vital background for more complex circuits that contain active elements such as diodes and transistors.

Chapter 2 reviews rectifier diodes, light emitting diodes, Zener diodes and explains simple circuits incorporating them. This chapter is also a review chapter for bipolar transistors, specifically NPN transistors, and discusses the circuit behavior and the conditions that lead to the NPN bipolar transistor in cut-off, active and saturation regions.

Chapter 3 explains the N-channel and the P-channel MOS transistors, their current-voltage characteristics and CMOS gates, and then discusses the proper circuit design techniques that lead to transistor sizing in CMOS to meet design requirements prior to simulation.

Chapter 4 starts with Transistor-Transistor-Logic (TTL), explains the circuit operation of a TTL inverter, its logic levels and fan-out limit. However, the emphasis of this chapter is more about the CMOS-TTL interface and the various circuits used at the interface for successful logic translation.

Sensors and preliminary sensor physics are given in Chapter 5 . The most common sensors such as thermocouple, photo-diode and photo-detector, Hall-effect device and piezoelectric sensors are discussed in this chapter.

Chapter 6 examines the operational amplifiers and low-frequency operation amplifier circuits used for sensor output amplification. Voltage and trans-resistance amplifiers, analog comparators, Schmitt triggers, square waveform generators are included in this chapter.

Chapter 7 reviews the theory behind data converters such as analog-to-digital converters (ADC) and digital-to-analog converters (DAC). Many different types of ADC designs, such as flash, ramp and successive approximation are explained in this chapter with numerical examples. The weighted adder-type and ladder-type DAC designs are also shown in this chapter.

Chapter 8 combines most of the sensors studied in Chapter 6 and the operational amplifier circuits in Chapter 7 to explain the electromechanical control circuits. The usage of relay switch, opto-isolator, Hall-effect device, pulse-width-modulation (PWM) circuits to operate electromechanical devices, such as DC motors, are also discussed. In the last part of this chapter, several full-scale electronics projects are presented. In each project, the characteristics of sensors used in the project are discussed, and the signal conditioning stage is designed to prepare the unit for analog-to-digital conversion. In the last stage of the design, an ADC is selected to interface with the microcontroller, integrating the design with the rest of the system.

In order to provide a reference material for all the past eight chapters, a brief review of combinational and sequential logic design principles is presented in Chapter 9 . A complete design does not only contain a sensor, a signal conditioning circuit and a data converter. Combinational and sequential logic blocks, in the form of “glue logic”, support various parts of the analog data-path, and therefore they constitute the major part of a design. Some of the analog front-end projects presented at the end of Chapter 8 prove that both analog and digital components must be integrated in a design in order to achieve complete functionality. Therefore, a solid understanding in digital logic design becomes a requirement to be able to build the entire analog front-end electronics for a sensor array prior to interfacing with a microcontroller.

Dr.Ahmet Bindal

Contents

1 Fundamentals of Passive Circuit Analysis 1

1.​1 Laplace Transform 1

1.​2 Definitions of Passive Elements 1

1.​3 Time-Domain Analysis of First Order Passive Circuits 3

1.​3.​1 RC Circuits 3

1.​3.​2 RL Circuits 6

1.​4 First Order Passive Circuit Analysis Using Natural Frequencies 12

1.​5 Time-Domain Analysis of Second Order Passive Circuits 14

1.​6 Transfer Function and Circuit Stability 19

2 Diode and Bipolar Transistor Circuits 33

2.​1 A Brief Review of Semiconductors 33

2.​2 PN Junction 36

2.​3 Rectifying Diode Circuits 38

2.​4 Zener Diode Circuits 42

2.​5 Light Emitting Diode (LED) 42

2.​6 Bipolar Transistors 43

2.​7 Bipolar Transistor Circuits 45

3 MOS Transistors and CMOS Circuits 57

3.​1 N-Channel MOSFET (NMOSFET) 57

3.​2 P-Channel MOSFET (PMOSFET) 59

3.​3 Complementary MOS (CMOS) Inverter 62

3.​4 Two-Input CMOS NAND Logic Gate 63

3.​5 Two-Input CMOS NOR Logic Gate 65

3.​6 Complex CMOS Logic Gate Implementation 66

3.​7 Rise and Fall Times 72

3.​8 Rise and Fall Delays 73

4 TTL Logic and CMOS-TTL Interface 89

4.​1 TTL Inverter 89

4.​2 TTL Inverter with Open Collector 93

4.​3 Two-Input TTL Nand Logic Gate 97

4.​4 Two-Input TTL NOR Logic Gate 99

4.​5 Input Current and Voltage Measurements of a Logic Gate 102

4.​6 Output Current and Voltage Measurements of a Logic Gate 103

4.​7 TTL-CMOS Interface with a Pull-up Resistor 104

4.​8 TTL-CMOS Interface with a Bipolar Transistor 108

4.​9 CMOS-TTL Interface with a Pull-Down Resistor 115

4.​10 CMOS-TTL Interface with a Bipolar Transistor 118

5 Physics of Sensors 123

5.​1 Thermocouple 123

5.​2 Photodiode 125

5.​3 Solar Cell 127

5.​4 Photo-resistor 129

5.​5 Piezoelectric Materials and Accelerometers 129

5.​6 Hall-Effect Devices 132

6 Operational Amplifiers and Circuits 135

6.​1 Operational Amplifier Properties 135

6.​2 Voltage Amplifier Circuits for Sensors 135

6.​3 Trans-resistance Amplifier Circuits for Sensors 144

6.​4 Analog Voltage Comparator 146

6.​5 Schmitt Trigger 147

6.​6 Square Waveform Generator 150

7 Data Converters 157

7.​1 Analog-to-Digital Converter Principles 157

7.​2 Sample and Hold Principle 160

7.​3 Flash Type Analog-to-Digital Converter 160

7.​4 Ramp Type Analog-to-Digital Converter 162

7.​5 Successive Approximation Type Analog-to-Digital Converter 165

7.​6 Weighted Sum Type Digital-to-Analog Converter 169

7.​7 Ladder Type Digital-to-Analog Converter 170

8 Front-End Electronics for Embedded Systems 175

8.​1 Electromechanica​l Device Control 175

8.​2 Pulse Width Modulation Circuits 178

8.​3 DC Motor Control 181

8.​4 Servo Control 181

8.​5 Hall-Effect Sensor Control 182

8.​6 Design Project 1:​ Designing Front-End Electronics for an Analog Microphone 183

8.​7 Design Project 2:​ Designing Front-End Electronics for a Temperature Measurement System 185

8.​8 Project 3:​ Designing Front-End Electronics for a Light Level Measurement System 189

8.​9 Project 4:​ Designing Photo Detector Circuits 191

8.​10 Project 5:​ Designing Front-End Electronics for an Optoelectronic Tachometer 194

8.​11 Project 6:​ Designing Front-End Electronics for a Hall-Effect-Based Tachometer 196

9 Review of Combinational and Sequential Logic Circuits and Design 201

9.​1 Logic Gates 202

9.​2 Boolean Algebra 208

9.​3 Designing Combinational Circuits Using Truth Tables 211

9.​4 Combinational Logic Minimization—Karnaugh Maps 214

9.​5 Basic Logic Blocks 220

9.​6 Adders 229

9.​7 Subtractors 240

9.​8 Shifters 241

9.​9 Multipliers 244

9.​10 D Latch 247

9.​11 Timing Methodology Using D Latches 249

9.​12 D Flip-Flop 250

9.​13 Timing Methodology Using D Flip-Flops 252

9.​14 Timing Violations 254

9.​15 Register 259

9.​16 Shift Register 261

9.​17 Counter 262

9.​18 Moore-Type State Machine 263

9.​19 Mealy-Type State Machine 268

9.​20 Controller Design:​ Moore-Type State Machine Versus Counter-Decoder Scheme 272

9.​21 A Simple Memory Block 276

9.​22 A Design Example 279

Index295

About the Author

Ahmet Bindal

received his M.S. and Ph.D. degrees in Electrical Engineering from the University of California, Los Angeles CA. His doctoral research was on the material characterization for HEMT GaAs transistors. During his graduate studies, he was a research associate and a technical consultant for Hughes Aircraft Co. In 1988, he joined the technical staff of IBM Research and Development Center in Fishkill, NY, where he worked as a device design and characterization engineer. He developed asymmetrical MOS transistors and ultra thin Silicon-On-Insulator (SOI) technologies for IBM. In 1993, he transferred to IBM at Rochester, MN, as a senior circuit design engineer to work on the floating-point unit for the AS-400 mainframe processor. He continued his circuit design career at Intel Corporation in Santa Clara, CA, where he designed 16-bit packed multipliers and adders for the MMX unit for Pentium II processors. In 1996, he joined Philips Semiconductors in Sunnyvale, CA, where he was involved in the designs of instruction/data caches and various SRAM modules for the Trimedia processor. His involvement with VLSI architecture also started in Philips Semiconductors and led to the design of the Video-Out unit for the same processor. In 1998, he joined Cadence Design Systems as a VLSI architect and directed a team of engineers to design self-timed asynchronous processors. After approximately 20 years of industry work, he joined the Computer Engineering faculty at San Jose State University in 2002. His current research interests range from nano-scale electron devices to robotics. Dr. Bindal has over 30 scientific journal and conference publications and 10 invention disclosures with IBM. He currently holds three U.S. patents with IBM and one with Intel Corporation.

© Springer International Publishing Switzerland 2017

Ahmet BindalElectronics for Embedded Systems10.1007/978-3-319-39439-8_1

1. Fundamentals of Passive Circuit Analysis

Ahmet Bindal1  

(1)

Computer Engineering Department, San Jose State University, San Jose, California, USA

Ahmet Bindal

Email: ahmet.bindal@sjsu.edu

1.1 Laplace Transform

Laplace transform “transforms” a function, f(t), in time-domain to a function, F(s), in frequency domain . We will use Laplace transform to determine the impedance of a passive element in this section.

It is defined as:

(1.1)

1.2 Definitions of Passive Elements

Current-voltage relationship across a resistor , R, is defined as shown in Fig. 1.1.

Fig. 1.1

Current-voltage relationship across a resistor, R

This relationship is called Ohm’s law and mathematically expressed as follows:

(1.2)

Taking Laplace transform of both sides of Eq. 1.2 yields:

Thus, the impedance of the resistor becomes:

(1.3)

Current-voltage relationship across a capacitor , C, is defined as shown in Fig. 1.2.

Fig. 1.2

Current-voltage relationship across a capacitor , C

This relationship originates from the Coulomb’s law and mathematically expressed as follows:

(1.4)

Taking Laplace transform of both sides of Eq. 1.4 yields:

where VC(0) is assumed 0 V.

Thus, the impedance of the capacitor becomes:

(1.5)

Current-voltage relationship across an inductor , L, is defined as shown in Fig. 1.3.

Fig. 1.3

Current-voltage relationship across an inductor , L

This relationship is mathematically expressed as follows:

(1.6)

Taking Laplace transform of both sides of Eq. 1.6 yields:

where IL(0) is assumed 0 A.

Thus, the impedance of the capacitor becomes:

(1.7)

1.3 Time-Domain Analysis of First Order Passive Circuits

1.3.1 RC Circuits

In this section, we will examine the circuit behavior of simple RC circuits. A circuit composed of a series combination of a resistor and a capacitor is shown in Fig. 1.4. The switch is assumed to close at t = 0.

Fig. 1.4

A simple RC circuit where the switch closes at t = 0

Applying Kirchoff’s voltage law to the circuit yields:

(1.8)

But,

(1.9)

In order to use Eq. 1.9 in Eq. 1.8, we need to differentiate both sides of Eq. 1.8.

(1.10)

Substituting Eq. 1.9 into Eq. 1.10 yields:

(1.11)

(1.12)

In Eq. 1.11, the right side is equal to zero because V is a constant voltage and its derivative becomes zero.

We know I(t) is composed of a general and a particular solution for this first-order constant coefficient differential equation . Thus,

But, IPART(t) = 0 since the right hand side of the differential equation in Eq. 1.12 is zero .

IGEN(t), on the other hand, is expressed as follows:

(1.13)

Thus,

(1.14)

To find s, we need to take the Laplace transform of both sides of the differential equation in Eq. 1.12.

Thus,

(1.15)

Since I(s) ≠ 0, then Eq. 1.15 reveals $$ \text{s} + \frac{\text{1}}{{\text{RC}}} = \text{0} $$ (characteristic equation).

Therefore, $$ \text{s} = - \frac{\text{1}}{{\text{RC}}} $$, and I(t) becomes:

(1.16)

To find A, we need to use the initial voltage across the capacitor . In this case, we assume VOUT(0) = 0.

But, at t = 0, we have:

(1.17)

Thus,

and

(1.18)

The current in Eq. 1.18 is plotted as a function of time in Fig. 1.5.

Fig. 1.5

The current waveform of the RC circuit in Fig. 1.4 as a function of time

Substituting I(t) in Eq. 1.18 into Eq. 1.8 yields:

(1.19)

The voltage in Eq. 1.19 is plotted as a function of time in Fig. 1.6.

Fig. 1.6

The voltage waveform of the RC circuit in Fig. 1.4 as a function of time

1.3.2 RL Circuits

In this section, we will examine the circuit behavior of simple RL circuits. A circuit composed of a series combination of a resistor and an inductor is shown in Fig. 1.7. The switch is assumed to close at t = 0.

Fig. 1.7

A simple RL circuit where the switch closes at t = 0

Applying Kirchoff’s voltage law to the circuit yields:

(1.20)

But, the current-voltage relationship across the inductor is

(1.21)

Substituting Eq. 1.21 into Eq. 1.20 yields:

(1.22)

Rearranging the terms in Eq. 1.22 produces:

(1.23)

Eq. 1.23 is a constant coefficient linear differential equation. Therefore, I(t) in this equation is composed of general and particular solutions , IGEN(t) and IPART(t), respectively. Thus,

(1.24)

IPART(t) = K since the right hand side of the differential equation in Eq. 1.23 is a constant.

IGEN(t), on the other hand, is expressed as follows:

(1.25)

Combining IGEN(t) and IPART(t) yields:

(1.26)

To find K, we need to substitute IPART(t) = K into Eq. 1.23.

(1.27)

To find s in Eq. 1.26, we need to equate the right hand side of the differential equation in Eq. 1.23 to zero, and take the Laplace transform of both sides.

Therefore:

Since IGEN(s) ≠ 0, then $$ \text{s} + \frac{\text{R}}{\text{L}} = \text{0} $$

Therefore, $$ \text{s} = - \frac{\text{R}}{\text{L}} $$

(1.28)

Thus,

(1.29)

To solve for A, we need to use the initial condition , I(0) = 0. Thus,

(1.30)

This current is plotted as a function of time in Fig. 1.8.

Fig. 1.8

The current waveform of the RL circuit in Fig. 1.7 as a function of time

For the output voltage, we need to use Eq. 1.20.

Substituting I(t) in Eq. 1.30 into VOUT(t) above yields:

(1.31)

This voltage is plotted as a function of time in Fig. 1.9.

Fig. 1.9

The voltage waveform of the RL circuit in Fig. 1.7 as a function of time

Example 1.1

Assume the RC circuit in Fig. 1.10 receives a pulse input as shown in Fig. 1.11. Let us derive the response of the circuit at the output node, VOUT(t).

Fig. 1.10

A simple RC circuit with a pulse input

Fig. 1.11

Pulse input waveform

This circuit can be examined in two distinct time intervals: 0 < t < T and T < t < 2T.

The circuit analysis for 0 < t < T is the same as the analysis for the RC circuit in Fig. 1.4.

Thus,

If the time duration, T, is long enough such that T ≫ RC, the output voltage, VOUT(t), at t = T becomes:

(1.32)

Therefore, VOUT(T) = V becomes the initial condition for the circuit for T < t < 2T. However, at t = T, the input transitions to 0 V, and the circuit in Fig. 1.10 transforms into the RC circuit shown in Fig. 1.12. Here, the current flows into the opposite direction of the current in Fig. 1.10.

Fig. 1.12

The equivalent RC circuit in Fig. 1.10 during T < t < 2T

Writing the Kirchoff’s voltage law for this circuit yields:

(1.33)

Employing the Ohms’s law in Eq. 1.33 yields:

Differentiating both sides of this equation, and substituting the current-voltage relationship for the capacitor produces:

(1.34)

Solving the differential equation in Eq. 1.34 yields:

(1.35)

Then the output voltage becomes:

(1.36)

Fetching the initial condition from Eq. 1.32, and using it in Eq. 1.36 produces:

or

(1.37)

Substituting A in Eq. 1.37 into I(t) in Eq. 1.35 yields:

(1.38)

Plotting $$ \text{I(t)} = \frac{\text{V}}{\text{R}}{\bf{exp}}\left({{{- }\frac{\text{t}}{{\text{RC}}}}}\right) $$ during 0 < t < T, and $$ \text{I(t)} = - \frac{\text{V}}{\text{R}}{\bf{exp}}\left[{{ - \frac{{\text{(t}}\,-\,{\text{T)}}}{{\text{RC}}}}}\right] $$ during T < t < 2T yields the following waveform in Fig. 1.13. In this figure, I(t) becomes a negative quantity during T < t < 2T because the current in Fig. 1.12 flows in the opposite direction of the current in Fig. 1.10.$$ {\text{V}}_{\text{OUT}} ( {\text{t}} ) $$ becomes $$ {\text{V}}_{\text{OUT}} \left( {\text{t}} \right) = {\text{R}}\,{\text{I}}\left( {\text{t}} \right) $$.

Fig. 1.13

The current through the RC circuit in Fig. 1.10

Thus,

(1.39)

Plotting $$ \text{V}_{{\text{OUT}}} \text{(t)} = \text{V}\left[1 - {\bf{exp}}\left({{ - \frac{\text{t}}{{\text{RC}}}}} \right)\right] $$ during 0 < t < T, and $$ \text{V}_{{\text{OUT}}} \text{(t)} = \text{V}\,{\bf{exp}}\left[{{ - \frac{{\text{(t}}\,-\,{\text{T)}}}{{\text{RC}}}}}\right] $$ during T < t < 2T yields the following waveform in Fig. 1.14.

Fig. 1.14

The voltage at the output of the RC circuit in Fig. 1.10

1.4 First Order Passive Circuit Analysis Using Natural Frequencies

Natural frequencies method is an easy way to find the current through a passive element and the voltage value across it. This method only uses the initial and final conditions on the element and the natural frequencies of the circuit.

There are three steps involved to evaluate the current or the voltage value as a function of time:

Step 1:

Evaluate the initial (t = 0) current or voltage values at a passive element

Step 2:

Evaluate the final (t → ∞) current or voltage values at a passive element

Step 3:

Evaluate the natural frequencies of the circuit when there is no current or voltage source applied to the circuit.

Once these three steps are completed, we can determine the current and voltage values for a passive element and plot the corresponding waveforms .

To show how this method works, assume the simple RC circuit in Fig. 1.15 with a fixed voltage source (the input voltage source can also be time-dependent, however this does not alter the analysis) at its input.

Fig. 1.15

A simple RC circuit with a fixed voltage source, V, at its input

Assume that VOUT(0) = 0 V. The initial output voltage may have a different value; however, this does not alter the circuit analysis. The initial current, I(0), becomes:

(1.40)

This completes step 1.

For step 2, we need to identify the value of the current through the circuit, and the voltage across the capacitor at t → ∞.

We know that as a constant current flows through a capacitor, and charges it completely, the capacitor becomes an open circuit. Thus, the current through this circuit becomes 0 A, and voltage across the capacitor becomes equal to V at t → ∞.

For step 3, the natural frequencies of the circuit must be calculated. When the input voltage source is separated from the circuit in Fig. 1.15, the equivalent input impedance of the circuit, ZIN(s) , becomes:

(1.41)

The natural frequencies method dictates to “terminate” all independent current and voltage sources in a circuit. Therefore, when the input voltage source, VIN , is terminated or forced to become 0 V, the numerator of ZIN(s) automatically becomes zero, revealing (sRC + 1) = 0.

Thus,

(1.42)

This is the natural frequency of the circuit, which is inversely proportional to t.

Therefore, the initial current starts at V/R but reduces to 0 A with a time constant τ = RC as t approaches ∞. Similarly, the output voltage starts at 0 V, and increases towards the value, V, with the same time constant, τ = RC. Here, the time constant is inversely proportional to the natural frequency as mentioned previously.

Then, the equations for I(t) and VOUT(t) are calculated as follows:

(1.43)

Similarly,

(1.44)

1.5 Time-Domain Analysis of Second Order Passive Circuits

An RLC circuit composed of a series combination of a resistor , inductor and capacitor is considered a second order passive network as shown in Fig. 1.16. In this circuit, assume the switch is closed at t = 0.

Fig. 1.16

A simple second order RLC circuit

The Kirchoff’s voltage law for the circuit yields:

(1.45)

But,

(1.46)

(1.47)

To be able to substitute Eqs. 1.46 and 1.47 into Eq. 1.45, we need to differentiate both sides of Eq. 1.45. Thus,

Reorganizing the terms yields:

(1.48)

But,

(1.49)

Here, IPART(t) = 0 and IGEN(t) = A exp(s₁t )+ B exp(s₂t) since the differential equation in Eq. 1.48 is a second order constant coefficient differential equation .

Thus,

(1.50)

s₁ and s₂ are the natural frequencies of this circuit and computed by solving the characteristic equation. Taking Laplace transform of Eq. 1.48 yields:

(1.51)

Thus,

(1.52)

Let $$ \upalpha = \frac{\text{R}}{{\text{2L}}} $$ and $$ \upomega_{\text{0}} = \frac{\text{1}}{{\sqrt {\text{LC}} }} $$ in s1,2. Then,

(1.53)

We still need two initial conditions to solve A and B. The first initial condition, I(0) = 0, because the initial current stored in the inductor is assumed 0 A.

The second initial condition , $$ \frac{{\text{dI(0)}}}{{\text{dt}}} $$, requires evaluating the RLC circuit at t = 0, and constructing its equivalent circuit as shown in Fig. 1.17.

Fig. 1.17

The equivalent RLC circuit in Fig. 1.16 at t = 0

Therefore,

Here, I(0) = 0. Then,

(1.54)

Applying the first initial condition , I(0) = 0, to Eq. 1.50 yields:

(1.55)

Applying the second initial condition , $$ \frac{{\text{dI(0)}}}{{\text{dt}}} = \frac{\text{V}}{\text{L}} $$, to Eq. 1.55 yields:

(1.56)

Substituting Eq. 1.56 into Eq. 1.55 produces:

(1.57)

where, $$ \text{s}_{{\text{1,2}}} = -\upalpha \pm \sqrt {\upalpha^{\text{2}} -\upomega_{\text{0}}^{\text{2}} }. $$

From Eq. 1.45, we also have:

But,

Thus,

(1.58)

If α > ω₀, substituting $$ \text{s}_{\text{1}} - \text{s}_{\text{2}} = - \text{2}\sqrt {\upalpha^{\text{2}} -\upomega_{\text{0}}^{\text{2}} } $$ into VOUT(t) in Eq. 1.58 yields:

(1.59)

This equation can be plotted in Fig. 1.18.

Fig. 1.18

The output voltage waveform when α > ω₀

However, for α < ω₀

Thus,

Using $$ {\bf{exp}}({{{\text{j}}{\uptheta}}}) = {\cos}\,\uptheta + {\text{j}}\,{\sin}\,\uptheta $$ (Euler’s equation) in VOUT(t) yields:

(1.60)

This equation produces quite a different result from Fig. 1.18, and contains the component of oscillation from sine and cosine terms in Eq. 1.60 as shown in Fig. 1.19.

Fig. 1.19

The output voltage waveform when α < ω₀

When the resistor in component in this circuit is completely eliminated, then VOUT(t) will reduce to VOUT(t) = V (1 – cos ω₀t) and oscillate with an angular frequency of ω₀. The resultant waveform is plotted in Fig. 1.20.

Fig. 1.20

The output voltage waveform when R = 0

1.6 Transfer Function and Circuit Stability

Transfer function , H(s), defines the relationship between the input and output of a passive circuit in frequency domain . The passive network has to be defined in terms of individual impedances of R, L and C to produce H(s) as shown in Fig. 1.21.

Fig. 1.21

Input-output relationship of a passive network in frequency (s) domain

Thus,

(1.61)

The transfer function , H(s), in Eq. 1.61 can be described as:

In this equation, if N(s) = 0, the roots of the polynomial gives the zeros of H(s). Similarly, if D(s) = 0, the roots of the polynomial produces the poles of H(s), which describes the stability of the circuit. The poles of the circuit are the same as the natural frequencies , and follow the form in Eq. 1.62:

(1.62)

Here, α is the real component and ω is the imaginary component of a pole. The root(s) from D(s) = 0 can be plotted on a complex plane as shown in Fig. 1.22.

Fig. 1.22

Possible locations of poles in a complex plane

In this figure, if the pole(s) is at position (0) or in complex conjugate form at position (1), this situation creates instability in the circuit. The resulting waveform grows in amplitude as a function of time similar to Fig. 1.23.

Fig. 1.23

Output of a passive network with complex poles at position (1) in Fig. 1.22

If the poles lay on the imaginary axis or in position (2) on the complex plane , the output waveform becomes oscillatory as shown in Fig. 1.24.

Fig. 1.24

Output of a passive network with complex poles at position (2) in Fig. 1.22

If the poles shift to the left hand side of the complex plane in Fig. 1.22 such as in position (3), the output of the circuit still becomes oscillatory but reaches to a stable voltage as shown in Fig. 1.25.

Fig. 1.25

Output of a passive network with complex poles at position (3) in Fig. 1.22

If the pole(s) lay on the negative real axis of the complex plane such as position (4), then the oscillation at the output disappears, and the waveform reaches to a stable value as shown in Fig. 1.26.

Fig. 1.26

Output of a passive network with real pole(s) at position (4) in Fig. 1.22

Example 1.2

Assume the following RC circuit in Fig. 1.27 to evaluate its stability .

Fig. 1.27

The RC circuit for stability analysis

First, each time-domain component in the circuit is transformed to a frequency-domain component using Laplace transform .

Thus, the circuit transforms into Fig. 1.28.

Fig. 1.28

The frequency-domain equivalent of the RC circuit in Fig. 1.27

Then the relationship between the input and output becomes:

(1.63)

To find the pole(s), the denominator needs to be zero .

Thus, the pole becomes:

(1.64)

Plotting this single pole on complex plane yields the following in Fig. 1.29.

Fig. 1.29

A single pole representation of the RC circuit in Fig. 1.27

From the position of the pole, we know that the circuit is stable, and VOUT(t) approaches to a stable value as shown in Fig. 1.30.

Fig. 1.30

The output response of the RC circuit in Fig. 1.27

Example 1.3

Now, let us assume the following RLC circuit in Fig. 1.31 to evaluate its stability . Again, we need to convert the time-domain components in this circuit to frequency-domain components. Taking the Laplace transform of VIN(t), and each passive component in the circuit transforms Fig. 1.31 to Fig. 1.32.

Fig. 1.31

The RLC circuit for stability analysis

Fig. 1.32

The frequency domain equivalent of the RLC circuit in Fig. 1.31

The transfer function , H(s), is evaluated as follows:

(1.65)

To find the pole(s), the denominator of H(s) in Eq. 1.65 needs to be zero . Thus,

(1.66)

Solving the polynomial in Eq. 1.66 reveals:

(1.67)

The roots, s₁ and s₂, can be simplified as follows:

where,

Assuming that L, R and C are all non-zero and non-negative, there are three possible cases depending on the passive component values.

Case 1: when α₀ > ω₀ then both poles become real.

Plotting these poles in Fig. 1.33 yields:

Fig. 1.33

The real poles of the RLC circuit in Fig. 1.31 when α₀ > ω₀

The output of the circuit, therefore, approaches to a stable value as t → ∞ as shown in Fig. 1.34.

Fig. 1.34

The output of the RLC circuit in Fig. 1.31 when α₀ > ω₀

Case 2: when α₀ = ω₀, then both poles are still real but they collapse on top of each other when plotted on complex plane as shown in Fig. 1.35.

Fig. 1.35

The real poles of the RLC circuit in Fig. 1.31 when α₀ = ω₀

The output of the circuit still produces a stable value as t → ∞ in Fig. 1.36.

Fig. 1.36

The output of the RLC circuit in Fig. 1.31 when α₀ = ω₀

Case 3: when α₀ < ω₀, then both poles become complex conjugate as shown in Fig. 1.37.

Fig. 1.37

The complex conjugate poles of the RLC circuit in Fig. 1.31 when α₀ < ω₀

The output of the circuit produces an oscillatory waveform but reaches to a stable value as t approaches infinity in Fig. 1.38.

Fig. 1.38

The output of the RLC circuit in Fig. 1.31 as a result of complex conjugate poles when α₀ < ω₀

Review Questions

1.

The following RL circuit is given:

In this circuit, the current, I, represents a constant current value. The current in the inductor L at t = 0 s is I/2 as shown in the schematic. At t = 0, the switch closes. Using the natural frequencies method

(a)

Find the current through the inductor and plot it.

(b)

Find the voltage across the inductor and plot it.

2.

The following RC circuit is given.

At t = 0, the switch closes. V is a constant voltage and VOUT(0) = 0 V.

Using natural frequencies method, find the output voltage, VOUT(t) and plot it.

Now, change the location of the capacitor, C, as shown below. Assume the voltage across the capacitor is 0 V at t = 0. How does VOUT(t) change? Plot the waveform for VOUT(t).

3.

The following circuits are given:

Apply the following waveforms to circuits A and B.

(a)

Find the expression for VL(t) in circuit A, and plot it for both input waveforms A and B.

(b)

Find the expression for VC(t) in circuit B, and plot it for both input waveforms A and B.

4.

The following circuits are given:

(a)

Find the transfer functions, $$ \text{H(s)} = \frac{{\text{V}_{\text{OUT}} (\text{s})}}{{\text{I}(\text{s})}} $$, of circuits A and B.

(b)

Draw the pole-zero diagrams and find out the stability of each circuit. From stability criteria, how does VOUT(t) change with time?

5.

The following capacitive circuit is given.

Apply the waveform below to the input of this circuit.

Solve I(t) and VOUT(t) using time-domain analysis and plot them as a function of time.

6.

The capacitors, C₁ and C₂, are connected in parallel with a switch as shown below. The capacitor, C₁, has an initial voltage of VDD, and capacitor, C₂, has 0 V. When the switch closes at t = 0, what will be the resultant voltage, VX?

7.

An LC circuit is given below:

The initial current stored in the inductor is I in the direction indicated in the circuit diagram, and the voltage across the capacitor is 0 V at t = 0 s before the switch is closed. Find the expression for VOUT(t) and draw its waveform using time-domain analysis.

8.

A constant voltage source, V, is applied to the circuit below. If the stored current in the inductor is 0 A, and the stored voltage across the capacitor is 0 V before the switch is closed, calculate the output voltage, VOUT(t), for t > 0.

9.

Assume the LC circuit below. The initial voltage stored across the capacitor is V. When the switch closes at t = 0, the current flows from the capacitor into the inductor and back into the capacitor. Assuming the stored current in the inductor is 0 A, find the current through the circuit, I(t), the voltage across the inductor, VOUT(t). Plot I(t) and VOUT(t) as a function of time.

© Springer International Publishing Switzerland 2017

Ahmet BindalElectronics for Embedded Systems10.1007/978-3-319-39439-8_2

2. Diode and Bipolar Transistor Circuits

Ahmet Bindal1  

(1)

Computer Engineering Department, San Jose State University, San Jose, California, USA

Ahmet Bindal

Email: ahmet.bindal@sjsu.edu

2.1 A Brief Review of Semiconductors

Semiconductors are crystalline structures in which each atom shares its valance electrons with the neighboring atoms. The simple two-dimensional crystalline structure in Fig. 2.1 shows every silicon atom sharing four valance electrons with neighboring four atoms. This is an intrinsic semiconductor which does not contain any impurities.

Fig. 2.1

Intrinsic semiconductor

However, if a different type of atom, such as arsenic, with five valance band electrons is placed in intrinsic silicon, the crystalline structure changes: As atom occupies a site by sharing four of the five valence electrons with Si atoms, and releases the last valance electron to the crystal as a free electron as shown in Fig. 2.2. As soon as this free electron departs from the As site, the site becomes positively charged because of the extra proton in the As atom. This crystalline structure is called N-type extrinsic semiconductor because the structure contains extra electrons and negatively charged.

Fig. 2.2

N-type extrinsic semiconductor

If an atom with three electrons, such as boron, is introduced in intrinsic semiconductor instead of As, B atom shares all of its three valance electrons with neighboring Si atoms. The crystalline structure ultimately forms a “hole” in the boron site, signifying absence of electrons as shown in Fig. 2.3. This is called P-type semiconductor where the B site is charged negatively when the hole is occupied by a free electron.

Fig. 2.3

P-type extrinsic semiconductor

Figure 2.4 shows the simplified energy band diagrams of all three types of semiconductors . An electron at the valance band, EV, needs to have enough energy to transition to the conduction band, EC , in order to be a free electron in the crystalline structure . This energy difference between EC and EV is called band gap energy, EG . There is also a virtual energy level called Fermi level , EF, where there is only 50% probability of finding an electron. In N-type semiconductors , the probability of finding free electrons is higher. Therefore, EF is closer to EC. However, this probability decreases if the semiconductor is the P-type where there are not many free electrons. As a result EF approaches to EV.

Fig. 2.4

Intrinsic , N-type and P-type semiconductor energy band diagrams

2.2 PN Junction

When N-type and P-type semiconductors are joined there will be an initial flow of electrons from the N-type semiconductor to the P-type until the Fermi energy levels on both sides become equal, and the structure becomes stable. Both the conduction and valance bands close to the junction bend as the result of the initial electron flow as shown in Fig. 2.5.

Fig. 2.5

PN junction

If a forward voltage , VF, is applied to the PN junction in the direction shown in Fig. 2.6, the energy supplied to the junction , E = −qVF, moves the Fermi level of the N-type semiconductor upwards relative to the P-type until the conduction and valence bands almost become flat across the junction. The applied voltage pushes the electrons in the N-type semiconductor and the holes in the P-type semiconductor towards each other, resulting in a continuous flow of current.

Fig. 2.6

PN junction under forward bias

When a reverse voltage , VR, is applied to the junction , on the other hand, electrons in the N-side and holes in the P-side are extracted from the PN junction , resulting in no conduction current as shown in Fig. 2.7.

Fig. 2.7

PN junction under reverse bias

When we plot the forward PN junction current as a function of forward voltage , the current increases slightly before the applied voltage reaches VF as shown in Fig. 2.8. However, this current keeps increasing exponentially in the neighborhood of VF as it abides by the following equation:

Fig. 2.8

PN junction diode current-voltage (I-V) characteristics

(2.1)

In this equation, q is called the electronic charge, k is the Boltzmann constant , T is temperature, and IO is the leakage current .

Applying reverse voltage across the diode produces only a small leakage current until the junction breaks down at VBR and becomes a short circuit.

2.3 Rectifying Diode Circuits

The simplest diode circuit incorporates a series resistor with the diode as shown in Fig. 2.9. In this circuit, the output voltage, VOUT, clamps to VF which is approximately equal to 0.7 V for silicon . The current, ID, becomes equal to:

Fig. 2.9

Biasing circuit for a rectifying diode

(2.2)

We need to use an appropriate RD to limit the forward current through the diode according to the manufacturer’s specifications.

A half-wave rectifier shown in Fig. 2.10 is an extension of the simple diode circuit in Fig. 2.9. When a sinusoidal waveform is applied to the input of this circuit as shown in the top part of Fig. 2.11, the diode will only conduct if the input voltage becomes greater than or equal to its forward voltage , VF ≈ 0.7 V. Therefore, when the input reaches its peak value, VMAX, the output can only produce (VMAX − 0.7) as shown by the center waveform in Fig. 2.11.

Fig. 2.10

Half-wave rectifier circuit

Fig. 2.11

Sinusoidal input (top), half-wave rectifier output (mid), output with capacitor (bottom)

However, the real purpose of this circuit is to produce an “almost” constant voltage by eliminating the half sinusoids as shown by the bottom waveform in Fig. 2.11. This can be achieved by connecting a parallel capacitor to the output resistor as shown in Fig. 2.12. When the input climbs from 0 V towards VMAX, the output closely follows the input as in the bottom waveform of Fig. 2.11. However, as the input starts decreasing from VMAX to 0 V, the voltage across the capacitor can no longer follow this change. The previously stored voltage across the capacitor (VMAX in this case) becomes larger than the input voltage, reverse-biasing the diode , and stopping the current conduction. As a result, the capacitor starts discharging through the resistor with a time constant, RC, as shown in the bottom part of Fig. 2.11.

Fig. 2.12

Half-wave rectifier circuit with output capacitor

The full-wave rectifier composed of four diodes is shown in Fig. 2.13. The circuit output is measured across the resistor, R. When the polarity of the sinusoidal input voltage is in its positive phase, the current conducts through two diodes in series and the output resistor as shown by the equivalent circuit on the left hand side of Fig. 2.14. As a result, the output voltage follows the input, but becomes (VIN − 2VF) as shown by the center waveform in Fig. 2.15.

Fig. 2.13

Full-wave rectifier circuit

Fig. 2.14

Full-wave rectifier circuit in positive phase (left), in negative phase (right)

Fig. 2.15

Sinusoidal input (top), full-wave rectifier output without capacitor (mid), output with capacitor (bottom)

When the sinusoidal input voltage changes its phase to negative, current conduction through the circuit still exists. But, this time the other two diodes start conducting as shown by the equivalent circuit on the right hand side of Fig. 2.14. The voltage drop across the output resistor still becomes equal to (VIN − 2VF).

The Direct Current (DC) rectification is achieved by adding a parallel capacitor at the output of the full-wave rectifier shown in Fig. 2.16. This circuit reveals a more efficient mechanism in generating a DC output compared to a half-wave rectifier . The circuit behavior in full-wave rectifier is similar to half-wave rectifier: the output closely follows the input in the first and third quadrants of the sinusoidal input signal, and the current conduction stops during the second and the fourth quadrants when the capacitor discharges through the output resistor with a time constant, RC, as shown by the bottom waveform of Fig. 2.15.

Fig. 2.16

Full-wave rectifier circuit with output capacitor

2.4 Zener Diode Circuits

Zener diode is another two terminal device where a precise constant voltage can be obtained across its terminals. Zener diode manufacturers specify the nominal and maximum Zener voltage, VZ, and the reverse current, IZ, in their datasheets. Zener diode is reverse biased with a series resistor that adjusts IZ as shown in Fig. 2.17. The resistance value becomes:

Fig. 2.17

Zener diode circuit

(2.3)

2.5 Light Emitting Diode (LED)

Light Emitting Diode (LED) is an optoelectronic device that emits light at a specific wavelength when an appropriate bias current, IL, is applied as shown in Fig. 2.18. RL is adjusted in order to compute IL, and comply with the required luminosity.

Fig. 2.18

LED diode circuit

(2.4)

The voltage drop across LED, VL, is also specified in the manufacturer’s datasheet.

2.6 Bipolar Transistors

There are two kinds of bipolar junction transistors (BJT) used in electronic circuits: NPN and PNP. The equivalent circuit of an NPN transistor shown in Fig. 2.19 basically consists of two back-to-back diodes. Its emitter current is the sum of base and collector currents as shown in Eq. 2.5

Fig. 2.19

NPN bipolar transistor and its equivalent circuit

(2.5)

The second type of BJT is the PNP transistor shown in Fig. 2.20. Its emitter current is still the sum of collector and base currents. However, the currents in this transistor flow in completely opposite directions compared to the currents in an NPN transistor .

Fig. 2.20

PNP bipolar transistor and its equivalent circuit

The current-voltage relationship of a typical NPN transistor is shown in Fig. 2.21. In this figure, collector current, IC, is plotted as a function of collector-emitter voltage , VCE, for a set of base currents, IB. For each IB, IC initially increases exponentially with VCE until it reaches a point after which it essentially remains constant.

Fig. 2.21

Current-voltage characteristics of an NPN transistor for different base current values

The current-voltage characteristics in Fig. 2.21 show three different regions of transistor operation. The first region is the cut-off region where the transistor does not conduct at all, and its base and collector currents become essentially 0 A. The second region is the active region where IC remains almost constant between VCE ≈ 0.2 V and VCC. The third region is the saturation region where IC exponentially increases with VCE between 0 and 0.2 V.

In cut-off mode of operation, the transistor stops conducting because the voltage across its base-emitter junction drops below 0.7 V, and its collector base-junction becomes reverse biased as shown in Fig. 2.22. As a result, only leakage currents exist in the transistor; IB and IC essentially become 0 A.

Fig. 2.22

Transistor bias currents and voltages in cut-off mode of operation

When the transistor operates in active mode, its base -emitter junction voltage , VBE, becomes approximately equal to 0.7 V although its collector-base junction still remains reverse biased. The base and collector currents become proportional to each other with a current gain of β (or hFE according to some transistor manufacturers) as shown in Fig. 2.23.

Fig. 2.23

Transistor bias currents and voltages in active mode of operation

When the transistor finally reaches saturation region , its collector-base and emitter-base junctions become forward biased as shown in Fig. 2.24. The transistor remains in saturation as long as VBE is greater than 0.7 V. A typical VBE and VBC are approximately 0.8 and 0.6 V, respectively. This produces 0.2 V between collector and emitter terminals as shown in the figure. In this mode, IB and IC can no longer hold the linear relationship (IC = β IB). A new relationship forms between the base saturation current, IBSAT, and the base active-region current, IBACT: IBSAT >> IBACT. This, in turn, produces IBSAT >> (ICACT/β). Here, ICACT is the active-region collector current.

Fig. 2.24

Transistor bias currents and voltages in saturation mode of operation

2.7 Bipolar Transistor Circuits

This section is dedicated to using BJTs in simple circuits, and analyzing the circuit behavior when the transistor is in active and saturation regions .

Example 2.1

A simple NPN bipolar transistor circuit that consists of an NPN bipolar transistor, RB and RC is given in Fig. 2.25. If VCC = 15 V, VIN = 5 V and β = 100, calculate IB, IC. What mode will this transistor operate in?

Fig. 2.25

A simple NPN bipolar circuit

The first task is to write Kirchoff’s Voltage Law (KVL) around the BE and CE junctions as shown in Eqs. 2.6 and 2.7. Therefore,

(2.6)

(2.7)

Test for cut-off mode:

Set IB = IC = 0 A. This produces VBE = 5 V and VCE = 15 V, and it proves that the transistor does not operate in cut-off region .

Test for active mode, set VBE = 0.7 V and solve IB from Eq. 2.6. Thus,

Then,

IC = β IB = 100 (0.43 mA) = 43 mA. Substitute IC = 43 mA into Eq. 2.7 and solve for VCE. Thus,

VCE = VCC − RC IC = 15 − 0.1 KΩ (43 mA) = 15 − 4.3 = 10.7 V

This value is greater than 0.2 V and proves that the transistor operates in the active region as shown in Fig. 2.26. In this figure, Eq. 2.7 is superimposed on top of the transistor IC-VCE characteristics in order to show where exactly this transistor operates at (quiescent point, Q).

Fig. 2.26

The quiescent point of the transistor

However, the location of the Q point is not optimal in this figure, and as it needs to be closer to the midpoint between 0 and VCC such as VCEQ = VCC/2 = 7.5 V to be more suitable for analog applications.

From Fig. 2.26, when IB = 0.43 mA and VCE = 7.5 V, IC becomes 43 mA. Thus,

The new load line is plotted in Fig. 2.26 with dashed lines.

Example 2.2

Another bipolar transistor circuit is given in Fig. 2.27. In this schematic, IC is selected to be 20 mA. The circuit still uses VIN = 5 V and VCC = 15 V for its operation. What are the values of RB and RC such that this transistor operates in the middle of the active region at VCEQ = 7.5 V?

Fig. 2.27

A bipolar circuit whose IC = 20 mA, but its RC and RB are unknown

For this design question, one must refer to the manufacturer’s datasheet and fetch the transistor IC-VCE characteristics as shown in Fig. 2.28.

Fig. 2.28

Manufacturer’s I-V characteristics of the NPN transistor

The load line from Eq. 2.7 is superimposed on top of the IC-VCE characteristics, and IB becomes 2 mA at VCEQ = 7.5 V when IC = 20 mA. Since the transistor operates in active region , β = IC/IB becomes 10. Rewriting Eq. 2.7 yields:

Rewriting Eq. 2.6 yields

However, there may be an instance where the load line may not necessarily intersect any of the IC-VCE curves at VCEQ = 7.5 V provided by the manufacturer, and the situation becomes similar to the case in Fig. 2.29. In this instance, RC is still calculated using Eq. 2.7 since VCEQ and ICQ have not changed.

Fig. 2.29

An instance where load line does not intersect any I-V characteristics

However, to calculate RB we need to use β = 10 calculated earlier. Thus,

Then using Eq. 2.6, RB can be calculated as

Example 2.3

Suppose the bipolar transistor circuit in Fig. 2.27 needs to operate in the saturation region where ICSAT = 40 mA and VCESAT = 0.2 V. What are the values of RB and RC?

From Eq. 2.7, we have:

To find RB, we need to use Eq. 2.6. Thus,

In saturation, the circuit operates with the load line no.1 as shown in Fig. 2.30, producing IC = 40 mA at QSAT. At this point however, IBSAT is not known other than IBSAT >> IBACT. The ratio between IBSAT and IBACT can be set as high as 10, although this number is very conservative. A more practical the multiplication factor may be in the neighborhood of 2 or 3 depending on IC-VCE characteristics of the transistor.

Now, RB becomes:

To find IBACT in the equation above, we need to operate the transistor in the active region with the same collector current when the transistor was in saturation region. That means that ICACT needs to be 40 mA, which rotates the load line clockwise around VCEMAX = 15 V to position no. 2 so that the transistor operates in the middle of active region at VCE = 7.5 V. At this new point, QACT, load line no. 2 intersects only one IB-curve: IB = 4 mA. Therefore, IBACT becomes 4 mA, and IBSAT = 10IBACT = 40 mA.

Fig. 2.30

Load line rotation to make ICSAT ≈ ICACT to allow IBSAT ≫ IBACT

Thus,

With RC = 370 Ω and RB = 105 Ω, the collector and the base currents both become 40 mA, and the transistor operates in saturation region with load line no. 1.

Review Questions

1. The following rectifier circuit is given:

(a)

If the forward-biased diode voltage is 1 V, C = 10 μF and RL = 10 Ω (load resistance), calculate the expression for VOUT(t) and plot the output voltage.

(b)

If RL = 100 Ω, what is the value of C if VOUT(t) drops by 1 V between T = 100 μs and 3T = 300 μs?

2. The following diode circuit is given:

In this circuit, the equivalent resistance of the diode is rd when the diode turns on at a forward bias voltage of VF, where VF is much smaller compared to V for 0 < t < T.

Assuming that VOUT(0) = 0 V and the time constant of the circuit is much smaller than T, determine the output voltage, VOUT(t), for 0 < t < T and t > T. Natural frequencies method described in Chapter 1 may be used to obtain the equation for VOUT(t). Plot the output waveform.

3. The following diode circuit is given:

In this circuit above, when VIN is reduced below VF the diode turns off. The inverse slope in the I-V characteristics below gives the diode internal resistance, r.

(a)

Compute and plot the current through the inductor if the initial inductor current is 0 A. Either time domain analysis or natural frequencies method may be used to compute the result.

(b)

Compute and plot the voltage across the output, VOUT. Either time domain analysis or natural frequencies method may be used to compute the result.

4. The NPN bipolar transistor is used to operate in the middle of active region. The transistor requires a collector current, IC = 30 mA, when the output of the circuit, VOUT, is at 5 V. The transistor develops VBE = 0.7 V in active region and maintains a current gain of 100, i.e. β = IC/IB = 100.

Use the output IC-VCE characteristics below to compute RB and RC that satisfy the proper transistor operation.

5. The same NPN bipolar transistor in question 4 now operates in saturation region where it develops VBESAT = 0.8 V and VCESAT = 0.2 V. It also produces a base current, IBSAT, 10 times larger than the active-region base current, IBACT.

If the transistor requires a collector current, ICSAT = 30 mA, to operate in saturation region, find RB and RC to satisfy the proper transistor operation. Use the IC-VCE characteristics below for calculations.

6. In the following circuit, the NPN bipolar transistor is used in such a way that it operates in the saturation region. The circuit requires a collector current, ICSAT = 30 mA, when its output, VOUT, is at 5 V. The transistor develops VBESAT = 0.8 V and VCESAT = 0.2 V in saturation region when its base current, IBSAT, is set 10 times higher compared to the base current when it is in active region, IBACT.

Find RC, RB and RE that satisfy the proper transistor operation.

© Springer International Publishing Switzerland 2017

Ahmet BindalElectronics for Embedded Systems10.1007/978-3-319-39439-8_3

3. MOS Transistors and CMOS Circuits

Ahmet Bindal1  

(1)

Computer Engineering Department, San Jose State University, San Jose, California, USA

Ahmet Bindal

Email: ahmet.bindal@sjsu.edu

3.1 N-Channel MOSFET (NMOSFET)

N-channel Metal-Oxide-Semiconductor-Field-Effect-Transistor (NMOSFET) is a three-terminal device that produces a drain current, ID , when positive voltages are applied to the gate and drain terminals with respect to the source terminal as shown in Fig. 3.1.

Fig. 3.1

NMOSFET circuit symbol

When the conduction starts, the device produces ID-VDS characteristics for different values of VGS as shown in Fig. 3.2. Each curve in this figure is obtained by increasing VDS and measuring ID at a constant VGS. Each I-V curve consists of two distinct regions: an active region and a saturation region. The device transitions from the active region into the saturation region when VDS reaches a saturation potential, VDSAT = VGS − VTN. Here, VTN is the threshold voltage applied to the gate to turn on the transistor.

Fig. 3.2

NMOSFET current-voltage characteristics

The I-V curve in Fig. 3.2 can be explained using the following equation:

(3.1)

where,

µN is the mobility of electrons in the drain-source channel in cm²/Vsec

COX is the gate oxide capacitance in F/cm²

WN is the width of the NMOS transistor

LN is the length of the NMOS transistor

VTN is the threshold voltage of the NMOS transistor

For small values of VDS, Eq. 3.1 can be approximated as:

(3.2)

This equation represents the active region of operation where the NMOS transistor reveals a linear relationship between ID and VDS. Therefore, in this region, NMOSFET can be represented as a resistor as shown in Fig. 3.3. In this figure, the power supply voltage, VDD , is the maximum allowable voltage applied to the gate of the transistor.

(3.3)

Fig. 3.3

NMOSFET ID–VDS curve when VDS = VDD and the equivalent circuits

The constant terms in Eq. 3.3 can be combined and equated to KN as shown below.

Then Eq. 3.3 becomes:

(3.4)

Equation 3.4 becomes approximately equal to the inverse slope of the ID–VDS curve in Fig. 3.3 for VDS smaller than VDSAT = VDD − VTN.

For VDS > VDSAT = VDD − VTN, however, the NMOS transistor goes into the saturation region as shown in Fig. 3.3. IDSAT can be obtained by substituting VGS = VDD and VDSAT = VDD − VTN in Eq. 3.1. Thus,

(3.5)

Equation 3.5 is a constant and independent of VDS. Therefore, the NMOS transistor can be represented as a constant current when it is in saturation region.

3.2 P-Channel MOSFET (PMOSFET)

As a complementary transistor to NMOSFET, P-channel MOSFET (PMOSFET) is also a three-terminal device which produces a drain current, ID , when negative voltages are applied to the gate and drain terminals with respect to the source as shown in Fig. 3.4.

Fig. 3.4

PMOSFET circuit symbol

The device produces ID–VSD characteristics for different values of VSG as shown in Fig. 3.5. Each curve in this figure is obtained at a constant VSG, and composed of the active and saturation regions. As in NMOS transistor, the device transitions from the active region to the saturation region when VSD reaches a saturation potential, VDSAT = VSG − VTP, where VTP is the threshold voltage to turn on the transistor.

Fig. 3.5

PMOSFET current-voltage characteristics

The mathematical expression in Eq. 3.6 below identifies the ID-VSD characteristics above.

(3.6)

where,

µP is the mobility of holes in the drain-source channel in cm²/Vsec

COX is the gate oxide capacitance in F/cm²

WP is the width of the PMOS transistor

LP is the length of the PMOS transistor

VTP is the threshold voltage of the PMOS transistor

For small values of VSD, Eq. 3.6 becomes:

(3.7)

Like its NMOS counterpart, Eq. 3.7 represents the active region of operation for the PMOS transistor . This equation can be approximated as a resistor in Eq. 3.8 when the power supply voltage, VDD , is applied between the gate and source terminals.

(3.8)

Combining all constant terms in Eq. 3.8 yields:

Then Eq. 3.8 becomes:

(3.9)

This equation is approximately equal to the inverse slope of the ID-VSD curve in Fig. 3.6 when VSG is smaller than VDD − VTP.

Fig. 3.6

PMOSFET equivalent circuit

For VSD > VDSAT = VDD − VTP, the PMOS transistor goes into the saturation region. The current in this region can be obtained by substituting VSG = VDD and VDSAT = VDD − VTP into Eq. 3.6. Thus,

(3.10)

Equation 3.10 is also constant and independent of VSD. Therefore, the PMOS transistor is represented as a constant current when it is in saturation region.

3.3 Complementary MOS (CMOS) Inverter

The first Complementary-Metal-Oxide-Semiconductor (CMOS) logic gate we will examine is the inverter. This gate consists of a single NMOS transistor in series with a PMOS transistor as shown in Fig. 3.7.

Fig. 3.7

CMOS inverter

In this circuit , when the input voltage, VIN(t), becomes equal to VDD (logic 1), the NMOS transistor turns on (because VGS = VDD > VTN), and the PMOS transistor turns off (because VSG = 0 V). The capacitance, CL, at the output terminal is then discharged through the equivalent NMOS resistance, RN, as shown in the left side of Fig. 3.8, and the output voltage decays towards 0 V with a RC time constant of RNCL. In other words, VOUT becomes:

Fig. 3.8

CMOS inverter discharge path (left) and charge path (right)

(3.11)

When VIN(t) = 0 V, on the other hand, NMOS transistor turns off (because VGS = 0 V), and PMOS turns on (because VSG = VDD > VTP). Consequently, a charge path forms through the equivalent PMOS resistor to charge the output capacitance from 0 V towards VDD as shown in the right side of Fig. 3.8. In other words,

(3.12)

3.4 Two-Input CMOS NAND Logic Gate

The two-input CMOS NAND gate is shown in Fig. 3.9. This logic gate is composed of two sections: an NMOS tree (between the output terminal and the ground), and a PMOS tree (between the power supply voltage and the output terminal). To construct the NMOS tree, two NMOS transistors are connected in series between the output terminal and the ground. The reason for this configuration is that if one of the NMOS transistors turns off, there will be no discharge path to lower VOUT, and VOUT stays at VDD. However, if both NMOS transistors are turned on, VOUT transitions to 0 V, which complies with the truth table for two-input NAND gate.

Fig. 3.9

Two-input CMOS NAND gate

The next phase is to form the PMOS tree. The PMOS tree is configured in a complementary manner to the NMOS tree. This means that any series combination of NMOS transistors in the NMOS tree must be transformed into a parallel combination of PMOS transistors in the PMOS tree , and vice versa. Therefore, we need to connect two PMOS transistors in parallel to form the PMOS tree , and place it between VOUT and VDD as shown in Fig. 3.9.

Figure 3.10 shows the discharge and charge paths for the two-input NAND gate. The only discharge path in this figure is through the series combination of two equivalent NMOS resistors as shown by the leftmost figure in Fig. 3.10. This yields the following output voltage:

Fig. 3.10

Two-input CMOS NAND gate discharging (left) and charging (middle and right) paths

(3.13)

The worst-case charge path , on the other hand, forms as a result of turning on only one of the PMOS transistors in the PMOS tree shown in the middle part of Fig. 3.10, and results in the following output voltage:

(3.14)

The best-case charge path turns on both PMOS transistors in the PMOS tree, and results in charging the output node in a faster pace as shown by the rightmost figure in Fig. 3.10. Equation 3.15 shows this behavior:

(3.15)

In Eqs. 3.13 to 3.15, the capacitance term, C, is associated with the intrinsic capacitance at the output node of the two-input NAND gate in Fig. 3.9. If there is an external capacitance at the output node, it must be added to the intrinsic capacitance before calculating the value of VOUT.

3.5 Two-Input CMOS NOR Logic Gate

The two-input CMOS NOR gate is shown in Fig. 3.11. To configure this logic gate , an NMOS tree composed of two parallel NMOS transistors is formed first. This arrangement ensures VOUT to be 0 V if one or more NMOSFETs in the NMOS tree are turned on. When both devices are turned off, then VOUT becomes VDD as dictated by the truth table of this gate.

Fig. 3.11

Two-input CMOS NOR gate

The PMOS tree is formed in a complementary fashion to the NMOS tree, and results in two PMOS transistors in series between VDD and VOUT as shown in Fig. 3.11.

Figure 3.12 shows a discharge path and two charge paths for the two-input NOR gate. The worst-case discharge path in this figure is through an NMOS transistor as shown by the leftmost figure in Fig. 3.12. This yields the following output voltage:

Fig. 3.12

Two-input CMOS NOR gate discharging (left and middle) and charging (right) paths

(3.16)

The best-case discharge path is when both NMOS transistors are turned on as shown by the center figure in Fig. 3.12. This produces a faster discharge rate as described by Eq. 3.17 below.

(3.17)

The only charge path is to turn on both PMOS transistors in the PMOS tree as shown by the rightmost figure in Fig. 3.12. It results in the following output voltage:

(3.18)

In Eqs. 3.16 to 3.18, the capacitance term, C, is associated with the intrinsic capacitance at the output node of the two-input NOR gate in Fig. 3.11. If there is an external capacitance at the output node, this capacitance must be added to the intrinsic capacitance before calculating the value of VOUT.

3.6 Complex CMOS Logic Gate Implementation

The best way to show how to build a complex CMOS logic gate is to give a comprehensive example, outlining each step in the implementation one at a time, and discussing the design trade-offs when they become necessary. For this particular reason, implementing a logic function, such as out = A . B . C + D, serves these two criteria. First, this logic gate is composed of AND and OR logic functions. Second, it calls for numerous design trade-offs during its implementation. There are basically two ways to implement this logic function.

The first method uses discrete CMOS gates. This produces a three-input AND gate with the A, B and C inputs, and a two-input OR gate, combining the D input with the output of the AND gate.

The second method integrates all the AND and OR functions of this complex gate in a single gate. This method forms a combined NMOS tree first, and then builds a complementary logic function in the PMOS tree . When forming the NMOS tree, we must remember connecting all NMOS transistors in series if we need to implement an AND function, and in parallel to implement an OR function.

Therefore, to implement out = A . B . C + D, we start with connecting three NMOS transistors with the A, B and C inputs in series to form the AND function. Then, we connect another NMOS transistor with the D input in parallel to this combination to complete the NMOS tree as shown in Fig. 3.13.

Fig. 3.13

Implementation of out = A . B . C + D

PMOS tree is formed in a complementary fashion: the PMOS transistors with the A, B and C inputs have to be connected in parallel because NMOS transistors with the same inputs were connected in series in the NMOS tree. This parallel combination is then connected in series with a PMOS transistor with the D input because the NMOS transistor with D input was connected in parallel in the NMOS tree . However, this process only produces an output function equal to $$ {\text{out}} = \overline{{({\text{A}} \, . \, {\text{B}} \, . \, {\text{C}} + {\text{D}})}} $$ if the implementation stops here. We need to add an inverter at the output of the logic gate to further convert the complemented logic function to its uncomplemented form, out = A . B . C + D.

The worst-case discharge and charge paths of this circuit are shown in Fig. 3.14. Both charging and discharging the output node takes two steps.

Fig. 3.14

Worst-case charge and discharge paths for out = A . B . C + D

To be able to charge the output node, three equivalent NMOS resistors connected in series need to discharge the intermediate node, VINT, as shown by the top figure in Fig. 3.14. The total capacitance at VINT is approximately the input capacitance of the inverter, CINV, which is the combination of NMOS and PMOS transistor gate capacitances. Therefore,

(3.19)

Once the charge across CINV is drained away, and VINT is lowered to 0 V, then in the second step, the PMOS transistor in the inverter turns on to charge the output node towards VDD.

To discharge the output node, the intermediate node needs to be charged by two equivalent PMOS resistors connected in series as shown by the bottom figure in Fig. 3.14. Once VINT reaches VDD, then the equivalent NMOS resistor in the inverter discharges the output node.

Another method to form out = A . B . C + D calls for the complemented inputs, $$ \overline{\text{A}} $$, $$ \overline{\text{B}} $$, $$ \overline{\text{C}} $$ and $$ \overline{\text{D}} $$, applied to the input of the logic gate if they are available. This method follows manipulating the logic function using De Morgan’s theorem.

In other words,

(3.20)

The logic function in Eq. 3.20 has already been complemented, and does not require an additional inverter at the output as shown in Fig. 3.15. To form the NMOS tree of this circuit, three NMOS transistors with complemented inputs, $$ \overline{\text{A}} $$, $$ \overline{\text{B}} $$ and $$ \overline{\text{C}} $$, are connected in parallel. Then this combination is connected in series with another NMOS transistor with $$ \overline{\text{D}} $$ input as shown in Fig. 3.15. The PMOS tree requires three PMOS transistors in series with $$ \overline{\text{A}} $$, $$ \overline{\text{B}} $$ and $$ \overline{\text{C}} $$ inputs, and a single PMOS transistor with $$ \overline{\text{D}} $$ input in parallel to this combination.

Fig. 3.15

Implementation of $$ {\text{out}} = {\text{A}} \, . \, {\text{B}} \, . \, {\text{C}} + {\text{D}} = (\overline{{\overline{\text{A}} + \overline{\text{B}} + \overline{\text{C}} ) \, . \, \overline{\text{D}} }} $$ (no output inverter is needed but all inputs need to be inverted)

Figure 3.16 shows the worst-case discharge and charge paths for the second implementation in Fig. 3.15. To discharge the output node, two equivalent NMOS resistors drain the output voltage towards 0 V as shown by the top figure in Fig. 3.16. Charging the output node, on the other hand, requires all three PMOS transistors to be turned on as shown by the bottom figure in Fig. 3.16.

Fig. 3.16

Worst-case charge and discharge paths for $$ {\text{out}} = {\text{A}} \, . \, {\text{B}} \, . \, {\text{C}} + {\text{D}} = (\overline{{\overline{\text{A}} + \overline{\text{B}} + \overline{\text{C}} ) \, . \, \overline{\text{D}} }} $$

3.7 Rise and Fall Times

Rise time , TR, is defined as the time interval during which the output rises from 20 to 80% of its final value as shown in Fig. 3.17. This value can be calculated analytically if the term RP in Eq. 3.12 is replaced by RPEQ, signifying a total equivalent PMOS resistance in the worst-case charge path . Therefore,

Fig. 3.17

Rise and fall times , rise and fall delays of a CMOS gate

(3.21)

Here, C is the sum of all intrinsic and load capacitances at the output node. From this equation, 20% of VOUT at t = T₁ becomes:

or

(3.22)

Similarly, 80% of VOUT at t = T₂ becomes:

or

(3.23)

Then, using Eqs. 3.22 and 3.23 we can calculate the rise time , TR:

(3.24)

Similar to rise time, the fall time is defined as the time interval during which the output falls from 80% to 20% of its final value as shown in Fig. 3.17. Rewriting Eq. 3.11, and replacing RN in this equation by RNEQ to signify the total equivalent NMOS resistance in the worst-case discharge path yields:

(3.25)

Thus, 80% of VOUT at t = T₁ becomes:

(3.26)

Similarly, 20% of VOUT at t = T₂ becomes:

(3.27)

Extracting T₁ from Eq. 3.26 and T₂ from Eq. 3.27, and computing the fall time , TF, yields:

(3.28)

3.8 Rise and Fall Delays

Rise delay , TDR, is defined as the time interval between 50% mark of the input voltage and 50% mark of the rising output as shown in the top part of Fig. 3.17.

If the input voltage is assumed to make an abrupt transition from VDD to 0 V at t = 0, then the 50% mark of the input voltage still resides at t = 0. Thus,

(3.29)

For T₂, the output rises 50% of its final value. Therefore, we must refer to Eq. 3.12.

or

(3.30)

Thus, the rise delay, TDR, becomes:

(3.31)

Similar to TDR, the fall delay , TDF, is computed by using Eq. 3.11. Graphically, TDF is also shown in the bottom part of Fig. 3.17.

Again, T₁ = 0 because the input abruptly transitions at t = 0. For T₂, however, one can write:

Thus,

(3.32)

Example 3.1

Assume that rise and fall times , and rise and fall delays of the circuit in Fig. 3.15 need to be computed.

From Eq. 3.24,

(3.33)

From Eq. 3.28,

(3.34)

From Eq. 3.31,

(3.35)

From Eq. 3.32,

(3.36)

The values of RN and RP can be calculated using the technology-dependent NMOS and PMOS transistor parameters, respectively. C is the value of the output capacitance.

Example 3.2

Again assume the complex gate in Fig. 3.15. Size each transistor width in this logic gate in terms of a minimum transistor width, W, to ensure TR = TF.

Since $$ {\text{T}}_{\text{R}} = {\text{ T}}_{\text{F}} ,{\text{ then 4}}. 2 {\text{ R}}_{\text{P}} {\text{C }} = { 2}. 8 {\text{ R}}_{\text{N}} {\text{C}} $$

Thus,

(3.37)

Substituting the values for RN and RP from Eq. 3.4 and Eq. 3.9 yields:

(3.38)

But,

and

Assume that µN = 3 µP (due to the device technology), L = LP = LN and VTN = VTP ≈ 0.2 VDD

Then,

(3.39)

and

(3.40)

Substituting Eqs. 3.39 and 3.40 into Eq. 3.38 yields:

or

Assuming WN = W (minimum geometry) yields:

Therefore, all NMOS transistors are sized W, and all PMOS transistors are sized 4.5W in order to ensure that the rise and fall times , computed through the worst-case critical paths, are equal to each other.

Example 3.3

Suppose the transistor widths of a two-input AND gate is given by the top figure in Fig. 3.18. The hole and electron mobilities are measured to be µP = 100 cm²/Vsec and µN = 300 cm²/Vsec, respectively. All transistor lengths are L = 0.1 µm, VDD = 3 V, VTN = VTP = 0.6 V and COX = 10⁻⁸ F/cm².

Fig. 3.18

Computation of worst-case gate delay of 2-input AND gate

The fall gate delay, TDF, and the rise gate delay, TDR, are computed as (TDR1 + TDF2) and (TDF1 + TDR2) respectively, and they are shown by the center and the bottom figures in Fig. 3.18. The worst-case gate delay is simply the larger of these two values.

First, let us compute (TDR1 + TDF2). Since CL is given, the computation always starts from the last stage. We know that:

Substituting WN = 10 µm and WP = 30 µm from Fig. 3.18 and the physical device parameters given above yields RN = RP ≈ 1.4 KΩ.

Then,

and

Here, CINT is the combination of NMOS and PMOS input gate capacitances of the inverter in Fig. 3.18.

Thus,

Consequently, $$ {\text{T}}_{\text{DR1}} + {\text{ T}}_{\text{DF2}} = {0.4} + {98}\, \approx {98}\,{\text{ps}} $$

The computation of (TDF1 + TDR2) starts from calculating TDR2 first.

Consequently, $$ {\text{T}}_{\text{DF1}} + {\text{ T}}_{\text{DR2}} = {98} + {0.8} \approx {99}\,{\text{ps}} $$

Therefore, the worst-case gate delay for this AND gate is TD = 99 ps.

Review Questions

1. Implement the following functions using CMOS circuits

(a)

Implement the following function with a two-stage CMOS circuit (with an output inverter).

(b)

Implement the following function with a single stage CMOS circuit (without an output inverter).

2. The NMOS tree of a CMOS circuit is given below.

(a)

Find the logic function of this circuit at the out terminal.

(b)

Determine the PMOS tree for this circuit. Explain the configuration steps clearly.

3. Design the CMOS gate that implements the following function:

(a)

Draw the circuit schematic without any output inverter.

(b)

Size all the transistors in this circuit such that TR = 3TF. The minimum geometry is W.

4. The following function is given:

Design a single-stage CMOS circuit with TDR = 2TDF. Determine all transistor widths in terms of minimum geometry, W.

5. The following function is given:

OUT = (A + B + C)

Design a two-stage CMOS circuit that maintains TR = 2TF = 500 ps at all nodes (internal or output) for a load capacitor of 100fF. Find all transistor widths in µm.

Use the technology below:

COX = 10⁻⁸ F/cm²

L = 0.25 µm

VDD = 3 V

VTN = VTP = 0.5 V

µN = 200 cm²/Vsec

µP = 100 cm²/Vsec

6. Implement one-bit SUM and COUT (carry-out) functions in an integrated CMOS logic gate with uninverted inputs, A, B, and CIN (carry-in):

The design criterion requires that TDR and TDF are equal to 400 ps in each stage of this CMOS circuit. Size the transistors in the CMOS circuit using the following technology:

CLOAD = 100fF = 100 × 10⁻¹⁵F (placed both at the sum and carry-out nodes)

VDD = 3 V

VTN = VTP = 0.5 V

µN = 300 cm²/Vsec

µP = 100 cm²/Vsec

L = 0.25 µm

COX = 10⁻⁸ F/cm²

7. Design the following circuit that drives CL = 500fF. In order to be able to drive such a large capacitance, the 2-1 MUX output must have an inverter stage. Start the design from the last stage. Inverted and uninverted inputs may be used during the design in order to minimize the number of transistors. Size the transistors such that the rise and fall times at all output nodes are 400 ps. Use the device technology specs below:

VDD = 3 V

VTN = 0.5 V

VTP = 0.5 V

COX = 10⁻⁸ F/cm²

L = 0.25 µm

µN = 600 cm²/Vsec

µP = 200 cm²/Vsec

8. An inverter is given below.

The NMOS and PMOS transistors are fabricated using the following technology:

VDD = 3 V

VTN = VTP = 0.6 V

µN = 1200 cm²/Vsec

µP = 600 cm²/Vsec

COX = 6.9 × 10⁻⁷ F/cm²

L = 0.25 μm

The current through a MOSFET is defined as:

(a)

Compute the static DC current when VIN = 2 V.

(b)

Compute the output voltage when VIN = 2 V.

Consider the equivalent circuits of NMOS and PMOS transistors at this bias condition.

9. The circuit below operates a Light Emitting Diode (LED):

The approximate I-V characteristics of the transistor are given below:

The LED needs to have 0.5 mA current and 1 V across its terminals to turn on. Otherwise, it does not conduct current. The input voltage, VIN(t), is initially at 3 V, but switches to 0 V at t = 0. The initial condition at VOUT is 0 V.

Using the I-V characteristics of the transistor and the component values in the circuit schematic above, derive the expression for VOUT(t). Plot VOUT(t) as function of time.

10. The circuit below illustrates a tri-state inverter driving a long wire with an equivalent resistance of R and capacitance of C.

At the end of the wire, two inverters, composed of a PMOS transistor with WPI = 4 µm and NMOS transistor with WNI = 2 µm, create a capacitive load.

NMOS and PMOS transistor I-V characteristics in tri-state buffers are shown below:

(a)

If rise and fall times at VOUT are 2ns, find the actual wire resistance in ohms.

(b)

What is the saturation current of the PMOS transistor in the tri-state inverter?

Use the following technology:

VDD = 3 V

COX = 10⁻⁷ F/cm²

L = 0.25 µm

11. The following circuit is given:

Assuming that NMOS transistor is in the linear region when it is turned on, find the output voltage of the circuit and plot it using the following device parameters:

μN = 100 cm²/Vsec

COX = 6.9 × 10⁻⁷ F/cm²

L = 0.25 μm

W = 10 μm

VDD = 3 V

VTN = 0.6 V

12. The waveform, V(t), is applied to G terminal of the circuit below.

A constant voltage, VDD, is applied to A.

PMOS ID-VSD characteristics are given below:

If VDD = 4 V, VT = 1 V, W = 5 μm, L = 0.25 μm and µPCOX = 10⁻⁶ A/V², plot the waveform at B.

13. A Set-Reset (SR) latch is given below. This latch should be designed to drive a 100fF capacitive load. The rise and fall times at each node in the circuit are 500 ps. The device technology specs are as follows:

VDD = 3 V

VTN = 0.5 V

VTP = 0.5 V

COX = 10⁻⁸ F/cm²

L = 0.25 µm

µN = 600 cm²/Vsec

µP = 200 cm²/Vsec

Size all the transistors in the circuit. To prevent contention between any two transistors, make sure to adjust the resistance of the transistor being sized to be about 20% of the resistance of the contending transistor.

14. A single ended SRAM cell is given below:

The device technology parameters for the NMOS and PMOS transistors are given below.

COX = 7 × 10⁻⁸ F/cm²

VDD = 3 V

L = 0.25 μm

μN = 200 cm²/Vsec

μP = 100 cm²/Vsec

VTN = VTP = 0.6 V

When WL = 0 V and the pass-gate NMOS transistor, WPASS, is off, the voltage at LOAD node is 3 V, and the voltage at IN node is 0 V (cell stores logic 0). Transistor sizes in both inverters are WP = 2 μm and WN = 1 μm in the SRAM cell.

(a)

Assuming that the pass-gate NMOS transistor acts as a switch with a channel resistance of 0 Ω when it is on, calculate the maximum allowed load capacitance value CL such that the stored bit in the SRAM cell does not accidentally change from logic 0 to 1.

(b)

What is the relationship(s) between transistor sizes to keep the logic state the same in the cell when the pass-gate NMOS transistor has a finite channel resistance when it is turned on? Assume identical rise and fall times at the internal nodes.

15. An NMOS transistor establishes the pass-gate functionality in the circuit below:

The input signal, VIN(t), and ID-VDS for this NMOS transistor are shown below.

Calculate ID from the data given above and plot the absolute value of ID as a function of time.

16.The circuit given below includes two pass-gate NMOS transistors connected in series.

Here, VA(t) and VB(t) are the voltages applied at the gates of the NMOS transistors as shown below:

Compute the nodal voltages, V₁(t) and V₂(t), as a function of time using the device technology below:

VDD = 1 V

VTN = 0.3 V

L = 0.1 µm

µN = 200 cm²/Vsec

COX = 7 × 10⁻⁸ F/cm²

© Springer International Publishing Switzerland 2017

Ahmet BindalElectronics for Embedded Systems10.1007/978-3-319-39439-8_4

4. TTL Logic and CMOS-TTL Interface

Ahmet Bindal1  

(1)

Computer Engineering Department, San Jose State University, San Jose, California, USA

Ahmet Bindal

Email: ahmet.bindal@sjsu.edu

4.1 TTL Inverter

Transistor-Transistor-Logic (TTL) is still used in limited capacity in discrete ICs due to its ability to deliver (or sink) large currents. However, power consumption, slow speed and the cost of fabrication are its main drawbacks. All TTL logic gates are composed of three stages. The simplest TTL logic gate, TTL inverter, is shown in Fig. 4.1.

Fig. 4.1

A simplified TTL inverter

The input stage of this gate contains only a single transistor, Q₁. This transistor is equivalent to two back-to-back diodes as shown in the inset of Fig. 4.1, and this configuration directs the current flow either towards the IN terminal or towards the control stage to activate Q₂ depending on the logic value at the input.

The control stage contains Q₂. Its function is to supply part of its emitter current to saturate Q₃ or turn off this transistor.

The output stage, also called totem-pole configuration, consists of Q₃ and Q₄. Q₃ absorbs all the current (sink current) from an output load. Q₄ supplies current (source current) to an output load. Supply voltage for any commercially available TTL stage is usually 5 V.

TTL Inverter When IN = 5 V

When the input voltage at the IN node is raised to 5 V, there will be no voltage drop across the diode , D₁ (corresponding to the emitter-base junction of Q₁). As a result, D₁ turns off as shown in Fig. 4.2.

Fig. 4.2

Currents and voltages of the TTL inverter when IN = logic 1

Therefore, the current from the voltage supply, VCC , directly flows into the base of Q₂ through D₂ (corresponding to the collector-base junction of Q₁), forming the base current for Q₂, IB2, and driving this transistor into saturation .

When Q₂ is in the saturation region, its collector current , IC2, combines with IB2, and forms the emitter current for Q₂, IE2 = IB2 + IC2. The majority of IE2 flows into the base of Q₃ and drives this transistor into saturation . The remaining part of IE2 flows through R₃, and biases the base-emitter junction of Q₃ with 0.8 V.

As a result of this scenario, the voltage drop between the base of Q₄ and the output terminal becomes 0.2 + 0.6 = 0.8 V. However, this potential difference is not sufficient to turn on Q₄ and the diode at the output stage simultaneously since they require at least 0.8 + 0.7 = 1.5 V. Thus, Q4 turns off.

As a result, IC3 becomes the “sink” current and absorbs all the output current from an external resistor, RL, as shown in Fig. 4.2. This current is also called IOL , corresponding to the low output current when the output is equal to VOL.

TTL Inverter When IN = 0 V

When input voltage at IN is lowered to 0 V, current flows through the diode , D₁ (corresponding to the emitter-base junction of Q₁), and turns on the diode. The voltage developed across this diode, 0.7 V, then becomes equal to the sum of the voltage drops across D₂ (corresponding base-collector junction of Q₁), the base-emitter junction of Q₂ and the base-emitter junction of Q₃. However, 0.7 V is not enough to saturate the transistors, Q₂ and Q₃, and turn on the diode at the same time as shown in Fig. 4.3.

Fig. 4.3

Currents and voltages of the TTL inverter when IN = logic 0

Since Q₂ stays off, the supply current, IB4, flows into the base of Q₄ and saturates this transistor. The collector current of Q₄, IC4, combines with IB4 to form the emitter current for Q₄, IE4. This current becomes the “source” current and flows into an external load resistor, RL, as shown in Fig. 4.3. This current is also called IOH , corresponding to the high output voltage , VOH. However, VOH never reaches the full supply voltage of 5 V, but stays around 3.5 V due to the combined voltage drop between VCC and the OUT terminal, namely R₄ IC4 + 0.2 + 0.7 ≈ 1.5 V.

Example 4.1

There are two ways for a TTL inverter to drive an LED. The circuit configuration depends on the current requirement of the LED, and the relative values of IOH and IOL given in the manufacturer’s datasheet. If the LED requires high current, and IOH happens to be much higher than IOL in the datasheet, then the best way to connect the LED is between the output terminal and the ground as shown in Fig. 4.4. As a result, IOH is used to turn on the LED.

Fig. 4.4

TTL inverter driving LED if IOH is much greater than IOL

The series resistance, RL, is computed as follows:

(4.1)

In this equation, VLED is the voltage drop across the LED.

If the LED requires high current and the TTL manufacturer’s datasheet specifies that IOL is much higher than IOH , then the better circuit configuration would be to connect the LED between the supply voltage and the OUT terminal as shown in Fig. 4.5. That way, IOL of the TTL inverter supplies all the current the LED needs.

Fig. 4.5

TTL inverter driving LED if IOL is much greater than IOH

This time, RL becomes:

(4.2)

If the LED’s current requirement is low and comparable to IOH or IOL , then either circuit configuration in Figs. 4.4 or 4.5 can be used to turn on the LED.

4.2 TTL Inverter with Open Collector

If the TTL inverter’s IOL is much higher than IOH , the output transistor Q₄ may not be necessary at all to operate an LED or some other two-terminal device. This reduces the overall device count in the inverter and forms a much simpler circuit called open-collector inverter as shown in Fig. 4.6. With open-collector configuration, the high logic level also reaches to the full voltage supply value of 5 V instead of staying at 3.5 V.

Fig. 4.6

Open-collector TTL inverter

The operation of open-collector inverter is similar to the operation of a common TTL inverter . However, the open collector of Q₃ will always need a pull-up resistor to operate properly.

Figure 4.7 describes the operation of this logic gate with a pull-up resistor when IN is connected to 5 V. The diode corresponding to the emitter-base junction of Q₁ turns off because there is 0 V across this junction. Q₂ goes into the saturation region with a current flowing in its base, IB2. A large portion of Q₂’s emitter saturation current, IE2, also flows into the base of Q₃ and causes this transistor to go into saturation provided that Q₃ is biased properly with an external load resistance, RL. The output voltage becomes VOL , which is in the order of 0.2 V. IOL becomes the collector current of Q₃. RL is determined in terms of VOL and IOL according to the following equation:

Fig. 4.7

Open-collector TTL inverter driving a CMOS gate when IN = logic 1

(4.3)

When IN = 0 V, the diode corresponding to the emitter-base junction of Q₁ turns on as shown in Fig. 4.8. However, the base of Q₁, now standing at 0.7 V, will not be sufficient to turn on the transistors, Q₂, Q₃ and the diode corresponding to the collector-base of Q₁. The output node is pulled up to VCC . IOH through RL becomes 0 A.

Fig. 4.8

Open-collector TTL inverter driving a CMOS gate when IN = logic 0

Example 4.2

Assume the output of the open-collector inverter in Fig. 4.7 includes an LED in series with RL. The load resistor now serves two purposes: it limits the current through LED and biases Q₃ when this transistor needs to be driven into saturation . Applying IN = 5 V in Fig. 4.9 causes both Q₂ and Q₃ to be in saturation region which produces OUT = VOL. The resulting IOL turns on the LED.

Fig. 4.9

Open-collector TTL inverter driving an LED when IN = logic 1

(4.4)

Then, RL is calculated as

(4.5)

where ILED = IOL.

When IN = 0 V is applied to the open-collector TTL inverter input, both Q₂ and Q₃ turn off, resulting no current flow through the LED as shown in Fig. 4.10. The LED turns off.

Fig. 4.10

Open-collector TTL inverter driving an LED when IN = logic 0

4.3 Two-Input TTL Nand Logic Gate

Two-input TTL NAND gate is shown in Fig. 4.11. In this figure, Q₁ produces two emitter ports each of which is connected to separate external inputs, IN₁ and IN₂.

Fig. 4.11

Two-input TTL NAND gate

Figure 4.12 shows both inputs of the two-input TTL NAND gate connected to 0 V. In this figure, Q₁ has been transformed into three discrete diodes, D₁, D₂ and D₃, to make the circuit analysis simpler. When IN₁ = IN₂ = 0 V, both D₁ and D₃ turn on. However, the voltage drop across either diode will not be sufficient to turn on D₂, Q₂ and Q₃ as discussed earlier. Q₄ is driven into saturation and supplies IOH to an output load. The output of the NAND gate transitions to logic 1.

Fig. 4.12

Two-input TTL NAND gate when IN₁ = IN₂ = logic 0

When one of the inputs of the NAND gate is connected to ground while the other tied to logic 1, only D₃ turns on. Both Q₂ and Q₃ turn off as shown in Fig. 4.13. As a result, Q₄ is driven into saturation and the output transitions to logic 1.

Fig. 4.13

Two-input TTL NAND gate when one of the inputs is at logic 0 (IN₂ = logic 0)

When both inputs of the NAND gate are tied to logic 1, both D₁ and D₃ turn off as shown in Fig. 4.14. The current through R₁ saturates Q₂, and Q₂’s emitter current saturates Q₃. The sum of voltage drops across the collector-emitter junction of Q₂ and collector-base junction of Q₃ now reaches about 0.8 V. However, this voltage becomes insufficient to turn on Q₄ and the output diode . As a result, the output terminal is pulled low to about 0.2 V and sinks any current from an external load.

Fig. 4.14

Two-input TTL NAND gate when IN₁ = IN₂ = logic 1

4.4 Two-Input TTL NOR Logic Gate

Two-input TTL NOR gate is shown in Fig. 4.15. This circuit contains two extra transistors, Q₁₁ and Q₁₂, at the input, and another two, Q₂₁ and Q₂₂, at the control stage, to produce the NOR behavior.

Fig. 4.15

Two-input TTL NOR gate

When both IN₁ and IN₂ are grounded, the diodes, D₁ and D₃ corresponding to the emitter-base junctions of Q₁₁ and Q₁₂, turn on as shown in Fig. 4.16. The voltage drop across either of these diodes will not be sufficient to turn on D₂, D₄, Q₂₁, Q₂₂ and Q₃. The transistor, Q₄, goes into saturation because a large current is supplied to the base of this transistor through R₂. As a result, the emitter current of Q₄ produces a source current to an external load, and the output of the gate is pulled up to logic 1.

Fig. 4.16

Two-input TTL NOR gate when IN₁ = IN₂ = logic 0

When IN₁ is tied to logic 1 and IN₂ at logic 0 (or vice versa), the diode , D₁ corresponding to the emitter-base of Q₁₁, turns off because there is 0 V across it as shown in Fig. 4.17. Q₂₁ goes into saturation because a large current is supplied to the base of this transistor through R₁₁ but Q₂₂ stays off. A large portion of Q₂₁’s emitter saturation current flows into the base of Q₃ and saturates this transistor. In the mean time, the output diode D and Q₄ turn off, leaving Q₃ in charge of sinking all current from an external load and pulling the output terminal to logic 0.

Fig. 4.17

Two-input TTL NOR gate when one of the inputs is at logic 0 (IN₂ = logic 0)

When IN₁ and IN₂ are at logic 1, the diodes , D₁ and D₃ corresponding to the emitter-base junctions of Q₁₁ and Q₁₂, turn off as shown in Fig. 4.18. However, both Q₂₁ and Q₂₂ go into saturation because of large currents supplied to the base of these transistors through R₁₁ and R₁₂, respectively. The sum of emitter saturation currents from Q₂₁ and Q₂₂ drive Q₃ into saturation and lower the output voltage to logic 0. Now, Q₃ is able to sink any current from an external load.

Fig. 4.18

Two-input TTL NOR gate when IN₁ = IN₂ = logic 1

4.5 Input Current and Voltage Measurements of a Logic Gate

It is imperative to know the typical values of input and output terminal currents and voltages of a logic gate in order to eliminate potential electrical problems when interconnecting the gate with other gates to implement a logic block. This especially applies to logic gates fabricated using different technologies, i.e. a TTL gate interfacing a CMOS gate or vice versa.

Figure 4.19 shows the schematic to measure the input terminal current , IIL , and voltage, VIL , when the input is lowered. The potentiometer connected at the input constantly adjusts the value of VIL while the resistor, RPROT, limits the magnitude of IIL. According to this figure, the minimum and maximum values of VIL become equal to RPROT IIL and (RPOT + RPROT) IIL, respectively where RPOT is the maximum potentiometer value.

Fig. 4.19

Input current (IIL) and voltage (VIL) measurements when the input voltage is low

Figure 4.20 shows the setup to measure the input current , IIH , and the voltage, VIH , when the input voltage is high. The potentiometer constantly adjusts the value of VIH while RPROT limits the magnitude of IIH. The minimum and maximum values of VIH become equal to VSUP − (RPOT + RPROT) IIH and VSUP − RPROT IIH, respectively.

Fig. 4.20

Input current (IIH) and voltage (VIH) measurements when the input voltage is high

4.6 Output Current and Voltage Measurements of a Logic Gate

Current and voltage measurements can also be applied to the output terminals of a logic gate. Figure 4.21 shows the setup to measure the output current , IOL , and the output voltage , VOL , when the output is low. Here, RPROT limits the amount of IOL while the potentiometer adjusts the value of VOL. According to this figure, the minimum and maximum VOL can be calculated as VSUP − (RPOT + RPROT) IOL and VSUP − RPROT IOL, respectively.

Fig. 4.21

Output current (IOL) and voltage (VOL) measurements when the output voltage is low

The setup in Fig. 4.22 is used if the output terminal current, IOH , and the output terminal voltage, VOH , need to be measured when the output is high. Here, RPROT limits the amount of IOH while the potentiometer constantly adjusts the value of VOH. According to this figure, the minimum and maximum values of VOH can be calculated as RPROT IOH and (RPOT + RPROT) IOH, respectively.

Fig. 4.22

Output current (IOH) and voltage (VOH) measurements when the output voltage is high

It is very possible to interface an old TTL logic gate with a state-of-the art CMOS logic gate. Logic level adjustment is a critical when interfacing tasks take place between two different logic families. This is mainly because power supply voltages used in each logic family may be different or each logic family may require different input and output logic levels. When interfacing becomes unavoidable, TTL and CMOS gates can be connected either using a passive device such as a resistor or an active device such as a bipolar transistor .

4.7 TTL-CMOS Interface with a Pull-up Resistor

When a TTL gate drives a CMOS gate, an external pull-up resistor , RPU, must be added to the interface to be able to switch the CMOS gate.

Figure 4.23 shows the interface where the TTL inverter input, IN, is at logic 1, and its output produces OUT = 0.2 V. TTL does not have any problem to switch the state of the CMOS inverter at this voltage level. The combination of a transient discharge current from the input of the CMOS inverter and a static current through the pull-up resistor , IPU, determines the maximum sink current value, IOL , of the TTL inverter as shown in Fig. 4.24. The IOL of the TTL inverter is fetched from the manufacturer’s datasheet to calculate RPU . Neglecting IDIS, IOL becomes:

Fig. 4.23

A common TTL gate driving a CMOS gate with a pull-up resistor , RPU

Fig. 4.24

A common TTL gate driving a CMOS gate with RPU when TTL input is at logic 1

(4.6)

Thus,

(4.7)

The CMOS switching becomes an issue when the TTL input is at logic 0 as shown in Fig. 4.25. In this case, the TTL output can produce a voltage in the neighborhood of 3.4–3.5 V. This voltage is more than enough to drive another common TTL gate. However, it may not be sufficient to drive a CMOS gate operating with a 5 V voltage supply. In general, CMOS gates require inputs well above their gate threshold voltage to be able to change the state of their output. Therefore, Q₄ will contribute delivering current to the input capacitance of the CMOS gate up until OUT reaches at 3.4 V. But, charging the input capacitance of the CMOS gate beyond 3.4 V is performed solely by the current through the pull-up resistor , IPU, until the voltage across the capacitor eventually reaches 5 V.

Fig. 4.25

A common TTL gate driving a CMOS gate with RPU when TTL input is at logic 0

Example 4.3

Assume that a TTL inverter operates with VCC  = 5 V and needs to drive several CMOS inverters, all operating with VDD = 5 V. Design a passive interface so the TTL inverter has the capability to drive multiple CMOS inverters.

The DC specifications for both parts are given in Fig. 4.26. According to this table, the TTL inverter cannot drive CMOS inverter(s) because the typical VOHTTL = 3.4 V is less than the minimum value of VIHCMOS = 4 V. Therefore, a pull-up resistor must be included between the gates as a passive interface . The low level voltages are compatible since VOLTTL = 0.25 V is below the maximum VILCMOS = 1 V.

Fig. 4.26

DC parameter diagram for the TTL and CMOS inverters

When the output of the TTL inverter is at logic 0, one can calculate the minimum value of RPU using Eq. 4.8.

(4.8)

RPU can be increased as high as 1 KΩ. However, this produces a static current of IOLTTL of 4.75 mA while the remaining current, 8 mA – 4.75 mA = 3.25 mA, is reserved to accommodate transient discharge currents from CMOS inverter input capacitor(s).

When the TTL inverter output switches to logic 1 (only about 3.4 V), the additional current to charge input capacitance of CMOS inverter(s) from 3.4 to 5 V will be through RPU. This passive charge path creates a time constant of τ = RPU CCMOS where CCMOS is the total input capacitance of CMOS inverter(s). Using smaller RPU values decreases this transient period at the expense of more power consumption.

Another important consideration in the interface design is the output current capability of the TTL inverter . One can compute both the high and low fan-out values, NH and NL, as follows:

and

According to this calculation, the TTL inverter can support up to 4000 CMOS inverters at its output.

4.8 TTL-CMOS Interface with a Bipolar Transistor

When a TTL gate drives a CMOS gate, an external active device , such as an NPN bipolar transistor shown in Fig. 4.27, can be used to adjust the required input voltage levels for the CMOS gate. However, using an active device, such as an NPN transistor in the interface , also introduces an extra layer of inversion between the TTL and the CMOS gates, requiring design modifications in the original design for correct logic functionality.

Fig. 4.27

A common TTL gate driving a CMOS gate with an NPN bipolar transistor

When IN = 5 V is applied to the TTL input, OUT becomes 0.2 V, which turns off the NPN transistor at the TTL-CMOS interface . The supply current, ICHAR, through RC charges the input capacitor of the CMOS gate to 5 V as shown in Fig. 4.28.

Fig. 4.28

A TTL gate driving a CMOS gate with an NPN when TTL input is at logic 1

Figure 4.29 examines the case when IN = 0 V at the TTL inverter’s input. The TTL output becomes about 3.4 V, which is more than enough to saturate the NPN transistor at the interface.

Fig. 4.29

A TTL gate driving a CMOS gate with an NPN when TTL input is at logic 0

Therefore, we have:

(4.9)

or,

(4.10)

Replacing OUT with VOH yields the value for RB. Thus,

(4.11)

Also,

(4.12)

or

(4.13)

In order to find ICSAT in Eq. 4.13, we need to locate the IB-curve that corresponds to IOH = IBSAT in the I-V characteristics in Fig. 4.30 as the step no. 1.

Fig. 4.30

Load line rotation of the bipolar circuit at the interface

However, we know that

(4.14)

Therefore, in step no. 2 we locate the IB-curve that corresponds to IBACT in Fig. 4.30. In step no. 3, we draw a load line that intersects the IBACT-curve at VCE = VCEMAX/2. This intersection is the quiescent point, QACT, for the transistor operating in the middle of active region, and produces ICACT. In step no. 4, we rotate the active-region load line counterclockwise around VCEMAX until the new load line intersects the IBSAT-curve at ICACT. The new quiescent point, QSAT, switches transistor operation from active region to saturation region. The value of ICSAT can now be used in Eq. 4.13.

Note that the multiplier, 10, used to define the ratio between IBSAT and IBACT in Eq. 4.14 is a conservative number and creates high static power consumption when the NPN transistor is on at the interface. Multipliers in the order of 2 or 3 can be more realistic to achieve lower the power consumption.

Example 4.4

Assume that a high-voltage TTL device operating with a power supply voltage of VCC  = 30 V needs to drive a CMOS gate(s) with a supply voltage of VDD = 3 V as shown in Fig. 4.31.

Fig. 4.31

Block diagram of a high voltage TTL device driving CMOS gate(s)

The nominal high and low output logic levels of the TTL device are VOH = 20 V and VOL = 0 V, respectively. The TTL device can generate up to IOH  = 100 mA source and IOL = 100 mA sink currents for an external load. The CMOS gate, on the other hand, needs to have a minimum VIH = 2 V and a maximum of VIL of 1 V to operate. However, the nominal CMOS input voltage levels are VIH  = 3 V and VIL  = 0 V at which the CMOS gate draws approximately IIH  = IIL  = 1 µA as shown in this figure.

How can one design an interface between the TTL device and the CMOS gate using (a) a passive network and (b) an active NPN bipolar transistor that can transform the voltage levels?

The first task is to use passive elements, such as resistors, at the interface. When the TTL device produces VOH = 20 V, the CMOS gate can only accommodate a maximum of VIH = 3 V. If we use a passive pull-up resistor at the interface for logic translation, the TTL high output voltage appears directly at the input of the CMOS gate and burn the device. Therefore, the only other choice is to use a step-down resistor network composed of R₁ and R₂ as shown in Fig. 4.32.

Fig. 4.32

Passive interface design when TTL device produces high output

Therefore,

VOH = (R₁ + R₂) IOH since the input impedance of the CMOS gate approaches infinity.

Substituting the values of VOH and IOH yields:

or

(4.15)

However,

(4.16)

or

(4.17)

Thus,

(4.18)

Figure 4.33 shows the opposite case when the TTL output becomes VOL = 0 V, and sinks 100 mA current emanating from the interface. However, this case does not provide additional information in calculating anything else but identifying the transient properties of the interface composed of IOL and the total input capacitance of CMOS gate(s), leading to the calculation of TTL-fanout.

Fig. 4.33

Passive interface design when TTL device produces low output

The result of using resistive network creates a static power consumption of IOH VOH = 2 W, which is quite high to be able to use resistors.

The next design suggests using a NPN bipolar transistor at the interface to adjust the current and voltage levels. However, the inclusion of this device also inverts the TTL output and requires redesigning the logic functionality.

When TTL output produces VOH = 20 V and IOH = 100 mA as shown in the equivalent circuit in Fig. 4.34, the bipolar transistor at the interface goes into saturation . IBSAT becomes equal to IOH .

Fig. 4.34

Active interface design when TTL device produces high output

Thus,

(4.19)

20 − 0.8 = RB 100 mA

(4.20)

Similarly,

(4.21)

(4.22)

However, to keep the bipolar transistor in saturation one needs:

(4.23)

A conservative approach is to make IBSAT 10 times higher than IBACT. However, the use of smaller multipliers, such as 2 or 3, is possible depending on the transistor output I-V characteristics as discussed earlier. Thus,

(4.24)

Substituting the values for IBSAT = 100 mA, and $$ \text{I}_{{\text{CACT}}} \approx \text{I}_{{\text{CSAT}}} $$, and Eq. 4.22 into Eq. 4.24 yields:

(4.25)

For β = 100

(4.26)

Figure 4.35 illustrates the case where the TTL device output produces VOL = 0 V and IOL = 100 mA, which turns off the bipolar transistor . No further design data can be obtained from this case.

Fig. 4.35

Active interface design when TTL device produces low output

4.9 CMOS-TTL Interface with a Pull-Down Resistor

When a CMOS gate drives a TTL gate, the high logic output of the CMOS gate does not create an issue for the input circuitry of the TTL gate. The problem arises only when the output of the CMOS gate needs to lower the input of the TTL gate towards logic 0, and in the process, it needs to drain a large input current from the TTL gate. An external pull-down resistor , RPD, helps sinking the large TTL input current and eventually causes the TTL gate to switch its state as shown in Fig. 4.36.

Fig. 4.36

CMOS inverter driving a TTL gate with a passive pull-down resistor

When the CMOS input voltage is 5 V, the NMOS transistor turns on with an equivalent resistance of RN as shown in Fig. 4.37. The diode corresponding to the emitter-base junction of Q₁ turns on. In case the output current sinking capability of the CMOS gate is much smaller than the input current generated by the TTL gate, the pull-down resistor , RPD, creates an extra drainage channel for the TTL input current as shown in Fig. 4.37. RPD is determined as follows:

Fig. 4.37

CMOS inverter driving a TTL gate with RPD when CMOS input is at 5 V

(4.27)

Here, VILTTL and IILTTL are the low input voltage and the low input current of the TTL gate, respectively. IOLCMOS is the low output current of the CMOS gate.

When the CMOS input voltage is 0 V, the PMOS transistor of the CMOS gate turns on and exhibits an equivalent resistance, RP, as shown in Fig. 4.38. Since the diode corresponding to the emitter-base junction of Q₁ turns off, the output voltage becomes:

Fig. 4.38

CMOS inverter driving a TTL gate with RPD when CMOS input is at 0 V

(4.28)

OUT approaches to VCC  = 5 V as long as RPD ≫ RP.

4.10 CMOS-TTL Interface with a Bipolar Transistor

When a CMOS gate drives a TTL gate, especially with a different supply voltage, it may be prudent to use an NPN transistor at the interface in order to translate the output voltage levels of the CMOS gate for the input voltage levels of the TTL gate as shown in Fig. 4.39. However, the bipolar circuit also creates a logic inversion as indicated previously.

Fig. 4.39

CMOS inverter driving a TTL gate with an NPN bipolar transistor

Figure 4.40 shows when IN = 0 V is applied to the input of the CMOS inverter. Since the output of the CMOS inverter reaches 5 V, the NPN transistor at the interface saturates. Therefore, one must satisfy IBSAT ≫ IBACT for this transistor to enter into the saturation region.

Fig. 4.40

CMOS inverter driving a TTL gate with a bipolar transistor when IN = 0 V

Using a conservative multiplication factor of 10, $$ \text{I}_{{\text{BSAT}}} \approx \text{10I}_{{\text{BACT}}} $$.

Thus,

(4.29)

However,

(4.30)

and

(4.31)

Here, IOHCMOS is the high output current of the CMOS gate, and VILTTL and IILTTL are the low input voltage and input current of the TTL gate, respectively.

Substituting the values of IBSAT in Eq. 4.30 and ICSAT ≈ ICACT in Eq. 4.31 in Eq. 4.29 yields:

(4.32)

Reorganizing the terms in Eq. 4.32 yields:

(4.33)

RB is selected as follows:

(4.34)

Here, VOHCMOS is the high output voltage of the CMOS gate. Then,

(4.35)

When IN = 5 V, the output voltage of the CMOS gate becomes equal to VOLCMOS as shown in Fig. 4.41. However, this voltage is not sufficient to turn on the interfacial bipolar transistor . Therefore, the NPN transistor’s collector reaches 5 V and turns off the diode corresponding to the emitter-base junction of Q₁ in the TTL gate.

Fig. 4.41

CMOS inverter driving a TTL gate with a bipolar transistor when IN = 5 V

Review Questions

1. Determine R₁, R₂, R₃ and R₄ resistors in a TTL inverter with the following I/O characteristics. Use β = 100 for all four NPN transistors. Assume VCC = 5 V.

2. Determine R₁, R₂ and R₃ resistors in an open collector TTL inverter with the following I/O characteristics. Use β = 100 for all four NPN transistors. Assume VCC = 20 V.

3. Implement out = A ⊕ B in a TTL logic gate using discrete gates. Try to implement the same logic function in an integrated form using a single gate.

4. A CMOS inverter with 3 V power supply needs to be interfaced with a TTL inverter with 12 V power supply as shown below. The interface is an active interface composed of an NPN transistor and resistors operating with 12 V power supply. The NPN bipolar transistor has a current gain of β = 100, and it goes into saturation if IBSAT ≈ 10IBACT.

The output current and voltage ratings of the CMOS inverter and input current and voltage ratings of the TTL inverter are shown below.

Find the resistor values connected to the base and the collector of the NPN transistor in this active interface. Apply both high (3 V) and low logic values (0 V) at the input of the CMOS gate, and check the voltage levels at the interface.

5. A bipolar circuit with an emitter resistance, RE, below is used to feed two CMOS inputs. TTLOUT port has the following characteristics:

Determine the resistors RB, RC and RE. What are the current and voltage levels at CMOSIN1 and CMOSIN2 ports? According to your calculations, can CMOSIN2 port be used to change the state of a CMOS gate?

© Springer International Publishing Switzerland 2017

Ahmet BindalElectronics for Embedded Systems10.1007/978-3-319-39439-8_5

5. Physics of Sensors

Ahmet Bindal1  

(1)

Computer Engineering Department, San Jose State University, San Jose, California, USA

Ahmet Bindal

Email: ahmet.bindal@sjsu.edu

5.1 Thermocouple

The temperature sensing in embedded systems is achieved by a device called thermocouple . The basic thermocouple structure consists of a junction of two metals with different work functions , Ψ₁ and Ψ₂, as shown in Fig. 5.1. Work function is an energy level between the conduction band of the metal and the vacuum level and changes with temperature. When two metals are welded together, electrons from the metal with lower work function transfer to the metal with the higher work function due to the difference in the conduction band energy levels as shown in Fig. 5.2. When the equilibrium is reached, temperature variations will change the amplitude of the work function difference, (Ψ₁ − Ψ₂), and cause galvanometric voltage drop between the two metals as shown in Fig. 5.3.

Fig. 5.1

Metal work functions to create a thermocouple

Fig. 5.2

Transfer of electrons due to the conduction energy difference between metals

Fig. 5.3

Galvanometric voltage drop after equilibrium is reached

The work function difference is recorded as a function of temperature for the two metals used in the thermocouple . Therefore, when a certain voltage is read between the two thermocouple terminals, the corresponding reading identifies the ambient temperature.

The equivalent circuit of the thermocouple is indicated in Fig. 5.4 where the equivalent resistance is in milliohms. VG(T) corresponds to the difference in work functions as a function of temperature and it is usually in millivolts range.

Fig. 5.4

Equivalent circuit of the thermocouple

5.2 Photodiode

Photodiode is a two-terminal semiconductor device composed of N and P-type semiconductors much like a rectifying diode as shown in Fig. 5.5. Once a junction is formed, electrons flow from the N-type to the P-type semiconductor until the Fermi levels (EF) of both sides become equal. This makes the valance (EV) and conduction bands (EC) bend across the junction to form a basic diode as shown in Fig. 5.6.

Fig. 5.5

N and P-type semiconductors

Fig. 5.6

N and P-type semiconductors after forming the PN junction

This device is designed to operate with a reverse bias voltage applied across its terminals as shown in Fig. 5.7, and it produces a short circuit current, ISC, composed of dark current, IDARK, and photon -generated current, IPH. The basic biasing and operation of the device are shown in Fig. 5.8. When the junction is reverse-biased with a voltage equal to V, the Fermi level on the P-side of the junction raises by an amount qV. This causes thermally generated minority carriers (holes in N-type semiconductor and electrons in P-type semiconductor ) to be pushed towards the junction and combine there. The overall process forms a reverse saturation current across the junction. With the increase in temperature more electron-hole pairs are created, increasing the reverse saturation current. The same effect can occur by illuminating the junction with a light source. When light energy is exposed to the PN junction, more electrons in the valance band make the transition to the conduction band in proportion to the light intensity, increasing the level of reverse saturation current as shown in Fig. 5.9. The dark current is essentially the reverse saturation current when no light is present, and equivalent to the minority carrier conduction when only thermal effects are present.

Fig. 5.7

Photodiode biasing circuit

Fig. 5.8

N and P-type semiconductors after reverse bias is applied to the PN junction

Fig. 5.9

Photodiode I-V characteristics as a function of light intensity

5.3 Solar Cell

Solar cell is not considered a sensor but it is another optical device that may be useful in an embedded system. The device requires no external voltage source and essentially a PN junction diode as shown in Fig. 5.6.

When the PN junction is illuminated with a light beam, electrons in the valance band transition to the conduction band and leave holes behind as shown in Fig. 5.10. The majority carriers (electrons in the N-type semiconductor and the holes in P-type semiconductor ) have a very brief lifetime and recombine. The minority carriers, however, have a lot longer lifetime which enables them to move towards the junction because of the energy band bending in the band structure. When they arrive at the junction, they recombine. This process gives rise to a light-generated current and production of photovoltaic voltage as shown in Fig. 5.11.

Fig. 5.10

Light illumination at the PN junction and the resulting electron-hole pairs

Fig. 5.11

Photovoltaic voltage drop between P and N regions as a result of light illumination

The resulting equivalent circuit of a photodiode exhibits constant current source characteristics, IP, in proportion to the light intensity, and a large parallel resistance, RP, as shown in Fig. 5.12.

Fig. 5.12

Equivalent circuit of solar cell

5.4 Photo-resistor

Detection of light can also be achieved using a photo-resistor as shown in Fig. 5.13. In normal conditions where light is not present, the photo-resistor slab shows low conductivity due to the lack of surface electrons .

Fig. 5.13

Photo-detector made out of a photo-resistor

When a beam of light is exposed on a photo-resistive material shown in Fig. 5.14, photons are absorbed by the material, and electron-hole pairs are generated. Surface electrons (minority carriers) increase the conductivity of the material between the two terminals of the device, giving rise to a photonic drift current.

Fig. 5.14

Photo-resistor under light produces more surface electrons

5.5 Piezoelectric Materials and Accelerometers

Accelerometers measure mass movement in specific directions. Figure 5.15 describes the use of piezoelectric resistor to measure the mass movement. If one end of the piezoelectric material is kept fixed while the other end is attached to a moving mass which moves freely, the tensile stress will bend the material and induce a change in conductivity. When the difference in conductivity is measured, the applied stress and the amount of mass movement can be correlated and quantified.

Fig. 5.15

Piezoelectric -resistor under no tensile stress (top) and under stress (bottom)

Figure 5.16 shows the true structure of the piezoelectric resistor where the piezoelectric bridges in serpentine form are laid on a fixed and floating semiconductor slabs. As the sensitive axis moves because of the movement in semiconductor slab, the change in the piezoelectric bridge conductivity is recorded as shown in the figure. Since this measurement is directly proportional to the motion of the slab, it produces how much and how fast the slab moves along the sensitive axis.

Fig. 5.16

Piezoelectric -resistor on moving semiconductor slab under stress

The same structure in Fig. 5.16 can be laid out to measure the movement in three different axes and provide valuable information for systems detecting the stability of a structure.

Accelerometers can also be based on differential capacitance measurements. Such an accelerometer is shown by the top figure in Fig. 5.17. This time the moving mass floats between two fixed plates as shown in the figure, and allowed to move in one direction. As the slab movement takes place, the gap between the first pair of plates decreases in relation to the other. Since capacitance is inversely proportional to the distance between the plates, the change in capacitance produces how much and how fast the floating mass moves. Here, d₁ and d₂ correspond to the distance between the first and second parallel plates . A is the area of each plate, and ε is the dielectric constant.

Fig. 5.17

Movement detection by differential capacitance measurement method

To increase the accuracy of the slab’s movement further, the capacitance values, C₁ and C₂, are measured and amplified simultaneously by a differential amplifier as shown by the bottom figure in Fig. 5.17.

5.6 Hall-Effect Devices

Hall-Effect devices operate with the presence of a magnetic field and form a very useful device for embedded systems. The basic idea behind the Hall-effect device is the formation of Hall-voltage when the device is exposed to a magnetic field. When there is no magnetic field, electrons drift according to the direction of the electric field produced by VD as shown in Fig. 5.18. The lateral voltage, VH, measured between the two ends of the semiconductor will be 0 V.

Fig. 5.18

Hall-effect device with no magnetic field (VH = 0 V)

However, when a magnetic field, B, is applied perpendicular to the semiconductor surface as shown in Fig. 5.19, the conducting electrons are diverted from their original path by a lateral force field and accumulate on one side of the semiconductor slab according to the equation below.

Fig. 5.19

Hall-effect device with magnetic field (VH > 0 V)

Here, F is the magnetic force exerted on the electron, q is the electronic charge and v is the velocity of the electron. As a result of this accumulation, VH forms between the two ends of the slab perpendicular to the electric field. This voltage is called Hall voltage and increases with the applied magnetic field.

© Springer International Publishing Switzerland 2017

Ahmet BindalElectronics for Embedded Systems10.1007/978-3-319-39439-8_6

6. Operational Amplifiers and Circuits

Ahmet Bindal1  

(1)

Computer Engineering Department, San Jose State University, San Jose, California, USA

Ahmet Bindal

Email: ahmet.bindal@sjsu.edu

6.1 Operational Amplifier Properties

Operational amplifiers are general purpose, dual input, single output devices that exhibit high input impedances , low output impedances and generate large gains within its frequency bandwidth.

Important characteristics of an operational amplifier are shown in Fig. 6.1. The input currents, I₁ and I₂, of this amplifier are very close to 0 A because of the high impedance at negative and positive input terminals. A milli-volt range voltage difference between the input terminals, (VIN1 − VIN2), can saturate the output of the operational amplifier to either its positive or negative power supply voltage value depending on the polarity of (VIN1 − VIN2). However, we can approximate this potential difference to be 0 V for the purposes of simple circuit analysis.

Fig. 6.1

Characteristics of an operational amplifier

6.2 Voltage Amplifier Circuits for Sensors

Inverting Voltage Sensor Amplifier

The following operational amplifier circuit in Fig. 6.2 produces voltage amplification , which results an inverted output, if one of the sensor terminals needs to be grounded. Figure 6.3 shows the current and voltage assignments of the circuit in Fig. 6.2 prior to circuit analysis.

Fig. 6.2

Inverting voltage sensor amplification circuit if one sensor terminal needs to be grounded

Fig. 6.3

Current and voltage assignments of the inverting sensor amplifier in Fig. 6.2

(6.1)

(6.2)

Substituting $$ {\text{I}} = \frac{{{\text{V}}_{\text{SEN}} }}{{{\text{R}}_{ 1} }} $$ into Eq. 6.2 yields:

(6.3)

Non-inverting Voltage Sensor Amplifier

The operational amplifier circuit in Fig. 6.4 produces voltage amplification with a non-inverted output if one sensor terminal needs to be grounded. Figure 6.5 shows the current and voltage assignments of the circuit in Fig. 6.4 prior to circuit analysis.

Fig. 6.4

Non-inverting voltage sensor amplification circuit if one of the sensor terminals needs to be grounded

Fig. 6.5

Current and voltage assignments of the inverting sensor amplifier in Fig. 6.4

Therefore,

(6.4)

(6.5)

Substituting $$ {\text{I}} = - \frac{{{\text{V}}_{\text{SEN}} }}{{{\text{R}}_{ 1} }} $$ into Eq. 6.5 yields:

(6.6)

Isolation Circuit with Unity Gain

Figure 6.6 represents the isolation circuit if the sensor requires very large input impedance before being interfaced to another circuitry. This circuit practically eliminates any output loading (isolation) on the sensor. One terminal of the sensor has to be grounded in order to use the isolation circuit .

Fig. 6.6

Isolation circuit with unity gain

The only equation available for this circuit is:

(6.7)

(6.8)

Voltage Sensor Amplifier with Signal and Reference Inputs

If the sensor output needs to be compared against a reference voltage, a differential amplifier circuit in Fig. 6.7 is used. This circuit produces a differential amplification of the input signals, (VSEN − VREF), provided that one of the sensor (and the reference signal ) terminals is connected to ground. Figure 6.8 shows the current and voltage assignments of the circuit in Fig. 6.7 prior to circuit analysis.

Fig. 6.7

Voltage sensor amplification with a reference voltage if one sensor terminal is grounded

Fig. 6.8

Current and voltage assignments of the sensor amplifier in Fig. 6.7

(6.9)

(6.10)

(6.11)

From Eq. 6.11,

(6.12)

Substituting Eq. 6.12 into Eq. 6.10 yields:

(6.13)

or

(6.14)

Finally, substituting Eq. 6.14 into Eq. 6.9 yields:

(6.15)

Reorganizing the terms in this equation produces:

Thus,

(6.16)

If R₁ = R₃ and R₂ = R₄, then Eq. 6.16 simplifies as:

(6.17)

In Eq. 6.17, the amplification is adjusted by the ratio of $$ \frac{{{\text{R}}_{ 2} }}{{{\text{R}}_{ 1} }} $$.

Summation Voltage Sensor Amplifier

It is possible to add two sensor inputs according to Fig. 6.9 provided that both sensors have one of their terminals grounded. Figure 6.10 shows the current and voltage assignments of the circuit in Fig. 6.9 prior to circuit analysis.

Fig. 6.9

Summation voltage sensor amplifier if one of the sensor terminals is grounded

Fig. 6.10

Current and voltage assignments of the summation sensor amplifier in Fig. 6.9

(6.18)

(6.19)

(6.20)

Eliminating I₁ and I₂ in Eqs. 6.18, 6.19 and 6.20 results in:

(6.21)

The output voltage in Eq. 6.21 forms the inverted sum of the sensor voltages, VSEN1 and VSEN2, with a amplification factor of $$ \frac{{{\text{R}}_{ 2} }}{{{\text{R}}_{ 1} }} $$.

Voltage Sensor Amplifier with Ungrounded Sensor Terminals

If neither of the sensor terminals can be grounded, then the circuit in Fig. 6.11 is used to obtain an amplified but an inverted sensor signal at the output. This schematic is similar to the differential amplifier schematic in Fig. 6.7; however, the sensor in this circuit is not grounded. The resistors, R₃ and R₄, are also replaced with the resistors, R₁ and R₂, respectively.

Fig. 6.11

Voltage amplification of a sensor if no sensor terminal is grounded

Figure 6.12 shows the current and voltage assignments of the circuit in Fig. 6.11 prior to circuit analysis. In this circuit, the voltage drop at the input of the operational amplifier is assumed 0 V. Similarly, the currents going to the positive and negative input terminals of the operational amplifier are assumed to be very close to 0 A.

Fig. 6.12

Current and voltage assignments of the sensor amplifier in Fig. 6.11

Therefore, from Fig. 6.12 we have:

or

(6.22)

We also have:

(6.23)

Substituting Eq. 6.23 into Eq. 6.22 yields:

or

(6.24)

Equation 6.24 shows the sensor voltage at the input of Fig. 6.11 is inverted and amplified with a ratio of $$ \frac{{{\text{R}}_{ 2} }}{{{\text{R}}_{ 1} }} $$.

6.3 Trans-resistance Amplifier Circuits for Sensors

Trans-resistance amplifiers are for sensors that generate current instead of voltage. These sensors are usually opto-electronic devices such photodiodes, photo-detectors and solar cells. These specialty amplifiers are designed to convert microampere-range currents into voltages.

Inverting Trans-resistance Sensor Amplifier

The operational amplifier circuit in Fig. 6.13 produces inverted sensor amplification if one sensor terminal is grounded. Figure 6.14 shows the current and voltage assignments of the circuit in Fig. 6.13 prior to circuit analysis.

Fig. 6.13

Inverting trans-resistance sensor amplifier if one sensor terminal is grounded

Fig. 6.14

Current and voltage assignments of the trans-resistance amplifier in Fig. 6.13

The Kirchoff’s voltage law for this circuit becomes:

(6.25)

Therefore,

(6.26)

Here, the input sensor current, ISEN, is inverted and amplified by the magnitude of R at the output.

Non-inverting Trans-resistance Sensor Amplifier

The following operational amplifier circuit in Fig. 6.15 produces non-inverted sensor amplification if one sensor terminal is grounded. This circuit basically combines the inverting trans-resistance amplifier in Fig. 6.13 and the inverting voltage amplifier in Fig. 6.2 with unity gain .

Fig. 6.15

Non-inverting trans-resistance sensor amplifier if one sensor terminal is grounded

Repeating Eq. 6.26 for the first stage yields:

For the second stage, we have:

(6.27)

Substituting VINT in Eq. 6.27 yields:

(6.28)

6.4 Analog Voltage Comparator

Voltage comparators are used to compare two analog inputs to produce an output signal either equal to the positive voltage supply of the operational amplifier or to 0 V (the negative voltage supply can be 0 V or a negative value depending on the operational amplifier datasheet). Figure 6.16 shows the circuit diagram of a comparator. Here, voltage levels at the N and P inputs are compared with each other. If the voltage at P becomes larger than N, VOUT transitions to VCC, and the LED turns on. Otherwise, VOUT stays at 0 V, and the LED turns off.

Fig. 6.16

Basic comparator circuit

A good application of a voltage comparator is a voltage monitoring circuit. Suppose we want to monitor the changes in the 2.5 V CPU power supply voltage constantly, and generate a reset signal if the supply voltage drops below 2 V.

A circuit shown in Fig. 6.17 can be used as a voltage monitor. In this circuit, a Zener diode with a value of 1.25 V is connected in series with RZ, which provides the biasing current for the diode. The voltage at the negative terminal of the operational amplifier must also be set at 1.25 V by R₁ = R₂. Thus,

Fig. 6.17

A voltage monitor circuit

(6.29)

Now, if VCC drops below 2.5 V, such as 2 V, VS proportionally changes:

Since this voltage is less than VZ = 1.25 V, Reset output in Fig. 6.17 switches to 2.5 V and resets the CPU.

6.5 Schmitt Trigger

Most TTL and CMOS logic gates require fast high and low logic transitions at their inputs. If the edges of the input signal are too slow to rise or fall, excessive current drainage, even uncontrolled oscillations at the output of a logic gate become possible. Schmitt triggers are used to remove slow transitions or noisy edges from signals and transform them into forms that will meet the input rise and fall time specifications of a logic gate.

A normal Schmitt trigger produces a low-to-high logic transition at a logic level much higher than the threshold voltage of a gate. Similarly, a high-to-low transition in the Schmitt trigger occurs at a logic level much lower than the threshold voltage of a gate. This creates hysteresis at the output of the Schmitt trigger despite noise-free and sharp logic transitions.

The basic Schmitt trigger circuit is shown in Fig. 6.18. In this figure, the output of the device transitions from one supply voltage (+VCC or –VCC) to the next as soon as the input voltage exceeds a set voltage limit. Schmitt trigger operates under the same principle of the voltage comparator . However, it compares the input voltage against two set values instead of one, and its feedback loop ensures that a portion of the output value is always taken into account when the comparison is performed at the input.

Fig. 6.18

Basic Schmitt trigger

We can adjust and set the voltage values in a Schmitt trigger by adjusting the values of R₁, R₂ and R₃.

If I₁, I₂ and I₃ are the currents passing through R₁, R₂ and R₃ in Fig. 6.18, then we can write the following:

(6.30)

However,

(6.31)

(6.32)

(6.33)

Substituting Eqs. 6.31, 6.32 and Eq. 6.33 into Eq. 6.30 yields:

If we define $$ \frac{ 1}{{{\text{R}}_{ 1 2 3} }} = \frac{ 1}{{{\text{R}}_{ 1} }} + \frac{ 1}{{{\text{R}}_{ 2} }} + \frac{ 1}{{{\text{R}}_{ 3} }} $$, then

(6.34)

If VOUT = +VCC then VF becomes:

(6.35)

Similarly,

If VOUT = −VCC then VF becomes:

(6.36)

Here, VFPOS and VFNEG are the two feedback voltages at the output terminal when VOUT = +VCC and VOUT = −VCC, respectively.

In this example, let us set the voltage level for the low-to-high logic transition to 3.3 V, and for the high-to-low logic transition to 0 V for an input voltage that swings between +5 V and −5 V. Therefore, we choose:

Then:

The operation and the output waveform generation of the Schmitt trigger are explained in Fig. 6.19 according to these numerical values. If VIN is less than the first set value, VFPOS = 3.3 V, then VOUT transitions to +VCC = 5 V. For input voltages greater than 3.3 V, VOUT transitions to −VCC = −5 V, and VF becomes VFNEG = 0 V. Here, VOUT stays at −5 V until VIN drops below the second set value, 0 V. As soon as VIN is less than 0 V, VOUT transitions back to +VCC = 5 V, and VF becomes VFPOS = 3.3 V. The next output change to −5 V does not take place until VIN reaches above 3.3 V.

Fig. 6.19

Schmitt trigger input and output waveforms

6.6 Square Waveform Generator

Operational amplifiers are excellent candidates to generate square waveforms with varying duty cycles. The circuit in Fig. 6.20 generates a square waveform at VOUT based on an RC feedback circuit.

Fig. 6.20

Square wave generator circuit

Suppose the operational amplifier has dual power supplies at +VCC and −VCC. Assume that the initial value of VOUT = +VCC and VSIG = −VCC since the output changes between +VCC and −VCC. When VOUT = +VCC, VREF becomes:

(6.37)

When VSIG departs from −VCC and approaches towards +VCC with a time constant of RC, it produces the following expression:

(6.38)

However, as soon as VSIG climbs above $$ {\text{V}}_{\text{REF}} = \frac{{{\text{R}}_{\text{F}} }}{{{\text{R}}_{\text{F}} {\text{ + R}}_{\text{O}} }}{\text{V}}_{\text{CC}} $$, VOUT changes its polarity and it becomes −VCC. Now, the accumulated charge on the capacitor starts discharging through R and the operational amplifier’s output impedance . As a result, VSIG starts decreasing from $$ \frac{{{\text{R}}_{\text{F}} }}{{{\text{R}}_{\text{F}} + {\text{R}}_{\text{O}} }}{\text{V}}_{\text{CC}} $$ towards −VCC with the same time constant, RC. Thus,

(6.39)

This discharge cycle continues until VSIG reaches a new VREF value, $$ - \frac{{{\text{R}}_{\text{F}} }}{{{\text{R}}_{\text{F}} + {\text{R}}_{\text{O}} }}{\text{V}}_{\text{CC}} $$, at which the output changes its polarity again to +VCC. With VOUT = +VCC, VREF transitions back to $$ \frac{{{\text{R}}_{\text{F}} }}{{{\text{R}}_{\text{F}} + {\text{R}}_{\text{O}} }}{\text{V}}_{\text{CC}} $$. Now, VSIG starts increasing from $$ - \frac{{{\text{R}}_{\text{F}} }}{{{\text{R}}_{\text{F}} {\text{ + R}}_{\text{O}} }}{\text{V}}_{\text{CC}} $$ towards +VCC, but stops at $$ \frac{{{\text{R}}_{\text{F}} }}{{{\text{R}}_{\text{F}} + {\text{R}}_{\text{O}} }}{\text{V}}_{\text{CC}} $$ because the output transitions to −VCC as mentioned previously. The waveforms at VSIG and VOUT are shown in Fig. 6.21.

Fig. 6.21

VSIG and VOUT waveforms of the square wave generator in Fig. 6.20

Review Questions

1. Determine the amplification, $$ {{{\text{V}}_{\text{OUT}}( {\text{t)}}}}/{{{\text{V}}_{\text{S}}( {\text{t)}}}} $$, in the circuit below.

The operational amplifier is non-ideal, and there is a voltage drop between the negative and positive input terminals, Δv, as shown in the figure. The amplifier has also a limited gain, A, between its differential input, Δv, and its output, VOUT(t).

2. Assuming the operational amplifier is ideal in the circuit below, find the output voltage, VOUT(t), in terms of VIN(t) and VREF(t).

3. Assuming the operational amplifier in the circuit below is ideal, find the output voltage, VOUT(t), in terms of VIN(t) using time-domain analysis. Plot the output voltage as a function of time if a square wave is applied at its input as shown below. The value of V in the input waveform is assumed to be smaller than the power supply voltage of the operational amplifier.

4. The following circuit shows a non-ideal operational amplifier where there is the voltage drop, Δv, between the positive and negative input terminals. Also, the amplifier exhibits a limited voltage gain, A, between its differential input and output. However, the input impedance, RIN, at each input terminal is considerably high, approaching infinity. Thus, the current going into any input terminal is assumed to be 0 A.

(a)

Find the overall voltage gain, VOUT(t)/VIN(t), of the circuit.

(b)

Now, assume the operational amplifier is ideal with Δv = 0 V, and A approaching to infinity. Apply a small signal sinusoidal voltage to VIN(t). What value does VOUT(t)/VIN(t) approach as frequency increases? Compute the absolute value of VOUT(t)/VIN(t).

5. The following non-inverting operational amplifier circuit is designed to have a positive amplification of 10, and it is used to eliminate the DC component of the sensor signal. If VO is the DC component and ΔVS is the time varying true component of the sensor signal, VS = VO + ΔVS, find the relative values of R₁ and R₂, and compute the offset voltage, VOFFSET, to eliminate VO.

6. The following operational amplifier RC oscillator generates square waveform whose values change between +VCC and −VCC. Consider RO = RF = R = 10 KΩ in this circuit.

(a)

Describe the operation of the circuit. First assume VOUT is at +VCC. Explain how the switching to −VCC takes place at the output. Draw the waveform for VOUT(t), VREF(t) and VSIG(t).

(b)

Calculate the value of the capacitor, C, if the period of oscillation is 2 µs. That means that VOUT(t) is at +VCC for a period of 1 µs and at −VCC for a period of 1 µs.

7. The following differential equation is given:

where A and B are constants, x(t) is a time varying voltage produced by a sensor, and y(t) is the analog output.

Generate y(t) using ideal operational amplifiers. Find the constants, A and B, in terms of the components used in the circuit.

8. Assuming the operational amplifier in the circuit below is non-ideal, and there is a voltage drop, ∆v, between the negative and positive inputs as shown in the figure. The amplification factor between the differential input and the output is A. Derive the equation for VOUT(t) in terms of V₁(t) − V₂(t).

© Springer International Publishing Switzerland 2017

Ahmet BindalElectronics for Embedded Systems10.1007/978-3-319-39439-8_7

7. Data Converters

Ahmet Bindal1  

(1)

Computer Engineering Department, San Jose State University, San Jose, California, USA

Ahmet Bindal

Email: ahmet.bindal@sjsu.edu

7.1 Analog-to-Digital Converter Principles

All analog domains interface with digital systems through Analog-to-Digital Converters (ADC) . In Fig. 7.1, an analog signal from a sensor is amplified to a certain level before sampling takes place in a sample-and-hold circuit inside an ADC . The sampled analog signal is then converted into digital form and directed to the CPU for processing according to an embedded program.

Fig. 7.1

Typical Analog-to-Digital and Digital-to-Analog Converter data-paths

The signal resolution is an important factor to consider in an ADC design. It simply means dividing a sampled analog signal by 2N number of voltage levels to represent its value where N is the number of bits in digital domain. The second important consideration is the range of analog values an ADC can capture and process.

Figure 7.2 describes the ADC resolution in a numerical example where an analog signal changes between 0 and 5 V. The bit resolution is only three bits. Therefore, ADC divides the range of an analog signal into 2³ = 8 levels between its maximum and minimum value, and identifies each analog level with three output bits. For example, an analog signal of 2.501 V is identified by a digital output of 100. If the analog signal increases to 3.124 V, the digital output that represents this voltage value still stays at 100. In other words, in a three-bit ADC there is no difference between 2.501 and 3.124 V in terms of their digital representation. The 0.625 V step size is the natural occurring error in a three-bit ADC, and it can be reduced only if the number of bits in the ADC is increased. In general, increasing the number of ADC bits by one halves the error. Therefore, designing a four-bit ADC instead of a three-bit ADC reduces the quantization error by 0.3125 V.

Fig. 7.2

Input-output description of a three-bit ADC

Reference voltage is generally determined by the maximum voltage level of the analog signal, and it is used to calculate the step size. In this three-bit ADC example in Fig. 7.2, the reference voltage is 5 V because the amplified analog voltage at the input of the ADC is limited not go beyond 5 V.

ADC samples non-periodic analog signals in regular time intervals as described in Fig. 7.3. The time interval between sampling points is called the sampling period. The sampling period is adjusted according to the processing speed of the ADC in order to generate accurate digital outputs.

Fig. 7.3

Sampling a continuous analog signal

Once sampled, the analog voltage at the input of an ADC is held steady throughout the sampling period while the conversion takes place as shown in Fig. 7.4. The shape of the converted signal may be quite different from the original analog signal due to the ADC resolution and the time duration between samples. In a three-bit ADC, sampling takes place in 0.625 V increments. Therefore, each sampling point becomes subject to a dynamic quantization error which changes between 0 and 0.625 V. For example, a three-bit ADC samples 3.4 V according to its closest sampling level of 3.125 V, and produces a 0.275 V error. Arbitrary signals that change with a frequency faster than the sampling frequency are subject to much larger dynamic errors. When converted back to their analog form, these signals show large deviations from their original shapes.

Fig. 7.4

Sampling period, hold concept and regeneration of an analog signal

7.2 Sample and Hold Principle

A basic sample-and-hold circuit consists of an NMOS transistor and a capacitor as shown in Fig. 7.5. The control input simply turn on an N-channel MOSFET for a short period of time, called sampling width, during which the analog voltage level at the input is stored on the capacitor. When the transistor is turned off, this analog value is held constant until the next sampling point.

Fig. 7.5

A typical sample-and-hold circuit

7.3 Flash Type Analog-to-Digital Converter

The simplest ADC is the flash-type as shown in Fig. 7.6. This three-bit ADC contains 2³ = 8 operational amplifiers. The analog signal is applied to all eight positive input terminals. The reference voltage is distributed to each negative input terminal via a voltage divider circuit. Each operational amplifier acts as a differential amplifier and amplifies the difference between a continuously changing analog signal and the portion of the reference voltage .

Fig. 7.6

Typical three-bit flash ADC schematic

Figure 7.7 describes the operation of the three-bit flash ADC and its encoder in a truth table. When the analog voltage is less than or equal to 0.625 V, only Out[0] becomes logic 1, all other outputs from Out[1] to Out[7] become logic 0. When the analog signal exceeds 0.625 V but less than 1.25 V, only Out[0] and Out[1] become logic 1, and again all others become logic 0. Higher analog voltages at the input successively produce more logic 1 levels as shown in Fig. 7.7. An encoder is placed at the output stage of all operational amplifiers to transform the voltage levels at Out[7:0] into a three-bit digital output, DOut[2:0]. The digital output is subject to an error of 0.625 V because only three bits are used for conversion.

Fig. 7.7

Three-bit flash ADC truth table describing its operation

7.4 Ramp Type Analog-to-Digital Converter

The ramp ADC uses only a single operation amplifier, but it employs an up-counter as well as a Digital-to-Analog Converter (DAC) in a loop structure a shown in Fig. 7.8. The digital output is obtained from C[3:0] terminals, and it progressively forms within several clock periods as opposed to being almost instantaneous as in the flash ADC .

Fig. 7.8

Typical four-bit ramp ADC schematic

The top portion of Fig. 7.9 describes the output voltage assignments of a four-bit ramp ADC using two different types of number-rounding schemes. The down-rounding scheme assigns a lower analog value for each digital output compared to the up-rounding scheme. For example, the down-rounding scheme produces a digital output of C[3:0] = 0100 for analog voltages between 1.0937 and 1.4062 V applied to its input. If the up-rounding scheme is used, the same digital output becomes equivalent to an analog voltage anywhere between 1.4062 and 1.7187 V.

Fig. 7.9

Four-bit ramp ADC truth table describing its operation

The middle table in Fig. 7.9 shows how the conversion takes place if the down-rounding mechanism is used in this four-bit ADC . Prior to its operation, the four-bit up-counter is reset and produces C[3:0] = 0000. Assuming an analog voltage of 2 V is applied to the input, which must be kept constant until the conversion is complete, C[3:0] = 0000 forces the DAC output, DACOUT, to be 0 V according to the down-rounding scheme. Since this value is less than 2 V at the sample/hold circuit output, SHOUT, the output of the differential amplifier, INCR, transitions to the positive supply potential of the operational amplifier, +VCC = 5 V, which prompts the four-bit counter to increment to C[3:0] = 0001. Consequently, the DAC generates DACOUT = 0.3125 V according to the truth table in Fig. 7.9. However, this value is still less than SHOUT = 2 V. Therefore, the differential amplifier produces another INCR = 5 V which prompts the counter to increment again to C[3:0] = 0010. Up-counting continues until C[3:0] = 0111 or DACOUT = 2.1875 V. Since this last voltage is greater than SHOUT = 2 V, the differential amplifier output switches back to its negative supply voltage, −VCC = 0 V, and stops the up-counter from incrementing further. The digital output stays steady at C[3:0] = 0111 from this point forward, representing 2 V analog voltage with a dynamic error of 0.1875 V.

The table at the bottom part of Fig. 7.9 represents the conversion steps if the up-rounding mechanism is used in this ADC . External reset still produces C[3:0] = 0000 initially. However, the DAC output starts the conversion with an increased amount of 0.3125 V instead of 0 V. The counter increments until C[3:0] = 0110, and produces 2.1875 V at the DACOUT node. At this value INCR becomes 0 V, and the up-counter stops incrementing further. C[3:0] = 0110 becomes the ADC result for 2 V.

7.5 Successive Approximation Type Analog-to-Digital Converter

The third type ADC is based on the successive approximation technique to estimate the value of the analog voltage. This type is a trade-off between the flash-type and the ramp-type in terms of speed and the number of components used in the circuit. As a numerical example, a typical four-bit successive approximation ADC schematic is shown in Fig. 7.10. In this figure, the up-counter in the ramp ADC is replaced by a control logic which successively converts an analog input into a digital form by a trial and error method. The output is obtained at the C[3:0] terminal.

Fig. 7.10

Typical four-bit successive approximation ADC schematic

The top portion of Fig. 7.11 shows the truth table to operate a four-bit successive approximation ADC . Two numerical examples in this figure illustrate the down-rounding and up-rounding schemes used during conversion.

Fig. 7.11

Four-bit successive approximation ADC truth table describing down-rounding and up-rounding approximation techniques

The first example in Fig. 7.11 illustrates the down rounding mechanism in a four-bit successive approximation ADC . In this example, an analog voltage of 3.5 V is applied to the analog input of the ADC. An external reset starts the converter at C[3:0] = 1000, which is considered a mid point between C[3:0] = 0000, representing the minimum analog input of 0 V, and C[3:0] = 1111, representing the maximum analog input of 5 V for this ADC . For C[3:0] = 1000, the DAC generates an initial analog voltage of 2.5 V at the DACOUT node. Since this value is less than the sampled analog voltage of 3.5 V at the SHOUT node, the operational amplifier produces IN = 5 V, and prompts the control logic to try a slightly higher digital output. As a result, the control logic produces C[3:0] = 1100 as its first trial, which is equivalent to a midway point between C[3:0] = 1000 and 1111. DACOUT becomes 2.5 + (2.5/2) = 3.75 V. But, this new voltage is larger than SHOUT = 3.5 V, and the operational amplifier produces IN = 0 V in return. The drop at IN node is an indication to the control logic that its initial attempt of C[3:0] = 1100 was too large, and it must lower its output. This time, the control logic tries C[3:0] = 1010, which is between C[3:0] = 1000 and 1100, and translates to DACOUT = 2.5 + (2.5/4) = 3.125 V. This value, in turn, generates IN = 5 V, and prompts the control logic to try a slightly higher output between C[3:0] = 1010 and 1100. In the third round, the control logic produces C[3:0] = 1011. DACOUT node becomes 2.5 + (2.5/4) + (2.5/8) = 3.4375 V and generates IN = 5 V. This new input suggests the control logic to try even higher digital output, such as 2.5 + (2.5/4) + (2.5/8) + (2.5/16) = 3.5937 V, in the fourth round. However, 2.5/8 = 0.3125 V is the resolution limit for this four-bit ADC , and as a result, the controller stalls at C[3:0] = 1011, revealing DACOUT = 3.4375 V. This voltage differs from SHOUT = 3.5 V by only 0.0625 V.

The second example in Fig. 7.11 explains the successive approximation technique if the up-rounding scheme is employed. The conversion again starts at C[3:0] = 1000, but with an incremented value of 2.5 + 0.3125 = 2.8125 V at the DAC output. Since this voltage is below SHOUT = 3.5 V, IN node becomes 5 V and prompts the control logic to produce a larger digital output. The control logic responds this with a digital output of C[3:0] = 1100, which corresponds to the analog voltage of 2.8125 + (2.5/2) = 4.0625 V at the DACOUT node. As a result, IN node becomes 0 V, and forces the control logic to lower its digital output. This time, the control logic tries C[3:0] = 1010 which is equivalent to 2.8125 + (2.5/4) = 3.4375 at the DACOUT node. Due to the resolution limit of this four-bit ADC , this step also becomes the end of successive approximation .

The control circuit of the four-bit ADC with down-rounding scheme is shown in Fig. 7.12. In this figure, the approximation process starts at the midpoint, C[3:0] = 1000, corresponding to DACOUT = 2.5 V according to the table in Fig. 7.11. When the external reset is removed, and ∆v, the difference between SHOUT and DACOUT, is found to be greater than the 0.3125 V step size, the control logic either goes to the state 1.25, and produces C[3:0] = 0100 (equivalent to 1.25 V) or the state 3.75, and produces C[3:0] = 1100 (equivalent to 3.75 V) in the first step of the successive approximation . This decision depends on the value of the control logic input, IN. If IN = 0, which translates to the analog input to be less than 2.5 V, the next state becomes the state 1.25. However, if IN = 1, the analog input is considered to be greater than 2.5 V, and the next state becomes the state 3.75. If ∆v is less than 0.3125 V, on the other hand, the control logic cannot proceed further due to its resolution limit, and moves to the state DONE. In the second step of successive approximation , the state 1.25 either transitions to the state 0.625 or the state 1.875, depending on the value at IN node. Similar transitions take place from the state 3.75 to either the state 3.125 or the state 4.375, again depending on the value at IN. After this point, the state machine performs one last approximation to estimate the value of analog input voltage, and reaches the DONE state with an output value as shown in Fig. 7.12.

Fig. 7.12

Four-bit successive approximation control circuit

7.6 Weighted Sum Type Digital-to-Analog Converter

The most common DAC utilizes the weighted summation method of digital inputs. A three-bit DAC with a weighted binary adder is shown in Fig. 7.13 as an example.

Fig. 7.13

Three-bit DAC schematic with weighted binary adder

This circuit is composed of two parts. The first part adds all three binary input bits, IN[2] (the most significant bit), IN[1] and IN[0] (the least significant bit), and produces an output, ADDOUT = −(0.5 IN[2] + 0.25 IN[1] + 0.125 IN[0]) according to the equation in Fig. 7.14. The second part is an analog inverter which forms OUT = −ADDOUT.

Fig. 7.14

Three-bit DAC operation with weighted binary adder

Therefore, the circuit in Fig. 7.13 generates OUT = 0.5 IN[2] + 0.25 IN[1] + 0.125 IN[0], where each binary value at IN[2:0] input is multiplied by the coefficients, 2⁻¹, 2⁻² and 2⁻³, before they are added to produce an output. For example, the combination of IN[2] = 1, IN[1] = 0 and IN[0] = 1, with +5 and 0 V logic levels generates OUT = 2.5 + 0.625 = 3.125 V. Similarly, all the other analog outputs in Fig. 7.14 can be generated using the equation at the top part of this figure with a maximum error of 0.625 V.

7.7 Ladder Type Digital-to-Analog Converter

The second kind of DAC uses a ladder structure composed of resistors as shown in Fig. 7.15. Each ladder segment contains a switch, Si, where i = 0, 1, … (N–1). The switch can be thrown to ground or VREF depending on the value of the binary input.

Fig. 7.15

N-bit DAC schematic with ladder configuration

The ladder structure produces an intermediate output, LadderOut, which is the weighted sum of all N binary inputs. The ratio, VREF/2N, determines the final value of LadderOut when it is multiplied with the weighted sum as shown in Fig. 7.16. The analog inverter generates Out = −LadderOut and creates a positive value. The example for a three-bit DAC with ladder configuration is shown at the bottom section of Fig. 7.16. With S₂ and S₀ switches thrown to VREF = 5 V and S₁ to ground, this combination produces a weighted sum of (2² + 2⁰) = 5 V. When this value is multiplied with the ratio, VREF/2³ = 5/8 = 0.625 V, the overall result becomes Out = 3.125 V for a digital input of S2 =1, S1 = 0, S0 = 1.

Fig. 7.16

Three-bit DAC operation with ladder configuration

Review Questions

1. A three-bit successive approximation ADC is given below. A sample-Hold circuit (S/H) samples the Analog Input in periodic intervals and feeds the voltage level to the operational amplifier.

Use the timing diagram below, and fill the blanks with analog or digital data for an Analog Input = 0.5 V with down-rounding mechanism.

2. A three-bit ramp ADC below operates with +VCC = 3 V and −VCC = 0 V. Input to this ADC can take any value between 0 and 3 V.

(a)

Assume that DAC has an up-rounding scheme to generate analog outputs from digital inputs. Apply 1.2 V to the Analog Input port, and draw the timing diagram that contains the clock, Reset, counter output (COUNTOUT), DAC output (DACOUT) and operational amplifier output (INCR). Show what happens to the timing diagram when the active-high Reset signal transitions to logic 1 after the ADC produces the desired digital output.

(b)

Now apply 2.9 V to the Analog Input. Draw the timing diagram with the same inputs and outputs listed above. Show what happens to the timing diagram when the active-high Reset signal transitions to logic 1 after the ADC produces the desired digital output.

(c)

Assume that the DAC rounding scheme is changed from up-rounding to down-rounding scheme. Apply 1.2 V to the Analog Input and generate the timing diagram with the input and output signals listed above. Show what happens to the timing diagram when the active-high Reset signal becomes logic 1 after the ADC produces the desired digital output. Do you see any issues with the operation of this circuit?

(d)

Now apply 2.9 V at the Analog Input port and generate the timing diagram with the input and output signals listed above. Do you see any issues in the operation of this circuit?

3. In a three-bit successive approximation ADC in Fig. 7.10, what kind of circuit can be built to detect the voltage difference between the Analog Input voltage at SHOUT and the DAC output at DACOUT at each state to be able to make state transitions in Fig. 7.12?

4. Build an eight-bit DAC that uses weighted summation technique. Find the analog voltage levels for inputs, 00110011, 10000000, 00000001, 11111111 and 10101010. Compare the analog voltage values corresponding to 10000000, 00000001 and 11111111 inputs from this DAC with the analog output voltages corresponding to the 1000, 0001 and 1111 inputs from a four-bit DAC that uses weighted binary adder.

5. Build an eight bit DAC that uses ladder configuration. How can you implement the input switches used in the ladder configuration? Apply 00110011, 10000000, 00000001, 11111111 and 10101010 inputs to this DAC and show how the circuit works. Is there any difference between the output values between this type and the type that uses weighted summation?

6. Implement an eight-bit flash, ramp and successive approximation ADC. Compare each type in terms of speed, and the number of components used in the circuit.

© Springer International Publishing Switzerland 2017

Ahmet BindalElectronics for Embedded Systems10.1007/978-3-319-39439-8_8

8. Front-End Electronics for Embedded Systems

Ahmet Bindal1  

(1)

Computer Engineering Department, San Jose State University, San Jose, California, USA

Ahmet Bindal

Email: ahmet.bindal@sjsu.edu

This chapter is primarily dedicated to front-end analog electronics interfacing microcontrollers . It brings together most of the topics covered in the previous seven chapters. The chapter starts with basic electromechanical device control and sensor circuits, then moves on to implementing full scale electronic platforms that contain sensor(s), amplifier(s), logic blocks, ADC and DAC.

8.1 Electromechanical Device Control

Relay switches are excellent choices to isolate digital circuits from noisy electrical environments or from circuits that require high voltages or currents to operate electromechanical devices. Figure 8.1 shows the operation of a relay switch. The parallel diode placed across the relay prevents transient currents to form and protects rest of the circuit from current surges emanating from the relay. When a high logic level is applied to the VIN terminal, the NPN transistor saturates. The resulting current transforms the inductor into an electromagnet, and closes the mechanical switch inside the relay enclosure. This action starts the current conduction in the secondary circuit to operate an electromechanical device. When there is no current present, the switch pulls back to its no contact position and stops the current in the secondary circuit.

Fig. 8.1

Bipolar circuit controlling a relay

Figure 8.2 uses the relay to activate a DC motor. When closed, the 12 V supply runs the DC motor. In this circuit VCC can safely be set to a voltage lot less than 12 V. Similarly, the supply voltage for the DC motor can be set much higher than 12 V without causing noise or harming the digital circuit.

Fig. 8.2

A dc motor activation circuit using a relay for electrical isolation

Opto-isolator is another device that uses optical means to isolate a digital circuit from an analog circuit that includes an electromechanical device and often requires high voltages or currents. The box defined by the dashed lines in Fig. 8.3 represents an opto-isolator. This device is composed of an infrared LED and a photo-transistor whose base is optically coupled with the light emanating from the LED. When the LED emits infrared light, it produces high voltage at the base of the photo-transistor to saturate it. Since opto-isolator only comes with an open-collector configuration, the collector of the photo-transistor has to be externally connected to a supply voltage with a current limiting resistor to function.

Fig. 8.3

Piezoelectric buzzer control using an opto-isolator

Figure 8.3 shows an application of the opto-isolator to operate a piezo-electric buzzer . When VIN terminal receives logic 1, the output of the inverter goes low. The supply current that flows through RD turns on the “internal” LED. Infrared light that emanates from the LED saturates the photo-transistor provided that the current through RO meets the manufacturer’s requirements for the transistor to saturate. As a result, the collector of the photo-transistor pulls low and turns off the output NPN transistor. Since there will be no current through the piezo-electric buzzer , it remains silent.

However, when VIN is lowered to 0 V, the inverter output goes to logic 1, and this produces 0 V across the infrared LED . The LED does not emit light, and the photo-transistor stops operating. Consequently, the base terminal of the photo-transistor goes to 12 V, and saturates the output NPN transistor. The buzzer starts operating.

It is essential to separate the ground terminals of the 5 V digital supply from the 12 V analog supply to prevent transmitting any electrical noise through ground connections that may adversely affect the operation of the digital circuit.

Figure 8.4 shows another application of the opto-isolator device if the DC motor requires even higher voltage than 12 V to operate. As discussed above with the piezo-electric buzzer , a low logic applied to VIN disables the opto-isolator and operates the DC motor. Again, it is a vital importance to separate the ground connections of the 5 and 24 V supplies from each other to prevent electrical noise produced in the analog circuitry from propagating through the ground terminal.

Fig. 8.4

DC motor control using an opto-isolator

8.2 Pulse Width Modulation Circuits

A simple Pulse Width Modulation (PWM) circuit is shown in Fig. 8.5. This circuit is an enhanced form of the square wave generator discussed earlier in Chapter 7.

Fig. 8.5

A simple pulse width modulation (PWM) circuit

In this circuit, there are two feedback loops. The primary feedback loop connects the output to the positive input of the operation amplifier with RF, setting up the reference signal, VREF, for the input. The secondary feedback loop connects the output to the negative input of the operational amplifier with the combination of a variable resistor, a diode and a capacitor. This RC circuit basically adjusts the pulse width at the output.

Assume VSIG = −VCC and VOUT = +VCC initially. VOUT = +VCC produces:

(8.1)

The output node starts charging the capacitor through the resistor, αR (α represents the portion of the potentiometer), and the diode, D₁, as shown in the top portion of Fig. 8.6. This produces:

Fig. 8.6

Charge (top) and discharge (bottom) paths of the PWM circuit in Fig. 8.6

(8.2)

As soon as VSIG reaches slightly above $$ \text{V}_{{\text{REF}}} \text{ = V}_{{\text{CC}}} \frac{{\text{R}_{\text{F}} }}{{\text{R}_{\text{F}} \text{ + R}_{\text{O}} }} $$, VOUT changes its polarity, and becomes equal to −VCC. As a result, VREF changes its value and becomes:

(8.3)

With VOUT = −VCC, this time the capacitor starts discharging through the diode, D₂, and the unused portion of R, (1 − α)R, from its initial value of $$ \frac{{\text{R}_{\text{F}} }}{{\text{R}_{\text{F}} \text{ + R}_{\text{O}} }}\text{V}_{{\text{CC}}} $$ towards −VCC as shown in the bottom portion of Fig. 8.6. Thus,

(8.4)

When VSIG reaches $$ - \frac{{\text{R}_{\text{F}} }}{{\text{R}_{\text{F}} \text{ + R}_{\text{O}} }}\text{V}_{{\text{CC}}} $$, however, the output changes its polarity to +VCC and forms a positive reference voltage, $$ \text{V}_{{\text{REF}}} \text{ = V}_{{\text{CC}}} \frac{{\text{R}_{\text{F}} }}{{\text{R}_{\text{F}} \text{ + R}_{\text{O}} }} $$. As a result, the capacitor starts charging through αR and D₁ again, and VSIG begins to increase from $$ - \frac{{\text{R}_{\text{F}} }}{{\text{R}_{\text{F}} \text{ + R}_{\text{O}} }}\text{V}_{{\text{CC}}} $$ to $$ \frac{{\text{R}_{\text{F}} }}{{\text{R}_{\text{F}} \text{ + R}_{\text{O}} }}\text{V}_{{\text{CC}}} $$.

The waveforms of VSIG and VOUT are very similar to the ones produced by the square wave generator in Chapter 7, and shown here again in Fig. 8.7. In this figure, the time constants during the rise and the fall of VSIG are different from each other due to α. This property enables fine-tuning the pulse width, and therefore the duty cycle of the output waveform.

Fig. 8.7

The waveforms at VSIG and VOUT of the PWM circuit in Fig. 8.6

8.3 DC Motor Control

Operating a DC motor in different speeds can be achieved by the combination of a PWM circuit cascaded with an opto-isolator circuit as shown in Fig. 8.8. The opto-isolator separates the ground terminals of the noise-receptive digital circuit from the circuit that operates the motor which usually requires high voltages.

Fig. 8.8

DC motor control

The PWM can generate voltages between 0 V and +VCC to turn on and off the optical transistor in high speeds not too suitable for a relay.

The pulse duration of the PWM output at +VCC lasts only micro seconds, during which the output bipolar transistor supplies current to the DC motor. The only way to observe this is through measuring the motor’s rpm. Motor’s speed can be increased by increasing the time constant of the secondary feedback circuit or αRC. The motor can practically be turned off if the value of the variable resistance is reduced to 0 Ω.

8.4 Servo Control

It is possible to design a pulse generator to control a servo motor. The signal input to an analog servo calls for a pulse with a period of 20 ms as shown in Fig. 8.9.

Fig. 8.9

Servo control waveforms

If the pulse width is maintained at T = 1.5 ms, the servo arm stays at neutral position. Reducing T to 1.25 ms turns the servo arm to −90° from the neutral axis. Similarly increasing T to 1.75 ms rotates the servo arm to +90°. However, some servo motor manufacturers specify T = 1 ms and T = 2 ms pulse widths for −90 and +90° arm rotations in their datasheets, respectively, and this requires calibrating servo arm movement for each servo manufacturer.

8.5 Hall-Effect Sensor Control

The Hall-effect device studied in Chapter 5 operates in the presence of a magnetic field, and forms a very useful device for systems that require controlling mechanical rotation.

The magnetic properties of Hall-effect devices have enabled manufacturers to devise a simple device resistant to heat, cold, pressure and many other external effects. The basic usage of this device is car industry. However, many other industries that employ magnetic field in the operation of their systems also use this device. Figure 8.10 shows a unipolar Hall-effect device manufactured by Allegro Microsystems.

Fig. 8.10

Unipolar Hall-effect device manufactured by Allegro Microsystems

The package contains a Hall-effect device that produces milli-volt range Hall voltage when exposed to a magnetic field, a DC amplifier that amplifies the Hall voltage to full logic levels at its output, and finally an NPN bipolar transistor with an open collector.

When this device is connected to activate an LED as shown in Fig. 8.11, the exposure to magnetic field enables the Schmitt trigger to produce a high logic output to saturate the NPN transistor. The resulting current, IL, turns on the LED and becomes:

Fig. 8.11

Usage of the unipolar Hall-effect device to activate LED

(8.5)

Here, VLED is the voltage drop across the LED . IL in this equation must be adjusted to be able to saturate the bipolar transistor and turn on the LED.

The remainder of this chapter is dedicated to numerous design projects that prepare the sensor signal to interface with the microcontroller. Every project uses a different type of sensor and follows a unique data-path to condition the analog signal prior to analog-to-digital conversion. The last two projects integrate digital logic blocks with analog circuitry, therefore they require logic design skills outlined in Chapter 9.

8.6 Design Project 1: Designing Front-End Electronics for an Analog Microphone

The first design project simply prepares the analog signal from a microphone for the ADC . The microphone used in Fig. 8.12 is analog microphone ADMP504 produced by Analog Devices. From the manufacturer’s datasheet, the microphone produces a maximum voltage of 0.25 V, which needs to be amplified to a maximum value of 5 V for the analog-to-digital converter, AD7819, also produced by Analog Devices. The microphone produces an output DC offset voltage of 0.8 V that needs to be cleaned from the analog signal before the signal is amplified. Therefore, VREF in Fig. 8.12 should be adjusted to a certain value that offsets the 0.8 V DC offset in the microphone output signal.

Fig. 8.12

Microphone front end circuit

According to the datasheet we have:

(8.6)

where, VMIKE is the analog voltage produced by the microphone without DC offset, and VOFF = 0.8 V. We also have:

(8.7)

(8.8)

From Eq. 8.8,

(8.9)

Substituting Eq. 8.9 into Eq. 8.7 yields:

(8.10)

Rearranging the terms in Eq. 8.10 yields:

(8.11)

Substituting Eq. 8.6 into Eq. 8.11 yields:

(8.12)

In order to isolate the term with VMIKE, we need to eliminate the terms with VOFF and VREF. Thus,

or

(8.13)

Then,

(8.14)

From the datasheets, the maximum value produced by the microphone is VMIKE = 0.25 V and the maximum value at the input of the ADC is VOUT = 5 V. Therefore, from Eq. 8.14:

(8.15)

We use R₁ = 1 KΩ and R₂ = 19 KΩ

Using Eqs. 8.15 in 8.13 yields VREF = 1.05 × 0.8 = 0.85 V.

Therefore, we must find a Zener diode at 0.85 V or a potentiometer that can produce 0.85 V. However, the latter choice is prone to temperature fluctuations.

8.7 Design Project 2: Designing Front-End Electronics for a Temperature Measurement System

The second design project amplifies the signal from a type-K thermocouple , and prepares it for the ADC . The thermocouple signal changes linearly with temperature as shown in Fig. 8.13. From this figure, the thermocouple signal can be approximated as VT ≈ 0.0407 T in mV. However, at low temperatures the deviation from linearity introduces error as large as 2 mV.

Fig. 8.13

Voltage-temperature characteristics of type-K thermocouple

In the first attempt, let us build a circuit that measures ambient temperatures between 0 and 200 °C. This is a very straightforward design that requires only signal amplification as shown in Fig. 8.14.

Fig. 8.14

A circuit that measures temperatures between 0 and 200 °C

The amplification is performed by two cascaded inverting stages. In the first stage, we have:

(8.16)

In the second stage,

(8.17)

We know the maximum voltages at VT = 8.14 mV (at T = 200 °C) and VTEMP = 5 V. This requires an overall gain of approximately 614. If the first stage amplifies the thermocouple signal by 20 times, then the second stage will need an amplification of 30.7. Thus,

(8.18)

Similarly,

(8.19)

Selecting R₁ = 1 KΩ, R₂ = 20 KΩ, R₃ = 2 KΩ, and R₄ ≈ 62 KΩ according to Eqs. 8.18 and 8.19 will proportionally change the sensor readings at VTEMP between 0 and 5 V.

The second circuit in Fig. 8.15 conditions the temperature readings at VT between −200 and 200 °C.

Fig. 8.15

A circuit that measures temperatures between −200 and 200 °C

Since the thermocouple voltage readings become negative for temperatures less than 0 °C, the best method is to add a DC offset to the actual thermocouple signal to eliminate the negative values of VT. The maximum value of the “extrapolated” VT at −200 °C is −8.14 mV according to Fig. 8.13. This is a very small value to offset. Therefore, a better option is to amplify the thermocouple signal without any DC offset in the first stage, and then employ an offset voltage for the amplified signal in the next stage. The amplification in the first stage produces the result in Eq. 8.20.

(8.20)

In the second stage, a steady DC offset voltage can be generated by a rectifying diode. Assuming the diode has VF = 600 mV, the amplification at the first stage must yield:

(8.21)

In this equation, if R₁ = 1 KΩ then R₂ ≈ 72 KΩ.

This amplification factor makes the value of VP to be approximately −600 mV at −200 °C, and +600 mV at +200 °C.

For the second stage, when VOFF = 600 mV, then:

(8.22)

According to Eq. 8.22, when temperature drops to −200 °C and VP becomes −600 mV, then:

(8.23)

Similarly, when temperature rises to 200 °C and VP becomes +600 mV, then:

(8.24)

A Zener diode can also be used to create a DC offset in the second stage. The smallest reference voltage from a Zener diode is approximately 1.8 V, and using this value in Eq. 8.21 requires a gain over 200 in the first stage. However, producing a high voltage gain from a single stage amplifier should be avoided because small deviations in resistor values introduce large errors in amplifier gain.

To calculate the biasing resistor value, RF, in the second stage requires determining the forward current, IF, of the rectifying diode. Assuming that VCC = 5 V, and this particular diode calls for IF = 1 mA in order to produce VF = 600 mV across its terminals, RF becomes approximately equal to 4.4 KΩ to set up the correct DC offset, VOFF.

The third stage simply provides a voltage inversion. Thus:

(8.25)

The maximum value of VTEMP should be around 5 V before the analog-to-digital converter stage. Thus:

(8.26)

(8.27)

According to Eq. 8.27, we can use R₃ = 1.1 KΩ and R₄ = 4.7 KΩ. In Eq. 8.25, R₅ can be taken as 10 KΩ.

All three cascaded stages produce the following output voltage at VTEMP:

(8.28)

In this equation, VTEMP becomes 0 V at T = −200 °C (and VT = −8.14 mV). Similarly, at T = 200 °C (and VT = 8.14 mV) VTEMP becomes approximately 5 V.

8.8 Project 3: Designing Front-End Electronics for a Light Level Measurement System

Another interesting project with operational amplifiers is to measure the intensity of a light source with a photodiode. Once reverse biased, photodiodes produce high levels of reverse saturation current when exposed to light. An OSRAM SFH-213 is a popular photodiode with a spectral range of 400–1100 nm, peaking at 900 nm. It has a relatively small dark (thermal) current, IDARK, of 1 nA and area of 1 mm². Its light sensitivity of 550 mA/W makes this diode generate 5.5 µA of photo current (short circuit), IPH, when exposed to 10 W/m² intensity light source within its spectral range.

The reverse breakdown voltage of SFH-213 is 50 V per manufacturer’s datasheet. Therefore, reverse biasing this diode with −VCC = −15 V as shown in Fig. 8.16 is safe although this voltage level may also increase the dark current characteristics beyond what is specified in the datasheet. The pre-amplification stage in Fig. 8.16 produces a gain proportional to the resistor R₁ as shown in Eq. 8.29.

Fig. 8.16

A circuit that measures light level (−VCC is used to bias the photodiode)

(8.29)

The resistor, RP, limits the current through the photodiode and also provides a reverse biased voltage less than VCC across its terminals in case the power supply voltage is greater than the breakdown voltage.

The second stage in Fig. 8.16 is primarily used for signal conditioning such as elimination of the dark current component of the photodiode and possibly noise cancellation with some voltage amplification. This stage produces the following voltage gain:

(8.30)

Substituting Eq. 8.29 into Eq. 8.30 yields:

(8.31)

In Eq. 8.31, if we tune the potentiometer such that:

(8.32)

Then Eq. 8.31 can be reformed as:

(8.33)

Using IPH = 5.5 µA and the maximum value of VOUT = 5 V, Eq. 8.33 can be rewritten as:

(8.34)

According to Eq. 8.34, selecting R₂ = 1 KΩ, R₁ = 27 KΩ produces R₃ = 33 KΩ.

From Eq. 8.32, the dark voltage becomes:

(8.35)

Also from Eq. 8.29, VPH becomes approximately equal to 0.15 V.

If we allow I₄ = 1 mA at the input of the second stage, R₄ can be approximately equal to:

(8.36)

The potentiometer, RDARK, should be a small value compared to R₄ such as 100 Ω. This way, values up to 100 µV can be produced at the VDARK input.

The second schematic in Fig. 8.17 is used if the reverse bias voltage for the photodiode is +VCC = 15 V for the same project. This configuration requires both amplification stages in Fig. 8.16 to be inverting type.

Fig. 8.17

A circuit that measures light level (+VCC is used to bias the photodiode)

Both circuits use Analog Devices eight-bit ADC , AD7819.

8.9 Project 4: Designing Photo Detector Circuits

The circuits in Figs. 8.18 and 8.19 are simple on/off circuits sensitive to light, and do not require any ADC to interface with the microcontroller. The sole purpose of these circuits is to create a hardware interrupt for the microcontroller or engage an electro-mechanical device based on light detection.

Fig. 8.18

Photo detector circuit with an operational amplifier

Fig. 8.19

Photo detector circuit operating a small DC motor

When the light is exposed to the photodiode in Fig. 8.18, the voltage level at VPH drops with respect to VREF because the photo current through the diode, IPH, becomes much larger than the thermally-generated reverse saturation current, IDARK. Therefore,

(8.37)

Suppose VCC = 5 V. If we use the same photodiode, SFH-213, from the earlier design with IPH = 5.5 µA, and assume VPH = 3 V (although values less that 3 V or closer to 5 V are also acceptable design entries for VPH) when the light is on, then RPH becomes:

(8.38)

When the light is off, IPH ≈ 0 A and VPH = VCC = 5 V.

This means that VREF should be somewhere between VPH = 3 and 5 V. Suppose VREF = 4 V and IREF = 1 mA. Then the maximum potentiometer value, RREF, becomes:

(8.39)

If we adjust the tap on the potentiometer, RREF, such that VREF becomes 4 V, then Δv = VPH − VREF becomes Δv = 3 – 4 = −1 V when the light turns on and VOUT = 5 V. When the light turns off, VREF is still at 4 V, but VPH becomes 5 V. This produces Δv = 5 − 4 = +1 V, and VOUT becomes 0 V.

The circuit in Fig. 8.19 is an extension of the photo detector circuit in Fig. 8.18, and is used to operate a small DC motor. In this figure, the DC motor spins as long as the light is on, but it turns off when the light is switched off. A Zener diode is used to set a reference voltage for the difference amplifier.

Assume that the power supply voltages are +VCC = 15 V and −VCC = 0 V. IPH = 5 µA when the light turns on, and the DC motor operates at a voltage of VM = 5 V at IM = 100 mA.

When the light is on, assume VPH = 13 V. This produces:

(8.40)

When the light is off, the photodiode only generates negligible reverse biased current (IDARK), and VPH becomes VCC = 15 V.

Therefore, VZ must be selected somewhere between VPH = 13 and 15 V although voltages much lower then VPH = 13 V are also acceptable design entries. Thus, assume VZ = 14 V with IZ = 1 mA from the Zener diode datasheet.

When the light is on, Δv = VPH − VZ, becomes Δv = 13 − 14 = −1 V, and the output of the operational amplifier, VOUT, becomes 15 V. This voltage should drive the NPN transistor into saturation. Thus:

(8.41)

(8.42)

Substituting VOUT = 15 V, VCC = 15 V, and the typical values of VBESAT and VCESAT into Eqs. 8.41 and 8.42 yields:

(8.43)

(8.44)

If 2N3904 is used in the circuit, then we can ignore the value of IBSAT compared to ICSAT. This produces IM = 100 mA ≈ ICSAT. Then from Eq. 8.44:

(8.45)

From the I-V characteristics of 2N3904, the NPN transistor goes into saturation at ICSAT = 100 mA when IBSAT ≥ 100 µA. Thus:

(8.46)

When the light turns off, Δv = VPH − VZ = 15 − 14 = +1 V, and VOUT becomes 0 V. This voltage turns off the NPN transistor and therefore the DC motor.

8.10 Project 5: Designing Front-End Electronics for an Optoelectronic Tachometer

Among all the other projects the optoelectronic tachometer design is the most demanding because it contains both analog and digital building blocks to complete the design. The analog part shown in Fig. 8.20 is similar to Fig. 8.17 except the incident light beam to the photodiode is chopped by a four-bladed propeller. The data path in Fig. 8.20 amplifies and cleans the pulsed photo current, IPH, generated by the photodiode. The output of this circuit, clockVAR, indicates a variable clock signal, and is used to compute the prop rpm which varies in time. This variable but low frequency clock signal is tracked by a known reference clock, clockREF, oscillating at 1 MHz, in order to compute the unknown frequency at clockVAR.

Fig. 8.20

Clock generation circuit for optoelectronic tachometer

The circuit in Fig. 8.21 shows two counters . The first counter, Pulse Counter, is a 16-bit wide counter and operates with the unknown clock frequency at clockVAR. The second reference counter, Ref Counter, operates with 1 MHz clock at clockREF, and it is 26 bits wide. The output of Ref Counter, CountOutREF, is connected to a decoder whose sole purpose is to detect the end of a minute long time period. This translates to generating logic 1 at OneMinute node for a binary value of 11-1001-0011-1000-0111-0000-0000 at CountOutREF or a waiting for a period of 6 × 10⁷ µs before generating a Stop signal with the 1 MHz reference clock. When the end detection occurs, the pulse generated at OneMinute port stops both the Pulse and Ref Counters. The total number of counts at the output of Pulse Counter , CountOutPULSE, signifies the number of optical pulses received within 1 min time interval. However, depending on the number of blades on the propeller, this number still needs to be divided by the number of blades on the prop. Therefore, a four bladed prop requires CountOutPULSE to be shifted to the right by two. The output of the shifter, RPMOUT, thus reads the number of revolutions of the four-bladed prop per minute.

Fig. 8.21

An optoelectronic tachometer architecture

Figure 8.22 shows the circuit schematic of the counters . After an external reset, the pulse and reference counter outputs become CountOutPULSE = 0 and CountOutREF = 0, respectively, and both counters immediately start counting upwards using different clocks until they reach the 1 min mark. At the 1 min mark, the pulse received from the Stop input switches the port configuration of the 3-1 MUX from C-port to S-port, halting the count mechanism and putting both counters in idle mode. The counters stay in this state until they simultaneously receive an external reset.

Fig. 8.22

Pulse and reference counter circuit for the optoelectronic tachometer

The digital circuits in Fig. 8.21 can be implemented with discrete ICs from Texas instruments. However, it is best to consider a Field-Programmable-Gate-Array (FPGA) platform for implementations that require higher clock frequencies, especially when building timing-critical units such as a reference counter in a similar design.

8.11 Project 6: Designing Front-End Electronics for a Hall-Effect-Based Tachometer

The circuit in Fig. 8.23 operates similar to the optoelectronic tachometer in the previous project but with a Hall-effect device in place. This project uses Allegro A1120 Hall-effect sensor shown in Fig. 8.10. Every time the sensor is exposed to magnetic field, as small as 35 Gauss, on a rotating disc in Fig. 8.23, the NPN bipolar transistor in the device turns on and pulls down the output node, clockVAR, to 0 V.

Fig. 8.23

The clock generation circuit for a Hall-effect-based tachometer

When the magnetic field is removed from the sensor or drops below 25 Gauss, on the other hand, the NPN transistor turns off, and the resistor, RL, pulls up the clockVAR node to VCC. This produces a clock waveform with a very brief duration at 0 V. A capacitor is added between V and ground to eliminate noise components in the power supply.

Applying this clock signal to the Pulse Counter , and a 1 MHz reference clock to the Ref Counter in Fig. 8.21 produces the same scenario described in the previous project. When 1 min elapses, CountOutREF produces a pulse at OneMinute port, and disables the counting mechanism in both the Pulse and Ref counters. The number of pulses at CountOutPULSE determines the rpm of the rotating disc. There is no need for a Divide by Blade unit, representing the number of blades in a prop, unless there is more than one permanent magnet on the rotating disc.

Review Questions

1.

Design an analog servo controller that can rotate a servo arm to the left and right by producing pulse widths between 1 and 2 ms in a 20 ms period. How can this servo controller be designed using only digital blocks from Chapter 9?

2.

Design a controller that generates pulses for a brushless motor. The design should include fine tuning the pulse width as well as the period of the pulse. Implement the same design using only digital blocks.

3.

Design an analog interface to a microcontroller for reading the changing capacitance values of an accelerometer. Refer to Chapter 5 to be acquainted with the physical principles of accelerometers. Use digital logic design concepts from Chapter 9 to support the front-end electronics.

4.

Wenner four pin method measures the resistivity of soil. A constant current is applied to the outer pins while the inner pins measure the voltage. The resistivity is calculated based on ρ = 2πLR, where L is the distance between the pins that measures voltage, and R is the resistance obtained from dividing the measured voltage by the constant current.

When the resistance value rises above R = 30 Ω, irrigation becomes necessary. R = 3 Ω, on the other hand, indicates well-moist soil. The irrigation system for soil turns on with an active-high pulse when R = 30 Ω at 6 am every morning and stays on as long as the pulse. A 10 min irrigation drops the resistance back to 3 Ω. Design a system composed of analog and digital components that operate the irrigation system. Refer to Chapter 9 to design the logic blocks required for this system.

5.

Design a traffic light module composed of red, yellow and green lights, which controls the flow of traffic on a major street. An optoelectronic device, such as a photodiode, monitors the rate of traffic (cars per minute) on this street. When the rate is 10 cars/min or less, the controller stops the incoming traffic for 1 min and turn on the green light for the cross traffic. The yellow light stays on for 1 s before the module transitions from green to red. Use the digital design principles from Chapter 9 to implement this system.

6.

Design the front end electronics of a wind meter. Assume that wind rotates a four bladed propeller connected to the wind meter. Draw the circuit schematic between the prop and the microcontroller. Indicate the appropriate sensor(s) to be used in the system. Refer to Chapter 9 in order to design the digital portion of this system.

7.

Distance between two points needs to be measured. A pulsed laser beam is placed at the point of origin; a reflective target is located at the destination. When the laser beam hits the target and reflected back to the unit, the unit effectively measures the time difference between the rising edge of the original pulsed laser beam and the rising edge of the reflected beam to calculate the distance. Design the front-end electronics between the laser beam and the microcontroller. Use the digital logic design concepts given in Chapter 9 to support the analog electronics.

8.

A resistive transducer measures the applied pressure in grams. When there is no force, the sensor shows in excess of 1 MΩ resistance. However, when pressure is applied, the resistance decreases with increasing pressure. Some of the resistance readings are given below:

An operational amplifier circuit given below can be used as the initial stage for this system with RT, corresponding to the changing resistance of the transducer.

If it becomes necessary, use the digital logic design principles given in Chapter 9 to implement the system.

9.

A triple light optoelectronic detection system needs to be designed such that it can distinguish red, yellow and green lights from each other. Conceptualize the type of sensor array to implement such a system, and design its analog front-end electronics for the microcontroller. Refer to Chapter 9 in order to use the necessary digital logic blocks to complete this system.

10.

Use the operational amplifier circuit below to amplify human voice with an analog microphone. Use VCC = 9 V, C₁ = C₂ = 10 µF and the potentiometers, RM = R₃ = 100 KΩ. Here, C₁ and C₂ become short circuits when an Alternating Current (AC) signal (i.e. human voice) is applied to the circuit. However, these capacitors become open circuits in Direct Current (DC) when there is no AC signal. Obtain the values of R₁, R₂ and R₄, in order to obtain the waveforms at VMIC, VPOS and VOUT as shown.

© Springer International Publishing Switzerland 2017

Ahmet BindalElectronics for Embedded Systems10.1007/978-3-319-39439-8_9

9. Review of Combinational and Sequential Logic Circuits and Design

Ahmet Bindal1  

(1)

Computer Engineering Department, San Jose State University, San Jose, California, USA

Ahmet Bindal

Email: ahmet.bindal@sjsu.edu

This chapter is primarily dedicated to reviewing combinational and sequential logic circuits. Understanding and designing logic blocks are part of the integration effort to build the front-end electronics for microcontrollers.

The first part of this chapter starts with defining logic gates and the concept of truth table which then leads to the implementation of basic logic circuits. Later in the chapter, the concept of Karnaugh maps is introduced in order to minimize gate count, thereby completing the basic requirements of combinational circuit design. Following the minimization techniques, various fundamental logic blocks such as multiplexers, encoders , decoders and one-bit adders are introduced so that they can be used to construct larger scale combinational logic circuits. These include different types of adders such as ripple-carry adder , carry-look-ahead adder , carry-select adder , and the combination of all three types depending on gate count, circuit speed and power consumption. Subtractors , linear and barrel shifters , and array multipliers are also considered combinational mega cells and they will be examined in this chapter.

The definition of clock and system timing are the integral elements for sequential logic circuits. Data in a digital system moves from one storage device to the next by the virtue of a system clock. During its travel, data is routed in and out of different combinational logic blocks, and becomes modified to satisfy a specified functionality.

Therefore, in the second part of this chapter we will review the memory devices that store data, and explain the process of designing sequential circuits that require clock input . We will begin with the introduction of two basic memory elements, the latch and the flip-flop. We will explain how data travels between memory elements using timing diagrams , and analyze timing violations as a result of unexpected combinational logic delays on the data path or the clock line. Later in the chapter, we will design the basic sequential building blocks, such as registers , shift registers and counters , and show the Moore-type and the Mealy-type state machines that control data movement. We will study the advantages and disadvantages of these conventional controllers against counter-decoder type controllers in various design environments. We will introduce the concept of block memory and how it is used in a digital system at the end of this chapter. We will conclude the chapter with a comprehensive example of transferring data from one memory block to the next, the use of timing diagrams in the development of the design, and show how to incrementally build a data-path and a controller using timing diagrams.

9.1 Logic Gates

AND Gate

Assume that the output , OUT, in Fig. 9.1 is at logic 0 when both switches, A and B, are open. Unless both A and B close, the output stays at logic 0.

Fig. 9.1

Switch representation of a two-input AND gate

A two-input AND gate functions similarly to the circuit in Fig. 9.1. If any two inputs, A and B, of the AND gate in Fig. 9.2 are at logic 0, the gate produces an output , OUT, at logic 0. Both inputs of the gate must be equal to logic 1 in order to produce an output at logic 1. This behavior is tabulated in Table 9.1, which is called a “truth table ”.

Fig. 9.2

Two-input AND gate symbol

Table 9.1

Two-input AND gate truth table

The functional representation of the two-input AND gate is:

Here, the symbol “.” between inputs A and B represents the AND-function.

OR Gate

Now, assume a parallel connectivity between switches A and B as shown in Fig. 9.3. OUT becomes to logic 1 if any of the switches close; otherwise the output will stay at logic 0.

Fig. 9.3

Switch representation of two-input OR gate

A two-input OR gate shown in Fig. 9.4 also functions similarly to the circuit in Fig. 9.3. If any two inputs are at logic 1, the gate produces an output, OUT, at logic 1. Both inputs of the gate must be equal to logic 0 in order to produce an output at logic 0. This behavior is tabulated in the truth table , Table 9.2.

Fig. 9.4

Two-input OR gate symbol

Table 9.2

Two-input OR gate truth table

The functional representation of the two-input OR gate is:

where, the symbol “+” between inputs A and B signifies the OR-function.

Exclusive OR Gate

A two-input Exclusive OR gate , XOR gate , is shown in Fig. 9.5. The XOR gate produces a logic 0 output if both inputs are equal. Therefore, in many logic applications this gate is used to compare the input logic levels to see if they are equal. The functional behavior of the gate is tabulated in Table 9.3.

Fig. 9.5

Two-input XOR gate symbol

Table 9.3

Two-input XOR gate truth table

The functional representation of the two-input XOR gate is:

where, the symbol “⊕” between inputs A and B signifies the XOR function.

Buffer

A buffer is a single input device whose output is logically equal to its input. The only use of this gate is to be able to supply current to the cumulative capacitive loading of logic gates at the output node. The logical representation of this gate is shown in Fig. 9.6.

Fig. 9.6

Buffer symbol

Complementary Logic Gates

All basic logic gates need to have complemented forms. If a single input needs to be complemented, an inverter shown in Fig. 9.7 is used. The inverter truth table is shown in Table 9.4.

Fig. 9.7

Inverter symbol

Table 9.4

Inverter truth table

The functional representation of the inverter is:

where, the symbol “−” on top of the input , IN, represents the complement-function.

The complemented form of two-input AND gate is called two-input NAND gate , where “N” signifies negation. The logic representation is shown in Fig. 9.8, where a circle at the output of the gate means complemented output. The truth table of this gate is shown in Table 9.5. Note that all output values in this table are exact opposites of the values given in Table 9.1.

Fig. 9.8

Two-input NAND gate symbol

Table 9.5

Two-input NAND gate truth table

The functional representation of the two-input NAND gate is:

Similar to the NAND gate, two-input OR and XOR gates have complemented configurations, called two-input NOR and XNOR gates , respectively.

The symbolic representation and truth table of a two-input NOR gate is shown in Fig. 9.9 and Table 9.6, respectively. Again, all the outputs in Table 9.6 are exact complements of Table 9.2.

Fig. 9.9

Two-input NOR gate symbol

Table 9.6

Two-input NOR gate truth table

The functional representation of the two-input NOR gate is:

The symbolic representation and truth table of a two-input XNOR gate is shown in Fig. 9.10 and Table 9.7, respectively. This gate , like its counterpart two-input XOR gate , is often used to detect if input logic levels are equal.

Fig. 9.10

Two-input XNOR gate symbol

Table 9.7

Two-input XNOR gate truth table

The functional representation of the two-input XNOR gate is:

Tri-State Buffer and Inverter

It is often necessary to create an open circuit between the input and the output of a logic gate if the gate is not enabled. This need creates two more basic logic gates, the tri-state buffer and tri-state inverter .

The tri-state buffer is shown in Fig. 9.11. Its truth table in Table 9.8 indicates continuity between the input and the output terminals if the control input, EN, is at logic 1; when EN is lowered to logic 0, an open circuit exists between IN and OUT, which is defined as a high impedance, HiZ, condition at the output terminal.

Fig. 9.11

Tri-state buffer symbol

Table 9.8

Tri-state buffer truth table

The tri-state inverter is shown in Fig. 9.12 along with its truth table in Table 9.9. This gate behaves like an inverter when EN input is at logic 1; however, if EN is lowered to logic 0, its output disconnects from its input .

Fig. 9.12

Tri-state inverter symbol

Table 9.9

Tri-state inverter truth table

The control input, EN, to tri-state buffer and inverter can also be complemented in order to produce an active-low enabling scheme.

The tri-state buffer with the active-low enable input in Fig. 9.13 creates continuity when EN = 0.

Fig. 9.13

Tri-state buffer symbol with complemented enable input

The tri-state inverter with the active-low input in Fig. 9.14 also functions like an inverter when EN is at logic 0, but its output becomes HiZ when EN is changed to logic 1.

Fig. 9.14

Tri-state inverter symbol with complemented enable input

9.2 Boolean Algebra

It is essential to be able to reconfigure logic gates to suit our design goals. Logical reconfigurations may be as simple as re-grouping the inputs of a single gate or complementing the inputs of several gates to reach a design objective.

Identity, commutative, associative, distributive laws and DeMorgan’s negation rules are used to perform logical manipulations. Table 9.10 tabulates these laws.

Table 9.10

Identity, commutative, associative, distributive and DeMorgan’s rules

Example 9.1

Reduce $$ {\text{OUT = A}}\,.\,{\overline{\text{B}}}\,.\,{\text{C + A}}\,.\,{\text{B}}\,.\,{\text{C + A}}\,.\,{\overline{\text{B}}} $$ using algebraic rules.

Example 9.2

Reduce $$ {\text{OUT}} = {\text{A}} + {\overline{\text A}}\,.\,{\text{B}} $$ using algebraic rules.

Example 9.3

Reduce $$ {\text{OUT}} = {\text{A}}\,.\,{\text{B}}+ {\overline{\text A}}\,.\,{\text{C}} + {\text{B}}\,.\,{\text{C}} $$ using algebraic rules.

Example 9.4

Reduce $$ {\text{OUT}} = ({\text{A}} + {\text{B}})\,.\,( {\overline{\text A}} + {\text{C}}) $$ using algebraic rules.

Example 9.5

Convert $$ {\text{OUT = (A + B)}}\,.\,\overline{{{\text{C}}\,.\,{\text{D}}}} $$ into an OR-combination of two-input AND gates using algebraic laws and DeMorgan’s theorem .

Example 9.6

Convert $$ {\text{OUT = A}}\,.\,{\text{B + C}}\,.\,{\text{D}} $$ into an AND-combination of two-input OR gates using algebraic laws and DeMorgan’s theorem.

9.3 Designing Combinational Circuits Using Truth Tables

A combinational circuit is cascaded form of basic logic gates without any feedback from the output to any input . The logic function is obtained from a truth table that specifies the complete functionality of the digital circuit.

Example 9.7

Using the truth table given in Table 9.11 determine the output function of the digital circuit.

Table 9.11

An arbitrary truth table with four inputs

The output function can be expressed either as the OR combination of AND gates or the AND combination of OR gates .

If the output is expressed in terms of AND gates, all output entries that are equal to one in the truth table must be grouped together as a single OR gate .

This expression is called the Sum Of Products (SOP ), and it contains seven terms each of which is called a “minterm”. In the first minterm, $$ {\overline{\text{A}}}\,.\,{\overline{\text{B}}}\,.\,{\overline{\text{C}}}\,.\,{\overline{\text{D}}} $$, each A, B, C and D input is complemented to produce OUT = 1 for the A = B = C = D = 0 entry of the truth table . Each of the remaining six minterms also complies with producing OUT = 1 for their respective input entries.

The resulting combinational circuit is shown in Fig. 9.15.

Fig. 9.15

AND-OR logic representation of the truth table in Table 9.11

If the output function needs to be expressed in terms of OR gates , all the output entries that are equal to zero in the truth table must be grouped as a single AND gate .

This expression is called the Product Of Sums (POS ), and it contains nine terms each of which is called a “maxterm”. The first maxterm, $$ {\text{A + B + }} {\overline{\text C}}{ + } {\overline{\text D}} $$, produces OUT = 0 for the ABCD = 0011 entry of the truth table. Since the output is formed with a nine-input AND gate, the values of the other maxterms do not matter to produce OUT = 0. Each of the remaining eight maxterms generates OUT = 0 for their corresponding truth table input entries.

The resulting combinational circuit is shown in Fig. 9.16.

Fig. 9.16

OR-AND logic representation of the truth table in Table 9.11

9.4 Combinational Logic Minimization—Karnaugh Maps

One of the most useful tools in logic design is the use of Karnaugh maps (K-map ) to minimize combinational logic functions.

Minimization can be performed in two ways. To obtain SOP form of a minimized logic function, the entries with logic 1 in the truth table must be grouped together in the K-map . To obtain POS form of a minimized logic function, the entries with logic 0 must be grouped together in the K-map.

Example 9.8

Using the truth table in Table 9.12, determine the minimized SOP and POS output functions. Prove them to be identical.

Table 9.12

An arbitrary truth table with three inputs

The K-map formed according to the truth table groups 1s to obtain the minimized output function, OUT, in SOP form in Fig. 9.17.

Fig. 9.17

K-map of the truth table in Table 9.12 to determine SOP

Grouping 1s takes place among neighboring boxes in the K-map where only one variable is allowed to change at a time. For instance, the first grouping of 1s combines ABC = 000 and ABC = 010 as they are in neighboring boxes. Only B changes from logic 0 to logic 1 while A and C stay constant at logic 0. To obtain OUT = 1, both A and C need to be complemented; this produces the first term, $$ {\overline{\text{A}}}\,.\,{\overline{\text{C}}} $$, for the output function. Similarly, the second grouping of 1s combines the neighboring boxes, ABC = 000, 001, 100 and 101, where both A and C change while B stays constant at logic 0. To obtain OUT = 1, B needs to be complemented; this generates the second term, $$ \overline{\text{B}} $$, for the output function.

This means that either the term $$ {\overline{\text{A}}}\,.\,{\overline{\text{C}}} $$ or $$ \overline{\text{B}} $$ makes OUT equal to logic 1. Therefore, the minimized output function, OUT, in the SOP form is:

Grouping 0s produces the minimized POS output function as shown in Fig. 9.18.

Fig. 9.18

K-map of the truth table in Table 9.12 to determine POS

This time, the first grouping of 0s combines the boxes, ABC = 011 and 111, where A changes from logic 0 to logic 1 while B and C stay constant at logic 1. This grouping targets OUT = 0, which requires both B and C to be complemented. As a result, the first term of the output function, $$ {\overline{\text B}}{ + } {\overline{\text C}} $$, is generated. The second grouping combines ABC = 110 and 111 where C changes value while A and B are equal to logic 1. To obtain OUT = 0, both A and B need to be complemented. Consequently, the second term, $$ {\overline{\text A}}{ + } {\overline{\text B}} $$, is generated.

Either of the terms $$ {\overline{\text B}}{ + } {\overline{\text C}} $$ or $$ {\overline{\text A}}{ + } {\overline{\text B}} $$ makes OUT = 0. Therefore, the minimized output function in the POS form becomes:

To find out if the SOP and POS forms are identical, one can manipulate the POS using the algebraic rules given earlier.

However, this is the SOP form of the output function derived above.

Example 9.9

Using the truth table in Example 9.7 determine the minimized SOP and POS output functions.

To obtain an output function in SOP form, 1s in the K-map in Fig. 9.19 is grouped together as shown below.

Fig. 9.19

K-map of the truth table in Table 9.11 to determine SOP

The minimized output function contains only three minterms compared to seven minterms in Example 9.7. Also, the minterms are reduced to groups of two or three inputs instead of four.

The resultant combinational circuit is shown in Fig. 9.20.

Fig. 9.20

Minimized logic circuit in SOP form from the K-map in Fig. 9.19

Further minimization can be achieved algebraically, which then reduces the number of terms from three to two.

The corresponding combinational circuit is shown in Fig. 9.21.

Fig. 9.21

Logic circuit in Fig. 9.20 after algebraic minimizations are applied

To obtain a POS output function, 0s are grouped together as shown in Fig. 9.22.

Fig. 9.22

K-map of the truth table in Table 9.11 to determine POS

The minimized output function contains only three maxterms compared to nine in Example 9.7. Also, the maxterms are reduced to groups of two inputs instead of four.

The resultant combinational circuit is shown in Fig. 9.23.

Fig. 9.23

Minimized logic circuit in POS form from the K-map in Fig. 9.22

Example 9.10

Determine if the minimized SOP and POS output functions in Example 9.9 are identical to each other.

Rewriting the POS form of OUT from Example 9.9 and using the algebraic laws shown earlier, this expression can be re-written as:

The result is identical to the SOP expression given in Example 9.9.

Example 9.11

Determine the minimal SOP and POS forms of the output function, OUT, from the K-map in Fig. 9.24. Note that the “X” sign corresponds to a “don’t care” condition that represents either logic 0 or logic 1.

Fig. 9.24

An arbitrary K-map with “don’t care” entries

For SOP, we group 1s in the K-map in Fig. 9.25. Boxes with “don’t care” are used as 1s to achieve a minimal SOP expression.

Fig. 9.25

Grouping to determine SOP form for the K-map in Fig. 9.24

The SOP functional expression for OUT is:

For POS , we group 0s in the K-map in Fig. 9.26. Boxes with “don’t care” symbols are used as 0s to achieve a minimal POS expression.

Fig. 9.26

Grouping to determine POS form for the K-map in Fig. 9.24

The POS functional expression for OUT is:

To show that the SOP and POS expressions are identical, we start with the POS expression using the algebraic manipulations described earlier in Table 9.10.

The result is identical to the minimal SOP expression for OUT shown above.

9.5 Basic Logic Blocks

2-1 Multiplexer

A 2-1 multiplexer (MUX) is one of the most versatile logic elements in logic design. It is defined as follows:

A functional diagram of the 2-1 MUX is given in Fig. 9.27. According to the functional description of this device, when sel = 1 input A is passed through the device to become its output. When sel = 0 input B is passed through the device to become its output .

Fig. 9.27

2-1 MUX symbol

According to this definition, the truth table in Table 9.13 can be formed:

Table 9.13

2-1 MUX truth table

Now, let us transfer the output values from the truth table to the K-map in Fig. 9.28.

Fig. 9.28

2-1 MUX K-map

Grouping 1s in the K-map reveals the minimal output function of the 2-1 MUX in SOP form:

The corresponding combinational circuit is shown in Fig. 9.29.

Fig. 9.29

2-1 MUX logic circuit

4-1 Multiplexer

Considering A, B, C and D are the inputs, the functional description of a 4-1 MUX becomes as follows:

According to this description, we can form a truth table and obtain the minimal SOP or POS expression for OUT. However, it is quite easy to decipher the SOP expression for OUT from the description above. The AND-combination of A, complemented sel1 and complemented sel2 inputs constitute the first minterm of our SOP. The second minterm should contain B, complemented sel1 and uncomplemented sel2 according to the description above. Similarly, the third minterm contains C, uncomplemented sel1 and complemented sel2. Finally, the last minterm contains D, uncomplemented sel1 and uncomplemented sel2 control inputs. Therefore, the SOP expression for the 4-1 MUX becomes equal to the logic expression below and is implemented in Fig. 9.30.

Fig. 9.30

4-1 MUX logic circuit in SOP form

However, implementing 4-1 MUX this way is not advantageous due to the amount of gate delays; a three-input AND gate is a serial combination of a three-input NAND and an inverter, and similarly a four-input OR connects a four-input NOR to an inverter . Therefore, we obtain a minimum of four gate delays instead of two according to this circuit.

Logic translations are possible to reduce the gate delay. The first stage of this process is to complement the outputs of all four three-input AND gates. This necessitates complementing the inputs of the four-input OR gate , and results in a circuit in Fig. 9.31.

Fig. 9.31

Logic conversion of 4-1 MUX in Fig. 9.30

However, an OR gate with complemented inputs is equivalent to a NAND gate . Therefore, the circuit in Fig. 9.32 becomes optimal for implementation purposes because the total MUX delay is only the sum of a three-input NAND and a four-input NAND gate delays instead of the earlier four gate delays.

Fig. 9.32

4-1 MUX logic circuit in NAND-NAND form

The symbolic diagram of the 4-1 MUX is shown in Fig. 9.33.

Fig. 9.33

4-1 MUX symbol

Encoders

Encoders are combinational logic blocks that receive 2N number of inputs and produce N number of encoded outputs .

Example 9.12

Generate an encoding logic from the truth table given in Table 9.14.

Table 9.14

An arbitrary encoder truth table with four inputs

The K-maps shown in Fig. 9.34 groups 1s and produces the SOP expressions for OUT1 and OUT2.

Fig. 9.34

K-maps of the truth table in Table 9.14

Decoders

Decoders are combinational logic blocks used to decode encoded inputs. An ordinary decoder takes N inputs and produces 2N outputs .

Example 9.13

Design a line decoder in which an active high enable signal activates only one of eight independent outputs according to truth table in Table 9.15. When the enable signal is lowered to logic 0, all eight outputs are disabled and stay at logic 0.

Table 9.15

Truth table of a line decoder with three inputs with enable

In this table, all outputs become logic 0 when the enable signal, EN, is at logic 0. However, when EN = 1, activation of the output starts. For each three-bit input entry, there is always one output at logic 1. For example, when IN[2] = IN[1] = IN[0] = 0, OUT[0] becomes active and equals to logic 1 while all other outputs stay at logic 0. IN[2] = IN[1] = IN[0] = 1 activates OUT[7] and disables all other outputs.

We can produce each output expression from OUT[7] to OUT[0] simply by reading the input values from the truth table. The accompanying circuit is composed of eight AND gates , each with four inputs as shown in Fig. 9.35.

Fig. 9.35

Logic circuit of a line decoder in Table 9.15

One-Bit Full Adder

A one-bit full adder has three inputs: A, B, and carry-in (CIN), and two outputs : sum (SUM) and carry-out (COUT). The symbolic representation of a full adder is shown in Fig. 9.36.

Fig. 9.36

One-bit full adder symbol

A one-bit full adder simply adds the contents of its two inputs, A and B, to the contents of CIN, and forms the truth table given in Table 9.16.

Table 9.16

One-bit full adder truth table

We can obtain the minimized SOP expressions for SUM and COUT from the K-maps in Figs. 9.37 and 9.38.

Fig. 9.37

SUM output of a one-bit full adder Consequently

Fig. 9.38

COUT output of a one-bit full adder

Consequently,

Thus,

The resultant logic circuits for SUM and COUT are shown in Fig. 9.39.

Fig. 9.39

One-bit full adder logic circuit

One-Bit Half Adder

A one-bit half adder has only two inputs, A and B with no CIN. A and B inputs are added to generate SUM and COUT outputs. The symbolic representation of a half-adder is shown in Fig. 9.40.

Fig. 9.40

One-bit half-adder symbol

The truth table given in Table 9.17 describes the functionality of the half adder .

Table 9.17

One-bit half-adder truth table

From the truth table, the POS expressions for SUM and COUT can be written as:

Therefore, we can produce SUM and COUT circuits as shown in Fig. 9.41.

Fig. 9.41

One-bit half adder logic circuit

9.6 Adders

One-bit full-adders can be cascaded serially to produce multiple-bit adder configurations. There are three basic adder types:

Ripple-Carry Adder

Carry-Look-Ahead (CLA) Adder

Carry-Select Adder

However, different hybrid adder topologies can be designed by combining these configurations. For the sake of simplicity, we will limit the number of bits to four and explain each topology in detail.

Ripple-Carry Adder

The ripple-carry adder is a cascaded configuration of multiple one-bit full adders . The circuit topology of a four-bit ripple carry adder is shown in Fig. 9.42. In this figure, the carry-out output of a one-bit full adder is connected to the carry-in input of the next full adder to propagate carry from CIN[0] to higher bits.

Fig. 9.42

Four-bit ripple-carry adder

For the 0-th bit of this adder, we have:

where,

G[0] = A[0] . B[0] as the zeroth order generation term

P[0] = A[0] + B[0] as the zeroth order propagation term

For the first bit:

where,

G[1] = A[1] . B[1] as the first order generation term

P[1] = A[1] + B[1] as the first order propagation term

For the second bit:

where,

G[2] = A[2] . B[2] as the second order generation term

P[2] = A[2] + B[2] as the second order propagation term

And for the third bit:

These functional expressions of SUM and COUT also serve to estimate the maximum gate delays for each bit of the adder .

The circuit diagram in Fig. 9.43 explains the maximum delay path through each bit.

Fig. 9.43

Logic circuit of the four-bit adder with the maximum and minimum delays

The maximum gate delay from A[0] or B[0] inputs to SUM[0] is 2TXOR2, where TXOR2 is a single two-input XOR gate delay.

The maximum gate delay from A[0] or B[0] to COUT[0] is 2TOR2 + TAND2 where TOR2 and TAND2 are two-input OR gate and two-input AND gate delays, respectively.

The gate delay from A[1] or B[1] to SUM[1] is still 2TXOR2; however, the delay from A[0] or B[0] to SUM[1] is 2TOR2 + TAND2 + TXOR2, which is more than 2TXOR2 and must be considered the maximum gate delay for this particular bit position and for more significant bits.

The maximum gate delay from A[0] or B[0] to COUT[1] is 3TOR2 + 2TAND2. It may make more sense to expand the expression for COUT[1] as COUT[1] = G[1] + P[1] . G[0] + P[1] . P[0] . CIN[0], and figure out if the overall gate delay, TOR2 + TAND3 + TOR3, is smaller compared to 3TOR2 + 2TAND2. Here, TAND3 and TOR3 are single three-input AND and OR gate delays, respectively.

The maximum gate delay from A[0] or B[0] to SUM[2] is 3TOR2 + 2TAND2 + TXOR2. When the expression for SUM[2] is expanded as SUM[2] = A[2] ⊕ B[2] ⊕ (G[1] + P[1] . G[0] + P[1] . P[0] . CIN[0]), we see that this delay becomes TOR2 + TAND3 + TOR3 + TXOR2, and may be smaller than the original delay if TAND3 < 2TAND2 and TOR3 < 2TOR2.

The maximum gate delay from A[0] or B[0] to COUT[2] is 4TOR2 + 3TAND2. When COUT[2] is expanded as COUT[2] = G[2] + P[2] . G[1] + P[2] . P[1] . G[0] + P[2] . P[1] . P[0] . CIN[0], the maximum delay becomes TOR2 + TAND4 + TOR4, and may be smaller than the original delay if TAND4 < 3TAND2 and TOR4 < 3TOR2. Here, TAND4 and TOR4 are single four-input AND and OR gate delays, respectively.

Finally, the maximum delay from A[0] or B[0] to SUM[3] is 4TOR2 + 3TAND2 + TXOR2, which is also the maximum propagation delay for this adder . When the functional expression for SUM[3] is expanded as SUM[3] = A[3] ⊕ B[3] ⊕ (G[2] + P[2] . G[1] + P[2] . P[1] . G[0] + P[2] . P[1] . P[0] . CIN[0]), the total propagation delay becomes TOR2 + TAND4 + TOR4 + TXOR2, and again it may be smaller compared to the original delay if TAND4 < 3TAND2 and TOR4 < 3TOR2.

Carry-Look-Ahead Adder

The idea behind carry-look-ahead (CLA) adders is to create a topology where carry-in bits to all one-bit full adders are available simultaneously. A four-bit CLA circuit topology is shown in Fig. 9.44. In this figure, the SUM output of a more significant bit does not have to wait until the carry bit ripples from the least significant bit position, but it gets computed after some logic delay. In reality, all carry-in signals are generated by complex combinational logic blocks called Carry-Look-Ahead (CLA) hook-ups, as shown in Fig. 9.44. Each CLA block adds a certain propagation delay on top of the two-input XOR gate delay to produce a SUM output .

Fig. 9.44

A four-bit carry-look-ahead adder

The earlier SUM and CIN expressions derived for the ripple carry adder can be applied to the CLA adder to generate its functional equations.

Therefore,

SUM[0] = A[0] ⊕ B[0] ⊕ CIN[0]

SUM[1] = A[1] ⊕ B[1] ⊕ CIN[1]

SUM[2] = A[2] ⊕ B[2] ⊕ CIN[2]

SUM[3] = A[3] ⊕ B[3] ⊕ CIN[3]

where,

CIN[1] = G[0] + P[0] . CIN[0]

CIN[2] = G[1] + P[1] . G[0] + P[1] . P[0] . CIN[0]

CIN[3] = G[2] + P[2] . G[1] + P[2] . P[1] . G[0] + P[2] . P[1] . P[0] . CIN[0]

Therefore, CIN[1] is generated by the COUT[0] function within FA0. However, CIN[2] and CIN[3] have to be produced by separate logic blocks in order to provide CIN signals for FA2 and FA3.

According to Fig. 9.44, once a valid CIN[0] becomes available, it takes successively longer times to generate valid signals for higher order SUM outputs due to the increasing complexity in CLA hook-ups.

Assume that TSUM0, TSUM1, TSUM2 and TSUM3 are the propagation delays of bits 0, 1, 2 and 3 with respect to the CIN[0] signal. We can approximate TSUM0 = TXOR2. To compute TSUM1, we need to examine the expression for CIN[1]. In this expression, P[0] . CIN[0] produces a two-input AND gate delay, and G[0] + (P[0] . CIN[0]) produces a two-input OR gate delay to be added on top of TXOR2. Therefore, TSUM1 becomes TSUM1 = TAND2 + TOR2 + TXOR2. Similarly, the expressions for CIN[2] and CIN[3] produce TSUM2 = TAND3 + TOR3 + TXOR2 and TSUM3 = TAND4 + TOR4 + TXOR2, respectively.

The maximum propagation delay for this adder is, therefore, TSUM3 = TAND4 + TOR4 + TXOR2.

Despite the CLA adder’s advantage of being faster than the ripple-carry adder , in most cases the extra CLA logic blocks make this adder topology occupy a larger chip area if the number of adder bits is above eight.

Carry-Select Adder

Carry-Select Adders require two rows of identical adders. The identical adders can be as simple as two rows of identical ripple-carry adders or CLA adders depending on the design requirements. Figure 9.45 shows the circuit topology of a four-bit carry-select adder composed of two rows of ripple carry adders .

Fig. 9.45

A four-bit carry-select adder

In this figure, the full adder at the least significant bit position operates normally and generates a value for COUT[0]. As this value is generated, the two one-bit full adders, one with CINA[1] = 0 and the other with CINB[1] = 1, simultaneously generate SUMA[1] and SUMB[1]. If COUT[0] becomes equal to one, SUMB[1] gets selected and becomes SUM[1]; otherwise, SUMA[1] becomes the SUM[1] output . Whichever value ends up being SUM[1], it is produced after a 2-1 MUX propagation delay.

However, we cannot say the same in generating SUM[2] and SUM[3] outputs in this figure. After producing SUM[1], carry ripples through both adders normally to generate SUM[2] and SUM[3]; hence, the speed advantage of having two rows of adders becomes negligible. Therefore, we must be careful when employing a carry-select scheme before designing an adder, as this method practically doubles the chip area.

Even though carry-select topology is ineffective in speeding up this particular four-bit adder, it may be advantageous if employed to an adder with greater number of bits in conjunction with another adder topology such as the CLA.

Example 9.14

Design a 32-bit carry-look-ahead adder . Compute the worst-case propagation delay in the circuit.

We need to be careful in dealing with the CLA hook-ups when generating higher order terms because the complexity of these logic blocks can “grow” exponentially in size while they may only provide marginal speed gain when compared to ripple-carry scheme.

Therefore, the first step of the design process is to separate the adder into eight-bit segments with full CLA hook-ups. The proposed topology is shown in Fig. 9.46.

Fig. 9.46

A 32-bit carry-look-ahead topology

Each eight-bit CLA segment contains six CLA hook-ups from CLA0 to CLA5 as shown in Fig. 9.47.

Fig. 9.47

An eight-bit segment of the carry-look ahead adder in Fig. 9.46

CIN and SUM expressions from bit 0 through bit 7 are given below.

SUM[0] = A[0] ⊕ B[0] ⊕ CIN[0]

SUM[1] = A[1] ⊕ B[1] ⊕ CIN[1]

where, CIN[1] = G[0] + P[0] . CIN[0]

SUM[2] = A[2] ⊕ B[2] ⊕ CIN[2]

where, CIN[2] = G[1] + P[1] . G[0] + P[1] . P[0] . CIN[0]

SUM[3] = A[3] ⊕ B[3] ⊕ CIN[3]

where, CIN[3] = G[2] + P[2] . G[1] + P[2] . P[1] . G[0] + P[2] . P[1] . P[0] . CIN[0]

SUM[4] = A[4] ⊕ B[4] ⊕ CIN[4]

where, CIN[4] = G[3] + P[3] . (G[2] + P[2] . G[1] + P[2] . P[1] . G[0] + P[2] . P[1] . P[0] . CIN[0])

SUM[5] = A[5] ⊕ B[5] ⊕ CIN[5]

SUM[6] = A[6] ⊕ B[6] ⊕ CIN[6]

SUM[7] = A[7] ⊕ B[7] ⊕ CIN[7]

And finally,

In these derivations, particular attention was paid to limit the number of inputs to four in all AND and OR gates since larger gate inputs are counterproductive in reducing the overall propagation delay.

From these functional expressions, maximum propagation delays for SUM[7] and COUT[7] are Estimated using the longest logic strings in Fig. 9.48.

Fig. 9.48

Propagation delay estimation of the eight-bit carry-look-ahead adder in Fig. 9.47

For SUM[7], the minterm, P[2] . P[1] . P[0] . CIN[0], generates the first four-input AND gate . This is followed by a four-input OR-gate whose minterms are G[2], P[2] . G[1], P[2] . P[1] . G[0], and P[2] . P[1] . P[0] . CIN[0]. This gate is followed by a four-input AND, four-input OR, two-input AND, two-input OR and two-input XOR-gates in successive order. The entire string creates a propagation delay of TSUM7 = 2(TAND4 + TOR4) + TAND2 + TOR2 + TXOR2 from CIN[0] to SUM[7].

For COUT[7], the longest propagation delay is between CIN[0] to COUT[7] as shown in Fig. 9.48, and it is equal to TCOUT7 = 2(TAND4 + TOR4) + TAND3 + TOR3. The delays for the rest of the circuit in Fig. 9.46 become easy to determine since the longest propagation delays have already been evaluated.

The delay from CIN[0] to SUM[15], TSUM15, simply becomes equal to the sum of TCOUT7 and TSUM7. In other words, TSUM15 = 4(TAND4 + TOR4) + TAND3 + TOR3 + TAND2 + TOR2 + TXOR2. Similarly, the delay from CIN[0] to COUT[15], TCOUT15, is equal to TCOUT15 = 4(TAND4 + TOR4) + 2(TAND3 + TOR3).

The remaining delays are evaluated in the same way and lead to the longest propagation delay in this circuit, which is from CIN[0] to SUM[31], TSUM31.

Thus,

TSUM31 = 3[2(TAND4 + TOR4) + TAND3 + TOR3] + 2(TAND4 + TOR4) + TAND2 + TOR2 + TXOR2

or

TSUM31 = 8(TAND4 + TOR4) + 3(TAND3 + TOR3) + TAND2 + TOR2 + TXOR2

Example 9.15

Design a 32-bit hybrid carry-select/carry-look-ahead adder . Compute the worst-case propagation delay in the circuit.

Large adders are where the carry-select scheme shines! This is a classical example in which the maximum propagation delay is reduced considerably compared to the CLA scheme examined in Example 9.14.

As mentioned earlier, a twin set of an adder configuration is required by the carry-select scheme. The adders can be ripple-carry, carry-look-ahead or the combination of the two.

In this example, the 32-bit adder is again divided in eight-bit segments where each segment consists of a full CLA adder as shown in Fig. 9.49. The first segment, CLA-0, is a single unit which produces COUT[7] with full CLA hook-ups. The rest of the eight-bit segments are mirror images of each other and they are either named A-segments (A1, A2 and A3) or B-segments (B1, B2 and B3).

Fig. 9.49

A 32-bit carry-look-ahead /carry-select adder

As the CLA-0 generates a valid COUT[7], the CLA-A1 and CLA-B1 simultaneously generate COUTA[15] and COUTB[15]. When COUT[7] finally forms, it selects either COUTA[15] or COUTB[15] depending on the value of CIN[0]. This segment produces COUT[15] and SUM[15:8].

COUT[15], on the other hand, is used to select between COUTA[23] and COUTB[23], both of which have already been formed when COUT[15] arrives at the 2-1 MUX as a control input. COUT[15] also selects between SUMA[23:16] and SUMB[23:16] to determine the correct SUM[23:16].

Similarly, COUT[23] is used as a control input to select between SUMA[31:24] and SUMB[31:24]. If there is a need for COUT[31], COUT[23] can serve to determine the value of COUT[31].

The maximum propagation delay for the 32-bit carry-select/CLA adder can be found using the logic string in Fig. 9.50. The first section of this string from CIN[0] to COUT[7] is identical to the eight-bit CLA carry delay in Fig. 9.48. There are three cascaded MUX stages which correspond to the selection of COUT[15], COUT[23], and SUM[31].

Fig. 9.50

Maximum delay propagation of the 32-bit adder in Fig. 9.49

Considering that a 2-1 MUX propagation delay consists of a two-input AND gate followed by a two-input OR gate , we obtain the following maximum delay for this 32-bit adder:

TSUM31 = 2(TAND4 + TOR4) + TAND3 + TOR3 + 3(TAND2 + TOR2)

Considering the maximum propagation delay in Example 9.14, this delay is shorter by at least 6(TAND4 + TOR4). Larger carry-select/carry-look-ahead adder schemes provide greater speed benefits at the cost of approximately doubling the adder area.

9.7 Subtractors

Subtraction is performed by a technique called Twos (2s) complement addition . Twos complement addition requires complementing one of the adder inputs (1s complement), and then adding one to the least significant bit.

Example 9.16

Form −4 using 2s complement addition using four bits.

A negative number is created by first inverting every bit of +4 (1s complement representation) and then adding 1 to it. +4 is equal to 0100 in four-bit binary form.

Its 1s complement is 1011. Its 2s complement is 1011 + 0001 = 1100.

Therefore, logic 0 signifies a positive sign, and logic 1 signifies a negative sign at the most significant bit position of a signed number.

Example 9.17

Add +4 to −4 using 2s complement addition

+4 = 0100 in binary form

−4 = 1100 in 2s complement form of +4.

Perform +4–4 = 0100 + 1100 = 1 0000

where, logic 1 at the overflow bit position is neglected in a four-bit binary format.

Therefore, we obtain 0000 = 0 as expected.

Subtractors function according to 2s complement addition . We need to form 1s complement of the adder input to be subtracted and use CIN[0] = 1 at the adder’s least significant bit position to perform subtraction.

Figure 9.51 illustrates the topology of a 32-bit subtractor where input B is complemented and CIN[0] is tied to logic 1 to satisfy 2s complement addition and produce A–B.

Fig. 9.51

A symbolic representation of a 32-bit subtractor

9.8 Shifters

There are two commonly used shifters in logic design:

Linear shifters

Barrel shifters

Linear Shifters

A linear shifter shifts its inputs by a number of bits to the right or left and routes the result to its output .

Example 9.18

Design a four-bit linear shifter that shifts its inputs to the left by one bit and produces logic 0 at the least significant output bit when SHIFT = 1. When SHIFT = 0, the shifter routes each input directly to the corresponding output.

The logic diagram for this shifter is given in Fig. 9.52. In this figure, each input is connected to the port 0 terminal of the 2-1 MUX as well as the port 1 terminal of the next MUX at the higher bit position. Therefore, when SHIFT = 1, logic 0, IN[0], IN[1], and IN[2] are routed through port 1 terminal of each 2-1 MUX and become OUT[0], OUT[1], OUT[2], and OUT[3], respectively. When SHIFT = 0, each input goes through port 0 terminal of the corresponding 2-1 MUX and becomes the shifter output.

Fig. 9.52

Four-bit linear shifter

Barrel Shifters

Barrel shifters rotate their inputs either in clockwise or counterclockwise direction by a number of bits but preserve all their inputs when generating an output.

Example 9.19

Design a four-bit barrel shifter that rotates its inputs in a clockwise direction by one bit when SHIFT = 1. When SHIFT = 0, the shifter routes each one of its four inputs to its corresponding output .

The logic diagram for this shifter is given in Fig. 9.53. The only difference between this circuit and the linear shifter in Fig. 9.52 is the removal of logic 0 from the least significant bit, and connecting this input to the IN[3] pin instead. Consequently, this leads to OUT[0] = IN[3], OUT[1] = IN[0], OUT[2] = IN[1] and OUT[3] = IN[2] when SHIFT = 1, and OUT[0] = IN[0], OUT[1] = IN[1], OUT[2] = IN[2] and OUT[3] = IN[3] when SHIFT = 0.

Fig. 9.53

Four-bit barrel shifter

Example 9.20

Design a four-bit barrel shifter that rotates its inputs clockwise by one or two bits.

First, there must be three control inputs specifying “no shift”, “shift 1 bit” and “shift 2 bits”. This requires a two control-bit input, SHIFT[1:0], as shown in Table 9.18. All assignments in this table are done arbitrarily. However, it makes sense to assign a “No shift” to SHIFT[1:0] = 0, “Shift 1 bit” to SHIFT[1:0] = 1 and “Shift 2 bits” to SHIFT[1:0] = 2 for actual rotation amount.

Table 9.18

A four-bit barrel shifter truth table

According to this table, if there is no shift, each input bit is simply routed to its own output . If “shift 1 bit” input is active, then each input is routed to the neighboring output at the next significant bit position. In other words, IN[3] rotates clockwise and becomes OUT[0]; IN[0], IN[1] and IN[2] shift 1 bit to the left and become OUT[1], OUT[2] and OUT[3], respectively. If “shift 2 bits” becomes active, then each input is routed to the output of the neighboring bit which is two significant bits higher. This gives the impression that all input bits have been rotated twice before being routed to the output. Thus, OUT[0] = IN[2], OUT[1] = IN[3], OUT[2] = IN[0] and OUT[3] = IN[1].

Therefore, using Table 9.18, we can conclude the logic diagram in Fig. 9.54.

Fig. 9.54

Logic diagram of the barrel shifter in Table 9.18

A more detailed view of Fig. 9.54 is given in Fig. 9.55.

Fig. 9.55

Logic circuit of the barrel shifter in Fig. 9.54

9.9 Multipliers

Similar to our everyday hand multiplication method, an array multiplier generates all partial products before summing each column in the partial product tree to obtain a result. This scheme is explained in Fig. 9.56 for a four-bit array multiplier.

Fig. 9.56

4 × 4 array multiplier algorithm

The rules of partial product generation are as follows:

1.

The zeroth partial product aligns with multiplicand and multiplier bit columns.

2.

Each partial product is shifted one bit to the left with respect to the previous one once it is created.

3.

Each partial product is the exact replica of the multiplicand if the multiplier bit is one. Otherwise, it is deleted.

Example 9.21

Multiply 1101 and 1001 according to the rules of array multiplication.

Suppose 1101 is a multiplicand and 1001 is a multiplier . Then, for a four-bit multiplier four partial products are formed. The bits in each column of the partial product are added successively. Carry bits are propagated to more significant bit positions. This process is illustrated in Fig. 9.57.

Fig. 9.57

4 × 4 array multiplier algorithm example

Example 9.22

Design the partial product tree for a four-bit array multiplier .

Following the convention in Fig. 9.56 and the rules of partial product generation for an array multiplier, we can implement the partial product tree as shown in Fig. 9.58.

Fig. 9.58

4 × 4 array multiplier bit selector tree

In this figure, partial product elements of the zeroth partial product, B[0].A[3], B[0].A[2], B[0].A[1] and B[0].A[0], are replaced by PP0[3:0] for purposes of better illustration. Similarly, PP1[3:0], PP2[3:0] and PP3[3:0] are the new partial product outputs corresponding to the rows one, two and three.

Example 9.23

Design a full adder tree responsible for adding every partial product in the partial product tree for a four-bit array multiplier .

After generating partial products, the next design step is to add partial product elements column by column to generate SUM outputs, SUM[7:0], while propagating carry bits for higher order columns. Following the naming convention in Fig. 9.58, all 16 partial product elements are fed to the full adder tree in Fig. 9.59. The box outlined by dashed lines shows how the carry propagation takes place from one column to the next.

Fig. 9.59

An eight-bit propagate adder for the bit selector tree in Fig. 9.58

9.10 D Latch

The D Latch is the most basic memory element in logic design. It has a data input, D, a clock input and a data output, Q, as shown at the top portion of Fig. 9.60. It contains a tri-state inverter at its input stage followed by two back-to-back inverters connected in a loop configuration, which serves to store data.

Fig. 9.60

Logic and circuit diagrams of a D latch

The clock signal connected to the enable input of the tri-state inverter can be set either to active-high or active-low. In Fig. 9.60, the changes at the input transmit though the memory element and appear at the output during the low phase of the clock. In contrast, changes at the input are blocked during the high phase of the clock, and no data transmits to the output. Once the data is stored in the back-to-back inverter loop, it becomes stable and does not change until different data is introduced at the input. The buffer at the output stage of the latch is used to drive multiple gate inputs.

The operation of the D latch is shown in Fig. 9.61. During the low phase of the clock , the tri-state inverter is enabled. The new data transmits through the tri-state inverter, overwrites the old data in the back-to-back inverter stage, and reaches the output . When the clock switches to its high phase, the input-output data transmission stops because the tri-state buffer is disabled and blocks any new data transfer. Therefore, if certain data needs to be retained in the latch, it needs to be stored in the latch some time before the rising edge of the clock. This time interval is called the set-up time , tS, and it is approximately equal to the sum of delays through the tri-state inverter and the inverter in the memory element. At the high phase of the clock, the data stored in the latch can no longer change as shown in Fig. 9.61.

Fig. 9.61

Operation of D latch

9.11 Timing Methodology Using D Latches

A pipeline consists of combinational logic blocks bounded by memory elements as shown at the top portion of Fig. 9.62. The main purpose of pipelines is to process several data packets within the same clock cycle and maximize the data throughput.

Fig. 9.62

Timing methodology using D latches

To illustrate the concept of pipeline, latches are used as memory elements in the pipeline shown in Fig. 9.62. In every latch boundary, data propagates from one combinational logic stage to the next at the high and low phases of clock .

The bottom figure in Fig. 9.62 shows the timing diagram of a data transfer for a set of data packets ranging from D1 to D3 at the IN terminal. The first data packet, D1⁰, retains its original value during the high phase of the clock (Cycle 1H) at the node A. D1⁰ then propagates through the T1 stage and settles at the node B in a modified form, D1¹, sometime before the falling edge of the clock. Similarly, D1¹ at the node C retains its value during the low phase of the clock while its processed form, D1², propagates through the T2 stage and arrives at the node D before the rising edge of the clock. This data is processed further in the T3 stage and transforms into D1³ before it becomes available at the OUT terminal at the falling edge of the clock in Cycle 2L.

Similarly, the next two data packets, D2⁰ and D3⁰, are also fed into the pipeline at the subsequent positive clock edges. Both of these data propagate through the combinational logic stages, T1, T2 and T3, and become available at the OUT terminal at the falling edge of Cycle 3L and Cycle 4L, respectively.

The total execution time for all three data packets takes four clock cycles according to the timing diagram in Fig. 9.62. If we were to remove all the latch boundaries between nodes A and F and wait until all three data packets, D1, D2 and D3, were processed through the sum of the three combinational logic stages, T1, T2 and T3, the total execution time would have been 3 × 3 = 9 clock cycles as each combinational logic stage requires one clock cycle to process data. Therefore, pipelining can be used advantageously to process data in a shorter amount of time and increase data throughput.

9.12 D Flip-Flop

D flip-flop is another important timing element in logic design to maintain timing while transferring data from one combinational logic block to the next.

Similar to a latch, a flip-flop also has a data input, D, a clock input and a data output , Q, as shown at the top portion of Fig. 9.63.

Fig. 9.63

Logic and circuit diagrams of a D flip-flop

The bottom portion of Fig. 9.63 shows the circuit schematic of a typical flip-flop which contains two latches in series. The first latch has an active-low clock input, and it is called the master. The second latch has an active-high clock input, and it is called the slave. The master accepts new data during the low phase of the clock, and transfers this data to the slave during the high phase of the clock .

Figure 9.64 shows the timing attributes of a flip-flop. The set-up time , tS, is the time interval for the valid data to arrive and settle in the master latch before the rising edge of the clock . The hold time, tH, is the time interval after the positive edge of the clock when the valid data needs to be kept steady and unchanged. The data stored in the master latch propagates through the slave latch and becomes the flip-flop output some time after the rising edge of the clock. This is called clock-to-q delay or tCLKQ.

Fig. 9.64

Timing attributes of a D flip-flop

The operation of the flip-flop in two different phases of clock is shown in Fig. 9.65. During the low phase of the clock, new data enters the master latch, and it is stored. This data cannot propagate beyond the master latch because the tri-state inverter in the slave latch acts as an open circuit during the low phase of the clock. The flip-flop output reveals only the old data stored in the slave latch. When the clock goes high, however, the new data stored in the master latch transmits through the slave and arrives at the output. One can calculate approximate values of tS and tCLKQ using the existing gate delays in the flip-flop.

Fig. 9.65

Operation of D flip-flop

9.13 Timing Methodology Using D Flip-Flops

Data propagation through a pipeline with D flip-flops is shown in Fig. 9.66.The bottom figure in Fig. 9.66 shows the timing diagram of a data transfer for a set of data packets ranging from D1 to D3 at the IN terminal.

Fig. 9.66

Timing methodology using D flip-flops

The first data packet, D1⁰, at the IN terminal has to be steady and valid during the set-up and hold periods of the flip-flop, but it is free to change during the remaining part of the clock period as shown by oscillatory lines. Once the clock goes high, the valid D1⁰ starts to propagate through the combinational logic block of T1 and reaches the second flip-flop boundary. The processed data, D1¹, has to arrive at the second flip-flop input, B, no later than the set-up time of the flip-flop. Otherwise, the correct data cannot be latched. D1¹ propagates through the second (T2) and third (T3) combinational logic stages, and becomes D1² and D1³, respectively, before exiting at the OUT terminal as shown in the timing diagram in Fig. 9.66.

The subsequent data packets, D2⁰ and D3⁰ are similarly fed into the pipeline stage at consecutive positive clock edges following D1⁰. They are processed and modified by the T1, T2 and T3 combinational logic stages as they propagate through the pipeline, and emerge at the OUT terminal.

The total execution time for three input data packets, D1⁰, D2⁰ and D3⁰, takes six clock cycles, including the initial three clock cycle build-up period before D1³ emerges at the OUT terminal. If we were to remove all the flip-flop boundaries between the nodes A and F, and wait for these three data packets to be processed without any pipeline structure, the total execution time would have been 3 x 3 = 9 clock cycles, assuming each T1, T2 or T3 logic stage imposes one clock cycle delay.

Once again, the pipelining technique considerably reduces the overall processing time and data throughput whether the timing methodology is latch-based or flip-flop-based.

The advantage of using latches as opposed to flip-flops is to be able to borrow time from neighboring stages. For example, the propagation delay in T1 stage can be extended at the expense of shortening the propagation delay in T2. This flexibility does not exist in a flip-flop based design in Fig. 9.66.

9.14 Timing Violations

Although pipelining scheme helps to reduce the overall data processing time, we still need to watch out for possible timing violations because occasionally data does not comply with the requirements of flip-flop (or latch) set-up and hold times at pipeline boundaries.

This section examines the set-up and hold timing violations in a pipeline controlled by flip-flops. Figure 9.67 shows a section of a pipeline where a combinational logic block with a propagation delay of TCOMB is sandwiched between two flip-flops. At the rising edge of the clock , the valid and steady data that meets the set-up and hold times is fed into the pipeline from the IN terminal. After tCLKQ delay at the node A, the data propagates through the combinational logic block and emerges at the node B as shown in the timing diagram . However, the data arrives at the node B past the allocated set-up time of the flip-flop and creates a set-up violation . The amount of violation is dependent on the clock period and is calculated as follows:

Fig. 9.67

Setup violation

(9.1)

Figure 9.68 describes the hold time violation where the clock shifts by TCLK due to an unexpected delay in the clock line. In the timing diagram , the valid data is fed into the pipeline from the IN terminal, and arrives at the node B after tCLKQ and TCOMB delays. Due to the shifted clock, the data arrives at the node B very early. This creates a substantial set-up time slack equal to (TC + TCLK − tS − tCLKQ − TCOMB) but produces a hold time violation at the delayed clock edge. The amount of violation is dependent on the clock delay and is calculated as follows:

Fig. 9.68

Hold violation

(9.2)

Set-up violations can be recovered simply by increasing the clock period, TC. However, there is no easy way to fix hold violations. We need to search for hold time violation at each flip-flop input, and add additional delay to the combinational logic block terminating at the particular flip-flop in order to avoid the violation.

The schematic in Fig. 9.69 examines the timing ramifications of two combinational logic blocks with different propagation delays merging into one block in a pipeline stage. The data at the node A arrives at the node C much earlier than the data arriving at the node D as shown in the timing diagram . The data at the nodes C and D propagate through the last combinational logic block and arrive at the node E. This scenario creates minimum and maximum paths at the node E. We need to focus on the maximum path, (T2 + T3), when examining the possibility of a set-up violation and the minimum path, (T1 + T3), when examining the possibility of a hold violation at the next clock edge.

Fig. 9.69

A timing example combining two independent data-paths

To further illustrate the timing issues through multiple combinational logic blocks, an example with logic gates is given in Fig. 9.70. In this example, the inputs of a one-bit adder are connected to the nodes A and B. The adder is bypassed with the inclusion of a 2-1 MUX which selects either the output of the adder or the bypass path by a selector input, SEL.

Fig. 9.70

An example with multiple propagation paths

The propagation delays of the inverter, TINV, and the two-input NAND gate , TNAND2, are given as 100 ps and 200 ps, respectively. The set-up, hold and clock-to-q delays are also given as 100, 0 and 300 ps, respectively.

One-bit full adder and the 2-1 MUX are shown in terms of inverters and two-input NAND gates in Fig. 9.71. We obtain a total of seven propagation paths all merging at the node R. However, we only need to search for the maximum and the minimum paths to locate possible set-up and hold violations .

Fig. 9.71

Logic circuit of Fig. 9.70 showing maximum and minimum paths

The maximum delay path consists of the inverter 1, and the series combination of four two-input NAND gates numbered as 1, 3, 4 and 6 shown in the schematic. This path results in a total delay of 900 ps. The minimum delay path, on the other hand, contains two two-input NAND gates numbered as 5 and 6, and it produces a delay of 400 ps. Placing these propagation delays in a timing diagram in Fig. 9.72 ultimately yields a set-up slack of 100 ps at the node R when a clock period of 1400 ps is used. There is no need to investigate for hold violations because there is no shift in the clock edge. The data emerges at the nodes A, B, C and SEL after tCLKQ = 300 ps where tH = 0 ps.

Fig. 9.72

Timing diagram of the circuit in Fig. 9.71

9.15 Register

While a flip-flop can hold data only for one clock cycle until a new data arrives at the next clock edge, a register can hold the same data perpetually until the power is turned off.

Figure 9.73 shows the circuit diagram of a one-bit register composed of a flip-flop and a 2-1 MUX . The Write Enable pin, WE, is a selector input to the 2-1 MUX and transfers new data from the IN terminal to the flip-flop input when WE = 1. If the WE input is at logic 0, any attempt to write a new data to the register is blocked; the old data stored in the flip-flop simply circulates around the feedback loop from one clock cycle to the next.

Fig. 9.73

One-bit register and a sample timing diagram

The timing diagram at the bottom of Fig. 9.73 describes the operation of the one-bit register. The data at the IN terminal is blocked until the WE input becomes logic 1 in the middle of the second clock cycle. At this point, the new data is allowed to pass through the 2-1 MUX and updates the contents of the register at the rising edge of the third clock cycle. Since the WE input is pulled to logic 0 before the end of the third clock cycle, the register output , OUT, stays at logic 1 during the fourth clock cycle.

A 32-bit register shown in Fig. 9.74 is composed of 32 one-bit registers. All 32 registers have a common clock and WE input. Therefore, any new 32-bit data introduced at the register input changes the contents of the register at the rising edge of the clock if the WE input is kept at logic 1.

Fig. 9.74

32-bit register

9.16 Shift Register

The shift register is a particular version of an ordinary register and specializes in shifting data to the right or left according to design needs.

Figure 9.75 shows the circuit schematic of a four-bit shift register that shifts serial data at the IN terminal to the left at every positive clock edge.

Fig. 9.75

Four-bit shift register

The operation of this shift register is explained in the timing diagram in Fig. 9.76. In cycle 1, SHIFT = 0. Therefore, the change at the IN terminal during this cycle does not affect the register outputs. However, when the SHIFT input transitions to logic 1 in the middle of cycle 2, it allows IN = 1 to pass to the least significant output bit, OUT[0], at the beginning of the third clock cycle. From the middle of cycle 2 to cycle 13, SHIFT is kept at logic 1. Therefore, any change at the IN node directly transmits to the OUT[0] node at the positive edge of every clock cycle. The other outputs, OUT[1], OUT[2] and OUT[3], produce the delayed version of the OUT[0] one clock cycle apart from each other because the output of a lesser significant bit is connected to the input of a greater significant bit in the shift register.

Fig. 9.76

A sample timing diagram of the four-bit shift register in Fig. 9.75

When the SHIFT input transitions to logic 0 from the middle of cycle 13 to cycle 17, the shift register becomes impervious to any new data entry at the IN terminal, and retains the old values from the beginning of cycle 13 to cycle 18 as shown in Fig. 9.76. From the middle of cycle 17, the SHIFT input becomes logic 1 again, and the shift register distributes new data entries at the IN terminal to its outputs .

9.17 Counter

The counter is a special form of a register which is designed to count up (or down) at each rising edge of the clock .

The counter in Fig. 9.77 shows a typical 32-bit up-counter with two control inputs, COUNT and LOAD. COUNT = 1 enables the counter to count upwards at the rising edge of each clock cycle. LOAD = 1 loads new data at the IN terminal to the counter. Once loaded, the counter output , OUT[31:0], increments by one at every positive clock edge until all of its outputs become logic 1. The next increment automatically resets all the counter outputs to logic 0. When LOAD = COUNT = 0, the counter neither loads new data nor is able to count upwards; it stalls and repeats its old output value.

Fig. 9.77

A 32-bit counter and a sample timing diagram

The sample timing diagram at the bottom of Fig. 9.77 illustrates its operation. Prior to the first clock edge, the LOAD input is at logic 1 which allows an input value, IN[31:0] = 3, to be stored in the counter. This results in OUT[31:0] = 3 at the positive edge of the first clock cycle. During the first clock cycle, LOAD = 0 and COUNT = 1 start the up-count process. The contents of the output, OUT[31:0] = 3, subsequently increments by one. The result, 3 + 1 = 4, passes through the C-port of the 3-1 MUX and arrives at the flip-flop inputs. At the positive edge of the second clock cycle, this new value overwrites the old registered value, and the OUT[31:0] node becomes equal to 4. In the next cycle, the counter goes through the same process and increments by one. However, in the same cycle, the LOAD input also transitions to logic 0, and turns on the I-port of the 3-1 MUX. This new port prevents any new data from entering the up-counter , but keeps the old data in the following clock cycles. As a result, the counter output stops incrementing and stalls at the value of OUT[31:0] = 5.

9.18 Moore-Type State Machine

State machines are mainly used in digital designs to control the proper data-flow. Their topology is mainly composed of one or multiple flip-flops and feedback loop(s) that connect flip-flop outputs to flip-flop inputs. There are two types of state machines: Moore-type and Mealy-type.

Figure 9.78 shows the Moore-type state machine topology consisting of a flip-flop and a feedback loop. In this configuration, the feedback loop includes a combinational logic block that accepts both the flip-flop output and external inputs. If there are multiple flip-flops, the combination of all flip-flop outputs constitutes the “present” state of the machine. The combination of all flip-flop inputs is called the “next” state because at the positive edge of the clock these inputs become the flip-flop outputs , and form the “next” present state . Flip-flop outputs may be processed further by an additional combinational logic block to form present state outputs.

Fig. 9.78

Block diagram and state representation of Moore machine

The basic state diagram of a Moore machine , therefore, includes the present state (PS) and the next state (NS) as shown on the right hand side of Fig. 9.78. The machine can transition from the PS to the NS if the required present state inputs are supplied. The outputs of the Moore machine are solely generated by the present state. Therefore, machine outputs emerge only from the present and the next states as shown in the basic state diagram.

The state diagram in Fig. 9.79 shows an example of a Moore-type machine with four states. Note that every state-to-state transition in the state diagram requires a valid present state input entry, and every node generates one present state output .

Fig. 9.79

State diagram of a Moore machine with four states

The state 0, S0, produces a present state output, OUT = 1, regardless of the value of the present state input, IN. When IN = 1, the state S0 transitions to the next state S1; otherwise, it maps onto itself. The state S1 produces OUT = 2. Its next state becomes the state S1 if IN = 0; otherwise, it transitions to a new state S2. The state S2 also produces a present state output, OUT = 3, and transitions to the state S3 if IN = 1. The state S2 remains unchanged if IN = 0. In the fourth and final state S3, the present state output , OUT = 4, is produced. The machine stays in this state if IN stays at 0; otherwise, it goes back to the state S1.

The present state inputs and outputs of this Moore machine and its states can be tabulated in a table called the “state table ” given in Fig. 9.80. In this table, the first column under PS lists all the possible present states of the state diagram in Fig. 9.79. The middle two columns contain the next state entries for IN = 0 and IN = 1. The last column lists the present state outputs, one for each present state.

Fig. 9.80

State table of the Moore machine in Fig. 9.79

The binary state assignment is performed in Fig. 9.81 where only one bit is changed between adjacent states.

Fig. 9.81

Bit representations of states S0, S1, S2 and S3

The binary form of the state table in Fig. 9.80 is reconstructed in Fig. 9.82 according to the state assignment in Fig. 9.81. This table, called the “transition table ”, includes the binary representation of the next state and the present state outputs .

Fig. 9.82

Transition table of the Moore machine in Fig. 9.79

Forming this machine’s K-maps for the NS0, NS1, OUT0, OUT1 and OUT2 requires grouping all the input terms, PS1, PS0 and IN, according to the table in Fig. 9.82. The K-maps and their corresponding SOP representations are shown in Fig. 9.83.

Fig. 9.83

K-maps and SOP expressions for the Moore machine in Fig. 9.79

The next step is to generate the circuit diagram that produces all five outputs of the Moore machine according to the SOP expressions in Fig. 9.83. This circuit diagram is given in Fig. 9.84.

Fig. 9.84

Logic circuit of the Moore machine in Fig. 9.79

In order to generate this circuit, the individual combinational logic blocks for the NS0 and NS1 must be constructed first in terms of PS0, PS1 and IN. Then each NS0 and NS1 node is connected to the corresponding flip-flop input to form the feedback loops of the state machine . The logic blocks for the OUT0, OUT1 and OUT2 are generated directly from PS0 and PS1.

9.19 Mealy-Type State Machine

The Mealy-type state machine shares the same circuit topology as the Moore-type machine. The machine contains one or more flip-flops and feedback loop(s) as shown in Fig. 9.85. However, present state outputs are generated from the combinational logic block in the feedback loop rather than from present states in the Moore-type machines.

Fig. 9.85

Block diagram and state representation of Mealy-type machine

As a result of this topology, the basic state diagram of a Mealy machine includes the present state, the next state and the input condition that transition the present state to the next state as shown on the right hand side of Fig. 9.85. The present state outputs do not emerge from each present state; instead, they are functions of the present state inputs and the present state .

The Mealy state diagram in Fig. 9.86 exhibits similar characteristics compared to the Moore state diagram in Fig. 9.79, and all the state names and the state-to-state transitions in this diagram are kept the same for comparison purposes. However, each arrow connecting one state to the next now carries the value of the present state output as a function of the present state input as indicated in Fig. 9.85. As a result, the Mealy state table in Fig. 9.87 contains two separate columns that tabulate the values of NS and OUT for IN = 0 and IN = 1. The binary state assignment is the same as in Fig. 9.81, which results in a transition table in Fig. 9.88.

Fig. 9.86

State diagram of a Mealy-type machine with four states

Fig. 9.87

State table of the Mealy-type machine in Fig. 9.86

Fig. 9.88

Transition table of the Mealy-type machine in Fig. 9.86

The K-maps for the NS0, NS1, OUT0, OUT1 and OUT2 are formed according to the table in Fig. 9.88 and are shown in Fig. 9.89 with the corresponding SOP expressions. Figure 9.90 shows the circuit diagram of this machine according to the expressions in Fig. 9.89. The methodology used to construct this circuit diagram is identical to the methodology used in the circuit diagram for the Moore machine in Fig. 9.84.

Fig. 9.89

K-maps and SOP expressions for the Mealy-type machine in Fig. 9.86

Fig. 9.90

Logic circuit of the Mealy-type machine in Fig. 9.86

9.20 Controller Design: Moore-Type State Machine Versus Counter-Decoder Scheme

Both Mealy and Moore-type state machines have practical implementation limits when it comes to design. A large ring-style state machine composed of N states such as Fig. 9.91 may have multiple outputs attached to each state, making its implementation nearly impossible with conventional state machine implementation techniques. However, these types of designs are excellent candidates for the counter-decoder type of designs where each state in the state diagram is associated with a counter output value. Therefore, as the counter increments, the present state outputs of each state in Fig. 9.91 can simply be generated using a set of decoders connected at the counter output.

Fig. 9.91

State diagram of a counter with N states

To illustrate this theory, a controller that generates the timing diagram in Fig. 9.92 will be implemented using both the Moore-type state machine and the counter-decoder approach.

Fig. 9.92

Timing diagram of a state machine with a single input, Stop, and a single output

As shown in the timing diagram below, this state machine generates a single active-high output , Out = 1, once in every eight cycles as long as Stop = 0. When Stop = 1, the machine stalls and retains its current state.

Once the state assignments are made for each clock cycle of Fig. 9.92, the state diagram in Fig. 9.93 emerges for a Moore-type state machine.

Fig. 9.93

Moore-type state machine representation of the timing diagram in Fig. 9.92

The states S0 and S1 in the timing diagram are assigned to the first and second clock cycles, respectively. The third clock cycle is assigned to state S2 where Out = 1. The fourth clock cycle corresponds to state S3. The machine stays in state S3 as long as Stop = 1. This ranges from the fourth to the sixth clock cycle in the timing diagram. The state assignments from the seventh to the tenth clock cycles become states S4, S5, S6 and S7. The eleventh clock cycle returns to state S0.

Implementing the state diagram in Fig. 9.93 follows a lengthy process of producing the state tables , transition tables , and K-maps that results in a total of four outputs (three flip-flop outputs due to eight states and one output for Out). However, using a counter-decoder approach minimizes this design task considerably and reveals a rather explicit circuit implementation.

When the timing diagram in Fig. 9.92 is redrawn to implement the counter-decoder design approach, it yields a simple three-bit counter which counts from zero to seven as shown in Fig. 9.94. The counter output , CountOut, is included in this figure to show the relationships between the state assignments, the input node, Stop, and the output node, Out. The figure also shows the clock cycle where the counter resets itself when its output reaches seven.

Fig. 9.94

Timing diagram of a three-bit counter with a single input (Stop) and a single output

The first task for the design is to construct a three-bit up-counter as shown in Fig. 9.95. The counter in this figure is derived from a general counter topology, and it consists of a three-bit adder, three 2-1 MUXes and three flip-flops. A three-input AND gate is used as a decoder at the counter output to implement Out = 1 when the CountOut node reaches 2. Therefore, this method follows a simple, step-by-step design approach in producing the final circuit that does not require implicit logic design techniques.

Fig. 9.95

Counter-decoder representation of the timing diagram in Fig. 9.94

9.21 A Simple Memory Block

Small memory blocks can be assembled from one-bit registers shown in Fig. 9.73 to use in a variety of designs. For example, a 32-bit wide, 16-bit deep memory block shown in Fig. 9.96 can be built by stacking 16 rows of 32-bit registers on top of each other. The 32-bit register in each row has tri-state output buffers to be used during read as shown in Fig. 9.97.

Fig. 9.96

A 32 × 16 memory and the truth table of its address decoder

Fig. 9.97

A 32-bit register slice at every row of Fig. 9.96

All inputs to each column of Fig. 9.96 are connected together to write data. For example, the input terminal, IN[0], in Fig. 9.96 is connected to all the input pins, In[0], of rows 0 to 15 in Fig. 9.97 to write a single bit of data at a selected row. The same is true for the remaining inputs, IN[1] through IN[31].

Similarly, all outputs of each column in Fig. 9.96 are connected together to read data from the memory block. For example, the output pin, OUT[0], is connected to all output pins, Out[0], from each row to read one bit of data from a selected row. The same is true for the remaining output pins, OUT[1] through OUT[31].

Every row of the memory block in Fig. 9.96 is accessed by individual Write Enable (WE) and Read Enable (RE) signals for writing or reading data, respectively.

In order to generate the WE inputs, WE[0] to WE[15], an address decoder is used. This decoder enables only one row while deactivating all the other rows using a four-bit address, Address[3:0], and a single WE input according to the truth table in Fig. 9.98. For example, a 32-bit data is written to row 0 if WE = 1 and Address[3:0] = 0000 at the decoder input. However, WE = 0 blocks writing data to all rows of the memory block regardless of the input address as shown in the truth table in Fig. 9.99.

Fig. 9.98

The address decoder for the 32 × 16 memory in Fig. 9.96 when WE = 1

Fig. 9.99

The address decoder for the 32 × 16 memory in Fig. 9.96 when WE = 0

The RE inputs, RE[0] through RE[15], use address decoders similar to Fig. 9.98 and Fig. 9.99 to read a block of data from a selected row. The read operation is achieved with a valid input address and RE = 1 according to the truth table in Fig. 9.100. An RE = 0 entry disables reading data from any row regardless of the value of the input address as shown in Fig. 9.101.

Fig. 9.100

The address decoder for the 32 × 16 memory in Fig. 9.96 when RE = 1

Fig. 9.101

The address decoder for the 32 × 16 memory in Fig. 9.96 when RE = 0

Therefore, one must provide a valid input address and the control signals, RE and WE, to perform a read or a write operation, respectively. The WE = 0 and RE = 1 combination reads data from the selected row. Similarly, the WE = 1 and RE = 0 combination writes data to a selected row. The WE = 0 and RE = 0 combination disables both reading and writing to the memory block. The control input entry, WE = 1 and RE = 1, is not allowed, and it should be interpreted as memory read.

9.22 A Design Example

This design example combines the data-path and controller design concepts described earlier in this chapter. It also introduces the use of important sequential logic blocks, such as flip-flop, register , counter and memory, into the design.

Every design starts with gathering the small or large logic blocks to construct a data-path and setting up a proper data-flow according to the design specifications. Once the data-path is set, then the precise data movements from one logic block to the next is shown using a timing diagram . Any change in the data-path should be included in the timing diagram or vice versa.

When the data-path design and its timing diagram are complete and fully associate with each other, the next step in the design process is to build the controller circuit that governs the data-flow. To define the states of the controller, the clock periods that generate different sets of controller outputs are separated from each other and named as distinct states. Similarly, the clock periods with identical controller outputs are combined under the same state. The controller design can be Moore-type or Mealy-type according to the design needs.

The example design in this section reads two eight-bit data packets from an 8 × 8 source memory (memory A), processes them and stores the result in an 8 × 4 target memory (memory B). The processing part depends on the relative contents of each data packet: if the contents of the first data packet are larger than the second, the contents of the data packets are added. Otherwise, they are subtracted from each other before the result is stored.

The block diagram in Fig. 9.102 demonstrates the data-path required for this memory-to-memory data transfer as described above. The timing diagram in Fig. 9.103 needs to accompany the data-flow in Fig. 9.102 since it depicts precise data movements at each clock cycle.

Fig. 9.102

Data-path of a memory -memory data transfer

Fig. 9.103

Timing diagram of the memory -memory data transfer in Fig. 9.102

Initially, counter A generates the addresses 0 to 7 for the memory A and writes the data packets A0 to A7 through its DataInA[7:0] port. This is shown in the timing diagram in Fig. 9.103 from clock cycles 1 through 8. When this task is complete, counter A resets and reads the first data packet A0 from AddrA[2:0] = 0 in clock cycle 9. In the next clock cycle, A0 becomes available at DOut1[7:0], and the counter A increments by one. In cycle 11, AddrA[2:0] becomes 2, the data packet A1 is read from DOut1[7:0], and the data packet A0 transfers to DOut2[7:0]. In this cycle, the contents of the data packets A0 and A1 are compared with each other by subtracting A1 (at DOut1) from A0 (at DOut2). If the contents of A0 are less than A1, then the sign bit, Sign, of (A0 − A1) becomes negative. Sign = 1 selects (A0 + A1) at ADDOut[7:0] and routes this value to DataInB[7:0]. However, if the contents of A0 are greater than A1, (A0 − A1) becomes positive. Sign = 0 selects (A0 − A1) and routes this value from SUBOut[7:0] to DataInB[7:0]. The result at DataInB[7:0] is written at AddrB[1:0] = 0 of memory B at the positive edge of clock cycle 12. In the same cycle, A1 is transferred to DOut2[7:0], and A2 becomes available at DOut1[7:0]. A comparison between A1 and A2 takes place, and either (A1 + A2) or (A1 – A2) is written to memory B depending on the value of the Sign node. However, this is an unwarranted step in the data transfer process because the design requirement states that the comparison has to be done only once between data packets from memory A. Since A1 is used in an earlier comparison with A0, A1 cannot be used in a subsequent comparison with A2, and neither (A1 + A2) nor (A1 - A2) should be written to memory B. The remaining clock cycles from 13 through 18 compare the values of A2 with A3, A4 with A5, and A6 with A7, and write the added or subtracted results to memory B. After clock cycle 19, all operations on this data-path suspend, the counters are reset, and all writes to the memory core are disabled.

To govern the data-flow in Fig. 9.103, a Moore-type state machine (or a counter-decoder -type controller) is used. A Mealy-type state machine for a controller design is usually avoided because the present state inputs to this type of state machine may change during the clock period and result in jittery outputs .

The inclusion of the controller identifies the control signals that govern the data-flow in Fig. 9.104. These signals increment the counters A and B, and enable writes to memory A or B when necessary. The timing diagram in Fig. 9.103 is also expanded to include the control signals, IncA, IncB, WEA and WEB, as shown in Fig. 9.105. Therefore, it provides a complete picture of the data transfer process from memory A to memory B in contrast to the earlier timing diagram in Fig. 9.103.

Fig. 9.104

Compete block diagram of the memory-memory data transfer with the controller

Fig. 9.105

Complete timing diagram of the memory-memory data transfer in Fig. 9.104

The controller in Fig. 9.104 is implemented by a Moore-type state machine in Fig. 9.106 and counter-decoder-type design in Fig. 9.107.

Fig. 9.106

Moore-type state diagram of the controller unit in Fig. 9.104

Fig. 9.107

Counter-decoder schematic of the controller unit in Fig. 9.104

In the Moore type design, the states from S1 through S18 are assigned to each clock cycle of the timing diagram in Fig. 9.105. Subsequently, the values of the present state outputs , WEA, IncA, WEB and IncB, at each clock cycle are read off from the timing diagram and attached to each state in Fig. 9.106. The reset state, S0, is included in the Moore machine in case the data-path receives an external reset signal to interrupt an ongoing data transfer process. Whichever state the machine may be, Reset = 1 always transitions the state of the machine to S0 state. These transitions are not included in Fig. 9.106 for simplicity.

The counter-decoder style design in Fig. 9.107 consists of a five-bit counter and four decoders to generate WEA, IncA, WEB and IncB control signals. To show the operation of this design to generate WEA, for example, this particular decoder includes eight five-input AND gates, one for each clock cycle from cycle number one to cycle number eight in order to keep WEA = 1 in Fig. 9.105. The five-bit counter implicitly receives a reset signal from its output when it reaches clock cycle 18 and resets counter A, counter B and the rest of the system in Fig. 9.104.

Review Questions

1. Implement the following gates:

(a)

Implement a two-input XOR gate using two-input NAND gates and inverters.

(b)

Implement a two-input AND gate using two-input XNOR gates and inverters.

2. Simplify the equation below:

3. Simplify the equation below:

4. Obtain the SOP and POS expressions for the following function:

5. Implement the following function using NAND gates and inverters:

6. Implement the following function using NOR gates and inverters:

7. Implement the following 2-1 multiplexer using AND and OR gates:

Note that the function of this complex gate must produce the following:

If En = 1 then out = A else (when En = 0) out = B.

8. Implement the following 3-1 multiplexer using AND and OR gates:

Note that the function of this complex gate must produce the following:

If En = 2 then out = A; if En = 1 then out = B else (when En = 0 or En = 3) out = C.

9. Implement a two-bit ripple-carry adder with inputs A[1:0] and B[1:0] and an output C[1:0] using one-bit half- and full-adders. Preserve the overflow bit at the output as C[2].

10. Implement a two-bit ripple-carry subtractor with inputs A[1:0] and B[1:0] and an output C[1:0] using one-bit half and full-adders. Preserve the overflow bit at the output as C[2].

11. Implement a two-bit multiplier with inputs A[1:0] and B[1:0] and an output C[3:0] using one-bit half and full-adders.

12. Construct a four-bit comparator with inputs A[3:0] and B[3:0] using a subtractor. The comparator circuit should identify the following cases as active-high outputs:

A[3:0] = B[3:0]

A[3:0] > B[3:0]

A[3:0] < B[3:0]

13. Implement a two-bit decoder that produces four outputs.

When enabled the decoder generates the following outputs:

in[1:0] = 0 then out[3:0] = 1

in[1:0] = 1 then out[3:0] = 2

in[1:0] = 2 then out[3:0] = 4

in[1:0] = 3 then out[3:0] = 8

When disabled the out [3:0] always equals to zero regardless of the input value.

14. Design a 64-bit adder in ripple-carry form and compare it against carry-look-ahead, carry-select, and carry-look-ahead/carry-select hybrids in terms of speed and the number of gates which define the circuit area. Divide the 64-bit carry-look-ahead/carry-select hybrid into four-bit, eight-bit, 16-bit and 32-bit carry-look-ahead segments. Indicate which carry-look-ahead/carry-select hybrid produces the optimum design.

15. Implement the following Moore machine:

16. Implement the following Moore machine using a timer. The timer is initiated when In = 1. The state machine goes to the A-state and stays there for 10 cycles. In the tenth cycle, the state machine transitions to the B-state and stays in this state for only one cycle before switching to the IDLE-state. One implementation scheme is to construct a four-bit up-counter to generate the timer. When the counter output reaches 9, the decoder at the output of the counter informs the state machine to switch from the A-state to the B-state.

17.The following decoder needs to be implemented using only two-input NAND gates and inverters.

TNAND = 500 ps (two-input NAND propagation delay)

TINV = 100 ps (inverter propagation delay)

tCLKQ = 200 ps (clock-q delay)

tSU = 200 ps (set-up time)

tH = 300 ps (hold time)

(a)

Implement this decoder between two flip-flop boundaries.

(b)

Find the maximum clock frequency using a timing diagram.

(c)

Now the clock is shifted by 500 ps at the receiving flip-flop boundary. Show whether or not you have any hold violation using a timing diagram.

18. The block diagram is given below:

Block B contains one-bit adder with SUM = A ⊕ B ⊕ CIN and COUT = A . B + CIN . (A + B), and two flip-flops as shown below:

(a)

Using the gates with propagation delays below, determine the setup time for the A, B, and CIN inputs with respect to clkshift.

(b)

Assuming T = 0 ns and TCLK (clock period) = 5 ns, if data at A, B and CIN become valid and stable 4 ns after the positive edge of clkshift, will there be any timing violations? Assume tH (hold time) = 3 ns for the flip-flop.

(c)

How can you eliminate the timing violations? Show your calculations and draw a timing diagram with no timing violations.

19. A schematic is given below:

S

(a)

Assume tSU (setup time) = 200 ps, tH (hold time) = 200 ps, tCLK-Q (clock-to-q delay) = 300 ps for the flip-flop, and TA = 1000 ps, TB = 100 ps for the internal logic blocks on the schematic. Show if there is any timing violation or timing slack by drawing a detailed timing diagram when TC = 0 ps.

(b)

What happens if TC = 400 ps? Show it in a separate timing diagram.

20. The state diagram of a Moore machine is given below:

The assignment of the states A, B and C are indicated as follows:

(a)

Implement this state machine using inverters, two-input and three-input AND gates and two-input OR gates.

(b)

Find the maximum operating frequency of the implementation in part (a) if the following timing assignments are applied:

tSU (setup time) = 100 ps, tH (hold time) = 100 ps, tCLK-Q (clock-to-q delay) = 200 ps, TINV = 200 ps, TAND2 = 300 ps, TAND3 = 400 ps, TOR2 = 400 ps.

Here, TINV, TAND2, TAND3, TOR2 correspond to the inverter, two-input and three-input AND gates and two-input OR gate, respectively.

21. Data is transferred from Memory Tx to Memory Rx starting from the address 0 × 00 and ending at the address 0 × 0F as shown below. Once a valid address is produced for Memory Tx, the data becomes available at the next positive clock edge. On the other hand, data is written to the Memory Rx at the positive edge of the clock when a valid address is produced. The operating clock frequency of Memory Tx is twice as high as that of Memory Rx.

(a)

Assuming address generators for Memory Tx and Memory Rx start generating valid addresses at the same positive clock edge, show which data is actually stored in Memory Rx using a timing diagram. Indicate all the address and data values for Memory Tx and Memory Rx in the timing diagram.

(b)

Now, assume that the operating clock frequency of Memory Tx is four times as high as the clock frequency of Memory Rx and the write takes place at the negative edge of the clock for Memory Rx when a valid address is present. Redraw the timing diagram indicating all address and data values transferred from one memory to the next.

22. Serial data is transferred to program four eight-bit registers. The start of the transfer is indicated by a seven-bit sequence = {1010101} immediately followed by the address of the register (two bits) and the data (eight bits). The transfer stops after programming the last register. After this point, all other incoming bits at the serial input is ignored. Design this interface by developing a data-path and a timing diagram simultaneously. Implement the state diagram. Can this controller be implemented by a counter-decoder scheme?

Index

A

Acceptor

Accelerometer

Active device interface (with a bipolar transistor)

Active region

Adder

Address decoder

Analog microphone

Analog-to-Digital Converter (ADC)

AND gate

Array multiplier

As atom

B

Barrel shifter

Base current

Base-emitter voltage

B atom

Bipolar transistor

Block diagram

Boltzmann constant

Boolean algebra

Breakdown voltage

Buffer

Buzzer

C

Capacitance

Capacitor

Carry-look-ahead adder

Carry-select adder

Clock

CMOS inverter

CMOS NAND logic gate

CMOS NOR logic gate

CMOS-TTL interface

Collector

Collector-base voltage

Collector current

Collector-emitter voltage

Combinational logic

Complementary MOS (CMOS)

Complemented logic gate

Complex CMOS logic gate implementation

Complex plane

Conduction band (EC)

Constant coefficient differential equation

Controller design

Counter

Counter-decoder design

Crystalline structure

Current gain

Current-voltage characteristics

Cut-off region

D

Data-path

DC motor control

Decoder

De Morgan’s theorem

Denominator

D flip-flop

Difference amplifier

Digital-to-Analog Converter (DAC)

Diode

D latch

Down-rounding

Drain current (ID)

Drain-source saturation voltage (V DSAT )

Drain-source voltage (V DS )

E

Effective resistance

Electromechanical

Electron

Electron mobility (µN)

Embedded system

Emitter

Emitter current

Encoder

Energy band bending

Energy band gap (EG)

Equivalent circuit

Equivalent resistor

Exclusive NOR gate

Exclusive OR gate

Exponential

Extrinsic semiconductor

F

Fall delay

Fall time

Fermi level (E F )

First-order passive circuits

Flash-type ADC

Forward-bias

Forward voltage

4-1 multiplexer

4-1 MUX

Free electron

Frequency domain analysis

Front-end electronics

Full adder

Full-wave rectifier

G

Galvanometric voltage drop

Gate

Gate oxide capacitance (C OX )

Gate-source voltage (V GS )

General solution

H

Half adder

Half-wave rectifier

Hall-effect device

Hall-effect sensor

Hall-effect switch

Hall-effect tachometer

Hall voltage (V H )

Hardware

Hold time

Hold violation

Hole

Hole mobility (µ P )

I

ID-VDS curve

Inductance

Inductor

Initial condition

Input current

Input Current High (IIH)

Input Current Low (IIL)

Input current measurement

Input impedance(Z IN (s))

Input resistance (R IN )

Input voltage (V IN (s))

Input Voltage High (VIH)

Input Voltage Low (VIL)

Input voltage measurement

Instability

Intrinsic

Inverter

Inverting amplifier

Isolation circuit

J

Junction

K

Karnaugh map

Kirchoff’s voltage law

K-map

L

Ladder-type DAC

Laplace transform

Leakage current

Light Emitting Diode (LED)

Light level measurement

Linear shifter

Load line

Logic gate

M

Magnetic field

Magnetic tachometer

Mealy machine

Memory

Minimization

Moore machine

2-1 multiplexer

Multiplier

2-1 MUX

N

NAND gate

Natural frequency

N-channel MOSFET (NMOSFET)

Next state

NMOS transistor

NMOS transistor threshold voltage (V TN )

NMOS tree

Non-inverting amplifier

NOR gate

NPN transistor

N-type semiconductor

Numerator

O

One bit full adder

One-bit half adder

Open-collector

Operational amplifier (Opamp)

Optoelectronic tachometer

Opto-isolator

OR gate

Oscillation

Oscillatory

Output

Output current

Output Current High (IOH)

Output Current Low (IOL)

Output current measurement

Output impedance

Output I-V characteristics

Output voltage

Output Voltage High (VOH)

Output Voltage Low (VOL)

Output voltage measurement

P

Parallel plates

Particular solution

Passive device interface (with a resistor)

Passive elements

Passive network

P-channel MOSFET (PMOSFET)

Photo detector

Photodiode

Photon

Photo-resistor

Photo-transistor

Photovoltaic voltage drop

Piezoelectric

PMOS transistor

PMOS transistor threshold voltage (V TP )

PMOS tree

PN junction

PNP transistor

Poles

POS

Power supply voltage (V CC )

Power supply voltage (V DD )

Present state

Product of sums

P-type semiconductor

Pull-down resistor

Pull-up resistor

Pulse Width Modulation (PWM) circuit

R

Ramp-type ADC

Read enable

Rectifying diode

Reference signal

Reference voltage

Register

Relay

Resistor

Reverse-bias

Reverse voltage

Ripple-carry adder

Rise delay

Rise time

S

Sample and hold

Sampling

Saturation

Saturation region

Schmitt trigger

2s complement addition

Semiconductor

Sensor

Sequential logic

Servo control

Set-up slack

Set-up time

Set-up violation

Shifter

Shift register

Silicon

Sinusoidal

Solar cell

Source

Square waveform generator

Stability

State diagram

State machine

State table

Subtractor

Successive approximation

Successive approximation ADC

Summation amplifier

Sum of products (SOP)

T

Temperature measurement

Tensile stress

Thermocouple

Time constant

Time-domain analysis

Timing diagram

Timing methodology

Timing violations

Transfer function

Transistor length

Transistor-Transistor Logic (TTL)

Transistor width

Transition table

Trans-resistance amplifier

Tri-state

Truth table

TTL-CMOS interface

TTL inverter

TTL NAND logic gate

TTL NOR logic gate

U

Unity gain

Up-counter

Up-rounding

V

Valence band (E V )

Voltage amplifier

Voltage comparator

W

Waveform

Weighted sum DAC

Work function

Worst-case charge path

Worst-case discharge path

Write enable

X

XNOR gate

XOR gate

Z

Zener diode

Zeros