0% found this document useful (0 votes)
279 views528 pages

Albert P. Malvino Jerald A Brown

digital computer electronics

Uploaded by

Zlatko Pentek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
279 views528 pages

Albert P. Malvino Jerald A Brown

digital computer electronics

Uploaded by

Zlatko Pentek
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 528
(emai ) 1D Ce NoBIyitg + Dita Digital Computer Electronics Third Edition Albert Paul Malvino, Ph.D. Jerald A. Brown RAT GLENCOE McGraw-Hill us, Ohio Woodland New York, New York Columb Hills, California Peoria, Ilinois ‘This textbook was prepared wih tho assistance of Publishing Advisory Service LS! eeu photo: Manired KageiPeter Amold nc To my wife, Joanna, who encourages me to write ‘And to my daughters, Joanna, Antonia, Lucinda, Patricia, and Miriam, who keep me young APM to my wife Viekie dearest friend fellow adventurer love of my life IAB. rary of Gangress Cataloging Puiicaton Data Malvina, Albee Paul Digital computer electronics / Albert Paul Malvino, Jerald A Brown, — Sed ec. pom. Includes incex ISBN 0-02-800594-5 (hardcover) 1, Electronic digtal computers. 2. Microcomputers. 3. into 085 (Microprocessor). Brown, Jerald A.M, Tie ‘TK7888.3.M337 1993 621.39'16—ac20 92.5895 cP igtal CompuarEletonios, Thi Eton Impsin 1990, {Copyght © 198, 1989 by GloncowMcGrau-Hl Al rights reserved. Copyright© 1983, 1977 by eGraw-Hil re. Al ghs reserved. Pind in the nied States of Amro, Except as pormitd under ine Unted States Copyright Ac, no pat ofthis pubicaton may be reproduced fr dstouted in any form o by any moans, or sored ina dalabase or rirovl syst, witout pr writen permission ofthe publish. SBN 0-02-800506-5, Printed in tho Unted States of America. 456789101112 cous 03.0201 0099 ene Contents PREFACE vi CHAPTER 6. ARITHMETIC-LOGIC UNITS 9 6-1, Binary Addition 62, Binary Sutton 63. Half Adder 6-4 Full Ades 6:5. Binary CN ie Sie ies sites oe =a Complement” 6-8. 2'Complement Adder Subracte Digital Principles 1 2 " CHAPTER 1. NUMBER SYSTEMS AND. CHAPTER 7, FLIP-FLOPS 90. CHAPTER |APTER 7. FLIP-FLOPS : Vl. RS Latches 7-2, Level Clocking 7-3. D Latches 1 Ronee ceemeeT yi Pinay Odometer 4, dgerrguered D FlipFlop 75. Edge-Tggeed Used TSS. Binary o-Decimal Conversion oF FUDUDUmrmr———L 1-6. Microprocessors 11. Decimal Binary Conversion Io Hexadecimal Numbers CHAPTER 8, REGISTERS AND 19, Hexadcina-Binary Conversions COUNTERS’ 106 10. Hexadecimal-to-Desial Conversion Lr I, Decimal‘o-exadesimal Conversion Ce 1612. BCD Numbers 1-13. The ASCII Code 8-5. Synchronous Counters 8-6, Ring Counters 81. Other Couners 8, Thee State Regier 9. Bu Organized Computers CHAPTER 2, GATES 19 2-1, Inverters 2-2. OR Gates 2-3, AND Gates CHAPTER 9, MEMORIES 130 Cee 9-1, ROMs 9.2. PROMs and EPROMs 9.3. RAMs 9-4. A Small TTL Memory 9-5. Hexadecimal Addresses CHAPTER 3. MORE LOGIC GAT 32 3. sow Gates 3.2 De Morgans Fist Theorem 33. nano Gales 3. De Maras Send Totem 3-5. EXCLUSIVE.OR Gates 3-6. The Controlled La 7 —_ SAP (Simple-as-Possible) Computers 140 5 CHAPTER 4. TTL CIRCUITS | 48 CHAPTER 10. SAP-1 140 4-1. Digital Integrated Circuits 4-2, 7400 Devices. 10-1. Architecture 10-2, Instruction Set 4-3. TTL Characteristics 4-4. TTL Overview 10-3. Programming SAP-I 10-4. Fetch Cycle 5. ANDORANVERT Gates 4-6. Open-Collector Gates 40-5. Execution Cycle 10-6. The SAP-1 4-7. Multiplexers Microprogram 10-7, ‘The SAP-1 Schematic Di 10-8. Mieroprogramming CHAPTER S. BOOLEAN ALGEBRA AND CHAPTER 11. SAP-2 173 KARNAUGH MAPS 64 11-1, Bidirectional Registers 11-2. Architecture 5-1. Boolean Relations 5-2. Sum-of-Products Method 11-3. Memory-Reference Instructions 11-4. Re 53. Algebraic Simplification $-4, Karnaugh Maps. Instructions 11-5. Jump and Call Instructions 5-3. Pairs, Quads. and Octets 5.6. Karnaugh 11-6. Logic Instructions 11-7, Other Instructions Simplifications 5-7. Don'-Care Conditions 11-8. SAP-2 Summary iii CHAPTER 12. SAP-3. 195 12-1. Programmi 12-3. Arithmetic Model 1 Instructions | Decrements, and Rotates 12-5. Logic Instructions 12-6, Arithmetic and Logic Immediates 12-7. Jump Instructions 12-8, Extended-Register Instructions 12-9, Indirect Instructions 12-10. Stack Instructions 2. MOV and MVI 4, Increments, PART 3 Programming Popular Microprocessors 213 CHAPTER 13. INTRODUCTION TO MICROPROCESSORS 213 13-1. Computer Hardware 13-2. Definition of a Microprocessor 13.3. Some Common Uses for Microprocessors 13-4. Microprocessors Featured in This Text 13-5. Access to Microprocessors CHAPTER 14. PROGRAMMING AND LANGUAGES 216 14-1, Relationship between Electronics and Pro 14.2. Programming 4-3. Fundamental Premise 144. Flowcharts 14-5, Programming Languages 14-6. Assembly Language 14-7. Worksheets CHAPTER IS. SYSTEM OVERVIEW 224 New Concepts 15-1, Computer Architecture 15-2. Microprocessor Architecture Specific Microprocessor Families 15-3. 6502 Family [5-4, 6800/6808 Family 15.5. 8080/8085/Z80 Family 15-6, 8086/8088 Family CHAPTER 16. DATA TRANSFER INSTRUCTIONS 240 New Concepts 16-1, CPU Control Instructions 16-2. Data Transfer Instructions Specific Microprocessor Families 16-3. 6502 Family 16-4. 6800/6808 Family 16-5. 8080/8085/780 Family 16-6, 808618088 Family CHAPTER 17. ADDRESSING MODES—I_ 263 New Concepts 17-1. What Is an Addressing Mode? 17-2. The Paging Concept 17-3, Basie Addressing Modes ie Microprocessor Families 17-4. 6502 Family 17-5, 6800/6808 Family 17-6, 8080/8085/Z80 Family 17-7. 8086/8088 Family iv Contents CHAPTER 18. ARITHMETIC AND FLAGS. 20 New Concepts 18-1, Microprocessors and Numbers 18-2. Arithmetic Instructions 18-3, Flag Instructions Specific Microprocessor Families 18.4 6502 Family 18-5. 6800/6808 Family 18-6. SO80:8085'Z80 Family 18-7. 808618088 Family CHAPTER 19. LOGICAL INSTRUCTIONS. 305 New Concepts 19-1, The aND Instruction 19.2, The oR Instruction 19.3. The EXCLUSIVE OR OR, XOR Instruction 19-4. The Nor Instruction 19-5. The Nec (NeGate) Instruction Specific Microprocessor Families 19-6. 6502 Family 19-7. 6800/6808 Family 19-8. 808018085/Z80 Family 19.9, 8086/8088 Family CHAPTER 20, SHIFT AND ROTATE INSTRUCTIONS | 319 New Concepts 20-1. Rotating 20-2. Shifting 20-3. An Example Specific Microprocessor F: 20-4, 6502 Family 20-5, 6800/6808 Family 20-6, 8080/8085/Z80 Family 20-7. 8086/8088 Family CHAPTER 21, ADDRESSING MODES New Concepts 21-1, Advanced Addressing Modes Specific Microprocessor Families 21-2. 6502 Family 21-3. 6800/6808 Family 21-4, 8080/8085/Z80 Family 21-5, 8086/8088 Family Il 329 CHAPTER 22, BRANCHING AND LOOPS 342 New Coneepts 22-1. Unconditional Jumps Conditional Branching 3. Compare and Test Instructions 22-4. Increment and Decrement Instructions Nested Loops specific Microprocessor Families 22-6. 6502 Family 6800/6808 Family 22-8, 80808085280 Family 22-9, 8086/8088 Family CHAPTER 23. SUBROUTINE AND STACK INSTRUCTIONS 363 New Concepts 23-1. Stack and Stack Pointer 23-2. Branching versus Subroutines 23-3. How Do Subroutines Return? 23-4. Pushing and Popping Registers Specific Microprocessor Fami 23-6, 6800/6808 Family 23 24-8, 8086/8088 Family 23-5, 6502 Family '8080/8085/280 Family Microprocessor Instruction Set Tables 379 A Expanded Table of 8085/8080 and 780 (8080 Subset) Instructions Listed by Category 381 Mini Table of 8085/8080 and Z80 (8080 Subset) Instructions Listed by Category 410 Condensed Table of 8085/8080 and 280 (8080) Instructions Listed by Category 415 Condensed Table of 8085/8080 and Z80 (8080 Subset) Instructions Listed by Op Code 417 Condensed Table of 8085/8080 and 780 (8080 Subset) Instructions Listed Alphabetically by 8085/8080 Mnemonic 419 Condensed Table of 8085/8080 and Z80 (8080 Subset) Instructions Listed Alphabetically by Z80 Mnemonic a2 B, Expanded Table of 6800 Instructions Listed by Category 422 Short Table of 6800 Instructions Listed Alphabetically 434 Short Table of 6800 Instructions Listed by Category 437 Condensed Table of 6800 Instructions Listed by Category 4a Condensed Table of 6800 Instructions Listed Alphabetically 443 Condensed Table of 6800 Instructions Listed by Op Code a4 ic Expanded Table of 8086/8088 Instructions Listed by Category 445 Condensed Table of 8086/8088 Instructions Listed by Category 465 Condensed Table of 8086/8088 Instructions Listed Alphabetically 469) D, Expanded Table of 6502 Instructions Listed by Category 411 Short Table of 6502 Instructions Listed by Category 478 Condensed Table of 6502 Instructions Listed by Category 480 Condensed Table of 6502 Instructions Listed Alphabetically 481 Condensed Table of 6502 Instructions Listed by Op Code 482 APPENDIXES 485 1. The Analog Interface 2. Binary-Hexadecimal- Decimal Equivalents 3. 7400 Series TTL. 4. Pinouts and Function Tables S. SAP-1 Parts List 6. 8085 Instructions 7. Memory Locations: Powers of 2 8. Memory Locations: 16K and 8K Intervals 9. Memory Locations: 4K Intervals 10, Memory Locations: 2K Intervals 11. Memory Locations: 1K. Intervals, 12. Programming Models INDEX 519 Contents v Preface ‘Textbooks on microprocessors are sometimes hard to un derstand, This text attempts to present the various aspects ‘of microprocessors. in way that are understandable and interesting. The only prerequisite to using this textbook is an understanding of diodes an transistors, ‘A unique aspect of this text is its wide range. Whether you are interested in the student-constructed SAP (simple as-possible) microprocessor, the 6502, the 6800/6808, the '8080/8085/280, or the 8086/8088, this textbook can mect your needs. The text is divided into four parts. These parts can be used in different ways to meet the needs of a wide variety of students, classrooms, and instructors. Part 1, Digital Principles, is composed of Chapters 1 to 9. Featured topies include number systems, gates, boolean algebra, flip-lops, registers, counters, and memory. This information prepares the student for the microprocessor sections which follow Part 2, which consists of Chapters 10 to 12, presents the SAP (simple-as-possible) microprocessor. The student con= Seuets this processor using digital components. The SAP. processor contains the most common microprocessor func- tions. It features an instruction set which is a subset of that of the Intel 8085—leading naturally to a study of that ‘microprocessor. Part 3, Programming Popular Microprocessors (Chapters 13 to 23), simultaneously treats the MOS/Rockwell 650: the Motorola 6800/6808, the Intel 8080/8085 and Zilog 280, and the 16-bit Intel 8086/8088, Each chapter is divided into two sections, The first section presents new concepts: ‘second! section applies the new concepts to each micropro: cessor family. Discussion, programming examples, and problems are provided. The potential for comparative study is excellent “This part of the text takes a strong programming approach {o the study of microprocessors. Study is centered around the microprocessors instruction set and programming mode, ‘The S-bit examples and homework problems can be per formed by using either hand assembly or cross-assemblers. ‘The 16-bit 8086/8088 examples and problems can be per- formed by using either an assembler or the DOS DEBUG utility Part 4 is devoted to the presentation of the instruction sets of each microprocessor family in table form. Several lables are provided for each microprocessor family. per ‘mitting instructions to be looked up alphabetically, by op code, or by functional category, with varying levels of derail. The same functional categories are correspondingly used in the chapters in Part 3. This coordination between parts makes the learning process easier and more enjoyable Additional reference tables are provided in the appen- dixes. Answers to odd-numbered problems for Chapters | to 16 follow the appendixes. A correlated laboratory manual, Experiments for Digital Computer Electronics by Michael A. Miller, is available for use with this textbook. It contains experiments for every part of the text. It also includes programming problems for ‘each of the featured microprocessors, ‘A teachers manual is available which contains answers {0 all of the problems and programs for every micropro- cessor. In addition, a diskette (MS-DOS 360K 5Y%-inch diskette) containing cross-assemblers is included in the teacher's manual Special thanks to Brian Mackin for being such a patient ‘and supportive editor. To Olive Collen for her editorial ‘work. To Michael Miller for his work on the lab manual And to Thomas Anderson of Speech Technologies Inc. for the use of his cross-assemblers. Thanks also to reviewers Lawrence Fryda, Ilinois State University; Malachi Mc- Ginnis, ITT Technical Institute, Garland Texas; and Ben- jamin Suntag, Albert Paul Malvino Jerald A. Brown A man of true science uses but few hard words, and those only when none other will answer his purpose whereas the smatterer in science thinks that by mouthing hard words he understands hard things Herman Mehille DIGITAL PRINCIPLES 1 D- NUMBER SYSTEMS AND CODES Modern computers don’t work with decimal numbers Instead, they process binary numbers, groups of Os and Is. Why binary numbers? Because electronic devices are most reliable when designed for two-state (binary) operation ‘This chapter discusses binary numbers and other concepts needed to understand computer operation 1-1 DECIMAL ODOMETER René Descartes (1596-1650) said that the way to learn a new subject is to go from the known to the unknown, from the simple to the complex, Let's try it ‘The Known Everyone has seen an odometer (miles indicator) in action When a car is new, its odometer starts with ‘00000 After 1 mile the reading becomes (00001 Successive miles produce 00002, 00003, and so on, up to ‘00009 A familiar thing happens at the end of the tenth mile When the units wheel turns from 9 back to 0, a tab on this wheel forces the tens wheel to advance by 1. This is why the numbers change to 0010 Reset-and-Carry The units wheel has reset to 0 and sent a carry ¢o the tens wheel, Let’s cal this familiar action reset-and-carry The other wheels also reset and carry the odometer shows After 999 miles 00999 ‘What does the next mile do? The units wheel resets and carties, the tens wheel resets and carries, the hundreds wheel resets and carries, and the thousands whee! advances by 1, to get 01000 Digits and Strings ‘The numbers on each odometer wheel are called dig ‘The decimal number system uses ten digits, 0 through 9. In a decimal odometer, each time the units wheel runs out of digits it resets to 0 and sends a carry to the tens wheel. ‘When the tens wheel runs out of digits, it resets to 0 and sends a carry to the hundreds wheel. And so on with the remaining wheels. (One more point. A string isa group of characters (either letters or digits) written one after another. For instance. 734 is a string of 7, 3, and 4. Similarly, 2C8A is a string of 2, C, 8 and A 1-2 BINARY ODOMETER Binary means two. The binary number system uses only two digits, O and 1. All other digits (2 through 9) are thrown away. In other words, binary numbers are strings (of Os and Is An Unusual Odometer Visualize an odometer whose wheels have only two digits, and I. When each wheel turns, it displays 0, then 1. then 1 back to 0, and the cycle repeats. Because each wheel has only two digits, we call this device a binary odometer. Ina car a binary odometer starts with 0000 (zero) After 1 mile, it indicates 0001 (one) The next mile forces the units wheel to reset and carry; so the numbers change (0 0010 (two) The third mile results in O11 (three) What happens after 4 miles? The units wheel resets and carries, the second wheel resets and carries, and the third wheel advances by 1. This gives 0100 (foury Successive miles produce 0101 (fivey O10 Gin) O11 (even) After 8 miles, the units wheel resets and carries, the second wheel resets and carries, the third wheel resets and carries, and the fourth wheel advances by 1. The result is 1000 (eight) ‘The ninth mile gives tool (nine) ‘and the tenth mile produces 1010 (ten) (Try working out a few more readings on your own.) ‘You should have the idea by now. Each mile advances the units wheel by 1. Whenever the units wheet runs out of digits, it resets and carries. Whenever the second wheel runs out of digits, it resets and carries, And so for the other wheels Binary Numbers A binary odometer displays binary aumbers, strings af Os and Is. The number 0001 stands for 1, 0010 for 2, 0011 2 digital Computer Blectronies for 3, and so forth. Binary numbers are long when large amounts are involved, For instance, 101010 represents decimal 42. As another example, 111100001111 stands for decimal 3,855. ‘Computer citcuits are like binary odometers; they count and work with binary numbers. Therefore, you have to Tearn to count with binary numbers, to convert them to decimal numbers, and t0 do binary arithmetic. Then you will be ready to understand how computers operate ‘A final point, When a decimal odometer shows 0036. ‘we can drop the leading Os and read the number as 36 Similarly, when a binary odometer indicates 0011, we ean drop the Ieading Os and read the number as 11. With the leading 0s omitted, the binary numbers are 0, 1, 10, 11, 100, 101, and so on, To avoid confusion with decimal numbers, read the binary numbers like this: zero, one, one 1-3 NUMBER CODES People used to count with pebbles. ‘The numbers 1, 2, 3 looked like @, @@, @@@. Larzer numbers were worse: seven appeared as Codes From the earliest times, people have been creating codes that allow us to think, calculate, and communicate. The decimal numbers are an example of a code (see Table IL-1). Its an old idea now, but at the time it was as revolutionary; | stands for @, 2 for @@, 3 for @@@, and so forth ‘Table 1-1 also shows the binary code. | stands for @, 10 for @@, 11 for @@®, and so on. A binary number and a decimal number are equivalent if each represents the same amount of pebbles. Binary 10 and decimal 2 are equivalent because each represents @@. Binary decimal 5 are equivalent because each stands for . ‘TABLE 1-1. NUMBER CODES Pebbles Decimal Binary 0 None 0 1 1 2 10 3 nl 4 100 5 101 6 10 7 uL 8 ecccceee §=— 000 9 eoccee: 1001 Equivalence is the common ground between us and computers; it tells us when we're talking about the same thing. Ifa computer comes up with a binary answer of 101, equivalence means that the decimal answer is 5, As a start to understanding computers, memorize the binary-decimal equivalences of Table 1-1. EXAMPLE 1-1 Figure I-1a shows four light-emitting diodes (LEDs), A dark circle means that the LED is off; a light circle means it’s on. To read the display, use this code: @®@00 @0e@0 ‘0 oy Fig. 1-1 LED display of binary numbers, off 0 On 1 What binary number does Fig. 1-1a indicate? Fig. 1-16? SOLUTION Figure I-1a shows off-off-on-on. This stands for binary 0011, equivalent to decimal 3. Figure 1-10 is off-on-off-on, decoded as binary O101 and equivalent to decimal 5, EXAMPLE 1-2 A binary odometer has four wheels. What are the successive binary numbers? SOLUTION AAs previously discussed, the first eight binary numbers are (0000, 0001, 0010, 0011, 0100, 0101, O110, and 0111. On the next count, the three wheels on the right reset and carry; the fourth wheel advances by one. So the next eight numbers are 1000, 1001, 1010, 1011, 1100, 1101, 1110, and L111 ‘The final reading of 1111 is equivalent to decimal 15. The next mile resets all wheels t0 0, and the cycle repeats Being able to count in binary from 6000 10 1111 is essential for understanding the operation of computers, 1-2, BINARY-TO-DECIMAL EQUIVALENCES. Decimal Binary | Decimal Binary 0 ‘0000 8 1000 1 001 9 1001 2 010 10 1010 3 oon n ou 4 0100 2 1100 5 o1o1 B not 6 o110 6 1110 1 our 15 1 Therefore, you should memorize the equivalences of Table 12. 1-4 WHY BINARY NUMBERS ARE USED ‘The word ‘computer’ is misleading because it suggests a ‘machine that can solve only numerical problems. But a ‘computer is more than an automatic adding machine. Tt can play games, translate languages, draw pictures, and so on. To suggest this broad range of application, a computer is often referred to as a data processor. Program and Data Data means names, numbers, facts, anything needed 10 ‘work out a problem. Data goes into a computer, where it is processed or manipulated to get new information. Before it goes into a computer, however, the data must be coded in binary form. The reason was given earlier: a computer's circuits can respond only to binary numbers Besides the data, someone has to work out a program, a list of instructions telling the computer what t0 do. These instructions spell out each and every step in the data processing. Like the data, the program must be coded in binary form before it goes into the computer. So the two things we must input fo a computer are the program and the data. These are stored inside the computer before the processing begins. Once the computer run starts, each instruction is executed and the data is processed. ‘Hardware and Software ‘The electronic, magnetic, and mechanical devices of a computer are known as hardware. Programs are called software. Without software, « computer is a pile of dumb’ metal Chapter 1 Number Systems and Codes 3 ‘An analogy may help. A phonograph is like hardware and records are like software, The phonograph is useless without records, Furthermore, the music you get depends ‘nthe record you play. A similar idea applies to computers. A computer isthe hardware and programs are the software. The computer is useless without programs. The program stored in the computer determines what the computer will do; change the program and the computer processes the data in a different way. ‘Transistors ‘Computers use integrated circuits (ICs) with thousands of transistors, either bipolar or MOS. The parameters (Bx Teos 8m €1e-) can Vary more than 50 percent with temperature change and from one transistor to the next. Yet these computer ICs work remarkably well despite the transistor variations. How is it possible? ‘The answer is two-state design, using only two points ‘on the load line of each transistor. For instance, the common two-state design is the cutoff-saturation approach; each transistor is forced to operate at either cutoff or saturation When a transistor is cutoff or saturated, parameter variations have almost no effect. Because of this, it’s possible to design reliable two-state circuits that are almost independent of temperature change and transistor variations ‘Transistor Register Here’s an example of two-state design, Figure 1-2 shows a transistor register. (A register is a string of devices that store data.) The transistors on the left are cut off because the input base voltages are 0 V. The dark shading symbolizes the cutoff condition. The two transistors on the right have base drives of 5 V. ‘The transistors operate at either saturation or cutoff. A base voltage of 0 V forces each transistor to cut off, while a base voltage of 5 V drives it into saturation. Because of, this two-state action, each transistor stays in a given state ntl the base voltage switches it to the opposite state Another Code Two-state operation is universal in digital electronics. By deliberate design, all input and output voltages are either low or high. Here's how binary numbers come in: low voltage represents binary 0, and high voltage stands for binary 1. In other words, we use this code: Voltage Binary Low 0 High L For instance, the base voltages of Fig, 1-2 are low-low- hhigh-high, or binary 0011. The collector voltages are high- high-low-low, or binary 1100. By changing the base voltages wwe can store any binary number from 0000 to 1111 (decimal 010 15). Bit Bit isan abbreviation for binary digit. A binary number like 1100 has 4 bits; 110011 has 6 bits; and 11001100 has 8 bits. Figure 1-2 is a 4-bit register. To store larger binary ‘numbers, it needs more transistors. Add two transistors and you get a 6-bit register. With four more transistors, you'd hhave an 8-bit register. Nonsaturated Circuits Don’t get the ides that all ewo-state circuits switch between cutoff and saturation. When a bipolar transistor is heavily saturated, extra carriers are stored in the base region. Ifthe base voltage suddenly switches from high to low, the transistor cannot come out of saturation until these extra carriers have a chance to leave the base region. The time it takes for these carriers to leave is called the saturation delay time t,. Typically, ty is in nanoseconds. In most applications the saturation delay time is too short ‘to matter. But some applications require the fastest possible — s8y 1a. 1k Fou 1K ot 4 ov ov wt sy (appro) iaporox &) S oun oR sok ov ov By sv 1-2 Transistor register. Digital Computer Electronics switching time, To get this maximum speed, designers have come up with circuits that switch from cutoff (or nese cutoff) to a higher point on the load line (but short of saturation). These nonsaturated circuits rely on clamping diodes or heavy negative feedback to overcome transistor variations, Remember this: whether saturated or nonsaturated circuits are used, the transistors switch between distinct points on the load line. This means that all input and output voltages are easily recognized as low or high, binary 0 or binary 1 L988 SHH Fig. 1-3 Core register. Magnetic Cores Early digital computers used magnetic cores to store data Figure I-3a shows a 4-bit core register. With the right- hhand rule, you can see that conventional current into a wire produces a clockwise flux; reversing the current gives a counterclockwise flux. (The same result is obtained if electron-flow is assumed and the left-hand rule is used.) The cores have rectangular hysteresis loops; this means that flux remains in a core even though the magnetizing current is removed (see Fig. 1-3b). This is why a core register can store binary data indefinitely. For instance let’s use the following code: Flux Binary Counterclockwise 0 Clockwise L Then, the core register of Fig. 1-3b stores binary 1001, equivalent to decimal 9. By changing the magnetizing currents in Fig. 1-3a we can change the stored data, To store larger binary numbers, add more cores. Two cores added to Fig. 1-3a result in a 6-bit register; four more cores give an 8-bit register ‘The memory is one of the main parts of a computer, Some memories contain thousands of core registers. These registers store the program and data needed to run the computer, Other Two-State Examples ‘The simplest example of a two-state device is the on-off switch. When this switch is closed, it represents binary 1 when it’s open, it stands for binary 0. Punched cards are another example of the two-state concept. A hole in a card stands for binary 1, the absence of a hole for binary 0. Using a prearranged code, a card punch machine with a keyboard can produce a stack of cards containing the program and data needed 10 run a computer. Magnetic tape can also store binary numbers. Tape recorders magnetize some points on the tape (binary 1), while leaving other points unmagnetized (binary 0). By & prearranged code, a row of points represents either a coded instruction or data, In this way, a reel of tape can store thousands of binary instructions and data for later use in 2 computer. Even the lights on the control panel of a large computer are binary; a light that’s on stands for binary 1, and one that’s off stands for binary 0. Ina 16-bit computer, for instance, a row of 16 lights allows the operator to see the binary content in different computer registers. The operator ‘can then monitor the overall operation and, when necessary, troubleshoot In summary, switches, transistors, cores, cards, tape, lights, and almost all other devices used with computers are based on two-state operation. This is why we are forced. to use binary numbers when analyzing computer action, EXAMPLE 1-3 Figure 1.4 shows a strip of magnetic tape, The black circles ‘are magnetized points and the white circles unmagnetized points. What binary number does each horizontal row represent? Fig. 1-4 Binary numbers on magnetic tape. SOLUTION The tape stores these binary numbers Row 1 — Q00DIIIT | RowS 1100110 Row 2 10000110 | Row 6 — 01001001 Row3 10110111 | Row7 —100t101 Row 4 00110001 Chapter 1 Number Systems and Codes 5 (Nore: these binary numbers may represent either coded instructions or data.) A string of 8 bits is called a byte, In this example, the ‘magnetic tape stores 7 bytes, The first byte (row 1) is (00001111. The second byte (row 2) is 10000110. The third byte is 10110111. And so on. ‘A byte is the basic unit of data in computers, Most computers process data in strings of 8 bits or some multiple (16, 24, 32, and so on). Likewise, the memory stores data in strings of 8 bits or some multiple of 8 bits. 1-5 BINARY-TO-DECIMAL CONVERSION ‘You already know how to count to 15 using binary numbers, The next thing to leam is how to convert larger binary ‘numbers to their decimal equivalents ee ee we OP o a Fig. 1-5 (a) Decimal weights; (b) binary weights Decimal Weights ‘The decimal number system is an example of positional rotation; each digit position has a weight or value. With decimal numbers the weights are units, tens, hundreds, thousands, and so on. The sum of all digits multiplied by their weights gives the total amount being represented. For instance, Fig. 1-Sa illustrates a decimal odometer. Below each digit is its weight. The digit on the right has a weight of 10° (units), the second digit has a weight of 10! (ens), the third digit a weight of 10° (hundreds), and so. forth. The sum of all units multiplied by their weights is (5X 10) + (7 x 10) + x 10) + GB x 109, + (4 x 10) = 50,000 + 7000 + 0 + 30 + 4 = 57,044 Binary Weights Positional notation is also used with binary numbers because cach digit position has a weight. Since only two digits are used, the weights are powers of 2 instead of 10. As shown in the binary odometer of Fig. 1-Sb, these weights are 2° (units), 2" wos), 2° (fours), 2 (eights), and 2* (sixteens) If longer binary numbers are involved, the weights continue in ascending powers of 2 The decimal equivalent of 2 binary number equals the sum of all binary digits multiplied by their weights. For instance, the binary reading of Fig. 1-5b has a decimal ‘equivalent of 6 Digital Computer Electronics (Xx 24X24 OX 4+ Ox 2 + (LX 2M) = 164840404 1=25 Binary 11001 is therefore equivalent to decimal 25, ‘As another example, the byte 11001100 converts to decimal as follows: UX MEU XM+OKA+OX DB +X DB) 4x B+ Ox 2 + Ox 2 = 128 464+ 040484440+0= 204 So, binary 11001100 is equivalent to decimal 204, Fast and Easy Conversion Here’s a streamlined way to convert a binary number to its decimal equivalent Write the binary number. 2. Write the weights 1, 2, 4, 8, digits. 3. Cross out any weight under a 0. 4. Add the remaining weights. «under the binary For instance, binary 1101 converts to decimal as follows: hiro. (Write binary number) 28 4 21 (Write weights) 38 64 9 1 (Cross out weights) 48444041513 (Add weights) ‘You can compress the steps even further ot (Step 1) 8 4 2 1513 (Steps2t04) As another example, here’s the conversion of binary 1110101 in compressed form: Base or Radix ‘The base or radix of a number system equals the number ‘of digits it has. Decimal numbers have a base of 10 because digits 0 through 9 are used. Binary numbers have a base ‘of 2 because only the digits 0 and 1 are used. (In terms of ‘an oxlometer, the base or radix is the number of digits on ceach wheel.) A subscript attached t0 4 number indicates the base of the number. 100: means binary 100, On the other hand, 10099 stands for decimal 100. Subscripts help clarify equa: tions where binary and decimal numbers are mixed, For instance, the last two examples of binary-to-decimal con- version can be writen like this: 11013 10101 By Mo In this book we will use subscripts when necessary for laity. 1-6 MICROPROCESSORS ‘What is inside a computer? What is a microprocessor? What is a microcomputer? Computer The five main sections of a computer are input, memory. arithmetic and logic, control, and output, Here is a brief description of each. Input This consists of all the circuits needed to get programs and data into the computer. In some computers the input section includes a typewriter keyboard that converts Fetters and numbers into strings of binary data. Memory This stores the program and data before the computer run begins. It also can store partial solutions dduringa computerrun, similarto the way we use a sratchpad while working out a problem. Control This is the computer's center of gravity, analo- ‘20u to the conscious part of the mind. The control section directs the operation of all other Sections. Like the conductor (of an orchestra, it tells the other sections what to do and when to do it Arithmetic and logic This is the number-crunching sec- tion of the machine. It can also make logical decisions. With control telling it what to do and with memory feeding it data, the arithmetic-logic unit (ALU) grinds out answers to number and logic problems, Output This passes answers and other processed data to the outside world. The output section usually includes a video display to allow the user to see the processed data Microprocessor ‘The control section and the ALU are often combined physically into a single unit called the central processing unit (CPU). Furthermore, it’s convenient to combine the input and output sections into a single unit called the input- ‘owgput (UO) unit. In earlier computers, the CPU, memory, and LO unit filled an entire room. With the advent of integrated circuits, the CPU, memory, and /O unit have shrunk dramatically. Nowadays the CPU can be fabricated on a single semiconductor chip called a ‘microprocessor. In other words, a microprocessor is nothing ‘more than a CPU on a chip. Likewise, the UO circuits and memory can be fabricated ‘on chips. In this way. the computer circuits that once filled room now fit on a few chips. Microcomputer As the name implies, a microcomputer is a small computer. More specifically, a microcomputer is a computer that uses 1 microprocessor for its CPU. The typical microcomputer hhas three kinds of chips: microprocessor (usually one chip), ‘memory (several chips), and VO (one or more chips) If a small memory is acceptable, a manufacturer can fabricate all computer circuits on a single chip. For instance, the 8048 from Inte] Corporation is a one-chip microcomputer with an 8-bit CPU, 1,088 bytes of memory, and 27 VO lines. Powers of 2 Microprocessor design started with 4-bit devices, then evolved to 8+ and 16-bit devices. In our later discussions ‘of microprocessors, powers of 2 keep coming up because of the binary nature of computers. For this reason, you should study Table 1-3. It ists the powers of 2 encountered in microcomputer analysis. As shown, the abbreviation K. stands for 1,024 (approximately 1,000). Therefore, 1K means 1,024, 2K stands for 2,048, 4K for 4,096, and so. Most personal microcomputers have 640K (or greater) ‘memories that can store 655,360 bytes (or more) TABLE 1-3. POWERS OF 2 Powers of 2 Decimal equivalent Abbreviation 2 1 2 2 2 4 2 8 2 16 2 32 » 64 2 128 2 256 2 512 20 1,024 IK an 2.088 2K 2H 4,096 4K 20 8,192 8K 2 16,384 16K 25 32,768 32K 2 65,536 OK 4 The abbreviations IK, 2K, and so on, became established before K- for dilo- was in common use. Retaining the capital K serves as a useful reminder that K only approximates 1,000 Chapter 1 Number Systems and Codes 7 1-7 DECIMAL-TO-BINARY CONVERSION Next, you need to know how to convert from decimal to binary. After you know how it's done, you will be able to understand how circuits can be built to convert decimal numbers into binary numbers, Double-dabble is a way of converting any decimal number to its binary equivalent, It requires succes on by 2, writing down each quotient and its remainder. The remainders are the binary equivalent of the decimal number. ‘The only way (0 understand the method is to go through an example, step by step. Here is how to convert decimal 13 to its binary equivalent. Step 1. Divide 13 by 2, writing your work like this: 6 1 (first remainder) 25 ‘The quotient is 6 with a remainder of 1 Step 2. Divide 6 by 2 to get 3. 0 (second remainder) 276 1 273 This division gives 3 with a remainder of 0. ‘Step 3. Again you divide by 2 11> (third remainder) 273 0 276 1 2713 Here you get a quotient of 1 and a remainder of 1 Step 4. One more division by 2 gives Read down 271 273 0 276 1 278 8 Digital Computer Electronics In this final division, 2 does not divide into 1; therefore, the quotient is 0 with a remainder of 1 ‘Whenever you arrive at « quotient of O with a remainder of 1, the conversion is finished. The remainders when read downward give the binary equivalent. In this example, binary 1101 is equivalent to decimal 13 Double-dahble works with any decimal number. Pro- gressively divide by 2, writing each quotient and its remainder. When you reach a quotient of 0 and a remainder of 1, you are finished: the remainders read downward are the binary equivalent of the decimal number Streamlined Double-Dabble There's no need to keep writing down 2 before each division because you're always dividing by 2. From now on, here's how to show the conversion of decimal 13 to its binary equivalent EXAMPLE 1-4 Convert decimal 23 to binary. SOLUTION ‘The first step in the conversion looks like this: 258 Afterall divisions, the finished work looks like this dau. ‘This says that binary 10111 is equivalent to decimal 23. 1-8 HEXADECIMAL NUMBERS Hexadecimal numbers are extensively used in micropro- cessor work. To begin with, they are much shorter than binary numbers. This makes them easy to write and remember. Furthermore, you can mentally convert them to binary form whenever necessary An Unusual Odometer Hexadecimal means 16. The hexadecimal number system has a base or radix of 16. This means that it uses 16 digits to represent all numbers. The digits are 0 through 9, and A through F as follows: 0, 1, 2, 3, 4, 5, 6,7, 8,9, A. B. C, D, E, and F. Hexadecimal numbers are strings of these digits like 8AS, 4CF7, and ECS8, ‘An easy way {0 understand hexadecimal numbers is to visualize a hexadecimal odometer. Each wheel has 16 digits con its circumference. As it tums, it displays 0 through 9 as before. But then, instead of resetting, it goes on to display A, B, C, D, E, and F The idea of reset and carry applies to a hexadecimal ‘odometer, When a wheel turns from F back to 0, it forces the next higher wheel to advance by I. In other words, ‘when a wheel runs out of hexadecimal digits, it resets and If used in a car, a hexadecimal odometer would count as follows. When the car is new, the odometer shows all 0s: 0000 (zero) ‘The next 9 miles produce readings of 0001 (one) 0002 (two) 0003 three) 0004 (four) 0005 (five) 0006 (six) 0007 (seven) 0008 (eight) 0009 (nine) ‘The next 6 miles give 000A (ten) 000B (eleven) 00C (twelve) 00D (thirteen) 00 (fourteen) OOF (fifteen) At this point the least significant wheel has run out of digits. Therefore, the next mile forces a reset-and-carry to get 0010 (sixteen) The next 15 miles produce these readings: 0011, 0012, (0013, 0014, 0015, 0016, 0017, 0018, 0019, OOLA, OO1B, OIC, OOLD, OOIE, and OOIF. Once again, the least significant wheel has run out of digits. So, the next mile results in a reset-and-carry 0020 (thirty-two) Subsequent readings are 0021, 0022, 0023, 0024, 0025, (0026, 0027, 0028, 0029, 002A, 0028, 002C, 002D, O02E, and 002F, You should have the idea by now. Each mile advances the least significant wheel by 1. When this wheel runs out of hexadecimal digits, it resets and carries. And so on for the other wheels, For instance, if the odometer reading is asF the next reading is 8360. As another example, given SFE the next hexadecimal number is 6000, Equivalences ‘Table 1-4 shows the equivalences between hexadecimal, binary, and decimal digits. Memorize this table. It's essential that you be able to convert instantly from one system 10 another. TABLE 1-4. EQUIVALENCES Decimal 0 1 3 4 5 6 7 1000 8 1001 9 1010 0 toi n 1100 2 1101 B 110 4 un 15 Chapter 1 Number Systems and Codes 9 1-9 HEXADECIMAL-BINARY CONVERSIONS After you know the equivalences of Table 1-4, you can mentally convert any hexadecimal string to its binary ‘equivalent and vice versa Hexadecimal to Binary To convert a hexadecimal number 10 a binary number, convert cach hexadecimal digit to its 4-bit equivalent, using. ‘Table 1-4, For instance, here's how 9AF converts to binary OA FE 4 tog tool 1010 1111 ‘As another example, C5E2 converts like this cos E 2 4 bod 4 1100 101 1110 0010 Incidentally, for easy reading it’s common practice to leave 4 space between the 4-bit strings. For example, instead of writing cst 2, = 1100010111100010, wwe can write C5E2,, = 1100 0101 1110 0010; Binary to Hexadecimal To convert in the opposite direction, from binary to hexadecimal, you again use Table 1-4. Here are two examples. The byte 1000 1100 converts as follows: 1000. 1100 L L 8 oC ‘The 16-bit number 1110 1000 1101 0110 converts like ths: 1110 1000. 1101-110 + t t 4 BE 8 D 6 In both these conversions, we start with @ binary number and wind up with the equivalent hexadecimal number. 10 digital Computer Etectronics EXAMPLE 1-5 Solve the following equation for x: ay = MELT Uy SOLUTION ‘This is the same as asking for the hexadecimal equivalent of binary 1111 1111 1111 1111, Since hexadecimal F is equivalent to 1111, x = FFF. Therefore, FRFF,, = 111 1 11 111, EXAMPLE 1-6 ‘As mentioned earlier, the memory contains thousands of registers (core or semiconductor) that store the program and data needed for a computer run, These memory registers are known as memory locations. A typical microcomputer ‘may have up to 65,536 memory locations, each storing 1 byte Suppose the first 16 memory locations contain the bytes: 011 1100 1100 1101 0101 O11 (0010 1000 1111 0001 0010 1010 1101 0100 (0100 0000 oun ott 1100 001 1000 0100 0010 1000 0010 0001 0011 1010 oon 110 001 HHL Convert these bytes to their hexadecimal equivalents SOLUTION Here are the stored bytes and their hexsdecimal equivalents: Memory Contents Hex Equivalents oo1t 1100 ae 1100 1101 cD 0101 O11 37 0010 1000, 28 TL 0001 FI 010 1010 2a 1101 0100 Ds (0100 0000, 40 out OW n 1100 0011 3 1000 0100 84 0010 1000 28 0010 0001 21 oot! 1010, 3A 0011 1110, 3E oor 1111 1F What's the point of this example? When talking about the contents of a computer memory, we can use either binary numbers or hexadecimal numbers. For instance, we ‘can say that the first memory location contains OO11 1100, for we can Say that it contains 3C. Either string gives the same information, But notice how much easier itis to say. write, and think 3C than itis to say, write, and think 0011 1100, In other words, hexadecimal strings are much easier for people to work with. This is why everybody working \with microprocessors uses hexadecimal notation to represent particular bytes. ‘What we have just done is known as chunking, replacing longer strings of data with shorter ones. AC the first memory location we chunk the digits 0011 1100 into 3C. At the second memory location we chunk the digits 1100 1101 into CD, and so on EXAMPLE 1-7 ‘The typical microcomputer has a typewriter keyboard that allows you to enter programs and data; a video screen displays answers and other information, Suppose the video screen of a microcomputer displays the hexadecimal contents of the first eight memory locations AT 28 3 19 5A 4D 2c FS What are the binary contents of the memory locations? SOLUTION Convert from hexadecimal to binary to get 1o10 O11 010 1000 1100 0011 (0001 1001 101 1010 0100 110 010 1100 1111 1000 The fitst memory location stores the byte 1010 O111, the second memory location stores the byte 0010 1000, and so ‘This example emphasizes a widespread industrial prac- tice, Microcomputers are programmed to display chunked data, often hexadecimal. The user is expected to know hhexaclecimal-binary conversions. In other words, a computer manufacturer assumes that you know that A7 represents 1010 OLLI, 28 stands for 0010 1000, and so on. ‘One more point, Notice that each memory location in this example stores 1 byte, This is typical of first-generation ‘microcomputers because they use 8-bit microprocessor. 1-10 HEXADECIMAL-TO-DECIMAL CONVERSION You often need to convert a hexadecimal number 0 its ‘decimal equivalent, This section discusses methods for doing it. Hexadecimal to Binary to Decimal ‘One way to convert from hexadecimal to decimal is the two-step method of converting from hexadecimal to binary and then from binary to decimal. For instance, here's how to convert hexadecimal 3C to its decimal equivalent Step 1. Convert 3C to its binary equivalent: 3 ic + 4 oot 1100 Step 2. Convert OOL1 1100 to its decimal equivalent Oh 0) 110.0) BRS 6 32 16 8 4 2 [> ‘Therefore, decimal 60 an equation, ‘equivalent to hexadecimal 3C. As 3Cjg = OO 1100; = 6040 Positional-Notation Method Positional notation is also used with hexadecimal numbers because each digit position has a weight. Since 16 digits are used, the weights are the powers of 16, As shown in Chapter 1 Number Systems and Codes 11 rFlelele woe we Fig. 1-6 Hexadecimal weights, the hexadecimal odometer of Fig. 1-6, the weights are 16, 16, 16 and 16%. IF longer hexadecimal numbers are involved, the weights continue in ascending powers of 16. ‘The decimal equivalent of a hexadecimal string equals the sum ofall hexadecimal digits multiplied by their weights (n processing hexadecimal digits A through F, use 10 through 15.) For instance, the hexadecimal reading of Fig. 1-6 has a decimal equivalent of F x 16) + @& x 16) + E x 16) + x 169 15 x 167) + (8 x 16) + (14 x 16) + 6 * 169 1,440 + 2,048 + 224 + 6 3.718 In other words, 02 000 008 0008 008 0008 004 008 00¢ 0008 00 6 5.536 locations location i i | . | ig. 1-7 (a) First 16 words in memory; (8) 64K memory. Memory Locations and Addresses If a certain microcomputer has 64K memory, meaning {65,536 memory locations, each is able to store | byte. The different memory locations are identified by hexadecimal ‘numbers called addresses. For instance, Fig. 1-a shows the first 16 memory locations; their addresses are from 0000 to O00F The address of a memory location is different from its Stored contents, just as house address is different from 12 digital computer Electronics the people living in the house, Figure 1-7a emphasizes the point. At address 0000 the stored contents are 3C (equivalent {to 0011 1100). At address 0001 the stored contents are CD, at address 0002 the stored contents are 57, and so on. Figure 1-7b shows how to visualize a 64K memory. The first address is 0000, and the last i FFEF. ‘Table of Binary-Hexadecimal-Decimal Equivalents A 63K memory has 65,536 hexadecimal addresses from (0000 to FFFF. The equivalent binary addresses ate from 0000 0000 9000 0000 Mant ait The first 8 bits are called the upper byte (UB); the second 8 bits are the lower byte (LB). If you have to do a lot of binary-hexadecimal-decimal conversions, use the table of ‘equivalents in Appendix 2, which shows all the values for a 64K memory Appendix 2 has four headings: binary, hexadecimal, UB decimal, and LB decimal, Given a 16-bit address, you convert the upper byte to its decimal equivalent’ (UB decimal), the lower byte to its decimal equivalent (LB cimal), and then add the two decimal equivalents. For instance, suppose you want to convert 101 0111 1010 0010 to its decimal equivalent. The upper byte is 1101 O111, or hexadecimal D7; the lower byte is 1010 0010, or A2. Using Appendix 2, find D7 and its UB decimal equivalent D7 55,040 Next, find A2 and its LB decimal equivalent AQ 1682 ‘Add the UB and LB decimal equivalents to get 55,040 + 162 = $5,202 This is the decimal equivalent of hexadecimal D7A2 or binary 1101 0111 1010 0010. Once familiar with Appendix 2, you will find it enor ‘mously helpful. It is faster, more accurate, and ess tiring than other methods. The only calculation requited is adding the UB and LB decimal, easily done mentally, with pencil and paper, or if necessary, on a calculator, Furthermore, if {you are interested in converting only the lower byte, no caleulation is required, as shown in the next example EXAMPLE 1-8 ‘Convert hexadecimal 7E (o its decimal equivalent. SOLUTION ‘When converting only a single byte, all you are dealing with is the lower byte. With Appendix 2, look up 7E and its LB decimal equivalent to get TE 126 In other words, Appendix 2 can be used fo convert single bytes to their decimal equivalents (LB decimal) or double bytes to their decimal equivalents (UB decimal + LB decimal) 1-11 DECIMAL-TO-HEXADECIMAL CONVERSION ‘One way to perform decimal-to-hexadecimal conversion is to go from decimal to binary then to hexadecimal. Another way is hex-dabble, The idea is to divide successively by 16, writing down the remainders. (Hex-dabble slike double- dabble except that 16 is used for the divisor instead of 2.) Here's an example of how to convert decimal 2,479 into hexadecimal form. The first division is 1st 15 F 16 2,479, ‘The next step is 9 WA oo 16 2,479 ‘The final step is Read down 0 99 9 A vise 1s F 16 2479 Notice how similar hex-dabble is to double-dabble. Also. remainders greater than 9 have to be changed to hexadecimal digits (10 becomes A, 15 becomes F, ete.) If you prefer, use Appendix 2 to look up the decimal- hexadecimal equivalents, The next two examples show how EXAMPLE 1-9 Convert decimal 141 to hexadecimal SOLUTION Whenever the decimal number is between 0 and 255, all you have to do is look up the decimal number and its hhexadecimal equivalent. With Appendix 2, you can see at ‘glance that 8D < 141 EXAMPLE 1-10 Convert decimal 36,020 to its hexadecimal equivalent, SOLUTION If the decimal number is between 256 and 65,535, you need to proceed as follows, First, locate the largest UB decimal that is less than 36,020. In Appendix 2, the largest UB decimal is, UB decimal = 35,840 which has a hexadecimal equivalent of 8C = 35,840 This is the upper byte Next, subtract the UB decimal from the original decimal number: 36,020 ~ 35,840 = 180 The difference 180 has a hexadecimal equivalent Bd < 180 This is the lower byte. By combining the upper and lower bytes, we get the complete answer: 8CB4. This isthe hexadecimal equivalent of 36,020, After a little practice, you will find Appendix 2 to be fone of the fastest methods of decimal-hexadecimal conver. 1-12 BCD NUMBERS A nibble is a string of 4 bits. Binary-coded-decimal (BCD) ‘numbers express cach decimal digit asa nibble, For instance, decimal 2,945 converts to a BCD number as follows: Chapter 1 Number Systems and Codes 13 2 9 4 5 toi 4 4 0010 1001 0100. O10 ‘As you see, each decimal digit is coded as a nibble. Here’s another example: 9,863,, converts like this: oe oe 4 od 4b og 1001 1000 O10 O11 ‘Therefore, 1001 1000 0110 0011 is the BCD equivalent of 9.863, ‘The reverse conversion is similar. For instance, 0010 1000 0111 0100 converts as follows: 0010 1000. 111 0100 4 4 4 4 2 8 7 4 Applications BCD numbers are usefitl wherever decimal information is transferred into or out of a digital system. The circuits inside pocket calculators, for example, can process BCD numbers because you enter decimal numbers through the keyboard and see decimal answers on the LED or liquid- crystal display. Other examples of BCD systems are elec- tronic counters, digital voltmeters, and digital clocks; their circuits can work with BCD numbers. BCD Computers BCD numbers have limited value in computers. A few early computers processed BCD numbers but were slower and more complicated than binary computers. As previously mentioned, 2 computer is more than a number crunchet ‘because it must handle names and other nonnumeric data, nother words, a modem computer must be able to process alphanumerics (alphabet leters, numbers, and other sym- bols). This why modern computers have CPUs that process binary numbers rather than BCD numbers. Comparison of Number Systems ‘Table 1-5 shows the four number systems we have discussed. Each number system uses strings of digits to represent quantity. Above 9, equivalent strings appear different. For instance, decimal string 128, hexadecimal string 80, binary string 1000 0000, and BCD string 0001 0010 1000 are equivalent because they represent the same number of pebbles. Machines have to use long strings of binary or BCD ‘numbers, but people prefer to chunk the data in either decimal or hexadecimal form, As long as we know how t0 14 Digital Computer Electronics TABLE 1-5. NUMBER SYSTEMS Decimal Hexadecimal Binary BCD 0 0 ‘0000 0000 0000 0000 0000 1 1 (0000 0001 0000 0000 0001 2 2 (0000 0010 000 0000 0010 3 3 (0000 0011 9000 0000 0011 4 4 (0000 0100 9000 0000 0100 5 5 (0000 0101 9000 0000 O10 6 6 (0000 0110 000 0000 0110 7 1 (0000 0111 9000 0000 0111 8 8 (0000 1000 9000 0000 1000 9 9 (0000 1001 9000 0000 1001 10 A (0000 1010 9000 0001 0000 nL B (0000 1011 0000 0001 0001 R c (0000 1100 9000 0001 0010, B D (0000 1101 0000 0001 0011 ry E (0000 1110 9900 0001 0100 Is F (0000 1111 0000 0001 0101 16 10 (0001 0000 0000 0001 0110 32 20 (0010 0000 0000 0011 0010 o 40 (0100 0000 9000 0110 0100 128 80 1000 90009001 0010 1000 255 FF T1111 0010 0101 O101 convert from one number system to the next, we can always get back to the ultimate meaning, which is the number of pebbles being represented. 1-13 THE ASCII CODE To get information into and out of a computer, we need 10 use numbers, letters, and other symbols. This implies some kind of alphanumeric code for the VO unit of a computer. ‘At one time, every manufacturer had a different code, which led to all kinds of confusion. Eventually, industry settled on an input-output code known as the American Standard Code for Information Inerchange (abbreviated ASCII). This code allows manufacturers 0 standardize VO hardware such as keyboards, printers, video displays, and so on, ‘The ASCII (pronounced ask’-ce) code is a 7-bit code whose format (arrangement) is XXX KXXiXy where each X is 4 0 or a 1. For instance, the letter A is coded as 1000001 Sometimes, a space is inserted for easier reading: 100 0001 TABLE 1-6, THE ASCH CODE XXX XGXX,Xq_ O10 O11 1000110 00 Sh 0 ee P 001 1 A Qo a q oo10 po Re oon # 3 °C S cos 0100 SoD o1o1 % S E Ue uw 0 ee bP ve oun 7 °G Wo g w 1000 Co ow & he 1001 ey oy 1010 * 3 0% jt 101 eo k 1100 oS ok 1 Ho = M m 1110 + > ON a 20 ° it I! Table 1-6 shows the ASCII code, Read the table the same as a graph. For instance, the letter A has an X.XsX, fof 100 and an XX.X,X, of 0001. Therefore, its ASCH code is 100 0001 (A) ‘Table 1-6 includes the ASCII code for lowercase letters. The letter a is coded as 1100001 (a) More examples are 110.0010 (b) Hoooll 1.0100 «dy and so on, ‘Also look at the punctuation and mathematical symbols. Some examples are o100100 «S) o1o1oll C+) o1riiol (=) In Table 1-6, SP stands for space (blank). Hitting the space bar of an ASCII keyboard sends this into a microcomputer: 010 0000 (space) EXAMPLE 1-11 With an ASCH Keyboard, each Keystroke produces the ASCII equivalent of the designated character. Suppose you ‘ype PRINT X What is the output of an ASCH Keyboard’? SOLUTION P (101 0000), R (101 0010), 1 (100 1001), N (100 1110) T (101 0100), space (010 0000), X (101 1000). GLOSSARY address Each memory location has an address, analogous. toahouse address, Using addresses, we can tll the computer where desired data is stored. alphanumeric Letters, numbers, and other symbols ‘base ‘The number of digits (basic symbols) in a number system, Decimal has a base of 10, binary a base of 2, and hhexaklecimal a base of 16. Also called the radix bit An abbreviation for binary digit, byte A string of 8 bits. The byte isthe basic unit of binary information. Most computers process data with a length of 8 bits or some multiple of 8 bits. ‘central processing unit The control section and the arith- metic-logie section. Abbreviated CPU, chip An integrated circuit chunking Replacing a longer string by a shorter one. data Names, numbers, and any other information needed to solve a problem. digital Pertains to anything in the form of digits, for example, digital data ‘hardware The electronic, magnetic, and mechanical de- viees used in a computer. hexadecimal A wumber system with a base of 16. Hexa- decimal numbers are used in microprocessor work. input-output Abbreviated VO. The input and output sec tions of a computer are often lumped into one unit known as the VO unit. microcomputer A computer that uses 2 microprocessor for its central processing unit (CPU). ‘microprocessor A CPU on a chip. It contains the control and arithmetic-logic sections. Sometimes abbreviated MPU (microprocessor unit), nibble A string of 4 bits. Half of a byte program sequence of instructions that tells the computer how (0 process the data. Also known as software. register A group of electronic, magnetic, or mechanical devices that store digital data, software Programs string A group of digits or other symbols. Chapter 1 Number Systems and Codes 15 SELF-TESTING REVIEW Read each of the following and provide the missing words. 1 ‘Answers appear atthe beginning of the next question, 1. Binary means Binary numbers have a base of 2. The digits used in a binary number system are and 2. (wo; 0, 1) Names, numbers, and other information A needed to solve a problem are called — 7 The —_____ is a sequence of instructions that {ells the computer how to process the data 3. (data, program) Computer ICs work reliably be ccause they are based on design, When transistor is cut off or saturated, transistor — have almost no effect. 4. (two-state, variations) A — is a group of deviees that store digital data is an abbreviation for binary digit. A byte is a string of bits. 5. (register, Bit, 8) The control and arithmetic-logic sections are called the (CPU). A micro processor is a CPU on a chip. A microcomputer is a computer that uses a for its CPU, 6. (central processing unit, microprocessor) The ab- breviation K indicates units of approximately 1,000 ‘or precisely 1,024. Therefore, IK means 1,024, 2K means 2,048, 4K means and 64K PROBLEMS How many bytes are there in each of these num- bers? (4,096, 65,536) The hexadecimal number system is Widely used in analyzing and programming The hexadecimal digits are 0 to 9 and A to The main advantage of hexadecimal numbers isthe case of conversion from hexadecimal to and vice versa (nicroprocessors, P, binary) A typical microcom- puter may have up to 65,536 registers in its mem- ory. Each of these registers, usually called a stores 1 byte. Such a memory is specified as a 6 kilobyte memory, or simply a memory (memory location, 64K) Binary-coded-decimal (BCD) numbers express each decimal digit as a BCD numbers are useful whenever formation is transferred into or out ofa digital system. Equipment using BCD numbers includes pocket calculators, electronic counters, and digital voltmeters. (nibble, decimal) The ASCII code is 7-bit code for (letters, numbers, and other sym bots. (alphanumerics) With the typical microcomputer, you enter the program and data with typewriter keyboard that converts each character into ASCH code. CH0e0CCO®e Fig. 1-8 An §-bit LED display. 2 00 o10 1 Oty 1-7. Figure 1-8 shows an 8-bit LED display. light 1111 1011 111 0100 1010 , tile means that a LED is ox inary 1) and What are the equivalent dial numbers for each dark cle means a LED i Or (inary 0), What Of the following binary mabe 10,110, TL ele mesh 4 LED i oF (int of the following binary bebe rire ie What is the base for each of these numbers? al equivalent ee 148, Convert te following binary numbers o decimal b. 1100 0101, iembete ce. 23125 cout OFC, oo: I. rite the tion a 14, Wit the can & toup oa 19, Save the following equation for + sig = 11001001; sing binary aunbers 16S, What ithe decinalequivalat of 2" What does 1n10, An sissies his ouput Ik represen? Express 8.192 in Knits 146, A reer as ouput voltages ih ow Jow-high-ow-high-ow-high tow igh high-low, What is the binary number stored in the register? The decimal equivalent? 16 Digital Computer Electronics ‘What is the equivalent decimal number being stored? Fig. 1 1.13. 14, 1s. 1.16, 1.20. SHIDO -9 An Sit core register. In Fig. 1-9 clockwise flux stands for binary 1 and ‘counterclockwise flux for binary 0. What is the binary number stored in the 8-bit core register? Convert this byte to an equivalent decimal umber. 10 A S-bit switch register. Figure 1-10 shows a S-bit switch register. By opening and closing the switches you can set up different binary numbers. As usual, high output voltage stands for binary 1 and low output voltage for binary 0. What isthe binary number stored in the switch register? The equivalent decimal num- ber? Convert decimal 56 to its binary equivalent Convert 7p fo 8 binary number. An Sit transistor register stores decimal 150 What is the binary output of the register? How would you set the switches of Fig. 1-10 to get a decimal output of 272 AA hexadecimal odometer displays FS2A. What are the next six readings? ‘The reading on a hexadecimal odometer is 27FF. ‘What isthe next reading? Miles late. you see a reading of 8AFC. What are the next six readings? Convert each of the following hexadecimal num. bers to binary: a FF b. ABC ©. CD42 d. F329 Convert each of these binary numbers to an ‘equivalent hexadecimal number: 8, 1110 1000 b. 1100 1011 ©. 1010 1111 0110 4. 1000 1011 1101 0110 121. 12. 1:23, 124, 1.28, Here is « program written for the 8085 micto- processor Address Hex Contents 2000 3B! e 2001 oF 2002 D3 2003 20 2008 16 Convert the hex contents t0 equivalent binary numbers, Convert each of these hexadecimal numbers to its decimal equivalent: a FF bod ©. 8B @. 3c Convert the following hexadecimal numbers to their decimal equivalents: a. OFFF b. 3RFF c. TFEA d. B3D8 ‘A microcomputer has memory locations from (0000 to OFFF. Each memory location stores 1 byte. In decimal, how many bytes can the micro- computer store in its memory? How many kilo bytes is this? ‘Suppose a microcomputer has memory locations from 0000 to 3FFF. each storing | byte. How Chapter 1 Number Systems and Codes 17 1-26. 1.27. 1.28, 1:29, 1-30, ‘many bytes can the memory store? Express this in kilobytes. : ‘A microcomputer has & 32K memory. How many bytes does this represent? If 0000 stands for the first memory location, what is the hexadecimal notation for the last memory location? Ifa microcomputer has @ 68K memory, what are the hexadecimal notations forthe fist and last memory locations? Convert the following decimal numbers to hexa- decimal: a. 4,095 b. 16,383 ec. 32,767 65,535 Convert each of the following decimal numbers to hexadecimal numbers: a 238 b. 7,547 15,359 d. 47,285 How many nibbles are there in each of the fol. lowing: ) a. 1000 0111 100) 0000 0109 0011 ©. 161 1001 0111 0040 o1 10 a110 18 digital Computer Electronics C131 1:32, LM. If the numbers in Prob, 1-30 ate BCD numbers, What are the equivalent decimal numbers? ‘What is the ASCII code for each of the following: a7 bow ef ay Suppose you type LIST with an ASCII keyboard. What is the binary output as you strike each letter? For each of the following rows, provide the miss- ing numbers in the bases indicated, Base 2 Base 10 Base 16 0100 0001 3CD Hot 1110 111 lL GATES For centuries mathematicians felt there was a connection between mathematics and logic, but no one before George Boole could find this missing link. In 1854 he invented symbolic logic, known today as boolean algebra. Each variable in boolean algebra has either of two values: true or false. The original purpose of this two-state algebra was to solve logic problems Boolean algebra had no practical application until 1938, ‘when Claude Shannon used itto analyze telephone switching circuits. He let the variables represent closed and open relays. In other words, Shannon came up with a new application for boolean algebra. Because of Shannon's ‘work, engineers realized that boolean algebra could be applied to computer electronics ‘This chapter introduces the gate, a circuit with one or ‘more input signals but only one output signal. Gates are digital («wo-state) circuits because the input and output signals are either low or high voltages. Gates are often called logic circuits because they can be analyzed with boolean algebra 2-1 INVERTERS ‘An inverter is a gate with only one input signal and one ‘output signal; the output state is always the opposite of the input state, ‘Transistor Inverter Figure 2-1 shows a transistor inverter. This common-emitter amplifier switches between cutoff and saturation, When Vay is low (approximately 0 V), the transistor cuts off and Voc is high. On the other hand, a high Viy saturates the transistor. forcing Vour to 0 low, Table 2-1 summarizes the operation. A low input produces a high output, and a high input results in a low output. ‘Table 2-2 gives the same information in binary form: binary 0 stands for low voltage and binary 1 for high voltage. An inverter is also called a Nor gate because the output is not the same as the input. The output is sometimes called the complement (opposite) of the input. 15V lores) Fig. 2-1 Example of inverter design TABLE 2-1 TABLE 2.2 Vour High Low em Po fevour ae fe A Fig, 2-2 Logie symbols: (a) inverter; (b) another inverter symbol: (e) double inverter; () butter Inverter Symbol Figure 2-2a is the symbol for an inverter of any design, ‘Sometimes a schematic diagram will use the alternative ‘symbol shown in Fig. 2-2b; the bubble (smal! circle) is on 19 the input side. Whenever you see either ofthese symbols remember that the output is the complement of the input Noninverter Symbol If you cascade (wo inverters (Fig. 2-2c), you get a nonin- verting amplifier. Figure 2-24 is the symbol for a nonin- verting amplifier. Regardless ofthe circuit design, the action is always the same: a low input voltage produces a low output voltage, and a high input voltage results in a high ‘output voltage. The main use of noninverting amplifier is buffering (isolating) two other circuits, More will be said about buffers in a later chapter EXAMPLE 2-1 7 ° Le 1 bee out ° A 1 Fig. 2-3 Example 2-1, Figure 2-3a has an output, A to F, of 100101. Show how to complement each bit SOLUTION 3b). The Easy, Use an inverter on each signal line (Fig. 2 final output is now 011010, A hex inverter is a commercially available IC containing six separate inverters. Given a 6-bit register like Fig. 2-34. Wwe ean connect a hex inverter to complement each bit as shown in Fig. 2-35 One more point, In Fig. 2-3a the bits may represent a coded instruction, number, letter, ete. To convey this variety of meaning, a string of bits is often called a binary word for simply @ word. In Fig. 2-3b the word 100101 is complemented to get the word 011010. 2-2 oR GATES ‘The O8 gate has two or more input signals but only one ‘output signal, IF any input signal is high, the output signal is high 20 digital computer Electronics Fig. 24 A 2input diode of gate Diode or Gate Figure 2-4 shows one way to build an on gate. If both inputs are low, the output is low. If either input is high the diode with the high input conducts and the output is high. Because of the two inputs, we call this circuit a 2- input on gate ‘Table 2-3 summarizes the action; binary 0 stands for low voltage and binary 1 for high voltage. Notice that one or ‘more high inputs produce a high output; this is why the is called an OR gate. Fig. 2-5 A 3sinput diode on gate More than Two Inputs Figure 2-5 shows a 3-input on gate. If all inputs are low, all diodes are off and the output is Tow. If 1 or more inputs are high, the output is high, Table 2-4 summarizes the action, A table like this is called a sruth table; it lists all the input possibilities and the corresponding outputs. When constructing a truth table, always list the input words ina binary progression as shown (000, 001, 010, . .., 111; this guarantees that all input possibilities will be accounted for. ‘An oR gate can have as many inputs as desired; add one diode for each additional input. Six diodes result in a 6- TABLE 2:3. |. THREE- TWO INPUT ox GATE, or GATE, ¥ A BlY¥ —_ 0 0} 0 oi Loo] a road 0 1 1 ' 1 1 1 I input oR gate, nine diodes in a 9-input ox gate. No matter how many inputs, the action of any OR gate is summarized like this: one or more high inputs produce a high output Bipolar transistors and MOSFETs can also be used to build oR gates. But no matter what devices are used, OR gates always produce a high output when one or more inputs are high. Figure 2-6 shows the logie symbols for 2-, 3-, and 4-input oR gates. DD D> Fig. 2.6 on-gate symbols EXAMPLE 2-2 ‘Show the truth table of # 4-input on gate. SOLUTION Let ¥ stand for the output bit and A, B, C, D for input bits ‘Then the truth table has input words of 0000, 0001, 0010, EXAMPLE 2-3 How many inputs words are in the uth table of an 8-input on gate? Which input words produce a high output? SOLUTION The input words are 0000 0000, 0000 0001, .... LIIL LLL. With the formula of the preceding example, the total ‘number of input words is 2" = 2° = 256, In any OR gate, 1 or more high inputs produce a high output. Therefore, the input word of 0000 0000 results in « low output; all other input words produce a high output EXAMPLE 2-4 sv t | | = 1111, as shown in Table 2:5. As expected, output ¥ a + is 0 fo input word 0000; ¥ is 1 forall other input words aoa As a check, the number of input words ina truth table > always equals 2, where m is the number of input bits. A so 2 pec ot sa fa ih ue wih or pt nnd aie t a input om gate has 2° or 8 input words; and a 4-input oars st—p (on gate has 2 or 16 input words. ashy . Sates + soccooe|> e-n-Hccocls Fig. 2-7 Decimal-tobinary encoder ‘The switches of Fig. 2-7 are push-button switches like those of @ pocket calculator. The bits out of the ok gates form 4-bit word, designated Y,YsY,Yo. What does the circuit do? SOLUTION Figure 2-7 is a decimal-to-binary encoder, a circuit that converts decimal to binary. For instance, when push button 3 is pressed, the Y; and Yo OR gates have high inputs therefore, the output word is YAY.Y)Yp = OO Chapter 2 Gates 21 If button 5 is keyed, the ¥, and Yo OR gates have high inputs and the output word becomes Y¥AVYo 0101 When switch 9 is pressed, Y¥AViYo 001 Check the other input switches to convince yourself that the output word always equals the binary equivalent of the switch being pressed 2-3 AND GATES The AND gate has {vo or more input signals but only one output signal. All inputs must be high to get high output Oyh ®t, ve @ Fig. 28 A 2-input axo gate. (a circuit; (b) both inputs low: (61 low input, 1 high; (2) both inputs high Diode ap Gate Figure 2-8a shows one way to build an AND gate. In this circuit the inputs can be either low (ground) or high (+5 V). When both inputs are low (Fig, 2-86), both diodes ‘conduct and pull the output down to a low voltage. If one fof the inputs is low and the other high (Fig. 2-80), the diode with the low input conducts and this pulls the output down to a low voltage. The diode with the high input, on the other hand, is reverse-biased or cut off, symbolized by the dark shading in Fig. 2-8¢ When both inputs are high (Fig. 2-84), both diodes are cout off. Since there is no current in the resistor, the supply voltage pulls the output up 10 a high voltage (+5 V). 22 digital computer Electronics TABLE 2-6. TWO- INPUT ano GATE Y AB yo o 1}o 1 0] 0 1oaifa Table 2-6 summarizes the action. As usual, binary zero stands for low voltage and binary 1 for high voltage. As you see, A and B must be high to get a high output; this is ‘why the circuit is called an AND gate, Ao cot Fig, 2.9 A S-input avo. More than Two Inputs Figure 2-9 is a 3-input aND gate. If all inputs are low all diodes conduct and pull the output down to a low voltage. Even one conducting diode will pull the output down to 2 low voltage; therefore, the only way to get 2 high output is to have all inputs high. When all inputs are high, all diodes are nonconducting and the supply voltage pulls the output up to a high voltage Table 2-7 summarizes the 3-input AND gate, The output i O for all input words except 111. That is, all inputs must be high to get a high output. AND gates can have as many inputs as desired; add! one diode for each additional input. Eight diodes, for instance, result in an 8-input AND gate; sixteen diodes in a 16-input ‘TABLE 2-7. THREE- INPUT aNp GATE, B ----ecee|a| enone fa ‘0 Fig, 2-10 axp-gate symbols. AND gate. No matter how many inputs an AND gate has the action can be summarized like this: All inputs must be high to get a high output. Figure 2-10 shows the logic symbols for 2-, 3+, and 4- input AND gates. EXAMPLE 2-5 Describe the truth table of an 8-input AND gate. SOLUTION ‘The input words are from 0000 0000 t0 1111 1111, following the binary progression. The total number of input words is 2 = 2 = 256 ‘The first 255 input words produce a 0 output. Only the last word, IIIT IIL, results in a 1 output, This is because all inputs must be high to get a high output EXAMPLE 2-6 % % % Oh Fig. 211 Using ano gates to block or transmit data ‘The 6-bit register of Fig, 2-11 stores the word ABCDEF. ‘The ENABLE input can be low or high. What does the circuit do? SOLUTION One use of AND gates is to transmit data when certain conditions are satisfied. In Fig. 2-11 a low ENABLE blocks the register contents from the final output, but a high ENABLE transmits the register contents For instance, when ENABLE = 0 each AND gate has a low ENABLE input. No matter what the register contents, the output of each AND gate must be low. Therefore, the final woed is YsY.Y3¥2Y)Yq = 000000 ‘As you see, a low ENABLE blocks the register contents from the final output. On the other hand, when ENABLE = 1 the output of each AND gate depends on the data inputs (A. B,C, .. .j.a low data input results in a low output, and ‘high data input in a high output. For example, if ABCDE = 100100, a high ENABLE gives YSY.YsY:¥ Yo = 100100 In general, a high ENABLE transmits the register contents to the final output to get YsY,Ys¥2YiYo = ABCDEF 2-4 BOOLEAN ALGEBRA As mentioned earlier, Boole invented two-state algebra 10 solve logic problems. This new algebra had no practical use until Shannon applied it to telephone switching circuits, Today boolean algebra is the backbone of computer circuit analysis and design Inversion Sign In boolean algebra a variable can be either a 0 or a 1. For digital circuits, this means that a signal voltage can be either low or high. Figure 2-12 is an example of a digital circuit because the input and output voltages are either low or high. Furthermore, because of the inversion, ¥ is always the complement of A. 2—Do— A word equation for Fig. 2-12 is Fig. 212 Inverter Y= Nora ep Chapter 2 Gates 23 IA is, Y=nor0=1 On the other hand, if A is 1, Y=norl=0 In boolean algebra, the overbar stands for the Nor operation. This means that Eq. 2-1 can be written y=a 2.2) Read this as “¥ equals Nor A” or “Y equals the complement ‘of A." Equation 2-2 is the standard way to write the output of an inverter. Using the equation iseasy. Given the value of A, substitute and solve for Y. For instance, if A is 0, yeR=d=1 because Nor 0 is 1. On the other hand, if A is | because Nor 1 is 0.

| 32 [ | LL More LOGIC GATES ‘This chapter introduces NoR and NAND gates, devices that are widely used in industry. You will also learn about De Morgan's theorems: they help you to rearrange and simplify logic circuits 3-1 NOR GATES “The Nor gate has two or more input signals but only one ‘output signal. Al inputs must be low to get a high output In other words, the Nok gate recognizes only the input word whose bits are all 0s. ‘Two-Input Gate Figure 3-Ia shows the logical structure of a NoR gate, which is an on gate followed by an inverter. Therefore, the final output is NOT the OR of the inputs. Originally called a NoT-OR gate, the circuit is now referred to as a NOR gate. Figure 3-1b is the standard symbol for a NOR gate, Notice that the inverter triangle has been deleted and the smalt circle or bubble moved to the ox-gate output. The bubble is a reminder of the inversion that follows the oRing With Fig. 3-1a and b the following ideas are clear. If both inputs are low, the final output is high. If one input is low and the other high, the output is low. And if both inputs are high, the output is low Table 3-1 summarizes the circuit action. As you see, the [Nok gate recognizes only the input word whose bits are all 0s, In other words, all inputs must be low to get a high output 32 TABLE 3-1. TWO- INPUT Nor GATE, > A+B 0 0 eee |e dentally, the boolean equation for a 2-input NOR gate y=A4B BD Read this as “Y equals Nor A ox B.”” If you use this equation, remember that the oring is done first, then the to a ‘oR gates: (a) input (b) 4-inpu. Three-Input Gate Regardless of how many inputs a NOR gate has, it is still logically equivalent to an ox gate followed by an inverter For instance, Fig. 3-2a shows a 3-input Nor gate. The 3 inputs are ORed, and the result is inverted. Therefore, the boolean equation is Y=AFBTC 2) The analysis of Fig. 3-22 goes like this. If all inputs are low, the result of oning is low; therefore, the final output ‘TABLE 3-2. THREE-INPUT Nor GATE ae cl aeBee 000 1 oor o On ° gl ° 100 0 to 0 ii 0 o tia 0 is high. If one or more inputs are high, the result of oning is high; so the final output is low. Table 3-2 summarizes the action of a 3-input Now gate As you see, the circuit recognizes only the input word whose bits are 0s. In other words, all inputs must be low to get a high output. Four-Input Gate Figure 3-2 is the symbol for a 4-input Nor gate. The ‘inputs are ORed, and the result is inverted. For this reason, the boolean equation is Y¥=AFB+CFD G3) ‘The corresponding truth table has input words from 0000 to 1111. Word 0000 gives a 1 output; all other words produce a 0 output. (For practice, you should construct the truth table of the 4-input NoR gate.) 3-2 DE MORGAN'S FIRST THEOREM Most mathematicians ignored boolean algbebra when it first appeared; some even ridiculed it. But Augustus De Morgan saw that it offered profound insights. He was the first to acclaim Boole’s great achievement. Always a warm and likable man, De Morgan himself hhad paved the way for boolean algebra by discovering two important theorems. This section introduces the first theo- The First Theorem Figure 3-3a is « 2-input Nor gate, analyzed earlier. As you recall, the boolean equation is AB and Table 3-3 is the truth table. Fig. 3-3 De Morgan's fist theorem: (a) Now gate; (b) awe gate with inverted inputs, Figure 3-3b has the inputs inverted before they reach the AND gate, Therefore, the boolean equation is y=4B 1 both inputs are Jow in Fig. 3-35, the AND gate has high inputs; therefore, the final output is high. If one or more inputs are high, one or more AND-gate inputs must be low and the final output is low. Table 34 summarizes these ideas. TABLE 3-3 TABLE 34 Compare Tables 3-3 and 3-4. They're identical. This ‘means that the two circuits are logically equivalent; given the same inputs, the outputs are the same. In other words, the circuits of Fig. 3-3 are interchangeable. De Morgan discovered the foregoing equivalence long before logic circuits were invented. His first theorem says AYB B G4) ‘The left member of this equation represents Fig. 3-3a: the right member, Fig. 3-3b, Equation 3-4 says that Fig. 3-34 and b are equivalent (interchangeable) Bubbled ano Gate Figure 3-4a shows an AND gate with inverted inputs. This circuit is so widely used that the abbreviated logie symbol of Fig. 3-46 has been adopted. Notice that the inverter triangles have been deleted and the bubbles moved to the Chapter 3 More Logic Gates 3B Fig. 3-4 xp gate with inverted inputs: (a) cireit (B) abbreviated symbol. AND-gate inputs, From now on, we will refer to Fig. 3-46 as a bubbled AND gare; the bubbles are a reminder of the inversion that takes place before aNDing. q>— - =D- 345 De Morgan's first theorem, Figure 3-5 is a graphic summary of De Morgan's first theorem. A nok gate and a bubbled AND gate are equivalent. AAs shown later, because the circuits are interchangeable, you can often reduce complicated logic circuits to simpler forms. More than Two Inputs When 3 inputs are involved, De Morgan’s first theorem is written AFB +C=ABC (3-5) For 4 inputs A¥BSCFD (3-6) In both cases, the theorem says that the complement of a suum equals the product of the complements Fig. 3-6 De Morgan’s first theorem: (a) 3-input eiruits: (b) 4 input circuits B4 Digital Computer Electronics Here’s what really counts. Equation 3-5 says that a 3- input Nor gate and a 3-input bubbled aNb gate are equivalent (see Fig. 3-6a), Equation 3-6 means that a 4-input NOR gate and a 4-input bubbled AND gate are equivalent (Fig. 3-6b), Memorize these equivalent circuits; they are a visual statement of De Morgans first theorem. [Notice in Fig. 3-6 how the input edges of the NOR gate land the bubbled aND gate have been extended. This is ‘common drafting practice when there are many input signals. ‘The same idea applies to any type of gate. EXAMPLE 3-1 Prove that Fig. 3-7a and are equivalent. p> p> a we Fig. 3:7 Equivalent De Morgan circuit. SOLUTION ‘The final Nor gate in Fig, 3-7a is equivalent to a bubbled AND gate, This allows us to redraw the circuit as shown in Fig. 3-76, ‘Double inversion produces noninversion; therefore. cach double inversion in Fig. 3-7b cancels out, leaving the simplified citcuit of Fig. 3-7e. Figure 37a and ¢ are therefore equivalent Remember the idea. Given a logic circuit, you can replace any NOR’ gate by a bubbled AND gate. Then any double inversion (a pair of bubbles in a series path) cancels out ‘Sometimes you wind up with a simpler logic circuit than you started with; sometimes not. ‘But the point remains. De Morgan's first theorem enables you to rearrange a logic circuit with the hope of finding a ‘simpler equivalent cigcuit or perhaps getting more insight into how the original circuit works, 3-3 NAND GATES ‘The NAND gate has two or more input signals but only one ‘output signal. All input signals must be high to get a low ‘output —D o—t 9 Fig, 3-8 sano gate: (a) logical meaning; (b) standard symbol. ‘Two-Input Gate Figure 3-8a shows the logical structure of a NAND gate, an AND gate followed by an inverter. Therefore, the final ‘output is NoT the AND of the inputs. Originally called a NOT-AND gate, the circuit is now referred to as @ NAND gate Figure 3-8b is the standard symbol for a NAND gate, The inverter triangle has been deleted and the bubble moved to the aND-gate output. If one or more inputs are low, the result of aNDing is low; therefore, the final inverted output is high. Only when all inputs are high docs the ANDing produce a high signal; then the final output is low. Table 3-5 summarizes the action of a 2-input NAND gate. As shown, the NAND gate recognizes any input word with ‘one or more 0s. That is, one or more low inputs produce «high output. The boolean equation for a 2-input NAND gate is y= on Read this as “Y equals Nor AB.” If you use this equation, remember that the aNDing is done first then the inversion Fig, 3.9 Nano gates: (a) input; () input. ‘Three-Input Gate Regardless of how many inputs a NAND gate has, it's still logically equivalent to an AND gate followed by an inverter. For example, Fig. 3-9a shows a 3-input NAND gate, The inputs are ANDed, and the product is inverted. Therefore, the boolean equation is Y = FBC G8) Here is the analysis of Fig. 3-94. If one or more inputs are low, the result of anbing is low; therefore, the final output is high, If all inputs are high, the aNbing gives high signal; so the final output is low Table 3-6 is the truth table for a 3-input NAND gate. As indicated, the circuit recognizes words with one or more Os. This means that one or more low inputs produce a high output. TABLE 3.5, TABLE 3-6. THREE- TWO-INPUT INPUT NaNb GATE, NaNb GATE AB C| ABC A B| AB —— = Oo Ot oot oor] ot orf a o1ol| 1 rol t ord} ot Lalo roo} t a oe fi ole i Laiilo Four-Input Gate Figure 3-96 is the symbol for a 4-input NaNp gate, The inputs are ANDed, and the result is inverted. Therefore, the boolean equation is y = ABCD a9 If you construct the truth table, you will have input words from 0000 to 1111. All words from 0000 through 1110 Produce & 1 output; only the word L111 gives 2 0 output 3-4 DE MORGAN'S SECOND THEOREM ‘The proof of De Morgan’s second theorem is similar to the proof given for the first theorem. What follows is a brief explanation, ‘The Second Theorem ‘When two inputs are used, De Morgan's second theorem says that AB=R+8 G-10) In words, the complement of a product equals the sum of the complements. The eft member of this equation repre Sents a NAND gate (Fig. 3-10a); the right member stands > 0 Fig, 3-10 De Morgan's second theorem: (a) NAND gate: (b) 0% {gate with inverted inputs: (c) bubbled oR gate Chapter 3 More Logic Gates 3B for an on gate with inverted inputs (Fig, 3-10b). Therefore, De Morgan's second theorem boils down to the fact that Fig, 3-10a and 6 are equivalent EXAMPLE 3-2 Prove that Fig. 3-13a and c ate equivalent aD - 4 Fig. 3-11 De Morgan's second theorem, Bubbled on Gate ‘The circuit of Fig. 3-10b is so widely used that the abbreviated logic symbol of Fig. 3-10c has been adopted. From now on we will refer to Fig. 3-10c as a bubbled ow ‘gate; the bubbles are a reminder of the inversion that takes place before oRing. Figure 3-11 isa visual statement of De Morgan's second theorem: a NAND gate and a bubbled oR gate are equivalent. This equivalence allows you to replace one circuit by the other whenever desired. This may lead to a simpler logic circuit or give you more insight into how the original circuit works, More than Two Inputs ‘When 3 inputs are involved, De Morgan's second theorem is written ABC =A +B+C Gin 1-4 inputs are used, ABCD = 4+8+E+D (3-12) ‘These equations say that the complement of a product equals the sum of the complements. oe o » Fig, 3-12 De Morgan’s second theorem: (a) 3-input circuits () input circuits Figure 3-12 is a visual summary of the second theorem. Whether 3 or 4 inputs are involved, a NAND gate and a bubbled on gate are equivalent (interchangeable) 3G Digital Computer Electronics Ln oo we Fig. 3:13 Equivalent circuits, SOLUTION Replace the final NAND gate in Fig. 3-13a by a bubbled or gate. This gives Fig. 3-13b. The double inversions cancel out, Ieaving the simplified circuit of Fig. 3-13c. Figure 3-13a and c are therefore equivalent. Driven by the same inputs, either circuit produces the same output as the other. So if you're loaded with NaND gates, build Fig. 3-134. If four Shelves are full of AND and OR gates, build Fig 3-13¢ Incidentally, most people find Fig. 3-13b easier to analyze than Fig. 3-13a, For this reason, if you build Fig. 3-134, draw the circuit like Fig. 3-136. Anyone who sees Fig 3-13) on a Schematic diagram knows that the bubbled oR gate isthe same as a NAND gate and that the built-up circuit is (Wo NAND gates working into a NAND gate. EXAMPLE 3-3 Figure 3-14 shows a circuit called a control matrix. At frst, it looks complicated, but on closer inspection its relatively simple because ofthe repetition of NAND gates. De Morgan's theorem tells us that NAND gates driving NAND gates are coquivalent to AND gates driving oR gates. ‘The upper set of inputs T; t0 Tare called timing signals, conly one of them is high at a time. 7, goes high first, then Tz, then Ts, and so on, These signals control the rate and sequence of computer operations. The lower set of inputs LDA, ADD, SUB, and OUT are ‘computer instructions; only one of them is high at a time. The outputs Cy, Ep. Lys ---+ 10 Lo control different registers in the computer. ‘Answer the following questions about the control matrix: 2. Which outputs are high when 7, is high? b. IFT, and LDA are high, which outputs are high? cc. When T, and SUB are high, which outputs are high? i+# | F “Tate ret YOY 4 & fe ty fp 3414 Control matrix, SOLUTION a. Visualize T, high. You can quickly check out each gate and realize that Ey and Ly are the only high outputs b. This time T, and LDA are high, Check each gate and you can see that L,, and F; are the only high outputs, ¢. When 7, and SUB are high, the high outputs are Z,, Sis and Ey 3-5 EXCLUSIVE-OR GATES ‘An ok gate recognizes words with one or more Is. The EXCLUSIVE-OR gate is different; it recognizes only words that have an odd number of Is. ‘Two Inputs Figure 3-15a shows one way to build an EXCLUSIVE-oR gate, abbreviated xoR. The upper AND gate forms the product AB, and the lower AND gate gives AB. Therefore, the Boolean equation is v= 7B + AB G13) vy wens ‘or Fig. 3-18 (a) exctusive-ok gate. (b) A 2-input ExcLUSWE-OR ate, Here's what the circuit does. In Fig. 3-15a two low inputs mean both AND gates have low outputs; so the final ‘output is low. If A is low and B is high, the upper AND. gate has a high output; therefore, the final output is high Likewise, a high A and low B result in a final output that js high. If both inputs are high, both aNp gates have low ‘outputs and the final output is low. Table 3-7 shows the truth table for a 2-input EXCLUSIVE. ‘on gate. The output is high when A or B is high but not both; this is why the circuit is known as an EXCLUSIVE-OR ‘gate. In other words, the output is a | only when the inputs are different Chapter 9 More Logic Gates. 37 TABLE 3-7. TWO- INPUT xor GATE ———— AB! AB+ AB oo 0 L I L 0 I Logic Symbol and Boolean Sign Figure 3-15b is the standard symbot for a 2-input XoR gate. ‘Whenever you sce this symbol, remember the action: the inputs must be different to get a high output ‘A word equation for Fig. 3-15b is y Axor B Gy) In boolean algebra the sign @ stands for xoR addition ‘This means that Eq. 3-14 can be written Y=A@B GS) Read this as “Y equals A xo B.” Given the inputs, you can substitute and solve for the output, For instance, if both inputs are low, y=0@0=0 because xoRed with O gives 0. If one input is low and the other high, =0@1=1 because 0 xored with I produces 1. And so on. Here's a summary of the four possible xoR additions: 0@0 0 1 I ©008 1 D0 1 Remember these four results; we will be using xOR addition when we get fo arithmetic circuits Four Inputs In Fig. 3-164 the upper gate produces A @ B, while the lower gate gives C @ D. The final gate xoxs both of these ‘sums to get A®HOCOD G16) 38 Digital Computer Electronics or Fig. 316 A 4input exciusive-on gate: (a) circuit with 2-input OR gates (b loge symbol. It’s possible to substitute input values into the equation and solve for the output. For instance, if A through C are low and D is high, = 0@9@0@V o@! =1 ‘One way to get the truth table is to plow through all the input possibilities. ‘Alternatively, you can analyze Fig. 3-16a as follows. If all inputs are Os, the fist two gates have O outputs; so the final gate has a 0 output, If A to Care Os and D is a 1, the ‘upper gate has a 0 output, the lower gate has a 1 output, and the final gate has @ 1 output, In this way, you can analyze the circuit action for all input words. Table 3-8 summarizes the action, Here is an important property: each input word with an odd number of Is produces a I output. For instance, the first input word to produce a I output is 0001; this word has an odd number of Is, The next word with a 1 output is 0010; again an odd number of Is. A 1 output also occurs for these words: 0100, 111, 1000, 1011, 1101, and 1110, all of which have an odd number of 1s. ‘The circuit of Fig. 3-16a recognizes words with an odd number of 1s; it disregards words with an even number of 1s, Figure 3-16a is a 4-input xOR gate, In this book, we will use the abbreviated symbol of Fig. 3-16b to represent 4a 4-input xor gate. When you see this symbol, remember the action: the circuit recognizes words with an odd number of Is. Any Number of Inputs Using 2-input xo gates as building blocks, we can make XOR gates with any number of inputs. For example, Fig. TABLE 3-8. FOUR-INPUT xor GATE, Comment A Even | 0 oad 0 aa 0 Even | 0 oad 0 Even | 0 Even | 0 Odd 0 oad 1 Even 1 Even I Odd 1 Even 1 oud 1 owe 1 Even 1 ee-e--e [| Hono-e-cH o-oo ols a 0 0 1 1 o 0 1 _ o 0 1 1 0 0 1 1 = a>)- » Fig. 317 xox gates: (a) input; (>) 6input. 3:17a shows the abbreviated symbol fora 3-input xoR gate, and Fig. 3-176 is the symbol for a 6-input xoR gate. The final output of any XOR gate is the XoR sum of the inputs: Y=Aa@B@c Gn What you have to remember for practical work is ths: fan XOR gate, no matter how many inputs, recognizes only ‘words with an odd number of Is. Parity Even parity means a word has an even number of 1s. For instance, 110011 has even parity because it contains four Is, Odd parity means a word has an odd number of Is. As ‘an example, 110001 has odd parity because it contains thre Is, Here are two more examples: 11110000 1111 0011 1111 0000 1111 0111 (Even parity) (Odd parity) The first word has even parity because it contains ten Is; the second word has odd parity because it contains eleven Is. XOR gates are ideal for testing the parity of a word, XoR {gates recognize words with an odd number of Is. Therefore, ceven-parity words produce a low output and odd-parity words produce a high output EXAMPLE 3-4 ‘What is the output of Fig. 3-18 for each of these input words? a. 1010 1100 1000 1100, b. 1010 1100 1000 F101 00 ig. 318 Odd-paity tester. SOLUTION a. The word has seven Is, an odd number. Therefore, the output signal is opp =1 . The word has eight Is, an even number. Now opp =0 This is an example of an odd-party tester. An even- Parity word produces a low output. An odd-parity word results in a high output. EXAMPLE 3-5 The 7-bit register of Fig. 3-19 stores the leter A in ASCIL form. What does the 8-bit output word equal”? Chapter 3 More Logic Gates. 39 oe Inaction or ta ite ‘ot word wth odd write Fig. 3:19 Oud-parity generator. SOLUTION ‘The ASCII code for letter A is 100 0001, (see Table 1-6 for the ASCH code). This word has an even parity, which means that the XOR gate has a 0 output Because of the inverter, the overall output of the circuit is the 8-bit word 1100 0001 Notice that this has odd parity. ‘The circuit is called an odd-parity generator because it produces an 8-bit output word with odd party. If the register ‘word has even parity, 0 comes out of the XOR gate and the codd-parity bit is 1. On the other hand, if the register word hhas odd parity, a I comes out of the XOR gate and the odd- party bit is 0. No matter what the register contents, the ‘odd-parity bit and the register bits form a new 8-bit word that has odd parity ‘What is the practical application? Because of transients, noise, and other disturbances, [-bit errors sometimes occur in transmitted data. For instance, the letter A may be transmitted over phone lines in ASCH form: 100.0001 (A) Somewhere along the line, one of the bits may be changed. Ifthe X, bit changes, the received data will be 1000011) 40 Digital Computer Electronics Because of the I-bit error, we receive letter C when letter A was actually sent. One solution is to transmit an odd-parity bit along with the data word and have an xOR gate test each received ‘word for odd parity. For instance, with a circuit ike Fig. 3-19 the letter A would be transmitted as 1100 0001 ‘An xOr gate will test this word when it is received. If no error has occurred, the Xor gate will recognize the word. On the other hand, if a I-bit error has crept in, the XOR gate will disregard the received word and the data can be rejected. ‘A final point, When errors come, they are usually 1-bit errors, This is why the method described catches most of the errors in transmitted data EXAMPLE 3-6 What does the circuit of Fig. 3-20 do? y Fig. 3:20 SOLUTION When INVERT = 0 and A = 0, y=0@0=0 When INVERT = 0 and A y=0@1=1 In either case, the output is the same as A; that is, y=A for a low INVERT signal (On the other hand, when INVERT = 1 and A y When INVERT = 1 and A = 1, y This time, the output is the complement of A. As an equation, y=A for a high INVERT signal ‘To summarize, the circuit of Fig. 3-20 does either of two things. It transmits 4 when [VERT is 0 and A when INVERT is 1. 3-6 THE CONTROLLED INVERTER ‘The preceding example suggests the idea of a controlled inverter, a circuit that transmits a binary word or its I's complement. The 1' Complement ‘Complement each bit in a word and the new word you get is the 1s complement. For instance, given 1100 O11 the 1’s complement is 011 1000 Each bit in the original word is inverted to get the I's complement The Cireuit The xoR gates of Fig. 3-21 form a controlled inverter (sometimes called a programmed inverter). This circuit can transmit the register contents or the 1's complement of the register contents. As demonstrated in Example 3-6, cach XOR gate acts like this. A low INVERT results in and a high INVERT gives So each bit is either transmitted or inverted before reaching the final output. Visualize the register contents as a word AAs © + Ap and the final output as a word YY, ** » Yo. Then a low INVERT means Yao ++ Yo = Arg = Ay (On the other hand, a high INVERT results in YoYo" * + Yo = Avy As « concrete example, suppose the register word is ADAgs ++ Ay = L110 0110 ‘Then, & low INVERT gives an output word of Yi¥q" ++ Yo = 110 0110 and a high INVERT produces Yi¥e* ++ Yo = 0001 1001 The controlled inverter of Fig, 3-21 is important, Later ‘you will see how it is used in solving arithmetic and logic problems. For now, all you need to remember is the key idea. The output word from a controlled inverter equals the + bene +3 x = y % Ve 3-21 Controlled inverter Chapter $ More Logic Gates 41 input word when INVERT is low; the output word equals the I's complement when INVERT is high. Boldface Notation After you understand an idea, it simplifies discussions and equations if you use a symbol, letter, or other sign to represent the idea, From now on, boldface letters will stand for binary words. For instance, instead of writing Aye* ++ Ay = 1110 0110 wwe can write A= 11100110 Likewise, instead of Yr¥e° + Yp = 0001 1001 the simpler equation Y = 0001 1001 ccan be used. ‘This is another example of chunking. We are replacing long strings like AyA, +» * Ay and YY, >» Yo by A and Y. This chunked notation will be convenient when we get to computer analysis. ‘This is how to summarize the action of a controlled inverter: ‘A when INVERT = 0 when INVERT = | (oie: A boldface leter with an overbar means that each bit in the word is complemented: if A is a word, A is its 1's complement.) 3-7 EXCLUSIVE-NOR GATES ‘The EXCLUSIVE-NOR gate, abbreviated xNOR, is logically equivalent to an xoR gate followed by an inverter. For example, Fig. 3-22a shows a input xNoR gate, Figure 3-226 is an abbreviated way to draw the same circuit Opt dpb Fig. 322 A2-inputxvon gate: (a) citcuit;(b) abbreviated symbol 42> digital Computer Electronics TABLE 3.9. TWO-INPUT xNOR GATE, ecole -e-e|s| Jree-|= Because of the inversion on the output side, the truth table of an xNOR gate is the complement of an XO truth table, As shown in Table 3-9, the output is high when the inputs are the same. For this reason, the 2-input NOR gate is ideally suited for bie comparison, recognizing when two input bits are identical. (Example 3-7 tells you more about bit comparison.) aD o w Fig. 3:23 xvoR gates (a) 3+nput; (b) input Figure 3-23a is the symbol for a 3-input xox gate, and Fig. 3-23bis the d-input xo gate. Because ofthe inversion ‘on the output side, these XNOR gates perform the comple- mentary function of xox gates. Instead of recognizing odd- parity words, xNoR gates recognize even-parity words. EXAMPLE 3-7 What does the circuit of Fig. 3-24 do? SOLUTION ‘The citeuitis a word comparator: it recognizes two ident words. Here is how it works. The leftmost XNOR gate compares A, and By; if they are the same, ¥ is a 1. The second XNOR gate compares A, and By: if they are the same, Y, isa 1, In tum, the remaining XNOR gates compare the bits that are left, producing a 1 output For equal bits and a 0 output for unequal bits. Ifthe words A and B are identical, all xNOR gates have high outputs and the AND gate has a high EQUAL. If words ‘A and B differ in one or more bit positions, the AND gate has a low EQUAL, % Ie Jn |e [hn Yr Fig, 324 Word comparator GLOSSARY controlled inverter This circuit produces the 1's comple- ment ofthe input word. One application is binary subtrac- tion. It is sometimes called a programmed inverter. De Morgan's theorems The frst theorem says that a NoR ate is equivalent to a bubbled 4ND gate. The second theorem says that @ NAND gate is equivalent to a bubbled on gate. even parity An even number of 1s in a binary word NAND gate EZuivalent to an AND gate followed by an inverter. All inputs must be high to get a low output, Non gate Equivalent toanok gate followed by an inverter All inputs must be low to get a high output. ‘odd parity An odd number of Is in a binary word. arity generator A circuit that produces either an odd- or ceven-parity bit to go along with the data, XNOR gale Equivalent to an EXCLUSIVE-OR gate followed bby an inverter. The output is high only when the input word thas even party. XOR gafe An EXCLUSIVE-OR gate. It has a high output only when the input word has odd parity. For a 2-input XOR gate, the output is high only when the inputs are different SELF-TESTING REVIEW Read each of the following and provide the missing words. Answers appear at the beginning of the next question, 1. A-nor gate has «vo or more input signals, AIL inputs must be — to get a high output. A NoR gate recognizes only the input word whose bits are The NoR gate is logically equivalent to an or gate followed by an 2. (low, Os, inverter) De Morgan's first theorem says that a NOR gate is equivalent to a bubbled gate 3. (AND) ANAND gate is equivalent to an AND gate followed by an inverter. All inputs must be to get a low output. De Morgan's second theorem says that a NAND gate is equivalent to a bubbled gate 4. (high, oR) An xox gate recognizes only words with an —_____ number of Is. The 2-input xor gate has a high output only when the input bits are XOR gates are ideal for testing parity because even-parity words produce a ‘output and odd-parity words produce a output. 5. (odd, different, low, high) An odd-patity generator produces an odd-parity bit to go along with the data, Chapter 3 More Logic Gates 43. ‘The parity of the transmitted data is An XOR gate can test each received word for parity rejecting words with parity (odd, even) A controlled inverter is a logic circuit that transmits a binary word or its plement, PROBLEMS 7. (I's) The EXCLUSIVE-NOR gate is equivalent to an XOR gate followed by an inverter. Because of this, even-parity words produce a high output 341, In Fig. 3-25a the two inputs are connected to- gether. If A is low, what is Y? If A is high, what is ¥? Does the circuit act like a noninverter or an inverter? tp >—: i : ~~ yo 1 Fig. 3.25, 3-2. What is the output in Fig. 3-25b if both inputs are low? If one is low and the other high? If both are high? Does the cireuit act like an OR gate or an AND gate? 3-3, Figure 3.26 shows a Nox-gate crosshar switch, If all X and Y inputs are high, which of the Z outputs is high? If all inputs are high except X; and ¥,, which Z output is high? If X, and ¥y are low and all other inputs are high, which Z output is high? 3-4, In Fig. 3-26, you want Z; to be 1 and all other Z ‘outputs to be 0. What values must the X and ¥ inputs have? 35. 36. 31. 38. 39. 310, ‘The outputs in Fig. 3-27 are cross-coupled back to the inputs of the NoR gates. If R = O and § = 1, what do Q and Q equal? . of s Fig, 3:27 Cross-coupled Nox gates R= Lands equal? Q? Prove that Fig. 3-280 and b are equivalent. ‘What isthe output in Fig. 3-28a if all inputs are Os. I all inputs are 1s? What isthe output in Fig. 3-280 if all inputs are 0s. If all inputs are 1s? A.NoR has 6 inputs. How many input words are in its truth table? What i the only input word thet produces a 1 output? In Fig. 3-28a how many input words are there in the truth table? ‘What isthe output in Fig. 3-29 if all inputs are low? If all inputs are high? O in Fig, 3-27, what does Q "TS yyy Fig. 3.26 wos-pate crossbar switch 44 Digital Computer Electronics

You might also like