AP Computer Science Principles - Gates and Circuits Exam
AP Computer Science Principles - Gates and Circuits Exam
e
4 Gates and Circuits
5 Computing Components
In Conclusion
18 Limitations of Computing
GATES AND
CIRCUITS
Computers are electronic devices; the most fundamental hardware ele-
ments of a computer control the flow of electricity. In a very primitive
sense, we use technology to harness the power of a lightning bolt, bend-
ing it to our will so that we can perform calculations and make decisions.
This chapter dances the fine line between computer science and electrical
engineering, examining the most basic hardware elements in a computer.
In Chapter 2, we looked at number systems in general and at the
binary number system in particular. As we saw in Chapter 3, the binary
number system is of special interest because it is used to represent data in a
computer. In this chapter, we explore how computers use electrical signals
to represent and manipulate those binary values.
93
~~-vc·~,..-.- ,.,.~ H • '" ,....,. ~~ ~. ~ ~,.....,.. ,,,.- ~....- ~,. ... :-: '"";~~ ~"V;' .,.. • ,. " .,,..
•
94
Chapte1 Gates and Circuits
George Boole 1
96
Chapter Gates and Circuits
-
Nanoscience and
nanotechnology are the
study and application of
extremely small things:
., Gates
The gates in a compute r are sometim es rderred to as logic gates because
each performs just one logical fun ction. That is, each gate accepts o n e or
mo re input va lues and produces a single ou tput va lue . Because we are
d ea ling w ith binary in fo rmati o n, each input a nd output va lue is e it h e r 0,
• There are 25,400,000 co rresponding to a low-voltage signal, o r I , correspo ndi ng to a high-voltage
nanometers in an inch. signa l. The type of gate a nd the input va lues de te rmin e the o utput va lue.
• A sheet of newspaper Let's exa mine the processing o f th e follow ing six types of gates. We
is about 100,000 th e n sh ow how they ca n be combined into circu its to perform arithme ti c
nanometers thick. opera ti ons.
• If a marble were NOT
a nanometer,
AND
one meter would be
OR
the size of the Earth. 2
XOR
NAND
NOR
In this book we have colo rized th e logic diag ram symbols for each gate to
he lp you keep track o f the va rious types . When we exa mine full ci rcuits
with many gates, th e colors w ill h elp yo u distinguish among th em. In the
rea l worl d, h owever, logic diag rams are typica ll y black a nd white, a nd the
gates are dis tin guis h ed only by their shape.
NOT Gate
A NOT gate accepts o n e input value and produces one output va lu e.
shows a NOT gate represented in three ways: as a Boolean ex -
pression, as its logical d iag ram sy mbol, and thro u gh a t ruth ta ble. In each
representation, the variable A rep rese nts the input signa l, w h ich is either
0 or I. The variable X represe nts the o utput sig n al, w h ose va lu e (0 or 1)
is de termined by th e val u e of A.
By definition, if the input value for a NOT ga te is 0, the o ut put va lu e
is l; if th e in put value is I , the o utput is 0. A NOT gate is so metimes
refe rred to as a n inverter because it in verts th e input va lu e.
X = A'
AND Gate
d epicts an AND ga te . Unli ke a NOT gate, wh ich accepts one
in pu t signa l, an AND gate accepts two input s ign a ls. The val ues o f
both input s ignals determ in e wha t th e output signa l w ill be. If th e two
r-"\
A B
,___
x
x A • B
A
----i -
X -
0 0 0
s--L-..1 0 1 0
1 0 0
- 1 1 1
inpu t va lues for a n AND gate are both 1, the o utput is l ; o th erwise, the
ou tpu t is 0.
Th e AND ope ra ti on in Boolea n algebra is exp ressed using a sin gle dot
( · ). Som e tim es a n asterisk (*) is used to represem th is ope rator. Often the
o p erator itse lf is ass um ed . For exa mple, A·B is often wri tten AB.
Beca use there a rc two inputs and two possible va lues [or eac h in put,
fo ur possible combinations of I and O can be provided as inpu t to a n A D
ga te. Th erefo re, four situ at ions ca n occur when the AND operator is used
in a Boolean expression:
0 · 0 eq u a ls 0
O· I equa lsO
l · 0 eq ua ls 0
l · l equals l
Li kewise, the truth tab le showin g the beh avior o f th e AND gate has fou r
rows, sh owing a ll fo ur possible input combinations. Th e o utput column
o f the truth ta ble is co n sistent w ith resu lts o f rhese Boolea n expressions.
OR Gate
shows an OR gate. Li ke the AND gate, the OR ga te has two inpu ts.
If both input values a re 0, the ou tpu t value is O; otherw ise, the o utput is 1.
The Boolea n a lgebra OR ope ra tion is exp ressed using a p lus sig n (+).
The OR gate ha s two in p u ts, each of wh ic h ca n be one of two val u es.
Thus, as w ith a n AND gate, the re a re fo ur input combinations and there-
fo re fo ur rows in the truth table.
XOR Gate
The XOR, o r exclusive OR, ga te is shown in . An XOR ga te p ro-
d u ce s a 0 if its two inputs are the sa m e, a n d a l oth e rw ise. Note th e
d iffe rence be tween the XOR ga te and th e O R gate; t h ey differ in only o n e
A X
A 8 x
x A+ B -i - 0 0 0
e;-L/ 0 1 1
1 0 1
1 1 1
A B x
~
x A EEl B
x 0 0 0
B 0 1 1
1 0 1
1 1 0
input situation. When both input signals are 1, the OR gate produces a 1
and the XOR produces a 0.
Sometimes the regular OR gate is referred to as the inclusive OR,
beca use it produces a 1 if either or both of its input s is a l. Th e XOR pro-
duces a 1 on ly if its inputs are mixed (one I and one 0). Think of t he XOR
gate as saying, "When I say or, r mean one or the oth er, not both.N
The Boo lean algebra symbol E9 is sometimes used to express the XOR
opera tion. In addi ti on, the XOR opera tion ca n be expressed usi ng th e
o t her o perators; we leave t hat as an exercise.
No te that the logic di agram symbol for the XOR gate is just li ke the
symbol for an OR gate except that it has a n extra curved line connecting
its input signals.
A B x
x (A • B)' 0 0 1
-
0 1 1
1 0 1
1 1 0
A 8 x
x (A + B)' 0 0 1
0 1 0
1 0 0
1 1 0
No specific symbols are used to express the NAND and NOR opera-
tions in Boolean algebra. Instead, we rely on their definitions to express
?
The tenth strand the concepts. That is, th e Boolean algebra expression for NAND is th e
n egation of an AND operation. Likewise, the Boolean a lgebra expression
Computing Curricula for NOR is the negation of an OR operation.
1991, a report by
The logic diagram symbols fo r the NAND and NOR gates are the same
a joint task force of
the Association for
as those for the AND and OR ga tes except that the NAND and NOR
Computing Machinery sym bo ls use an inve rsion bubble (to ind icate the negation) . Compare the
(ACM) and the output col umns fo r the truth tab les for the AND and NANO ga tes. They
Institute of Electrical are opposites, when you look at them row by row. The same is true for
and Electronics the OR and NOR gates.
Engineers (IEEE), gave
recommendations for
the design of bachelor's Review of Gate Processing
degree curricula in
computer science.
We've looked at six specific types of gates. It may seem to be a difficu lt
Although the report task to keep them straight and remember how they a ll work-but that
had a section entitled probably depe nds on how you think abou t it. We definitely don't encour-
"Social and Professional age you to try to memori ze tr uth tables. The processing of these ga tes can
Context," which stated be described briefly in ge neral terms. If you think of them in that way,
that students need
you can produce the appropriate truth table any time you need it.
"to understand the
basic cultural, social, Let's review the processing of each ga te. Some of these descriptions
legal, and ethical issues are stated in terms o f which input values cause the gate to prod uce a I as
inherent in computing," output; in any othe r case, th e gate produces a 0.
the study of ethics
A NOT ga te inverts its sing le in put va lu e.
was not one of the
nine subject areas, or An AND gate produces I if both input va lues a re l.
strands. By 2001, social An OR ga te produces I if one or the other or both inp ut values
and professional issues are 1.
was included as a topic An XOR gate produces I if one or the other (but no t both) input
area in computing
values arc l.
education and called
the tenth strand.
ANAND gate prod uces the opposite results of an AND gate.
A NOR gate produces th e opposite resu lts of an OR ga te .
101
4.3 Constructing Gates
A B c x
x 0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
With these genera l processing r ules in mind, all that's left is to re membe r
the Bool ean ope rators and the logic dia g ram symb o ls. Keep in mind th at
several logic diagram sy mbols are va riarion s on other logic d iag ram sym-
bo ls. Also, remember t ha t th e colo rin g of the ga tes in this book is m eant
lO help yo u to keep track or the various ga te types; traditionall y, they are
sim ply black-a nd- w hite d iagrams.
Constructing Gates
Before we examine how ga tes are co nnected to fo rm circui ts, le t's exam-
ine, at an even more basic level, how a gate is cons tructed to control th e
flow of e lectricity.
102
Chapte1 Gates and Circuits
Source
Source Source
. - - - - - - - - - -Vout
Vin - -
Emitter
Emitter Emitter
-
Ground Ground Ground
Emitter
Ground
-
to crea te are th e NOT, NAND, and NOR ga tes. ~ sh ows how th ese
gates can be constructed using tra n sisto rs.
The diagra m for the NOT gate is essentially t he same as our o rigi n al
tra nsisto r diagram. It ta kes o nl y o ne transistor to create a NOT gate. The
sign al \J'. 11 re presents the input signal to th e NOT gaLe. If it is hig h, th e so urce
is ground ed and th e ou tput sign al V0 111 is low. If V; 11 is lo w, th e source is not
gro und ed a nd V0111 is high . Thu s th e inpu t signal is inverted, whic h is exactl y
what a NOT ga te does.
The NAND ga te req uires two transistors. The input sig nals v, and V2
represe nt t he input to th e NAND gate. If both input sign a ls are high, the
so urce is gro unded a nd the output V01 11 is low. If eit her input signal is lo w,
h oweve r, on e tra nsistor o r t h e ot h er keeps th e so urce signa l from be ing
gro und ed and the o u tput is h ig h . Therefore, if v, or V2 or both ca rry a low
signal (binary 0 ), th e o utput is a 1. This is con siste nt w ith th e processing
of a NAND ga te.
The construction o f a NOR gate also requ ires t wo tra nsistors . On ce
agai n, v, and V2 represent the in put to th e ga te. This time, h oweve r, the
transisto rs are not connected in series. The so urce connects to each tra nsis-
tor se parate ly. If either t ransistor al lows th e so urce signal to be ground ed,
th e o utput is 0. The refo re, the ou tp ut is high (b in ary 1) o n ly wh e n both
v, a nd V2 a re low (bina ry 0) , wh ich is wh a t we want fo r a NOR gate.
An AND gate produces outp ut that is exactly opposite of th e NANO
o utput o f a ga te. Therefo re, to con stru ct an AND ga te, we simpl y pass
the output o f a NANO gate t hrough a n in verte r (a NOT gate). That's w h y
104
Chapte Gates and Circuits
AND ga tes a re more complicated to con stru ct than NAND gates: They
require three transistors, two fo r the NAND and one for the NOT. The
same reaso n ing can be applied to underst:and the relation ship between
NO R and OR ga tes .
.4 Circuits
Now that we know how individua l gates work a nd how they are con-
Combinational circu it
structed, let's examine how we combine gates to form circuits. Circuits
A circuit whose
output is solely can be classified into two genera l categories. In a combinational circuit,
determined by its th e input values expli citl y de term ine the o utput. In a sequential circuit,
input values th e output is a function of t he input values as well a s th e existing state
of the circu it. Thus sequential circuits usua ll y in volve the sto rage o f infor-
Sequential circu it A
circuit whose output
mation. Most o f th e circuits we examine in this cha pter are com binational
is a function of its circu its, although we briefl y mention sequentia l m e m o ry circuits.
input values and the As with gates, we can describe t h e ope rations of entire circu its us ing
current state of the three notations: Boolean expression s, logic d iagrams, and truth tab les.
circuit These notations are dif[erent, but equally powerfu l, representation
techn iques.
Combinational Circuits
Gates are com bined into circuits by using th e ou tput of one gate as th e
input for a nother gate. For example, consider the following logic diagram
of a circuit:
The outpu t of the two AND gates is used as the input to the OR gate. The
input value A is used as input to both AND gates. The dot indicates that
two lines are co nn ected . If the intersection o f two crossing lines d oes not
have a dot, you shou ld thi nk of on e as "jumping over" the o th e r without
affectin g each other.
What does this logic diag ra m m ea n? We ll , le t's work backwa rd ro see
what it takes to get a particular res ult. For the final output X to be 1, either
D must be I or E mu st be 1. For D to be J , A and B must both be 1.
105
4.4 Circuits
A B C D E X
0 0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0
0 0 0 0 0
0 0
0 0
Because there are three inputs to this circuit, e ight rows are required to
describe a ll possible input combina tions. Intermedia te columns sh ow the
intermedia te va lues (D and E) in the circuit.
Fina lly, let's express this same circu it using Boolean algebra. A circuit
is a collection of interaci ing ga tes, so a Boolea n ex pression to represent
a circuit is a combina tion o f the appropriate Boolean operations. We just
have to put the operations together in th e proper form to crea te a val id
Boolea n a lgebra exp ression. ln this circu it, th e re are two AND exp res-
sions. The output of each AND o peration is input to the OR opera tion.
Thus this circuit is re prese nted by the following Boolea n expression (in
which t he AND operator is assumed):
(AB+ AC)
When we write truth tables, it is often beucr to label columns using t hese
kinds of Boolean expressions rather than a rbitrary variables su ch as D, E,
and X. That makes it clear w h a t ead1 column represents. In fact, we ca n
use Boolea n ex pressio n s to label our logic diag rams as we ll, el iminating
the need for inte rmed iate variables altogether.
Now lei 's go th e o t her way: Le t's take a Boolean expression and draw
the co rrespondin g logic diagram and truth table . Consider the following
Boo lea n exp ression:
A(B + C)
106
Chapter 4 Gates and Circuits
:~
~
A(B+C)
B +C
A B C B+C A(B + C)
0 0 0 0 0
0 0 0
0 0 0
0 0
0 0 0 0
Pick a row from this t ruth table a nd fo llow th e Jogic of th e circu it diag ram
to ma ke sure th e fina l res ults are consistent. Try it wi th a few rows to get
comfortable w ith the process o r tracing t he logic of a circuit.
Now compare th e final resu lt column in this truth tab le to the tru th
table fo r the previous exa mple. They are identica l. We h ave just de m o n -
Circuit equivalence strat ed circuit equivalence. That is, bo th circuits produce exactly the sa me
The same output for o utpu t for eacb in put va lu e combina ti o n.
each corresponding In fact, th is situation demo nstra tes an importan t property of Boolea n
input-value a lgebra ca lled the distributive law:
com bination for
two circuits A(B + C) = AB + AC
107
4.4 Circuits
PROPERTY AND OR
These prope rti es are consiste nt with o u r unde rsta nd ing of ga te p rocess - ?
ing as well as with t he t ruth ta b le a nd logi c dia g ram representations. For De Morgan's Law, named
for Augustus De Morgan
instance. th e commuta tive pro pe rty, in p lain En g lish, says th at th e order
of th e input signals doesn't rnauer, which is true. (Ve rify it using the truth
De Morgan, a
tables o f indiv idua l gates.) The complemem p ropeny says that if we put contemporary of
a sign a l a nd its inverse th rough an AND ga te, we are gu aranteed to ge t 0, George Boole, was
but if we put a signal and its inverse through an OR ga te, we are gua ra m eed the first professor of
co ge t 1. mathematics at the
Th e re is one ve ry famo us-a nd useful-th eore m in Boolea n a lgebra University of London
in 1828, where he
ca lled De Morgan's /a1v. This law states that th e NOT operato r applied to
continued to teach for
the AND o f two variab les is equa l to the NOT applied to each o f th e two 30 years. He wrote
variables wit h an OR between. That is, inverting the o utput of a n AND elementary texts on
gate is eq uiva lent to inverting the indi vid u a l signals fi rst and then passing arithmetic, algebra,
them through an OR gate: trigonometry, and
calculus as well as
(AB)'= A' ORB' papers on the possibility
of establishing a
The seco nd pan of t h e law states that th e NOT operator applied to t h e OR
logical calculus and
o f two variables is equa l LO th e NOT app li ed to each o f th e two va ri a bles the fundamental
w ith an AND between. Expressed in circuit te rms, this means th at invert- problem of expressing
ing the outpu t of an OR ga te is equiva lem to inverting borh signa ls first thought by means of
and then passing them th rough an AND ga te: symbols. De Morgan
did not discover the
(A+ B) ' = A'B' law bearing his name,
but he is credited with
De Morgan's law a n d ot h er Boolean a lgeb ra prope rti es provide a forma l
formally stating it as it
mechan ism for defining, m a nag ing, and eva lu a tin g logical circuit designs. is known today. 3
108
Chapter 4. Gates and Circuits
A B Sum Carry
0 0 0 0
0 0
0 0
In this case, we are actually looki ng for two outpu t res ults, the sum a nd
the carry. As a consequence, o ur circuit has two o u tput li n es .
If yo u compare the sum and carry columns to the o ucput of th e va r-
iou s ga tes, yo u see that the sum corresponds to th e XOR ga te and th e
carry corresponds to the AND gate . Thus the fo llowing ci rcuit diagram
re presents a half adder:
Truth Table
Logic Diagram A B Carry-in Sum Carry-out
Carry-in 0 0 0 0 0
0 0 0
A Sum 0 0 0
0 0
B
0 0 0
0 0
Carry-out 0 0
SO 51 52 F
I
0 0 0 DO
0 0 D1
0 0 D2
0 D3
Sor-
0 0 D4
DO D1 D2 D3 D4 DS D6 D7
0 D5 I I I I I
0 D6
S1 F
D7 S2
FIGURE 4.11 A block diagram of a multiplexer with three select control lines
111
4.5 Circuits as M emory
5 Circuits as Memory
Digital ci rc u its play a no Lh er impo na n t role: They ca n store in fo rm a tio n.
These circu its form a seq u ential circ uit, because the output o f the circu it
also se rves as input Lo the circuit. That is, th e existing state o f th e circuit
is u sed in pan to determ ine th e n exL sta te .
Many types o f m emory ci rcuits h ave b een designed. We exa mine
only one ty p e in th is book: the S-R latch. An S-R latch stores a sing le
binary digit ( 1 or 0). An S-R latch circuit cou ld be designed using a va riety
of ga tes. One such circuit, u sin g NAND ga tes, is piCLured in
The d esig n of this circuit guarantees th a t th e two o utputs X and Y a re
a lwa ys comple m e 11Ls of each other. That is, when X is 0 , Y is 1, and vice
versa . The va lue of X at any point in time is considered to be the current
sta le of t h e circu it. Th e refo re, if X is 1, th e circu it is storing a I; if X is 0,
the circ uit is storing a 0 .
Reca ll tha L a NAND gate prod u ces an ou tput of 1 u nless bo th o f iLs
inpu t val u es a re l. Each gate in this circuit has one ex te rn al in pu t (Sor
R) a nd on e in put coming from the o utp ut o f the ot h er ga te. Suppose the
curre nt sta te of Lh e circu it is storing a 1 (that is, X is I ), and su ppose both
S an d R are l. Then Y remains 0 a nd X re mains 1. Now suppose th at the
circu it is c urre nt ly storing a 0 (X is 0) and t hat R a nd S a re aga in 1. The n
Y remains l and X rema in s 0. No matter w hi ch va lu e is curre11Lly being
stored, if bo Lh in p u Lva lu es Sand R a re 1, th e circui t keeps its existi ng sla te.
This explana tion demonstrates that the S-R la tc h maintains its va lue
as long as Sa nd Ra re I . But h ow does a va lue get sLO red in Lhe first p lace?
~:
We set the S-R la tch to 1 by m o mentaril y setting S to 0 w hil e keeping R al
1. If S is 0, X becomes 1. As lo n g as Sis re turn ed to 1 immed ia tel y, Lhe S-R
latch re mains in a sla te of l . We set the latch t0 0 by m o m entarily seLtin g
R to 0 w hile keeping Sal I . If R is 0, Y b ecom es 0, and th us X becomes 0.
As lo ng as R is im med iately reset to 1, t h e circuit state re m ains 0.
By carefull y con troll ing th e va lu es of Sand R, th e circu it ca n be made R
to sto re e ithe r va lu e. By sca li n g this idea Lo large r circui ts, we ca n design FIGURE 4.12 An 5-R
m e mory devices with larger capacities. latch
112 j
Chapte1 4: Gates and Circuits
14 13 12 11 10 9 8
Ground
2 3 4 5 6 7
FIGURE 4.13 An SSI chip containing independent NANO gates
113
4. 7 CPU Chips
em bed ci rcuits with a hig h ga te-to-pin ratio. Tha t is. many ga tes a re com - ~
What is computer
bin ed to create complex ci rcu its t hat require o nly a few input a nd output
ethics?
values. Multiplexers a re an example of this type of circuit.
Be careful-the term
computer ethics is
CPU Chips ambiguous. The use of
the term in the tenth
Th e m ost important in teg ra ted circull 111 a n y compute r is th e cemral
strand of computer
processing unit (CPU). The processing of a CPU is d iscussed in th e n ext science curricula refers
chapter. but it is impo rta nt to recog nize at this poi m rha t th e CPU is, in to a code of ethics that
one sense. m e rely a n ad va nced circuit with input a nd ou tput lin es. computer professionals
Each CPU chi p co ntains a large numbe r of pins th rough which esse n- can apply w ithin
their own profession.
tiall y all co mmunication in a comp uter sys tem occurs. This communica-
Computer ethics also
tio n connects th e CPU to memory and I/O devices. w hich are th e mselves. refers to determinations
a t fundame ntal leve ls, advan ced circuits. made by contemporary
The explana ti o n of CPU processing and its imeraction with o th er philosophers to cases
devices takes us to anoth er level o f computer processi ng, so metim es re- that involve computers
ferred to as co111po11e11t architecture. Alt ho ugh it is still prima rily focused or computer networks.
SUMMARY
In this chapte r we discussed how a compu ter o perates at its lowest level
b y co nt ro lling the flow of elect ri cit y. Because we a re d ealing w ith digita l
compu ters that use binary informatio n. we concern ou rselves w it h only
two voltage ra nges, which we interpret as binary I o r 0. The fl ow o f elec-
tri cit y is guid ed by electroni c dev ices called gates. which perform basic
logica l ope rati o ns such as NOT, AND, a nd OR. A gat e is created by using
one or mo re transistors, an in ve ntio n that revol u tionized computing.
Gates ca n be combined imo ci rcuits. in w h ich th e o utpu t of one gate
se rves as an inp ut lO an o th e r gate. By d esigning th ese circuits ca refull y,
we ca n create devices th a t perfo rm more complex tasks such as ad d ing.
multiplex in g, and storing da ta. Collectio ns of gates, o r co111plete circuits. a re
often embedd ed into a single imegra ted circuit. or chip, which leads to th e
con cept o f a cen tra l proce sing unit (CPU).
114
Chapter · Gates and Circuits
Codes of Ethics5
There are two major orga nizations in com- to be h onest and realisti c in stating claims
puting: th e Association of Compu ting Ma- or estimates based on availa ble da ta;
chinery and th e In stitute of Electrical and to reject bribery in all its form s;
Electronics Engineers. The IEEE represents to improve th e und erstanding of technology,
the hard wa re side a nd the ACM represents its appropriate appl ication, and potential
the software side. However. in m a ny u ni- consequences;
ve rsities, this d istin ction is blurred. We are to maintain and improve our technica l
presenting both codes or ethics so you can competence and to un dertake techno log-
compa re a nd contrast them . ica l tasks for others only if qualified by
training or experience, or afte r full disclo-
IEEE Code of Ethics
We, th e m embe rs of th e IEEE, in recogni- sure of pertinent limitations;
ti on of th e impo rta nce o r our techno logies to seek, accept, and offer h o n est cr iticism
in affecting th e quality of life through- of technical work, to ack nowledge and
out the wo rld, and in a ccepting a perso nal correct errors, and to credi t properl y th e
contributions of o thers;
obligation to o ur profession, its m embers
to treat fa irly a ll pe rsons rega rdless of such
and the communities we serve, do hereby
factors as ra ce, re ligion, gende r, disa bility,
commit ourselves to the hig hest eth ica l a nd
professio na l condu ct and agree: age, or nationa l origin;
to avoid inju ring others. th eir prope rty,
to accept responsibility in m aking deci- reputation, o r emplo ym em by false o r
sion s consistent w ith the safety, health, m a li cious actio n;
and welfare of the public, and to d isclose to assist colleag ues and co-worke rs in their
promptly factors that m ig ht endanger the professio na l development and to support
public or th e en vironment; them in following this code of eth ics.
to avoid rea l or pe rceived conflicts of inter-
est wh enever possible, and to disclose them
to affected pa rties w hen the y do exist;
·~ •, • • "• , ' • , ', .. ,'.-:.:• ~ 1 ,' ~ _.,..., .. ••·• <'~vJr•.~1'}"7~'<"~·~~,...,,,_ __,.,-yy., r• "IF""'
115
Ethical Issues: Codes of Ethics
ETHICAL ISSUES · . ·
Codes of Ethics, continued
For Exercises 1- 17, mark th e answers true 10. A ga te can be design ed to accept
or fa lse as fo llows: more than two in puts.
A. True l l. A t ra nsistor is m ade o f
B. Fa lse sem iconductor ma terial.
l . Logic diagrams a n d Lruth tables a re 12 . Inve rting the o utpu t o f an AND
equally powe rful in expressi ng th e ga te is eq ui va lent LO in ve rt ing th e
processing o f gates a n d ci rcui ts . ind ivid u a l sign a ls first, th e n passing
2. Boolean expressions a re more powerfu l them th rough an OR ga te .
th an logic diagra ms in expressi ng the 13. Th e su m o f two binary d igits
processing o r ga tes and circuits. (ignoring t he carry) is ex pressed by
3. A NOT gate accepts two inputs. an AND gare.
4. The outp u t va lue or a n AND gate is I 14. A full ad de r ta kes th e ca rry- in va lue
when both inpu ts are 1. inLo acco u nt.
5. The AND a nd OR gates prod u ce 15. A m ul tiplexe r add s all of the bits on
opposite resu lts for t he same input. its input lines to produce its ou tpu t.
6. The output va lue of an OR ga te is I 16. Integra ted circui rs a re classified by t he
when both inpurs are 1. number o r gates con tai n ed in th em.
7. The output of an OR gate is 0 when 17. A CPU is a n integrated circuit.
one inpu t is 0 a n d o n e inpu t is I .
For Exe rcises 18-29, match th e gate w ith
8. The output val u e of a n XOR ga te is 0
th e descri p ti o n or th e opera ti o n or th e
unl ess bo th in p u ts are 1.
d iagra m .
9. The NOR ga te produces the opposite
A. AND
results o f t h e XOR gate.
B. NAND
117
24.
_
A _[>o__X 38. Give the three re presentatio ns of an
OR gate and say in words wha t OR
mean s.
-:---L__)~---x
39 . Give the three representations of
25 .
a n XOR gate and say in words what
XO R means.
A x
26 . 40 . Give the th ree representatio ns of a
B NAND gate and say in wo rds what
NAND means.
27 . ~B
c-J-
x 4 1. Give the three representations of
a NOR gate and say in words wha t
_A_ _~r- X NOR mea ns.
28 . 0>-----
42. Com pare and contrast the AND ga te
B
and the NAND gate.
A 43. Give the Boolea n expression
29 . O>-----
X
B fo r a three-inp ut AND ga te, and
Exercises 30-73 are sho rt-answer or design the n show its behavior w ith a truth
qu estion s. ta ble .
30 . How is voltage level used to
A
distinguish be twee n binary digits? B--~
x
3 1. Distinguish betwee n a gate and a
c
circuit.
118
Chapte1 Gates and Circuits
44. Give the Boolean expression for a 57. Draw a circu it d iagram correspon ding
three-input OR gate. and then show to the fol lowing Boolean expression:
its behavior w ith a truth table. A'B + (B + C)'
58. Draw a circuit diagram corresponding
A
B--~ LO the fo llowing Boo lea n expression:
(AB)' + (CD)'
c
59. Show the be h avior o f the following
45. What is used in a gate to establish circuit with a truth table:
how the input values map to the A
ou tput value?
How does a transistor behave? B
46.
47.
48.
Of what is a transistor made?
What happens when an electri c
D-
signal is grounded?
49. What are the three terminals in 60. Sh ow the be h avior of the following
a transistor, and how d o th ey circuit with a t ruth table:
operate? A
50. How many trans istors does it take for
each of these gates?
a. NOT B
b. AND
c. NOR 6 l. Show the behavior of the following
d. OR ci rcuit with a t ruth table:
e. XOR
51. Draw a transisto r diagram fo r an
AND gate. Explain the processing.
52. Draw a transistor diagram for an OR
gate. Explain th e processing.
53. How ca n ga tes be co mbin ed in to 62. Sh ow th e behavior of the fol lowing
circui ts? circu it wit h a tr uth table:
54. What are the two general categories
A
of circuits, and how do t hey differ?
~-
55. Draw a circuit diagram corresponding B
to th e followin g Boolean expression:
(A+ B)(B + C) C > - + - - - - -L /
56. Draw a circuit diag ram co rrespond ing c
LO the following Boolean expression:
(AB+ C)D
119
Thought Questions