6 Chapter 1 Introduction SHORT TIMES A microsecond (usec)is 10-6 second.A nanosecond (ns)is just 10-second.and a econd (ps)is 10-12 second.In a vacuum.light travels about a foot in a nanosec- integrated iruts now switching in less than 1,the speed-of-igh delay between these transistors across a half-inch-square silicon chip has become a limiting factor in circuit design. inputs and produce an output in less than 2 nanoseconds.This means that such a device can produce 500 million or more results per second. Economy.Digital circuits can provide a lot of functionality in a small space.Circuits that are used repetitively can be"integrated"into asingl "chip"and mass-produced at very low cost,making possible throw-away items like calculators,digital watches,and singing birthday cards.(You may ask,"Is this such a good thing?"Never mind!) Steadily advancing technology.When you design a digital system,you expected advances during the initial design of a system,to forestall system obsolescence and to add value for customers.For example,desktop com- puters often have"expansion sockets"to accommodate faster processors or larger memories than are available at the time of the computer's introduction. othat's enough ofa sales pitch on digital design.The rest of this chapter will give you a bit more technical background to prepare you for the rest of the book. 1.3 Digital Devices gate The most basic digital devices are called gates and no,they were not named after the founder of a large software company.Gates originally got their name from their function of allowing or retarding("gating")the flow of digital information In general,a gate has one or more i and produces an output that is a func tion of the current input value(s).While the inputs and outputs may be analog conditions such as voltage,current,even hydraulic pressure,they are modeled as taking on just two discrete values,0and 1. Figure 1-1 shows symbols for the three most important kinds of gates.A AND gate 2-input AND gate,shown in (a),produces a I output if both of its inputs are 1; otherwise it produces a0 output.The figure shows the same gate four times,with the four possible combinations of inputs that may be applied to it and the result- Copyright1999 by John F.Wakerly Copying Prohibited
6 Chapter 1 Introduction DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY Copyright © 1999 by John F. Wakerly Copying Prohibited inputs and produce an output in less than 2 nanoseconds. This means that such a device can produce 500 million or more results per second. • Economy. Digital circuits can provide a lot of functionality in a small space. Circuits that are used repetitively can be “integrated” into a single “chip” and mass-produced at very low cost, making possible throw-away items like calculators, digital watches, and singing birthday cards. (You may ask, “Is this such a good thing?” Never mind!) • Steadily advancing technology. When you design a digital system, you almost always know that there will be a faster, cheaper, or otherwise better technology for it in a few years. Clever designers can accommodate these expected advances during the initial design of a system, to forestall system obsolescence and to add value for customers. For example, desktop computers often have “expansion sockets” to accommodate faster processors or larger memories than are available at the time of the computer’s introduction. So, that’s enough of a sales pitch on digital design. The rest of this chapter will give you a bit more technical background to prepare you for the rest of the book. 1.3 Digital Devices The most basic digital devices are called gates and no, they were not named after the founder of a large software company. Gates originally got their name from their function of allowing or retarding (“gating”) the flow of digital information. In general, a gate has one or more inputs and produces an output that is a function of the current input value(s). While the inputs and outputs may be analog conditions such as voltage, current, even hydraulic pressure, they are modeled as taking on just two discrete values, 0 and 1. Figure 1-1 shows symbols for the three most important kinds of gates. A 2-input AND gate, shown in (a), produces a 1 output if both of its inputs are 1; otherwise it produces a 0 output. The figure shows the same gate four times, with the four possible combinations of inputs that may be applied to it and the resultSHORT TIMES A microsecond (µsec) is 10−6 second. A nanosecond (ns) is just 10−9 second, and a picosecond (ps) is 10−12 second. In a vacuum, light travels about a foot in a nanosecond, and an inch in 85 picoseconds. With individual transistors in the fastest integrated circuits now switching in less than 10 picoseconds, the speed-of-light delay between these transistors across a half-inch-square silicon chip has become a limiting factor in circuit design. gate AND gate
Section 1.4 Electronic Aspects of Digital Design 7 (a) (b) 。01 100 Figure 1-1 Digital devices:(a)AND gate;(b)OR gate;(c)NOT gate or inverter. ing outputs.A gate is called a combinational circuit because its output depends combinational only on the current input combination A 2-input OR gate,shown in(b).produces a 1 output if one or both of its OR gate inputs are 1;it produces a 0 output only if both inputs are 0.Once again,there are four possible input combinations,resulting in the outputs shown in the figure. A NOTgate,more commonly called an imerter,produces an output value NOT gate that is the opposite of the input value,as shown in(c). inverter We called these three gates the most important for good reason.Any digital function can be realized using just these three kinds of gates.In Chapter3we'l show how gates are realized using transistor circuits.You should know,however, that gates have been built or proposed using other technologies,such as relays, vacuum tubes,hydraulics,and molecular structures. A flip-flop is a device that stores either a 0 or 1.The state of a flip-flop is flip-flop the value that it currently stores.The stored value can be changed only at certain state times determined by a"clock"input,and the new value may further depend on the flip-flop's current state and its"control"inputs.A flip-flop can be built from a collection of gates hooked up in a clever way,as we'll show in Section 7.2. A digital circuit that contains flip-flops is called a sequential circuit sequential circuit because its output at any time depends not only on its current input,but also on the past sequence of inputs that have been applied to it.In other words,asequen- tial circuit has memory of past events. memory 1.4 Electronic Aspects of Digital Design Digital circuits are not exactly a binary version of alphabet soup-with all due respect to Figure 1-1,they don't have little 0s and Is floating around in them.As we'll see in Chapter 3,digital circuits deal with analog voltages and currents. behavior to be ignored in most cases,so circuits can be modeled as if they really did process 0s and Is. Copyright 1999 by John F.Wakerly Copying Prohibited
Section 1.4 Electronic Aspects of Digital Design 7 DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY Copyright © 1999 by John F. Wakerly Copying Prohibited ing outputs. A gate is called a combinational circuit because its output depends only on the current input combination. A 2-input OR gate, shown in (b), produces a 1 output if one or both of its inputs are 1; it produces a 0 output only if both inputs are 0. Once again, there are four possible input combinations, resulting in the outputs shown in the figure. A NOT gate, more commonly called an inverter, produces an output value that is the opposite of the input value, as shown in (c). We called these three gates the most important for good reason. Any digital function can be realized using just these three kinds of gates. In Chapter 3 we’ll show how gates are realized using transistor circuits. You should know, however, that gates have been built or proposed using other technologies, such as relays, vacuum tubes, hydraulics, and molecular structures. A flip-flop is a device that stores either a 0 or 1. The state of a flip-flop is the value that it currently stores. The stored value can be changed only at certain times determined by a “clock” input, and the new value may further depend on the flip-flop’s current state and its “control” inputs. A flip-flop can be built from a collection of gates hooked up in a clever way, as we’ll show in Section 7.2. A digital circuit that contains flip-flops is called a sequential circuit because its output at any time depends not only on its current input, but also on the past sequence of inputs that have been applied to it. In other words, a sequential circuit has memory of past events. 1.4 Electronic Aspects of Digital Design Digital circuits are not exactly a binary version of alphabet soup—with all due respect to Figure 1-1, they don’t have little 0s and 1s floating around in them. As we’ll see in Chapter 3, digital circuits deal with analog voltages and currents, and are built with analog components. The “digital abstraction” allows analog behavior to be ignored in most cases, so circuits can be modeled as if they really did process 0s and 1s. (c) 1 (a) 0 0 0 (b) 0 0 0 0 0 0 0 1 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 1 Figure 1-1 Digital devices: (a) AND gate; (b) OR gate; (c) NOT gate or inverter. combinational OR gate NOT gate inverter flip-flop state sequential circuit memory
8 Chapter 1 Introduction Figure 1-2 Logic values and noise Outputs Inputs oltage margins. ogic 1 invalid logic logic One important aspect of the digital abs action is to associate a range of analog values with each logic value (0 or 1).As shown in Figure 1-2,a typical gate is not guaranteed to have a precise voltage level for a logic 0 output.Rather, it may produce a voltage somewhere in a range that is a subser of the range guaranteed to be recognized as a0 by other gate inputs.The difference between noise margin the range boundaries is called noise margin-in a real circuit,a gate's output can be corrupted by this much noise and still be correctly interpreted at the inputs of other gates Behavior for logic 1 outputs is similar.Note in the figure that there is an "invalid"region between the input ranges for logic 0 and logic 1.Although any devices may have different boundaries.Still,all properly operating devices have devices.This characteristic is essential for reproducibility of results. It is the job of an electronic circuit designer to ensure that logic gates produce and recognize logic signals that are within the appropriate ranges.This is an analog circuit-design problem;we touch upon some aspects of this in Chapter 3.It is not possible to design a circuit that has the desired behavior under every possible condition of power-supply voltage,temperature,loading. and other factors.Instead,device manufacturer specifications provides specifications that define the conditions under which correct behavior is guaranteed. Asa digital designer.then,you need not delve into the detailed analog behavior ofa digital device to ensure its correct operation.Rather,you need only examine enough about the device's operating environment to determine that it is operating within its published specifications.Granted,some analog knowledge is needed to perform this examination,but not nearly what you'd need to design a digital device starting from scratch.In Chapter 3,we'll give you just what you need. Copyright1999 by John F.Wakerly Copying Prohibited
8 Chapter 1 Introduction DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY Copyright © 1999 by John F. Wakerly Copying Prohibited One important aspect of the digital abstraction is to associate a range of analog values with each logic value (0 or 1). As shown in Figure 1-2, a typical gate is not guaranteed to have a precise voltage level for a logic 0 output. Rather, it may produce a voltage somewhere in a range that is a subset of the range guaranteed to be recognized as a 0 by other gate inputs. The difference between the range boundaries is called noise margin—in a real circuit, a gate’s output can be corrupted by this much noise and still be correctly interpreted at the inputs of other gates. Behavior for logic 1 outputs is similar. Note in the figure that there is an “invalid” region between the input ranges for logic 0 and logic 1. Although any given digital device operating at a particular voltage and temperature will have a fairly well defined boundary (or threshold) between the two ranges, different devices may have different boundaries. Still, all properly operating devices have their boundary somewhere in the “invalid” range. Therefore, any signal that is within the defined ranges for 0 and 1 will be interpreted identically by different devices. This characteristic is essential for reproducibility of results. It is the job of an electronic circuit designer to ensure that logic gates produce and recognize logic signals that are within the appropriate ranges. This is an analog circuit-design problem; we touch upon some aspects of this in Chapter 3. It is not possible to design a circuit that has the desired behavior under every possible condition of power-supply voltage, temperature, loading, and other factors. Instead, the electronic circuit designer or device manufacturer provides specifications that define the conditions under which correct behavior is guaranteed. As a digital designer, then, you need not delve into the detailed analog behavior of a digital device to ensure its correct operation. Rather, you need only examine enough about the device’s operating environment to determine that it is operating within its published specifications. Granted, some analog knowledge is needed to perform this examination, but not nearly what you’d need to design a digital device starting from scratch. In Chapter 3, we’ll give you just what you need. logic 0 Outputs Inputs Noise Margin Voltage logic 1 logic 0 logic 1 invalid Figure 1-2 Logic values and noise margins. noise margin specifications
Section1.5 Software Aspects of Digital Design 9 景WAKE Figure 1-3 c-design template. yright 1976 by Micro Syste 1.5 Software Aspects of Digital Design Digital design need not involve any software tools.For example,Figure 1-3 shows the primary tool of the"old school"of digital design-a plastic template for drawing logic symbols in schematic diagrams by hand (the designer's name was engraved into the plastic with a soldering iron). Today,however,software tools are an essential part of digital design Indeed,the availability and practicality of hardware description languages (HDLs)and accompanying circuit simulation and synthesis tools have changed the entire landscape of digital design over the past several years.We'll make extensive use of HDLs throughout this book. In computer-aided design (CAD)various software tools improve the designer's productivity and help to improve the correctness and quality of designs.In a competitive world,the use of software tools is mandatory to obtain high-quality results on aggressive schedules.Important examples of software tools for digital design are listed below. Schematic entry.This is the digital designer's equivalent of a word proces- sor.It allows schematic diagrams to be drawn"on-line,"instead of with paper and pencil.The more advanced schematic-entry programs also check for common,easy-to-spot errors,such as shorted outputs,signals that don't go anywhere,and so on.Such programs are discussed in greater detail in Section 12.1. .HDLs.Hardware description languages,originally developed for circuit modeling.are now being used more and more for hardware design.They can be used to design anything from individual function modules to large, multi-chip digital systems.We'll introduce two HDLs.ABEL and VHDL. at the end of Chapter 4,and we'll provide examples in both languages in the chapters that follow. HDL compilers,simulators,and synthesis tools.A typical HDL software package contains several components.In a typical environment,the designer writes a text-based"program,"and the HDL compiler analyzes Copyright 1999 by John F.Wakerly Copying Prohibited
Section 1.5 Software Aspects of Digital Design 9 DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY Copyright © 1999 by John F. Wakerly Copying Prohibited 1.5 Software Aspects of Digital Design Digital design need not involve any software tools. For example, Figure 1-3 shows the primary tool of the “old school” of digital design—a plastic template for drawing logic symbols in schematic diagrams by hand (the designer’s name was engraved into the plastic with a soldering iron). Today, however, software tools are an essential part of digital design. Indeed, the availability and practicality of hardware description languages (HDLs) and accompanying circuit simulation and synthesis tools have changed the entire landscape of digital design over the past several years. We’ll make extensive use of HDLs throughout this book. In computer-aided design (CAD) various software tools improve the designer’s productivity and help to improve the correctness and quality of designs. In a competitive world, the use of software tools is mandatory to obtain high-quality results on aggressive schedules. Important examples of software tools for digital design are listed below: • Schematic entry. This is the digital designer’s equivalent of a word processor. It allows schematic diagrams to be drawn “on-line,” instead of with paper and pencil. The more advanced schematic-entry programs also check for common, easy-to-spot errors, such as shorted outputs, signals that don’t go anywhere, and so on. Such programs are discussed in greater detail in Section 12.1. • HDLs. Hardware description languages, originally developed for circuit modeling, are now being used more and more for hardware design. They can be used to design anything from individual function modules to large, multi-chip digital systems. We’ll introduce two HDLs, ABEL and VHDL, at the end of Chapter 4, and we’ll provide examples in both languages in the chapters that follow. • HDL compilers, simulators, and synthesis tools. A typical HDL software package contains several components. In a typical environment, the designer writes a text-based “program,” and the HDL compiler analyzes Figure 1-3 A logic-design template. Quarter-size logic symbols, copyright 1976 by Micro Systems Engineering computer-aided design (CAD)
10 Chapter 1 Introduction the program for syntax errors.If it compiles correctly,the designer has the optior of handing it over toasynthesis tool that creates a oresponding circuit design targeted to a particular hardware technology.Most often, before synthesis the designer will use the compiler's results as input to a "simulator"to verify the behavior of the design. Simulators.The design cycle for a customized,single-chip digital integrat- ed circuit is long and expensive.Once the first chip is built,it's very difficult,often impossible,to debug it by probing internal connections (they are really timy),or to change the gates and interconnections.Usually. changes must be made in the original design database and a new chip must be manufactured to incorporate the required changes.Since this process can take months to complete,chip designers are highly motivated to "get it right"(or almost right)on the first try.Simulators help designers predict the electrical and functional behavior of a chip without actually building it allowing most if not all bugs to be found before the chip is fabricated. Simulators are also used in the design of"programmable logic devices, introduced later,and in the overall design of systems that incorporate many individual components.They are somewhat less critical in this case because it's easier for the designer to make changes in comp nts and interconnections on a printed-circuit board.However,even a little bit of simulation can save time by catching simple but stupid mistakes. Test benches.Digital designers have learned how to formalize circuit sim- ulation and testing into software environments called "test benches."The idea is to build a set of progra ms around a design to automatically exercise its functions and check both its functional and its timing behavior.This is especially useful when small design changes are made-the test bench can be run to ensure that bug fixes or"improvements"in one area do not break something else.Test-bench programs may be written in the same HDL as the design itself,in C or C++,or in combination of languages including scripting languages like PERL. Timing analyzers and verifiers.The time dimension is very important in digital design.All digital circuits take time to produce a new output value in response to an input change,and much of a designer's effort is spent ensuring that such output changes occur quickly enough(or,in some cases. not too quickly).Specialized programs can automate the tedious task of drawing timing diagrams and specifying and verifying the timing relation ships between different signals in a complex system. Wordprocessors.Let's not forget the lowly text editor and word processor These tools are obviously useful for creating the source code for HDL- based designs,but they have an important use in every design-to create documentation! Copyright 1999 by John F.Wakerly Copying Prohibited
10 Chapter 1 Introduction DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY Copyright © 1999 by John F. Wakerly Copying Prohibited the program for syntax errors. If it compiles correctly, the designer has the option of handing it over to a synthesis tool that creates a corresponding circuit design targeted to a particular hardware technology. Most often, before synthesis the designer will use the compiler’s results as input to a “simulator” to verify the behavior of the design. • Simulators. The design cycle for a customized, single-chip digital integrated circuit is long and expensive. Once the first chip is built, it’s very difficult, often impossible, to debug it by probing internal connections (they are really tiny), or to change the gates and interconnections. Usually, changes must be made in the original design database and a new chip must be manufactured to incorporate the required changes. Since this process can take months to complete, chip designers are highly motivated to “get it right” (or almost right) on the first try. Simulators help designers predict the electrical and functional behavior of a chip without actually building it, allowing most if not all bugs to be found before the chip is fabricated. • Simulators are also used in the design of “programmable logic devices,” introduced later, and in the overall design of systems that incorporate many individual components. They are somewhat less critical in this case because it’s easier for the designer to make changes in components and interconnections on a printed-circuit board. However, even a little bit of simulation can save time by catching simple but stupid mistakes. • Test benches. Digital designers have learned how to formalize circuit simulation and testing into software environments called “test benches.” The idea is to build a set of programs around a design to automatically exercise its functions and check both its functional and its timing behavior. This is especially useful when small design changes are made—the test bench can be run to ensure that bug fixes or “improvements” in one area do not break something else. Test-bench programs may be written in the same HDL as the design itself, in C or C++, or in combination of languages including scripting languages like PERL. • Timing analyzers and verifiers. The time dimension is very important in digital design. All digital circuits take time to produce a new output value in response to an input change, and much of a designer’s effort is spent ensuring that such output changes occur quickly enough (or, in some cases, not too quickly). Specialized programs can automate the tedious task of drawing timing diagrams and specifying and verifying the timing relationships between different signals in a complex system. • Word processors. Let’s not forget the lowly text editor and word processor. These tools are obviously useful for creating the source code for HDLbased designs, but they have an important use in every design—to create documentation!