Download How Bits and Bytes Work1

Document related concepts

Resistive opto-isolator wikipedia , lookup

History of the transistor wikipedia , lookup

Opto-isolator wikipedia , lookup

Microprocessor wikipedia , lookup

Random-access memory wikipedia , lookup

Transistor wikipedia , lookup

Transcript
How Bits and Bytes Work
by Marshall Brain
Close
Please copy/paste the following text to properly cite this HowStuffWorks article:
Brain, Marshall. "How Bits and Bytes Work." 01 April 2000. HowStuffWorks.com. <http://computer.howstuffworks.com/bytes.htm> 14
January 2009.
If you have used a computer for more than five minutes, then you have
heard the words bits and bytes. Both RAM and hard disk capacities
are measured in bytes, as are file sizes when you examine them in a
file viewer.
You might hear an advertisement that says, "This computer has a 32bit Pentium processor with 64 megabytes of RAM and 2.1 gigabytes
of hard disk space." And many HowStuffWorks articles talk about bytes
(for example, How CDs Work). In this article, we will discuss bits and
bytes so that you have a complete understanding.
Decimal Numbers
The easiest way to understand bits is to compare them to something you know: digits. A digit is a single
place that can hold numerical values between 0 and 9. Digits are normally combined together in groups to
create larger numbers. For example, 6,357 has four digits. It is understood that in the number 6,357, the 7
is filling the "1s place," while the 5 is filling the 10s place, the 3 is filling the 100s place and the 6 is filling
the 1,000s place. So you could express things this way if you wanted to be explicit:
(6 * 1000) + (3 * 100) + (5 * 10) + (7 * 1) = 6000 + 300 + 50 + 7 = 6357
Another way to express it would be to use powers of 10. Assuming that we are going to represent the
concept of "raised to the power of" with the "^" symbol (so "10 squared" is written as "10^2"), another way
to express it is like this:
(6 * 10^3) + (3 * 10^2) + (5 * 10^1) + (7 * 10^0) = 6000 + 300 + 50 + 7 = 6357
What you can see from this expression is that each digit is a placeholder for the next higher power of 10,
starting in the first digit with 10 raised to the power of zero.
That should all feel pretty comfortable -- we work with decimal digits every day. The neat thing about
number systems is that there is nothing that forces you to have 10 different values in a digit. Our base-10
number system likely grew up because we have 10 fingers, but if we happened to evolve to have eight
fingers instead, we would probably have a base-8 number system. You can have base-anything number
systems. In fact, there are lots of good reasons to use different bases in different situations.
Computers happen to operate using the base-2 number system, also known as the binary number
system (just like the base-10 number system is known as the decimal number system). Find out why and
how that works in the next section.
The Base-2 System and the 8-bit Byte
The reason computers use the base-2 system is because it makes it a lot easier to implement them with
current electronic technology. You could wire up and build computers that operate in base-10, but they
would be fiendishly expensive right now. On the other hand, base-2 computers are relatively cheap.
So computers use binary numbers, and therefore use binary digits in place of decimal digits. The word
bit is a shortening of the words "Binary digIT." Whereas decimal digits have 10 possible values ranging
from 0 to 9, bits have only two possible values: 0 and 1. Therefore, a binary number is composed of only
0s and 1s, like this: 1011. How do you figure out what the value of the binary number 1011 is? You do it in
the same way we did it above for 6357, but you use a base of 2 instead of a base of 10. So:
(1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0) = 8 + 0 + 2 + 1 = 11
-1-
You can see that in binary numbers, each bit holds the value of increasing powers of 2. That makes
counting in binary pretty easy. Starting at zero and going through 20, counting in decimal and binary looks
like this:
0 =
0
1 =
1
2 =
10
3 =
11
4 =
100
5 =
101
6 =
110
7 =
111
8 = 1000
9 = 1001
10 = 1010
11 = 1011
12 = 1100
13 = 1101
14 = 1110
15 = 1111
16 = 10000
17 = 10001
18 = 10010
19 = 10011
20 = 10100
When you look at this sequence, 0 and 1 are the same for decimal and binary number systems. At the
number 2, you see carrying first take place in the binary system. If a bit is 1, and you add 1 to it, the bit
becomes 0 and the next bit becomes 1. In the transition from 15 to 16 this effect rolls over through 4 bits,
turning 1111 into 10000.
Bits are rarely seen alone in computers. They are almost always bundled together into 8-bit collections,
and these collections are called bytes. Why are there 8 bits in a byte? A similar question is, "Why are
there 12 eggs in a dozen?" The 8-bit byte is something that people settled on through trial and error over
the past 50 years.
With 8 bits in a byte, you can represent 256 values ranging from 0 to 255, as shown here:
0 = 00000000
1 = 00000001
2 = 00000010
...
254 = 11111110
255 = 11111111
In the article How CDs Work, you learn that a CD uses 2 bytes, or 16 bits, per sample. That gives each
sample a range from 0 to 65,535, like this:
0 = 0000000000000000
1 = 0000000000000001
2 = 0000000000000010
...
65534 = 1111111111111110
65535 = 1111111111111111
Next, we'll look at one way that bytes are used.
The Standard ASCII Character Set
Bytes are frequently used to hold individual characters in a text document. In the ASCII character set,
each binary value between 0 and 127 is given a specific character. Most computers extend the ASCII
character set to use the full range of 256 characters available in a byte. The upper 128 characters handle
special things like accented characters from common foreign languages.
-2-
You can see the 127 standard ASCII codes below. Computers store text documents, both on disk and in
memory, using these codes. For example, if you use Notepad in Windows 95/98 to create a text file
containing the words, "Four score and seven years ago," Notepad would use 1 byte of memory per
character (including 1 byte for each space character between the words -- ASCII character 32). When
Notepad stores the sentence in a file on disk, the file will also contain 1 byte per character and per space.
Try this experiment: Open up a new file in Notepad and insert the sentence, "Four score and seven years
ago" in it. Save the file to disk under the name getty.txt. Then use the explorer and look at the size of the
file. You will find that the file has a size of 30 bytes on disk: 1 byte for each character. If you add another
word to the end of the sentence and re-save it, the file size will jump to the appropriate number of bytes.
Each character consumes a byte.
If you were to look at the file as a computer looks at it, you would find that each byte contains not a letter
but a number -- the number is the ASCII code corresponding to the character (see below). So on disk, the
numbers for the file look like this:
F
o
u
r
a
n
d
s
e
v
e
n
70 111 117 114 32 97 110 100 32 115 101 118 101 110
By looking in the ASCII table, you can see a one-to-one correspondence between each character and the
ASCII code used. Note the use of 32 for a space -- 32 is the ASCII code for a space. We could expand
these decimal numbers out to binary numbers (so 32 = 00100000) if we wanted to be technically correct -that is how the computer really deals with things.
The first 32 values (0 through 31) are codes for things like carriage return and line feed. The space
character is the 33rd value, followed by punctuation, digits, uppercase characters and lowercase
characters. To see all 127 values, check out Unicode.org's chart.
We'll learn about byte prefixes and binary math next.
Byte Prefixes and Binary Math
When you start talking about lots of bytes, you get into prefixes like kilo, mega and giga, as in kilobyte,
megabyte and gigabyte (also shortened to K, M and G, as in Kbytes, Mbytes and Gbytes or KB, MB and
GB). The following table shows the binary multipliers:
Name
Abbr.
Size
Kilo
K
2^10 = 1,024
Mega
M
2^20 = 1,048,576
Giga
G
2^30 = 1,073,741,824
Tera
T
2^40 = 1,099,511,627,776
Peta
P
2^50 = 1,125,899,906,842,624
Exa
E
2^60 = 1,152,921,504,606,846,976
Zetta
Z
2^70 = 1,180,591,620,717,411,303,424
Yotta
Y
2^80 = 1,208,925,819,614,629,174,706,176
You can see in this chart that kilo is about a thousand, mega is about a million, giga is about a billion, and
so on. So when someone says, "This computer has a 2 gig hard drive," what he or she means is that the
hard drive stores 2 gigabytes, or approximately 2 billion bytes, or exactly 2,147,483,648 bytes. How could
you possibly need 2 gigabytes of space? When you consider that one CD holds 650 megabytes, you can
see that just three CDs worth of data will fill the whole thing! Terabyte databases are fairly common these
days, and there are probably a few petabyte databases floating around the Pentagon by now.
-3-
Binary math works just like decimal math, except that the value of each bit can be only 0 or 1. To get a
feel for binary math, let's start with decimal addition and see how it works. Assume that we want to add
452 and 751:
452
+ 751
--1203
To add these two numbers together, you start at the right: 2 + 1 = 3. No problem. Next, 5 + 5 = 10, so you
save the zero and carry the 1 over to the next place. Next, 4 + 7 + 1 (because of the carry) = 12, so you
save the 2 and carry the 1. Finally, 0 + 0 + 1 = 1. So the answer is 1203.
Binary addition works exactly the same way:
010
+ 111
--1001
Starting at the right, 0 + 1 = 1 for the first digit. No carrying there. You've got 1 + 1 = 10 for the second
digit, so save the 0 and carry the 1. For the third digit, 0 + 1 + 1 = 10, so save the zero and carry the 1. For
the last digit, 0 + 0 + 1 = 1. So the answer is 1001. If you translate everything over to decimal you can see
it is correct: 2 + 7 = 9.
To see how boolean addition is implemented using gates, see How Boolean Logic Works.
To sum up, here's what we've learned about bits and bytes:
Bits are binary digits. A bit can hold the value 0 or 1.
Bytes are made up of 8 bits each.
Binary math works just like decimal math, but each bit can have a value of only 0 or 1.
There really is nothing more to it -- bits and bytes are that simple.
For more information on bits, bytes and related topics, check out the links on the next page.
How Boolean Logic Works
by Marshall Brain (HowStuffWorks.com)
Have you ever wondered how a computer can do something like balance a check book, or play chess, or
spell-check a document? These are things that, just a few decades ago, only humans could do. Now
computers do them with apparent ease. How can a "chip" made up of silicon and wires do something that
seems like it requires human thought?
If you want to understand the answer to this question down at the very core, the first thing you need to
understand is something called Boolean logic. Boolean logic, originally developed by George Boole in
the mid 1800s, allows quite a few unexpected things to be mapped into bits and bytes. The great thing
about Boolean logic is that, once you get the hang of things, Boolean logic (or at least the parts you need
in order to understand the operations of computers) is outrageously simple. In this article,we will first
discuss simple logic "gates," and then see how to combine them into something useful.
Simple Gates
There are three, five or seven simple gates that you need to learn about, depending on how you want to
count them (you will see why in a moment). With these simple gates you can build combinations that will
implement any digital component you can imagine. These gates are going to seem a little dry here, and
incredibly simple, but we will see some interesting combinations in the following sections that will make
them a lot more inspiring. If you have not done so already, reading How Bits and Bytes Work would be
helpful before proceeding.
-4-
The simplest possible gate is called an "inverter," or a NOT gate. It takes one bit as input and produces as
output its opposite. The table below shows a logic table for the NOT gate and the normal symbol for it in
circuit diagrams:
NOT Gate
A
Q
0
1
1
0
You can see in this figure that the NOT gate has one input called A and one output called Q ("Q" is used
for the output because if you used "O," you would easily confuse it with zero). The table shows how the
gate behaves. When you apply a 0 to A, Q produces a 1. When you apply a 1 to A, Q produces a 0.
Simple.
The AND gate performs a logical "and" operation on two inputs, A and B:
AND Gate
A
B
Q
0
0
1
1
0
1
0
1
0
0
0
1
The idea behind an AND gate is, "If A AND B are both 1, then Q should be 1." You can see that behavior
in the logic table for the gate. You read this table row by row, like this:
AND Gate
ABQ
0
0
1
1
0
1
0
1
0
0
0
1
If A is 0 AND B is 0, Q is 0.
If A is 0 AND B is 1, Q is 0.
If A is 1 AND B is 0, Q is 0.
If A is 1 AND B is 1, Q is 1.
The next gate is an OR gate. Its basic idea is, "If A is 1 OR B is 1 (or both are 1), then Q is 1."
OR Gate
A
B
Q
0
0
1
1
0
1
0
1
0
1
1
1
Those are the three basic gates (that's one way to count them). It is quite common to recognize two others
as well: the NAND and the NOR gate. These two gates are simply combinations of an AND or an OR gate
with a NOT gate. If you include these two gates, then the count rises to five. Here's the basic operation of
NAND and NOR gates -- you can see they are simply inversions of AND and OR gates:
NOR Gate
A
B
Q
0
0
1
1
0
1
0
1
1
0
0
0
-5-
NAND Gate
A
B
Q
0
0
1
1
0
1
0
1
1
1
1
0
The final two gates that are sometimes added to the list are the XOR and XNOR gates, also known as
"exclusive or" and "exclusive nor" gates, respectively. Here are their tables:
XOR Gate
A
B
Q
0
0
1
1
0
1
0
1
0
1
1
0
XNOR Gate
A
B
Q
0
0
1
1
0
1
0
1
1
0
0
1
The idea behind an XOR gate is, "If either A OR B is 1, but NOT both, Q is 1." The reason why XOR might
not be included in a list of gates is because you can implement it easily using the original three gates
listed. Here is one implementation:
If you try all four different patterns for A and B and trace them through the circuit, you will find that Q
behaves like an XOR gate. Since there is a well-understood symbol for XOR gates, it is generally easier to
think of XOR as a "standard gate" and use it in the same way as AND and OR in circuit diagrams.
Simple Adders
In the article on bits and bytes, you learned about binary addition. In this section, you will learn how you
can create a circuit capable of binary addition using the gates described in the previous section.
Let's start with a single-bit adder. Let's say that you have a project where you need to add single bits
together and get the answer. The way you would start designing a circuit for that is to first look at all of the
logical combinations. You might do that by looking at the following four sums:
0
0
1
1
+0
+1
+0
+1
0
1
1
10
-6-
That looks fine until you get to 1 + 1. In that case, you have that pesky carry bit to worry about. If you
don't care about carrying (because this is, after all, a 1-bit addition problem), then you can see that you
can solve this problem with an XOR gate. But if you do care, then you might rewrite your equations to
always include 2 bits of output, like this:
0
0
1
1
+0
+1
+0
+1
00
01
01
10
From these equations you can form the logic table:
1-bit Adder with Carry-Out
A
B
Q
CO
0
0
1
1
0
1
0
1
0
1
1
0
0
0
0
1
By looking at this table you can see that you can implement Q with an XOR gate and CO (carry-out) with
an AND gate. Simple.
What if you want to add two 8-bit bytes together? This becomes slightly harder. The easiest solution is to
modularize the problem into reusable components and then replicate components. In this case, we need
to create only one component: a full binary adder.
The difference between a full adder and the previous adder we looked at is that a full adder accepts an A
and a B input plus a carry-in (CI) input. Once we have a full adder, then we can string eight of them
together to create a byte-wide adder and cascade the carry bit from one adder to the next.
In the next section, we'll look at how a full adder is implemented into a circuit.
Full Adders
The logic table for a full adder is slightly more complicated than the tables we have used before, because
now we have 3 input bits. It looks like this:
One-bit Full Adder with Carry-In and Carry-Out
CI
A
B
Q
CO
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
0
0
0
1
0
1
1
1
There are many different ways that you might implement this table. I am going to present one method here
that has the benefit of being easy to understand. If you look at the Q bit, you can see that the top 4 bits are
behaving like an XOR gate with respect to A and B, while the bottom 4 bits are behaving like an XNOR
gate with respect to A and B. Similarly, the top 4 bits of CO are behaving like an AND gate with respect to
A and B, and the bottom 4 bits behave like an OR gate. Taking those facts, the following circuit
implements a full adder:
-7-
This definitely is not the most efficient way to implement a full adder, but it is extremely easy to understand
and trace through the logic using this method. If you are so inclined, see what you can do to implement
this logic with fewer gates.
Now we have a piece of functionality called a "full adder." What a computer engineer then does is "blackbox" it so that he or she can stop worrying about the details of the component. A black box for a full adder
would look like this:
With that black box, it is now easy to draw a 4-bit full adder:
In this diagram the carry-out from each bit feeds directly into the carry-in of the next bit over. A 0 is hardwired into the initial carry-in bit. If you input two 4-bit numbers on the A and B lines, you will get the 4-bit
sum out on the Q lines, plus 1 additional bit for the final carry-out. You can see that this chain can extend
as far as you like, through 8, 16 or 32 bits if desired.
The 4-bit adder we just created is called a ripple-carry adder. It gets that name because the carry bits
"ripple" from one adder to the next. This implementation has the advantage of simplicity but the
-8-
disadvantage of speed problems. In a real circuit, gates take time to switch states (the time is on the order
of nanoseconds, but in high-speed computers nanoseconds matter). So 32-bit or 64-bit ripple-carry adders
might take 100 to 200 nanoseconds to settle into their final sum because of carry ripple. For this reason,
engineers have created more advanced adders called carry-lookahead adders. The number of gates
required to implement carry-lookahead is large, but the settling time for the adder is much better.
Flip Flops
One of the more interesting things that you can do with Boolean gates is to create memory with them. If
you arrange the gates correctly, they will remember an input value. This simple concept is the basis of
RAM (random access memory) in computers, and also makes it possible to create a wide variety of other
useful circuits.
Memory relies on a concept called feedback. That is, the output of a gate is fed back into the input. The
simplest possible feedback circuit using two inverters is shown below:
If you follow the feedback path, you can see that if Q happens to be 1, it will always be 1. If it happens to
be 0, it will always be 0. Since it's nice to be able to control the circuits we create, this one doesn't have
much use -- but it does let you see how feedback works.
It turns out that in "real" circuits, you can actually use this sort of simple inverter feedback approach. A
more useful feedback circuit using two NAND gates is shown below:
This circuit has two inputs (R and S) and two outputs (Q and Q'). Because of the feedback, its logic table
is a little unusual compared to the ones we have seen previously:
R
S
0
0
0
1
1
0
1
1
Q
Q'
Illegal
1
0
0
1
Remembers
What the logic table shows is that:
If R and S are opposites of one another, then Q follows S and Q' is the inverse of Q.
If both R and S are switched to 1 simultaneously, then the circuit remembers what was
previously presented on R and S.
There is also the funny illegal state. In this state, R and S both go to 0, which has no value in the memory
sense. Because of the illegal state, you normally add a little conditioning logic on the input side to
prevent it, as shown here:
-9-
In this circuit, there are two inputs (D and E). You can think of D as "Data" and E as "Enable." If E is 1,
then Q will follow D. If E changes to 0, however, Q will remember whatever was last seen on D. A circuit
that behaves in this way is generally referred to as a flip-flop.
In the next section we'll look at the J-K flip-flop.
The J-K Flip-Flop
A very common form of flip-flop is the J-K flip-flop. It is unclear, historically, where the name "J-K" came
from, but it is generally represented in a black box like this:
In this diagram, P stands for "Preset," C stands for "Clear" and Clk stands for "Clock." The logic table
looks like this:
P
C
Clk
J
K
Q
Q'
1
1
1
1
1-to-0
1-to-0
1
0
0
1
1
0
0
1
1
1
1-to-0
1
1
1
0
0
1
X
X
X
X
X
X
Toggles
0
1
1
0
Here is what the table is saying: First, Preset and Clear override J, K and Clk completely. So if Preset
goes to 0, then Q goes to 1; and if Clear goes to 0, then Q goes to 0 no matter what J, K and Clk are
doing. However, if both Preset and Clear are 1, then J, K and Clk can operate. The 1-to-0 notation means
that when the clock changes from a 1 to a 0, the value of J and K are remembered if they are opposites.
At the low-going edge of the clock (the transition from 1 to 0), J and K are stored. However, if both J and
K happen to be 1 at the low-going edge, then Q simply toggles. That is, Q changes from its current state
to the opposite state.
You might be asking yourself right now, "What in the world is that good for?" It turns out that the concept
of "edge triggering" is very useful. The fact that J-K flip-flop only "latches" the J-K inputs on a transition
from 1 to 0 makes it much more useful as a memory device. J-K flip-flops are also extremely useful in
counters (which are used extensively when creating a digital clock). Here is an example of a 4-bit counter
using J-K flip-flops:
- 10 -
The outputs for this circuit are A, B, C and D, and they represent a 4-bit binary number. Into the clock
input of the left-most flip-flop comes a signal changing from 1 to 0 and back to 1 repeatedly (an
oscillating signal). The counter will count the low-going edges it sees in this signal. That is, every time
the incoming signal changes from 1 to 0, the 4-bit number represented by A, B, C and D will increment by
1. So the count will go from 0 to 15 and then cycle back to 0. You can add as many bits as you like to this
counter and count anything you like. For example, if you put a magnetic switch on a door, the counter will
count the number of times the door is opened and closed. If you put an optical sensor on a road, the
counter could count the number of cars that drive by.
Another use of a J-K flip-flop is to create an edge-triggered latch, as shown here:
In this arrangement, the value on D is "latched" when the clock edge goes from low to high. Latches are
extremely important in the design of things like central processing units (CPUs) and peripherals in
computers.
Implementing Gates
In the previous sections we saw that, by using very simple Boolean gates, we can implement adders,
counters, latches and so on. That is a big achievement, because not so long ago human beings were the
only ones who could do things like add two numbers together. With a little work, it is not hard to design
Boolean circuits that implement subtraction, multiplication, division... You can see that we are not that far
away from a pocket calculator. From there, it is not too far a jump to the full-blown CPUs used in
computers.
So how might we implement these gates in real life? Mr. Boole came up with them on paper, and on paper
they look great. To use them, however, we need to implement them in physical reality so that the gates
can perform their logic actively. Once we make that leap, then we have started down the road toward
creating real computation devices.
The easiest way to understand the physical implementation of Boolean logic is to use relays. This is, in
fact, how the very first computers were implemented. No one implements computers with relays anymore - today, people use sub-microscopic transistors etched onto silicon chips. These transistors are incredibly
small and fast, and they consume very little power compared to a relay. However, relays are incredibly
- 11 -
easy to understand, and they can implement Boolean logic very simply. Because of that simplicity, you will
be able to see that mapping from "gates on paper" to "active gates implemented in physical reality" is
possible and straightforward. Performing the same mapping with transistors is just as easy.
Let's start with an inverter. Implementing a NOT gate with a relay is easy: What we are going to do is use
voltages to represent bit states. We will define a binary 1 to be 6 volts and a binary 0 to be zero volts
(ground). Then we will use a 6-volt battery to power our circuits. Our NOT gate will therefore look like this:
[If this figure makes no sense to you, please read How Relays Work for an explanation.]
You can see in this circuit that if you apply zero volts to A, then you get 6 volts out on Q; and if you apply 6
volts to A, you get zero volts out on Q. It is very easy to implement an inverter with a relay!
It is similarly easy to implement an AND gate with two relays:
Here you can see that if you apply 6 volts to A and B, Q will have 6 volts. Otherwise, Q will have zero
volts. That is exactly the behavior we want from an AND gate. An OR gate is even simpler -- just hook two
wires for A and B together to create an OR. You can get fancier than that if you like and use two relays in
parallel.
You can see from this discussion that you can create the three basic gates -- NOT, AND and OR -- from
relays. You can then hook those physical gates together using the logic diagrams shown above to create
a physical 8-bit ripple-carry adder. If you use simple switches to apply A and B inputs to the adder and
hook all eight Q lines to light bulbs, you will be able to add any two numbers together and read the results
on the lights ("light on" = 1, "light off" = 0).
Boolean logic in the form of simple gates is very straightforward. From simple gates you can create more
complicated functions, like addition. Physically implementing the gates is possible and easy. From those
three facts you have the heart of the digital revolution, and you understand, at the core, how computers
work.
- 12 -
How Electronic Gates Work
by Marshall Brain (HowStuffWorks.com)
If you have read the HowStuffWorks article on Boolean logic, then you
know that digital devices depend on Boolean gates. You also know
from that article that one way to implement gates involves relays.
However, no modern computer uses relays -- it uses "chips."
What if you want to experiment with Boolean gates and chips? What if
you would like to build your own digital devices? It turns out that it is
not that difficult. In this article, you will see how you can experiment
with all of the gates discussed in the Boolean logic article. We will talk
about where you can get parts, how you can wire them together, and
how you can see what they are doing. In the process, you will open the
door to a whole new universe of technology.
Setting the Stage
In the article How Boolean Logic Works, we looked at seven fundamental gates. These gates are the
building blocks of all digital devices. We also saw how to combine these gates together into higher-level
functions, such as full adders. If you would like to experiment with these gates so you can try things out
yourself, the easiest way to do it is to purchase something called TTL chips and quickly wire circuits
together on a device called a solderless breadboard. Let's talk a little bit about the technology and the
process so you can actually try it out!
If you look back at the history of computer technology, you find that all computers are designed around
Boolean gates. The technologies used to implement those gates, however, have changed dramatically
over the years. The very first electronic gates were created using relays. These gates were slow and
bulky. Vacuum tubes replaced relays. Tubes were much faster but they were just as bulky, and they were
also plagued by the problem that tubes burn out (like light bulbs). Once transistors were perfected
(transistors were invented in 1947), computers started using gates made from discrete transistors.
Transistors had many advantages: high reliability, low power consumption and small size compared to
tubes or relays. These transistors were discrete devices, meaning that each transistor was a separate
device. Each one came in a little metal can about the size of a pea with three wires attached to it. It might
take three or four transistors and several resistors and diodes to create a gate.
In the early 1960s, integrated circuits (ICs) were invented. Transistors, resistors and diodes could be
manufactured together on silicon "chips." This discovery gave rise to SSI (small scale integration) ICs. An
SSI IC typically consists of a 3-mm-square chip of silicon on which perhaps 20 transistors and various
other components have been etched. A typical chip might contain four or six individual gates. These chips
shrank the size of computers by a factor of about 100 and made them much easier to build.
As chip manufacturing techniques improved, more and more transistors could be etched onto a single
chip. This led to MSI (medium scale integration) chips containing simple components, such as full adders,
made up of multiple gates. Then LSI (large scale integration) allowed designers to fit all of the components
of a simple microprocessor onto a single chip. The 8080 processor, released by Intel in 1974, was the
first commercially successful single-chip microprocessor. It was an LSI chip that contained 4,800
transistors. VLSI (very large scale integration) has steadily increased the number of transistors ever since.
The first Pentium processor was released in 1993 with 3.2 million transistors, and current chips can
contain up to 20 million transistors.
In order to experiment with gates, we are going to go back in time a bit and use SSI ICs. These chips are
still widely available and are extremely reliable and inexpensive. You can build anything you want with
them, one gate at a time. The specific ICs we will use are of a family called TTL (Transistor Transistor
- 13 -
Logic, named for the specific wiring of gates on the IC). The chips we will use are from the most common
TTL series, called the 7400 series. There are perhaps 100 different SSI and MSI chips in the series,
ranging from simple AND gates up to complete ALUs (arithmetic logic
units).
The 7400-series chips are housed in DIPs (dual inline packages). As
pictured on the right, a DIP is a small plastic package with 14, 16, 20 or
24 little metal leads protruding from it to provide connections to the
gates inside. The easiest way to construct something from these gates
is to place the chips on a solderless breadboard. The breadboard lets
you wire things together simply by plugging pieces of wire into
connection holes on the board.
A solderless breadboard
All electronic gates need a source of electrical power. TTL gates use 5 volts for operation. The chips are
fairly particular about this voltage, so we will want to use a clean, regulated 5-volt power supply whenever
working with TTL chips. Certain other chip families, such as the 4000 series of CMOS chips, are far less
particular about the voltages they use. CMOS chips have the additional advantage that they use much
less power. However, they are very sensitive to static electricity, and that makes them less reliable unless
you have a static-free environment to work in. Therefore, we will stick with TTL here.
- 14 -
Metals, Insulators and Semiconductors
MO Approach
Na
- 15 -
Insulators and Semiconductors
- 16 -
Pure Diamond: colorless
B added Diamond: blue
N added Diamond: yellow
- 17 -
How Semiconductors Work
by Marshall Brain (HowStuffWorks.com)
Clockwise from top: A chip, an LED and a transistor are all made from semiconductor material.
Semiconductors have had a monumental impact on our society. You find semiconductors at the heart of
microprocessor chips as well as transistors. Anything that's computerized or uses radio waves depends on
semiconductors.
Today, most semiconductor chips and transistors are created with silicon. You may have heard
expressions like "Silicon Valley" and the "silicon economy," and that's why -- silicon is the heart of any
electronic device.
A diode is the simplest possible semiconductor device, and is therefore an excellent beginning point if you
want to understand how semiconductors work. In this article, you'll learn what a semiconductor is, how
doping works and how a diode can be created using semiconductors. But first, let's take a close look at
silicon.
Silicon is a very common element -- for example, it is the main element in sand and quartz. If you look
"silicon" up in the periodic table, you will find that it sits next to aluminum, below carbon and above
germanium.
Carbon, silicon and germanium (germanium, like silicon, is also a semiconductor) have a unique property
in their electron structure -- each has four electrons in its outer orbital. This allows them to form nice
crystals. The four electrons form perfect covalent bonds with four neighboring atoms, creating a lattice. In
carbon, we know the crystalline form as diamond. In silicon, the crystalline form is a silvery, metalliclooking substance.
In a silicon lattice, all silicon atoms bond perfectly to four
neighbors, leaving no electrons in the conduction band.
- 18 -
Metals tend to be good conductors of electricity because they usually have "free electrons" that can move
easily between atoms, and electricity involves the flow of electrons. While silicon crystals look metallic,
they are not, in fact, metals. All of the outer electrons in a silicon crystal are involved in perfect covalent
bonds, so they can't move around. A pure silicon crystal is nearly an insulator -- very little electricity will
flow through it.
But you can change all this through a process called doping.
Doping Silicon
You can change the behavior of silicon and turn it into a conductor by doping it. In doping, you mix a
small amount of an impurity into the silicon crystal.
There are two types of impurities:
N-type - In N-type doping, phosphorus or arsenic is added to the silicon in small quantities.
Phosphorus and arsenic each have five outer electrons, so they're out of place when they get into
the silicon lattice. The fifth electron has nothing to bond to, so it's free to move around. It takes only
a very small quantity of the impurity to create enough free electrons to allow an electric current to
flow through the silicon. N-type silicon is a good conductor. Electrons have a negative charge,
hence the name N-type.
P-type - In P-type doping, boron or gallium is the dopant. Boron and gallium each have only
three outer electrons. When mixed into the silicon lattice, they form "holes" in the lattice where a
silicon electron has nothing to bond to. The absence of an electron creates the effect of a positive
charge, hence the name P-type. Holes can conduct current. A hole happily accepts an electron
from a neighbor, moving the hole over a space. P-type silicon is a good conductor.
A minute amount of either N-type or P-type doping turns a silicon crystal from a good insulator into a
viable (but not great) conductor -- hence the name "semiconductor."
N-type and P-type silicon are not that amazing by themselves; but when you put them together, you get
some very interesting behavior at the junction. That's what happens in a diode.
A diode is the simplest possible semiconductor device. A diode allows current to flow in one direction but
not the other. You may have seen turnstiles at a stadium or a subway station that let people go through in
only one direction. A diode is a one-way turnstile for electrons.
When you put N-type and P-type silicon together as shown in this diagram, you get a very interesting
phenomenon that gives a diode its unique properties.
Even though N-type silicon by itself is a conductor, and P-type silicon by itself is also a conductor, the
combination shown in the diagram does not conduct any electricity. The negative electrons in the N-type
silicon get attracted to the positive terminal of the battery. The positive holes in the P-type silicon get
attracted to the negative terminal of the battery. No current flows across the junction because the holes
and the electrons are each moving in the wrong direction.
- 19 -
If you flip the battery around, the diode conducts electricity just fine. The free electrons in the N-type
silicon are repelled by the negative terminal of the battery. The holes in the P-type silicon are repelled by
the positive terminal. At the junction between the N-type and P-type silicon, holes and free electrons
meet. The electrons fill the holes. Those holes and free electrons cease to exist, and new holes and
electrons spring up to take their place. The effect is that current flows through the junction.
Diodes and Transistors
A device that blocks current in one direction while letting current flow in another direction is called a diode.
Diodes can be used in a number of ways. For example, a device that uses batteries often contains a diode
that protects the device if you insert the batteries backward. The diode simply blocks any current from
leaving the battery if it is reversed -- this protects the sensitive electronics in the device.
A semiconductor diode's behavior is not perfect, as shown in the graph below. When reverse-biased, an
ideal diode would block all current. A real diode lets perhaps 10 microamps through -- not a lot, but still not
perfect. And if you apply enough reverse voltage (V), the junction breaks down and lets current through.
Usually, the breakdown voltage is a lot more voltage than the circuit will ever see, so it is irrelevant.
When forward-biased, there is a small amount of voltage necessary to get the diode going. In silicon, this
voltage is about 0.7 volts. This voltage is needed to start the hole-electron combination process at the
junction.
- 20 -
Light Emitting Diodes (LED) (HowStuffWorks.com)
How Can a Diode Produce Light?
Light is a form of energy that can be released by an atom. It is made up of many small particle-like
packets that have energy and momentum but no mass. These particles, called photons, are the most
basic units of light.
Photons are released as a result of moving electrons. In an atom, electrons move in orbitals around the
nucleus. Electrons in different orbitals have different amounts of energy. Generally speaking, electrons
with greater energy move in orbitals farther away from the nucleus.
For an electron to jump from a lower orbital to a higher orbital, something has to boost its energy level.
Conversely, an electron releases energy when it drops from a higher orbital to a lower one. This energy is
released in the form of a photon. A greater energy drop releases a higher-energy photon, which is
characterized by a higher frequency. (Check out How Light Works for a full explanation.)
As we saw in the last section, free electrons moving across a diode can fall into empty holes from the Ptype layer. This involves a drop from the conduction band to a lower orbital, so the electrons release
energy in the form of photons. This happens in any diode, but you can only see the photons when the
diode is composed of certain material. The atoms in a standard silicon diode, for example, are arranged in
such a way that the electron drops a relatively short distance. As a result, the photon's frequency is so low
that it is invisible to the human eye -- it is in the infrared portion of the light spectrum. This isn't
necessarily a bad thing, of course: Infrared LEDs are ideal for remote controls, among other things.
Visible light-emitting diodes (VLEDs), such as the ones that light up numbers in a digital clock, are
made of materials characterized by a wider gap between the conduction band and the lower orbitals. The
size of the gap determines the frequency of the photon -- in other words, it determines the color of the
light.
- 21 -
LED Advantages
While all diodes release light, most don't do it very effectively. In an ordinary diode, the semiconductor
material itself ends up absorbing a lot of the light energy. LEDs are specially constructed to release a
large number of photons outward. Additionally, they are housed in a plastic bulb that concentrates the light
in a particular direction. As you can see in the diagram, most of the light from the diode bounces off the
sides of the bulb, traveling on through the rounded end.
LEDs have several advantages over conventional incandescent lamps. For one thing, they don't have a
filament that will burn out, so they last much longer. Additionally, their small plastic bulb makes them a lot
more durable. They also fit more easily into modern electronic circuits.
But the main advantage is efficiency. In conventional incandescent bulbs, the light-production process
involves generating a lot of heat (the filament must be warmed). This is completely wasted energy, unless
you're using the lamp as a heater, because a huge portion of the available electricity isn't going toward
producing visible light. LEDs generate very little heat, relatively speaking. A much higher percentage of
the electrical power is going directly to generating light, which cuts down on the electricity demands
considerably.
Up until recently, LEDs were too expensive to use for most lighting applications because they're built
around advanced semiconductor material. The price of semiconductor devices has plummeted over the
past decade, however, making LEDs a more cost-effective lighting option for a wide range of situations.
While they may be more expensive than incandescent lights up front, their lower cost in the long run can
make them a better buy. In the future, they will play an even bigger role in the world of technology.
- 22 -
Transistors Tutorial
Part 1:
"Bipolar Basics"
www.uoguelph.ca/~antoon/tutorial/xtor/xtor1/xtor1
"We look at the tiny devices that have reshaped the world of electronics."
Along with the solid-state diode, the point-contact transistor--invented in 1947 at Bell Labs--started the
semiconductor revolution and has gone on the become one of the rudimentary devices in today's
electronic equipment. The transistor, whether in discrete or IC form, is at the heart of most modern
circuitry. The transistor is considered by many to be the greatest invention of the twentieth-century, or as
one of the greatest. It is the key active component in practically all modern electronics. Its importance in
today's society rests on its ability to be mass produced using a highly automated process (fabrication) that
achieves astonishingly low per-transistor costs. A logic gate consists of about twenty transistors whereas
an advanced microprocessor, as of 2006, can use as many as 1.7 billion transistors (MOSFETs).[5] "About
60 million transistors were built this year [2002] ... for [each] man, woman, and child on Earth." [6]
Bipolar-Transistor Composition:
A bipolar transistor is basically a two PN junctions connected back-to-back within the same piece of
semiconductor material and sharing a common P- or N-doped semiconductor region. There are two types
of bipolar transistor, the NPN and the PNP. Fig. 1A is a simplified illustration of the composition of the
NPN type of transistor. In our illustration, the NPN type unit is shown as P-doped semiconductor material
sandwiched between two layers of N-doped material. The composition of a PNP transistor is just the
opposite of that, (i.e. the N- and P-doped materials in the transistor are interchanged). It follows then that
biasing considerations for NPN units are also opposite from those for the PNP unit.
Note from Fig. 1A that a bipolar transistor is comprised of a center region called the base surrounded by
two other regions known as the collector and the emitter. The difference between them will be discussed
shortly. The two junctions are arranged so that they are very close together; that's done by making the
shared base region very thin and lightly doped. That causes the two junctions to interact with one another.
Conduction is the collector-base junction depends largely on what happens in the emitter-base junction.
Because the region is lightly doped, it has a relatively small number of free carriers (holes in a P-type
base and electronics in an N-type base) to conduct current. On the other hand, the emitter region is quite
heavily doped, containing a much larger amount of donor impurity (for the NPN type) or acceptor impurity
(for the PNP type), so there are many more free carriers available in the emitter region to conduct current
than in the adjacent base region. Because of that, the emitter-base junction, when forward biased,
conducts much the same as a common PN junction diode.
The current that flows (composed of electrons for NPN units and holes, in the case of PNP transistors) is
mainly from the emitter to the base rather than vice versa. That is where the emitter derives its name--it
emits or injects current carriers in the other regions of the device.
The third region of a transistor, the collector, is lightly doped, much the same as the base, except with the
opposite type of doping impurity, so it (like the base region) has relatively few free carriers available to
conduct current in the normal way. The collector-base junction is normally reverse biased, so a depletion
layer forms, spreading out on either side of the junction. The depletion layer effectively removes the
carriers that would otherwise balance out the charges on the fixed impurity atoms of the crystals, setting
up a potential barrier to match the applied reverse voltage.
- 23 -
To the normal majority carriers in the base and emitter, that potential barrier is a big wall that must be
overcome before they can pass to the other side. So just as in the case of a normal diode, virtually no
current flows across the collector-base junction when left to its own devices. However, the junction is not
left to its own devices.
Remember that the base region is deliberately made very thin and lightly doped, while the emitter is made
much more heavily doped. Because of that, applying a forward bias to the emitter-base junction causes
vast majority carriers to be injected into th the base, and straight into the reverse-biased collector-base
junction. Those carriers are actually minority carriers in the base region, because that region is of
opposite semiconductor type to the emitter. To those majority-turned-minority carriers, the collector-base
junction depletion region is not a barrier at all but an inviting, accelerating filed; so as soon as they reach
the depletion layer, they are immediately swept into the collector region.
Forward biasing the emitter-base junction causes two things to happen that might seem surprising at first:
Only a relatively small current actually flows between the emitter and the base. much smaller than would
flow in a normal PN diode despite the forward bias applied to the junction between them. A much larger
current instead flows directly between the emitter and the collector regions, in this case, despite the fact
that the collector-base junction is reversed biased.
That effect is illustrated in Fig. 1A, which (hopefully) will help you to understand what is going on. The
diagram shows a NPN transistor, but the action in a PNP unit is similar except for the opposite region
polarity and conduction mainly by holes rather than electrons.
From a practical point of view, the behavior of bipolar transistors means that, unlike the simple PNjunction diode, it is capable of amplification. In effect, a small input current made to flow between the
emitter and collector. Only a small voltage--around 0.6 volts for a typical silicon transistor--is needed to
produce the small input current required.
In contrast, the reverse-bias voltage applied across the collector-base junction can be much larger;
typically anywhere from 6 to 90 volts or more. So in producing and being able to control a larger current in
this much higher-output circuit, the transistor's small input current and voltage can achieve considerable
voltage, power, and current, gains.
Bipolar transistors, therefore, work very well as both amplifiers and electronics switches. That is why they
have become the workhorses of modern electronics, virtually replacing the vacuum tube. The diagram in
Fig. 1A is designed to show how a bipolar transistor works, rather than its physical construction. The
- 24 -
actual form of the modern, planar, double-defuse epitaxial-junction transistor is shown in Fig. 1A.
The collector region is formed from a lightly doped layer grown epitaxially on the main substrate, which is
made from the same type (but more heavily doped) material to provide a low resistance connection. Here,
both are N-doped material; for a PNP transistor, they would be P-doped material.
The base region is formed by lightly diffusing the opposite type impurity into a medium-sized area of the
chip surface to reverse that type of area and create the base-collector unction. The emitter region is
formed by a second and heavier diffusion over the smaller area inside the first, but this time with the same
kind of impurity as used for the epitaxial collector region.
The second diffusion is very carefully controlled so that the emitter region that results extends almost--but
not quite--to the bottom of the base. That leaves the area of the base right below the emitter quite thin to
ensure that as many as possible of the carriers are injected from the emitter region will be swept through
to the collector. The thinner that active base region, the higher (in general) the gain of the transistor.
Note that although the collector and emitter regions are made of the same type of semiconductor
material, the two are physically quite different. The emitter is heavily doped (for a good carrier injection)
and can be relatively small since the emitter-base junction does not need to dissipate much power (heat).
In contrast, the collector is lightly doped (for a wide depletion area) and its junction is much larger since,
being reversed biased, it must dissipate much more power.
Connections to the emitter and base regions are made by way of aluminum electrodes deposited on the
surface. Thin wires are bonded to the electrodes for connection to the main device leads. The lowresistance substrate itself is used to connect to the collector region.
That is the basic construction used for most modern bipolar transistors, whether they are discrete units or
part of an
IC containing thousands of transistors. The main difference
is size, although, in an IC, the collector region of the
transistor will generally be in an epitaxial layer grown on
the opposite kind of substrate, and separated by diffused
walls (of the opposite type material) to separate the
transistors from each other.
In an IC, the active part of an individual transistor might
only be a couple micrometers square, while a very large
transistor (used to switch hundreds of amperes) might be
on a single wafer of 10 mm or more in diameter. Typical
small-to-medium power, discrete transistors used in
consumer and hobby electronics are grown on chips
measuring from 1- to about 3-mm square--the rest of the
component is protective packaging.
Transistor Operation:
Refer to Fig. 2, a PNP version of the illustration shown in
Fig. 1A. Note that both are essentially the same, except
that in this instance, the collector is more negative than the
base or the emitter. That is an important characteristic to
remember when it comes to the operation of bipolar transistors.
If a positive voltage is applied to the P-doped emitter (to the left), current will be swept through the baseemitter junction--with the holes from the P-doped material moving to the right and the electrons form the
N-doped material moving to the left. Some of the holes moving into the N-doped base region will combine
with the electrons and become neutralized, while others will migrate to the base-collector junction.
Normally, if the base-collector junction is negatively biased, there would be no current flow in the circuit.
However, there would be additional holes in the junction to travel to the base-collector junction, and
electrons can then travel toward the base-emitter junction, so a current flows even through that section of
the sandwich is biased (at cutoff) to prevent conduction. Most of the current travels between the emitter
and collector and does not flow out through the base.
The amplitude of the collector current depends principally on the magnitude of emitter current (e.g., the
collector current). Note that between each PN junction, there is an area known as the depletion or
transition region that is similar in some characteristics to a dielectric layer. That layer varies in accordance
with the operating voltage. The semiconductor materials on either side of the depletion regions constitute
the plates of a capacitor. The base-collector capacitance is indicated in Fig. 2 as Cbc, and the baseemitter capacitance is designated Cbe. A change in signal and operating voltages causes a non-linear
change in those junction capacitances.
There is also a base-emitter resistance (Rbe that must be considered. In practical transistors, emitter
- 25 -
resistance is on the order of a few ohms, while the collector resistance is many hundreds or even
thousands of times larger. The junction capacitance in combination with the base-emitter resistance
determine the useful upper-frequency limit of a transistor by establishing an RC time constant.
Because the collector is reversed biased, the collector-to-base resistance is high. On the other hand, the
emitter and collector currents are substantially equal, so the power in the collector circuit is larger than the
power in the emitter circuit.
(P = I2R, so the powers are proportional to the respective resistances, if the currents are the same.)
In practical transistors, emitter resistance is on the order of a few ohms, while the collector resistance is
many hundreds or thousands of times larger, so power gains of 20 to 40dB, or even more, are possible.
Figure 3 shows the schematic symbols for both the NPN and
PNP version of the bipolar transistor. The first two letters of
the designators (NPN or PNP) indicate the polarities of the
voltages applied to the collector and emitter in normal
operation. For example, in a PNP unit, the emitter is made
more positive with respect to the collector and the base, and
the collector is made more negative with respect to the base.
Another way of saying that is: the collector is more negative
than the base and the base is more negative than the emitter.
Transistor Amplifiers:
Transistors are among the most commonly used building
blocks in electronics. While they can be used as electronically
controlled switches, they are widely configured for amplifier
use. In fact, the vast majority of electronic circuits contain one
or more amplifiers of some type or another.
However, what exactly do we mean by the term
amplifier? By definition an amplifier is a circuit that
draws power from a source other than the input
signal and produces an output that is usually an
enlarged reproduction of the input signal.
We say usually because not all amplifiers are used
to magnify the input signal--buffer amplifiers (often
called unity-gain amplifiers) are not designed to
magnify the input signal. When operated as a
buffer, the transistor is used to isolate one stage from the effects of one that follows. Since buffer
amplifiers provide no increase in signal level, a 10-millivolt (mV) signal applied to the input of a unity-gain
amplifier produces an output signal at the same 10-mV level (a carbon copy of the input signal).
There are may types of amplifiers, however, and all fall into one of two broad categories: voltage
amplifiers or current (often referred to as a power) amplifiers. The term voltage amplifier implies to a
circuit in which a low voltage is applied to the input to produce a higher voltage at the output. The term
power amplifier is generally reserved for those that supply an appreciable power (or current) increase to
the load.
Because a vast array of amplifier circuits in use in modern electronics, amplifier circuits are often
subdivided by application--AF, IF, RF, Instrumentation, op-amp, etc. Another way of categorizing
amplifiers is by configuration: common-emitter, common-collector, and common-base for example. The
important parameters in such circuits are the cutoff frequency and the input/output impedances. The cutoff frequency at which the gain of an amplifier falls below 0.707 times the maximum gain of the circuit.
The input impedance is the output impedance of the transistor.
The essential usefulness of a transistor comes from its ability to use a small signal applied between one
pair of its terminals to control a much larger signal at another pair of terminals. This property is called
"gain". A transistor can control its output in proportion to the input signal; this is called an "amplifier". Or,
the transistor can be used to turn current on or off in a circuit like an electrically controlled "switch", where
the amount of current is determined by other circuit elements.
- 26 -
Operation graph of a transistor.
The two types of transistors have slight differences in how they are used in a circuit. A bipolar transistor
has terminals labelled base, collector and emitter. A small current at base terminal can control or switch a
much larger current between collector and emitter terminals. For a field-effect transistor, the terminals are
labelled gate, source, and drain, and a voltage at the gate can control a current between source and drain.
The image to the right represents a typical bipolar transistor in a circuit. Charge will flow between emitter
and collector terminals depending on the current in the base. Since internally the base and emitter
connections behave like a semiconductor diode, a voltage drop develops between base and emitter while
the base current exists. The size of this voltage depends on the material the transistor is made from, and
is referred to as Vbe.
Transistor as a switch
Transistors are commonly used as electronic switches, for both high power applications including
switched-mode power supplies and low power applications such as logic gates.
It can be seen from the graph that once the base voltage reaches a certain level, shown at B, no more
current will exist and the output will be held at a fixed voltage. The transistor is then said to be saturated.
Hence, values of input voltage can be chosen such that the output is either completely off, [7] or completely
on. The transistor is acting as a switch, and this type of operation is common in digital circuits where only
"on" and "off" values are relevant.
Transistor as an amplifier
The above common emitter amplifier is designed so that a small change in voltage in (Vin) changes the
small current through the base of the transistor and the transistor's current amplification combined with the
properties of the circuit mean that small swings in Vin produce large changes in Vout.
It is important that the operating parameters of the transistor are chosen and the circuit designed such that
as far as possible the transistor operates within a linear portion of the graph, such as that shown between
A and B, otherwise the output signal will suffer distortion.
Various configurations of single transistor amplifier are possible, with some providing current gain, some
voltage gain, and some both.
From mobile phones to televisions, vast numbers of products include amplifiers for sound reproduction,
radio transmission, and signal processing. The first discrete transistor audio amplifiers barely supplied a
few hundred milliwatts, but power and audio fidelity gradually increased as better transistors became
available and amplifier architecture evolved.
- 27 -
Modern transistor audio amplifiers of up to a few hundred watts are common and relatively inexpensive.
Transistors have replaced valves (electron tubes) in instrument amplifiers.
Some musical instrument amplifier manufacturers mix transistors and vacuum tubes in the same circuit,
as some believe tubes have a distinctive sound.
Comparison with vacuum tubes
Prior to the development of transistors, vacuum (electron) tubes (or in the UK "thermionic valves" or just
"valves") were the main active components in electronic equipment.
Advantages
The key advantages that have allowed transistors to replace their vacuum tube predecessors in most
applications are:









Small size and minimal weight, allowing the development of miniaturized electronic devices.
Highly automated manufacturing processes, resulting in low per-unit cost.
Lower possible operating voltages, making transistors suitable for small, battery-powered
applications.
No warm-up period for cathode heaters required after power application.
Lower power dissipation and generally greater energy efficiency.
Higher reliability and greater physical ruggedness.
Extremely long life. Some transistorized devices produced more than 30 years ago are still in
service.
Complementary devices available, facilitating the design of complementary-symmetry circuits,
something not possible with vacuum tubes.
Insensitivity to mechanical shock and vibration, thus avoiding the problem of microphonics in
audio applications.
Limitations



Silicon transistors do not operate at voltages higher than about 1000 volts (SiC devices can be
operated as high as 3000 volts). In contrast, electron tubes have been developed that can be
operated at tens of thousands of volts.
High power, high frequency operation, such as used in over-the-air television broadcasting, is
better achieved in electron tubes due to improved electron mobility in a vacuum.
On average, a higher degree of amplification linearity can be achieved in electron tubes as
compared to equivalent solid state devices, a characteristic that may be important in high fidelity
audio reproduction.
Silicon transistors are much more sensitive than electron tubes to an electromagnetic pulse, such as
generated by a nuclear explosion.
- 28 -
Integrated Circuit (www.answers.com)
Background
An integrated circuit, commonly referred to as an IC, is a microscopic array of electronic circuits and
components that has been diffused or implanted onto the surface of a single crystal, or chip, of
semiconducting material such as silicon. It is called an integrated circuit because the components, circuits,
and base material are all made together, or integrated, out of a single piece of silicon, as opposed to a
discrete circuit in which the components are made separately from different materials and assembled
later. ICs range in complexity from simple logic modules and amplifiers to complete microcomputers
containing millions of elements.
The impact of integrated circuits on our lives has been enormous. ICs have become the principal
components of almost all electronic devices. These miniature circuits have demonstrated low cost, high
reliability, low power requirements, and high processing speeds compared to the vacuum tubes and
transistors which preceded them. Integrated circuit microcomputers are now used as controllers in
equipment such as machine tools, vehicle operating systems, and other applications where hydraulic,
pneumatic, or mechanical controls were previously used. Because IC microcomputers are smaller and
more versatile than previous control mechanisms, they allow the equipment to respond to a wider range of
input and produce a wider range of output. They can also be reprogrammed without having to redesign
the control circuitry. Integrated circuit microcomputers are so inexpensive they are even found in children's
electronic toys.
The first integrated circuits were created in the late 1950s in response to a demand from the military for
miniaturized electronics to be used in missile control systems. At the time, transistors and printed circuit
boards were the state-of-the-art electronic technology. Although transistors made many new electronic
applications possible, engineers were still unable to make a small enough package for the large number of
components and circuits required in complex devices like sophisticated control systems and handheld
programmable calculators. Several companies were in competition to produce a breakthrough in
miniaturized electronics, and their development efforts were so close that there is some question as to
which company actually produced the first IC. In fact, when the integrated circuit was finally patented in
1959, the patent was awarded jointly to two individuals working separately at two different companies.
After the invention of the IC in 1959, the number of components and circuits that could be incorporated
into a single chip doubled every year for several years. The first integrated circuits contained only up to a
dozen components. The process that produced these early ICs was known as small scale integration, or
SSI. By the mid-1960s, medium scale integration, MSI, produced ICs with hundreds of components. This
was followed by large scale integration techniques, or LSI, which produced ICs with thousands of
components and made the first microcomputers possible.
The first microcomputer chip, often called a microprocessor, was developed by Intel Corporation in 1969.
It went into commercial production in 1971 as the Intel 4004. Intel introduced their 8088 chip in 1979,
followed by the Intel 80286, 80386, and 80486. In the late 1980s and early 1990s, the designations 286,
386, and 486 were well known to computer users as reflecting increasing levels of computing power and
speed. Intel's Pentium chip is the latest in this series and reflects an even higher level.
How Integrated Circuit
Components Are Formed
In an integrated circuit, electronic components such as resistors, capacitors, diodes, and transistors are
formed directly onto the surface of a silicon crystal. The process of manufacturing an integrated circuit will
make more sense if one first understands some of the basics of how these components are formed.
Even before the first IC was developed, it was known that common electronic components could be made
from silicon. The question was how to make them, and the connecting circuits, from the same piece of
silicon? The solution was to alter, or dope, the chemical composition of tiny areas on the silicon crystal
surface by adding other chemicals, called dopants. Some dopants bond with the silicon to produce regions
where the dopant atoms have one electron they can give up. These are called N regions. Other dopants
bond with the silicon to produce regions where the dopant atoms have room to take one electron. These
are called P regions. When a P region touches an N region, the boundary between them is referred to as
- 29 -
a PN junction. This boundary is only 0.000004 inches (0.0001 cm) wide, but is crucial to the operation of
integrated circuit components.
Within a PN junction, the atoms of the two regions bond in such a manner as to create a third region,
called a depletion region, in which the P dopant atoms capture all the N dopant extra electrons, thus
depleting them. One of the phenomena that results is that a positive voltage applied to the P region can
cause an electrical current to flow through the junction into the N region, but a similar positive voltage
applied to the N region will result in little or no current flowing through the junction back into the P region.
This ability of a PN junction to either conduct or insulate depending on which side the voltage is applied
can be used to form integrated circuit components that direct and control current flows in the same
manner as diodes and transistors. A diode, for example, is simply a single PN junction. By altering the
amount and types of dopants and changing the shapes and relative placements of P and N regions,
integrated circuit components that emulate the functions of resistors and capacitors can be also be
formed.
Design
Some integrated circuits can be considered standard, off-the-shelf items. Once designed, there is no
further design work required. Examples of standard ICs would include voltage regulators, amplifiers,
analog switches, and analog-to-digital or digital-to-analog converters. These ICs are usually sold to other
companies who incorporate them into printed circuit boards for various electronic products.
Other integrated circuits are unique and require extensive design work. An example would be a new
microprocessor for computers. This design work may require research and development of new materials
and new manufacturing techniques to achieve the final design.
Raw Materials
Pure silicon is the basis for most integrated circuits. It provides the base, or substrate for the entire chip
and is chemically doped to provide the N and P regions that make up the integrated circuit components.
The silicon must be so pure that only one out of every ten billion atoms can be an impurity. This would be
the equivalent of one grain of sugar in ten buckets of sand. Silicon dioxide is used as an insulator and as a
dielectric material in IC capacitors.
Typical N-type dopants include phosphorus and arsenic. Boron and gallium are typical P-type dopants.
Aluminum is commonly used as a connector between the various IC components. The thin wire leads from
the integrated circuit chip to its mounting package may be aluminum or gold. The mounting package itself
may be made from ceramic or plastic materials.
The Manufacturing
Process
Hundreds of integrated circuits are made at the same time on a single, thin slice of silicon and are then cut
apart into individual IC chips. The manufacturing process takes place in a tightly controlled environment
known as a clean room where the air is filtered to remove foreign particles. The few equipment operators
in the room wear lint-free garments, gloves, and coverings for their heads and feet. Since some IC
components are sensitive to certain frequencies of light, even the light sources are filtered. Although
- 30 -
manufacturing processes may vary depending on the integrated circuit being made, the following process
is typical.
Preparing the silicon wafer



A cylindrical ingot of silicon about 1.5 to 4.0 inches (3.8 to 10.2 cm) in diameter is held vertically
inside a vacuum chamber with a high-temperature heating coil encircling it. Starting at the top of
the cylinder, the silicon is heated to its melting point of about 2550°F (1400°C). To avoid
contamination, the heated region is contained only by the surface tension of the molten silicon. As
the region melts, any impurities in the silicon become mobile. The heating coil is slowly moved
down the length of the cylinder, and the impurities are carried along with the melted region. When
the heating coil reaches the bottom, almost all of the impurities have been swept along and are
concentrated there. The bottom is then sliced off, leaving a cylindrical ingot of purified silicon.
A thin, round wafer of silicon is cut off the ingot using a precise cutting machine called a wafer
slicer. Each slice is about 0.01 to 0.025 inches (0.004 to 0.01 cm) thick. The surface on which the
integrated circuits are to be formed is polished.
The surfaces of the wafer are coated with a layer of silicon dioxide to form an insulating base and
to prevent any oxidation of the silicon which would cause impurities. The silicon dioxide is formed
by subjecting the wafer to superheated steam at about 1830°F (1000°C) under several
atmospheres of pressure to allow the oxygen in the water vapor to react with the silicon.
Controlling the temperature and length of exposure controls the thickness of the silicon dioxide
layer.
Masking




The complex and interconnected design of the circuits and components is prepared in a process
similar to that used to make printed circuit boards. For ICs, however, the dimensions are much
smaller and there are many layers superimposed on top of each other. The design of each layer is
prepared on a computer-aided drafting machine, and the image is made into a mask which will be
optically reduced and transferred to the surface of the wafer. The mask is opaque in certain areas
and clear in others. It has the images for all of the several hundred integrated circuits to be formed
on the wafer.
A drop of photoresist material is placed in the center of the silicon wafer, and the wafer is spun
rapidly to distribute the photoresist over the entire surface. The photoresist is then baked to
remove the solvent.
The coated wafer is then placed under the first layer mask and irradiated with light. Because the
spaces between circuits and components are so small, ultraviolet light with a very short
wavelength is used to squeeze through the tiny clear areas on the mask. Beams of electrons or xrays are also sometimes used to irradiate the photoresist.
The mask is removed and portions of the photoresist are dissolved. If a positive photoresist was
used, then the areas that were irradiated will be dissolved. If a negative photoresist was used,
then the areas that were irradiated will remain. The uncovered areas are then either chemically
etched to open up a layer or are subjected to chemical doping to create a layer of P or N regions.
Doping—Atomic diffusion

One method of adding dopants to create a layer of P or N regions is atomic diffusion. In this
method a batch of wafers is placed in an oven made of a quartz tube surrounded by a heating
element. The wafers are heated to an operating temperature of about 1500-2200°F (816-1205°C),
and the dopant chemical is carried in on an inert gas. As the dopant and gas pass over the
wafers, the dopant is deposited on the hot surfaces left exposed by the masking process. This
method is good for doping relatively large areas, but is not accurate for smaller areas. There are
also some problems with the repeated use of high temperatures as successive layers are added.
Doping—lon implantation

The second method to add dopants is ion implantation. In this method a dopant gas, like
phosphine or boron trichloride, is ionized to provide a beam of high-energy dopant ions which are
fired at specific regions of the wafer. The ions penetrate the wafer and remain implanted. The
depth of penetration can be controlled by altering the beam energy, and the amount of dopant can
- 31 -
be controlled by altering the beam current and time of exposure. Schematically, the whole process
resembles firing a beam in a bent cathode-ray tube. This method is so precise, it does not require
masking—it just points and shoots the dopant where it is needed. However it is much slower than
the atomic diffusion process.
Making successive layers

The process of masking and etching or doping is repeated for each successive layer depending
on the doping process used until all of the integrated circuit chips are complete. Sometimes a
layer of silicon dioxide is laid down to provide an insulator between layers or components. This is
done through a process known as chemical vapor deposition, in which the wafer's surface is
heated to about 752°F (400°C), and a reaction between the gases silane and oxygen deposits a
layer of silicon dioxide. A final silicon dioxide layer seals the surface, a final etching opens up
contact points, and a layer of aluminum is deposited to make the contact pads. At this point, the
individual ICs are tested for electrical function.
Making individual ICs



The thin wafer is like a piece of glass. The hundreds of individual chips are separated by scoring a
crosshatch of lines with a fine diamond cutter and then putting the wafer under stress to cause
each chip to separate. Those ICs that failed the electrical test are discarded. Inspection under a
microscope reveals other ICs that were damaged by the separation process, and these are also
discarded.
The good ICs are individually bonded into their mounting package and the thin wire leads are
connected by either ultrasonic bonding or thermocompression. The mounting package is marked
with identifying part numbers and other information.
The completed integrated circuits are sealed in anti-static plastic bags to be stored or shipped to
the end user.
Quality Control
Despite the controlled environment and use of precision tools, a high number of integrated circuit chips
are rejected. Although the percentage of reject chips has steadily dropped over the years, the task of
making an interwoven lattice of microscopic circuits and components is still difficult, and a certain amount
of rejects are inevitable.
Hazardous Materials and
Recycling
The dopants gallium and arsenic, among others, are toxic substances and their storage, use, and disposal
must be tightly controlled.
Because integrated circuit chips are so versatile, a significant recycling industry has sprung up. Many ICs
and other electronic components are removed from otherwise obsolete equipment, tested, and resold for
use in other devices.
The Future
It is difficult to tell with any certainty what the future holds for the integrated circuit. Changes in technology
since the device's invention have been rapid, but evolutionary. Many changes have been made in the
architecture, or circuit layout, on a chip, but the integrated circuit still remains a silicon-based design.
The next major leap in the advancement of electronic devices, if such a leap is to come, may involve an
entirely new circuit technology. Better devices than the very best microprocessor have always been known
to be possible. The human brain, for example, processes information much more efficiently than any
computer, and some futurists have speculated that the next generation of processor circuits will be
biological, rather than mineral. At this point, such matters are the stuff of fiction. There are no immediate
signs that the integrated circuit is in any danger of extinction.
- 32 -
How Microprocessors Work
by Marshall Brain (HowStuffWorks.com)
2008 HowStuffWorks
Microprocessors are at the heart of all computers. See more computer hardware pictures.
The computer you are using to read this page uses a microprocessor to do its work. The
microprocessor is the heart of any normal computer, whether it is a desktop machine, a server or a laptop.
The microprocessor you are using might be a Pentium, a K6, a PowerPC, a Sparc or any of the many
other brands and types of microprocessors, but they all do approximately the same thing in approximately
the same way.
A microprocessor -- also known as a CPU or central processing unit -- is a complete computation engine
that is fabricated on a single chip. The first microprocessor was the Intel 4004, introduced in 1971. The
4004 was not very powerful -- all it could do was add and subtract, and it could only do that 4 bits at a
time. But it was amazing that everything was on one chip. Prior to the 4004, engineers built computers
either from collections of chips or from discrete components (transistors wired one at a time). The 4004
powered one of the first portable electronic calculators.
If you have ever wondered what the microprocessor in your computer is doing, or if you have ever
wondered about the differences between types of microprocessors, then read on. In this article, you will
learn how fairly simple digital logic techniques allow a computer to do its job, whether its playing a game
or spell checking a document!
Microprocessor Progression: Intel
The first microprocessor to make it into a home computer was the Intel 8080, a
complete 8-bit computer on one chip, introduced in 1974. The first
microprocessor to make a real splash in the market was the Intel 8088,
introduced in 1979 and incorporated into the IBM PC (which first appeared
around 1982). If you are familiar with the PC market and its history, you know
that the PC market moved from the 8088 to the 80286 to the 80386 to the
80486 to the Pentium to the Pentium II to the Pentium III to the Pentium 4. All of
these microprocessors are made by Intel and all of them are improvements on
the basic design of the 8088. The Pentium 4 can execute any piece of code
The Intel 8080 was the
that ran on the original 8088, but it does it about 5,000 times faster!
first microprocessor in
The following table helps you to understand the differences between the
a home computer. See
different processors that Intel has introduced over the years.
more microprocessor
pictures.
Clock
Data
Name
Date Transistors Microns
MIPS
speed
width
8080
1974
6,000
6
2 MHz
8 bits
0.64
8088
1979
29,000
3
5 MHz
16 bits
8-bit
0.33
- 33 -
bus
80286
1982
134,000
1.5
6 MHz
16 bits
1
80386
1985
275,000
1.5
16 MHz
32 bits
5
80486
1989
1,200,000
1
25 MHz
32 bits
20
Pentium
1993
3,100,000
0.8
60 MHz
32 bits
64-bit
bus
100
Pentium II
1997
7,500,000
0.35
233
MHz
32 bits
64-bit
bus
~300
Pentium III
1999
9,500,000
0.25
450
MHz
32 bits
64-bit
bus
~510
Pentium 4
2000 42,000,000
0.18
1.5 GHz
32 bits
64-bit ~1,700
bus
Pentium 4
"Prescott"
2004 125,000,000
0.09
3.6 GHz
32 bits
64-bit ~7,000
bus
Compiled from The Intel Microprocessor Quick Reference Guide and TSCP Benchmark Scores
Information about this table:
What's a Chip?
A chip is also called an integrated circuit. Generally it is a small,
thin piece of silicon onto which the transistors making up the
microprocessor have been etched. A chip might be as large as an
inch on a side and can contain tens of millions of transistors.
Simpler processors might consist of a few thousand transistors
etched onto a chip just a few millimeters square.
The date is the year that the processor was first introduced. Many processors are reintroduced at higher clock speeds for many years after the original release date.
Transistors is the number of transistors on the chip. You can see that the number of
transistors on a single chip has risen steadily over the years.
Microns is the width, in microns, of the smallest wire on the chip. For comparison, a human
hair is 100 microns thick. As the feature size on the chip goes down, the number of transistors
rises.
Clock speed is the maximum rate that the chip can be clocked at. Clock speed will make
more sense in the next section.
Data Width is the width of the ALU. An 8-bit ALU can add/subtract/multiply/etc. two 8-bit
numbers, while a 32-bit ALU can manipulate 32-bit numbers. An 8-bit ALU would have to
execute four instructions to add two 32-bit numbers, while a 32-bit ALU can do it in one
instruction. In many cases, the external data bus is the same width as the ALU, but not always.
The 8088 had a 16-bit ALU and an 8-bit bus, while the modern Pentiums fetch data 64 bits at a
time for their 32-bit ALUs.
MIPS stands for "millions of instructions per second" and is a rough measure of the
performance of a CPU. Modern CPUs can do so many different things that MIPS ratings lose a
lot of their meaning, but you can get a general sense of the relative power of the CPUs from
this column.
From this table you can see that, in general, there is a relationship between clock speed and MIPS. The
maximum clock speed is a function of the manufacturing process and delays within the chip. There is also
- 34 -
a relationship between the number of transistors and MIPS. For example, the 8088 clocked at 5 MHz but
only executed at 0.33 MIPS (about one instruction per 15 clock cycles). Modern processors can often
execute at a rate of two instructions per clock cycle. That improvement is directly related to the number of
transistors on the chip and will make more sense in the next section.
Microprocessor Logic
To understand how a microprocessor works, it is helpful to
look inside and learn about the logic used to create one. In the
process you can also learn about assembly language -- the
native language of a microprocessor -- and many of the things
that engineers can do to boost the speed of a processor.
A microprocessor executes a collection of machine
instructions that tell the processor what to do. Based on the
instructions, a microprocessor does three basic things:
Using its ALU (Arithmetic/Logic Unit), a
microprocessor can perform mathematical operations
like addition, subtraction, multiplication and division.
Photo courtesy Intel Corporation
Modern microprocessors contain complete floating
Intel Pentium 4 processor
point processors that can perform extremely
sophisticated operations on large floating point numbers.
A microprocessor can move data from one memory location to another.
A microprocessor can make decisions and jump to a new set of instructions based on those
decisions.
There may be very sophisticated things that a microprocessor does, but those are its three basic activities.
The following diagram shows an extremely simple microprocessor capable of doing those three things:
This is about as simple as a microprocessor gets. This microprocessor has:
An address bus (that may be 8, 16 or 32 bits wide) that sends an address to memory
A data bus (that may be 8, 16 or 32 bits wide) that can send data to memory or receive data
from memory
- 35 -
An RD (read) and WR (write) line to tell the memory whether it wants to set or get the
addressed location
A clock line that lets a clock pulse sequence the processor
A reset line that resets the program counter to zero (or whatever) and restarts execution
Let's assume that both the address and data buses are 8 bits wide in this example.
Here are the components of this simple microprocessor:
Registers A, B and C are simply latches made out of flip-flops. (See the section on "edgetriggered latches" in How Boolean Logic Works for details.)
The address latch is just like registers A, B and C.
The program counter is a latch with the extra ability to increment by 1 when told to do so, and
also to reset to zero when told to do so.
The ALU could be as simple as an 8-bit adder (see the section on adders in How Boolean
Logic Works for details), or it might be able to add, subtract, multiply and divide 8-bit values.
Let's assume the latter here.
The test register is a special latch that can hold values from comparisons performed in the
ALU. An ALU can normally compare two numbers and determine if they are equal, if one is
greater than the other, etc. The test register can also normally hold a carry bit from the last
stage of the adder. It stores these values in flip-flops and then the instruction decoder can use
the values to make decisions.
There are six boxes marked "3-State" in the diagram. These are tri-state buffers. A tri-state
buffer can pass a 1, a 0 or it can essentially disconnect its output (imagine a switch that totally
disconnects the output line from the wire that the output is heading toward). A tri-state buffer
allows multiple outputs to connect to a wire, but only one of them to actually drive a 1 or a 0
onto the line.
The instruction register and instruction decoder are responsible for controlling all of the other
components.
Although they are not shown in this diagram, there would be control lines from the instruction decoder that
would:
Tell the A register to latch the value currently on the data bus
Tell the B register to latch the value currently on the data bus
Tell the C register to latch the value currently output by the ALU
Tell the program counter register to latch the value currently on the data bus
Tell the address register to latch the value currently on the data bus
Tell the instruction register to latch the value currently on the data bus
Tell the program counter to increment
Tell the program counter to reset to zero
Activate any of the six tri-state buffers (six separate lines)
Tell the ALU what operation to perform
Tell the test register to latch the ALU's test bits
Activate the RD line
Activate the WR line
Coming into the instruction decoder are the bits from the test register and the clock line, as well as the bits
from the instruction register.
Microprocessor Memory
The previous section talked about the address and data buses, as well as the RD and WR lines. These
buses and lines connect either to RAM or ROM -- generally both. In our sample microprocessor, we have
an address bus 8 bits wide and a data bus 8 bits wide. That means that the microprocessor can address
(28) 256 bytes of memory, and it can read or write 8 bits of the memory at a time. Let's assume that this
simple microprocessor has 128 bytes of ROM starting at address 0 and 128 bytes of RAM starting at
address 128.
- 36 -
ROM chip
ROM stands for read-only memory. A ROM chip is programmed with a permanent collection of pre-set
bytes. The address bus tells the ROM chip which byte to get and place on the data bus. When the RD line
changes state, the ROM chip presents the selected byte onto the data
bus.
RAM stands for random-access memory. RAM contains bytes of
information, and the microprocessor can read or write to those bytes
depending on whether the RD or WR line is signaled. One problem with
today's RAM chips is that they forget everything once the power goes
off. That is why the computer needs ROM.
By the way, nearly all computers contain some amount of ROM (it is
possible to create a simple computer that contains no RAM -- many
RAM chip
microcontrollers do this by placing a handful of RAM bytes on the
processor chip itself -- but generally impossible to create one that contains no ROM). On a PC, the ROM
is called the BIOS (Basic Input/Output System). When the microprocessor starts, it begins executing
instructions it finds in the BIOS. The BIOS instructions do things like test the hardware in the machine, and
then it goes to the hard disk to fetch the boot sector (see How Hard Disks Work for details). This boot
sector is another small program, and the BIOS stores it in RAM after reading it off the disk. The
microprocessor then begins executing the boot sector's instructions from RAM. The boot sector program
will tell the microprocessor to fetch something else from the hard disk into RAM, which the microprocessor
then executes, and so on. This is how the microprocessor loads and executes the entire operating system.
Microprocessor Performance and Trends
The number of transistors available has a huge effect on the performance of a processor. As seen
earlier, a typical instruction in a processor like an 8088 took 15 clock cycles to execute. Because of the
design of the multiplier, it took approximately 80 cycles just to do one 16-bit multiplication on the 8088.
With more transistors, much more powerful multipliers capable of single-cycle speeds become possible.
More transistors also allow for a technology called pipelining. In a pipelined architecture, instruction
execution overlaps. So even though it might take five clock cycles to execute each instruction, there can
be five instructions in various stages of execution simultaneously. That way it looks like one instruction
completes every clock cycle.
Many modern processors have multiple instruction decoders, each with its own pipeline. This allows for
multiple instruction streams, which means that more than one instruction can complete during each clock
cycle. This technique can be quite complex to implement, so it takes lots of transistors.
Trends
The trend in processor design has primarily been toward full 32-bit ALUs with fast floating point
- 37 -
processors built in and pipelined execution with multiple instruction streams. The newest thing in
processor design is 64-bit ALUs, and people are expected to have these processors in their home PCs in
the next decade. There has also been a tendency toward special instructions (like the MMX instructions)
that make certain operations particularly efficient, and the addition of hardware virtual memory support
and L1 caching on the processor chip. All of these trends push up the transistor count, leading to the
multi-million transistor powerhouses available today. These processors can execute about one billion
instructions per second!
How Caching Works
by Guy Provost (HowStuffWorks.com)
2008 HowStuffWorks
Caching greatly increases the speed at which your computer pulls bits and bytes from memory.
See more computer memory pictures.
If you have been shopping for a computer, then you have heard the word "cache." Modern computers
have both L1 and L2 caches, and many now also have L3 cache. You may also have gotten advice on the
topic from well-meaning friends, perhaps something like "Don't buy that Celeron chip, it doesn't have any
cache in it!"
It turns out that caching is an important computer-science process that appears on every computer in a
variety of forms. There are memory caches, hardware and software disk caches, page caches and more.
Virtual memory is even a form of caching. In this article, we will explore caching so you can understand
why it is so important.
A Simple Example: Before Cache
Caching is a technology based on the memory subsystem of your computer. The main purpose of a
cache is to accelerate your computer while keeping the price of the computer low. Caching allows you to
do your computer tasks more rapidly.
To understand the basic idea behind a cache system, let's start with a super-simple example that uses a
librarian to demonstrate caching concepts. Let's imagine a librarian behind his desk. He is there to give
you the books you ask for. For the sake of simplicity, let's say you can't get the books yourself -- you have
to ask the librarian for any book you want to read, and he fetches it for you from a set of stacks in a
storeroom (the library of congress in Washington, D.C., is set up this way). First, let's start with a librarian
without cache.
The first customer arrives. He asks for the book Moby Dick. The librarian goes into the storeroom, gets the
book, returns to the counter and gives the book to the customer. Later, the client comes back to return the
book. The librarian takes the book and returns it to the storeroom. He then returns to his counter waiting
for another customer. Let's say the next customer asks for Moby Dick (you saw it coming...). The librarian
then has to return to the storeroom to get the book he recently handled and give it to the client. Under this
model, the librarian has to make a complete round trip to fetch every book -- even very popular ones that
are requested frequently. Is there a way to improve the performance of the librarian?
- 38 -
Yes, there's a way -- we can put a cache on the librarian. In the next section, we'll look at this same
example but this time, the librarian will use a caching system.
A Simple Example: After Cache
Let's give the librarian a backpack into which he will be able to store 10 books (in computer terms, the
librarian now has a 10-book cache). In this backpack, he will put the books the clients return to him, up to
a maximum of 10. Let's use the prior example, but now with our new-and-improved caching librarian.
The day starts. The backpack of the librarian is empty. Our first client arrives and asks for Moby Dick. No
magic here -- the librarian has to go to the storeroom to get the book. He gives it to the client. Later, the
client returns and gives the book back to the librarian. Instead of returning to the storeroom to return the
book, the librarian puts the book in his backpack and stands there (he checks first to see if the bag is full -more on that later). Another client arrives and asks for Moby Dick. Before going to the storeroom, the
librarian checks to see if this title is in his backpack. He finds it! All he has to do is take the book from the
backpack and give it to the client. There's no journey into the storeroom, so the client is served more
efficiently.
What if the client asked for a title not in the cache (the backpack)? In this case, the librarian is less
efficient with a cache than without one, because the librarian takes the time to look for the book in his
backpack first. One of the challenges of cache design is to minimize the impact of cache searches, and
modern hardware has reduced this time delay to practically zero. Even in our simple librarian example, the
latency time (the waiting time) of searching the cache is so small compared to the time to walk back to the
storeroom that it is irrelevant. The cache is small (10 books), and the time it takes to notice a miss is only
a tiny fraction of the time that a journey to the storeroom takes.
From this example you can see several important facts about caching:
Cache technology is the use of a faster but smaller memory type to accelerate a slower but
larger memory type.
When using a cache, you must check the cache to see if an item is in there. If it is there, it's
called a cache hit. If not, it is called a cache miss and the computer must wait for a round trip
from the larger, slower memory area.
A cache has some maximum size that is much smaller than the larger storage area.
It is possible to have multiple layers of cache. With our librarian example, the smaller but faster
memory type is the backpack, and the storeroom represents the larger and slower memory
type. This is a one-level cache. There might be another layer of cache consisting of a shelf that
can hold 100 books behind the counter. The librarian can check the backpack, then the shelf
and then the storeroom. This would be a two-level cache.
Computer Caches
A computer is a machine in which we measure time in very small increments. When the microprocessor
accesses the main memory (RAM), it does it in about 60 nanoseconds (60 billionths of a second). That's
pretty fast, but it is much slower than the typical microprocessor. Microprocessors can have cycle times as
short as 2 nanoseconds, so to a microprocessor 60 nanoseconds seems like an eternity.
What if we build a special memory bank in the motherboard, small but very fast (around 30
nanoseconds)? That's already two times faster than the main memory access. That's called a level 2
cache or an L2 cache. What if we build an even smaller but faster memory system directly into the
microprocessor's chip? That way, this memory will be accessed at the speed of the microprocessor and
not the speed of the memory bus. That's an L1 cache, which on a 233-megahertz (MHz) Pentium is 3.5
times faster than the L2 cache, which is two times faster than the access to main memory.
- 39 -
Some microprocessors have two levels of cache built right into the chip. In this case, the motherboard
cache -- the cache that exists between the microprocessor and main system memory -- becomes level 3,
or L3 cache.
There are a lot of subsystems in a computer; you can put cache between many of them to improve
performance. Here's an example. We have the microprocessor (the fastest thing in the computer). Then
there's the L1 cache that caches the L2 cache that caches the main memory which can be used (and is
often used) as a cache for even slower peripherals like hard disks and CD-ROMs. The hard disks are also
used to cache an even slower medium -- your Internet connection.
Caching Subsystems
Your Internet connection is the slowest link in your computer. So your browser (Internet Explorer,
Netscape, Opera, etc.) uses the hard disk to store HTML pages, putting them into a special folder on your
disk. The first time you ask for an HTML page, your browser renders it and a copy of it is also stored on
your disk. The next time you request access to this page, your browser checks if the date of the file on the
Internet is newer than the one cached. If the date is the same, your browser uses the one on your hard
disk instead of downloading it from Internet. In this case, the smaller but faster memory system is your
hard disk and the larger and slower one is the Internet.
Cache can also be built directly on peripherals. Modern hard disks come with fast memory, around 512
kilobytes, hardwired to the hard disk. The computer doesn't directly use this memory -- the hard-disk
controller does. For the computer, these memory chips are the disk itself. When the computer asks for
data from the hard disk, the hard-disk controller checks into this memory before moving the mechanical
parts of the hard disk (which is very slow compared to memory). If it finds the data that the computer
asked for in the cache, it will return the data stored in the cache without actually accessing data on the
disk itself, saving a lot of time.
Here's an experiment you can try. Your computer caches your floppy drive with main memory, and you
can actually see it happening. Access a large file from your floppy -- for example, open a 300-kilobyte text
file in a text editor. The first time, you will see the light on your floppy turning on, and you will wait. The
floppy disk is extremely slow, so it will take 20 seconds to load the file. Now, close the editor and open the
same file again. The second time (don't wait 30 minutes or do a lot of disk access between the two tries)
you won't see the light turning on, and you won't wait. The operating system checked into its memory
cache for the floppy disk and found what it was looking for. So instead of waiting 20 seconds, the data was
found in a memory subsystem much faster than when you first tried it (one access to the floppy disk takes
120 milliseconds, while one access to the main memory takes around 60 nanoseconds -- that's a lot
faster). You could have run the same test on your hard disk, but it's more evident on the floppy drive
because it's so slow.
To give you the big picture of it all, here's a list of a normal caching system:
L1 cache - Memory accesses at full microprocessor speed (10 nanoseconds, 4 kilobytes to 16
kilobytes in size)
L2 cache - Memory access of type SRAM (around 20 to 30 nanoseconds, 128 kilobytes to 512
kilobytes in size)
Main memory - Memory access of type RAM (around 60 nanoseconds, 32 megabytes to 128
megabytes in size)
Hard disk - Mechanical, slow (around 12 milliseconds, 1 gigabyte to 10 gigabytes in size)
Internet - Incredibly slow (between 1 second and 3 days, unlimited size)
As you can see, the L1 cache caches the L2 cache, which caches the main memory, which can be used
to cache the disk subsystems, and so on.
- 40 -
Cache Technology
One common question asked at this point is, "Why not make all of the computer's memory run at the same
speed as the L1 cache, so no caching would be required?" That would work, but it would be incredibly
expensive. The idea behind caching is to use a small amount of expensive memory to speed up a large
amount of slower, less-expensive memory.
In designing a computer, the goal is to allow the microprocessor to run at its full speed as inexpensively as
possible. A 500-MHz chip goes through 500 million cycles in one second (one cycle every two
nanoseconds). Without L1 and L2 caches, an access to the main memory takes 60 nanoseconds, or
about 30 wasted cycles accessing memory.
When you think about it, it is kind of incredible that such relatively tiny amounts of memory can maximize
the use of much larger amounts of memory. Think about a 256-kilobyte L2 cache that caches 64
megabytes of RAM. In this case, 256,000 bytes efficiently caches 64,000,000 bytes. Why does that work?
In computer science, we have a theoretical concept called locality of reference. It means that in a fairly
large program, only small portions are ever used at any one time. As strange as it may seem, locality of
reference works for the huge majority of programs. Even if the executable is 10 megabytes in size, only a
handful of bytes from that program are in use at any one time, and their rate of repetition is very high. On
the next page, you'll learn more about locality of reference.
How RAM Works
by Jeff Tyson and Dave Coustan (HowStuffWorks.com)
RAM is the best known form of computer memory and easy to upgrade. See more computer
hardware pictures.
Random access memory (RAM) is the best known form of computer memory. RAM is considered "random
access" because you can access any memory cell directly if you know the row and column that intersect
at that cell.
The opposite of RAM is serial access memory (SAM). SAM stores data as a series of memory cells that
can only be accessed sequentially (like a cassette tape). If the data is not in the current location, each
memory cell is checked until the needed data is found. SAM works very well for memory buffers, where
the data is normally stored in the order in which it will be used (a good example is the texture buffer
memory on a video card). RAM data, on the other hand, can be accessed in any order.
Similar to a microprocessor, a memory chip is an integrated circuit (IC) made of millions of transistors
and capacitors. In the most common form of computer memory, dynamic random access memory
(DRAM), a transistor and a capacitor are paired to create a memory cell, which represents a single bit of
data. The capacitor holds the bit of information -- a 0 or a 1 (see How Bits and Bytes Work for information
on bits). The transistor acts as a switch that lets the control circuitry on the memory chip read the
capacitor or change its state.
- 41 -
A capacitor is like a small bucket that is able to store electrons. To store a 1 in the memory cell, the bucket
is filled with electrons. To store a 0, it is emptied. The problem with the capacitor's bucket is that it has a
leak. In a matter of a few milliseconds a full bucket becomes empty. Therefore, for dynamic memory to
work, either the CPU or the memory controller has to come along and recharge all of the capacitors
holding a 1 before they discharge. To do this, the memory controller reads the memory and then writes it
right back. This refresh operation happens automatically thousands of times per second.
This refresh operation is where dynamic RAM gets its name. Dynamic RAM has to be dynamically
refreshed all of the time or it forgets what it is holding. The downside of all of this refreshing is that it takes
time and slows down the memory.
In this article, you'll learn all about what RAM is, what kind you should buy and how to install it. See the
next page to learn more about dynamic RAM and memory cells.
Memory Cells and DRAM
Memory cells are etched onto a silicon wafer in an array of columns (bitlines) and rows (wordlines). The
intersection of a bitline and wordline constitutes the address of the memory cell.
DRAM works by sending a charge through the appropriate column (CAS) to activate the transistor at each
bit in the column. When writing, the row lines contain the state the capacitor should take on. When
reading, the sense-amplifier determines the level of charge in the capacitor. If it is more than 50 percent, it
reads it as a 1; otherwise it reads it as a 0. The counter tracks the refresh sequence based on which rows
have been accessed in what order. The length of time necessary to do all this is so short that it is
expressed in nanoseconds (billionths of a second). A memory chip rating of 70ns means that it takes 70
nanoseconds to completely read and recharge each cell.
Memory cells alone would be worthless without some way to get information in and out of them. So the
memory cells have a whole support infrastructure of other specialized circuits. These circuits perform
functions such as:
Identifying each row and column (row address select and column address select)
Keeping track of the refresh sequence (counter)
Reading and restoring the signal from a cell (sense amplifier)
Telling a cell whether it should take a charge or not (write enable)
Other functions of the memory controller include a series of tasks that include identifying the type, speed
and amount of memory and checking for errors.
Static RAM works differently from DRAM. We'll look at how in the next section.
Static RAM
Static RAM uses a completely different technology. In static RAM, a form of flip-flop holds each bit of
memory (see How Boolean Logic Works for details on flip-flops). A flip-flop for a memory cell takes four or
six transistors along with some wiring, but never has to be refreshed. This makes static RAM significantly
faster than dynamic RAM. However, because it has more parts, a static memory cell takes up a lot more
space on a chip than a dynamic memory cell. Therefore, you get less memory per chip, and that makes
static RAM a lot more expensive.
Static RAM is fast and expensive, and dynamic RAM is less expensive and slower. So static RAM is used
to create the CPU's speed-sensitive cache, while dynamic RAM forms the larger system RAM space.
Memory chips in desktop computers originally used a pin configuration called dual inline package (DIP).
This pin configuration could be soldered into holes on the computer's motherboard or plugged into a
socket that was soldered on the motherboard. This method worked fine when computers typically
operated on a couple of megabytes or less of RAM, but as the need for memory grew, the number of
chips needing space on the motherboard increased.
- 42 -
The solution was to place the memory chips, along with all of the support components, on a separate
printed circuit board (PCB) that could then be plugged into a special connector (memory bank) on the
motherboard. Most of these chips use a small outline J-lead (SOJ) pin configuration, but quite a few
manufacturers use the thin small outline package (TSOP) configuration as well. The key difference
between these newer pin types and the original DIP configuration is that SOJ and TSOP chips are
surface-mounted to the PCB. In other words, the pins are soldered directly to the surface of the board,
not inserted in holes or sockets.
Memory chips are normally only available as part of a card called a module. You've probably seen
memory listed as 8x32 or 4x16. These numbers represent the number of the chips multiplied by the
capacity of each individual chip, which is measured in megabits (Mb), or one million bits. Take the result
and divide it by eight to get the number of megabytes on that module. For example, 4x32 means that the
module has four 32-megabit chips. Multiply 4 by 32 and you get 128 megabits. Since we know that a byte
has 8 bits, we need to divide our result of 128 by 8. Our result is 16 megabytes!
In the next section we'll look at some other common types of RAM.
Types of RAM
The following are some common types of RAM:
SRAM: Static random access memory uses multiple transistors, typically four to six, for each
memory cell but doesn't have a capacitor in each cell. It is used primarily for cache.
DRAM: Dynamic random access memory has memory cells with a paired transistor and
capacitor requiring constant refreshing.
FPM DRAM: Fast page mode dynamic random access memory was the original form of
DRAM. It waits through the entire process of locating a bit of data by column and row and then
reading the bit before it starts on the next bit. Maximum transfer rate to L2 cache is
approximately 176 MBps.
EDO DRAM: Extended data-out dynamic random access memory does not wait for all of
the processing of the first bit before continuing to the next one. As soon as the address of the
first bit is located, EDO DRAM begins looking for the next bit. It is about five percent faster than
FPM. Maximum transfer rate to L2 cache is approximately 264 MBps.
SDRAM: Synchronous dynamic random access memory takes advantage of the burst
mode concept to greatly improve performance. It does this by staying on the row containing the
requested bit and moving rapidly through the columns, reading each bit as it goes. The idea is
that most of the time the data needed by the CPU will be in sequence. SDRAM is about five
percent faster than EDO RAM and is the most common form in desktops today. Maximum
transfer rate to L2 cache is approximately 528 MBps.
DDR SDRAM: Double data rate synchronous dynamic RAM is just like SDRAM except that
is has higher bandwidth, meaning greater speed. Maximum transfer rate to L2 cache is
approximately 1,064 MBps (for DDR SDRAM 133 MHZ).
RDRAM: Rambus dynamic random access memory is a radical departure from the previous
DRAM architecture. Designed by Rambus, RDRAM uses a Rambus in-line memory module
(RIMM), which is similar in size and pin configuration to a standard DIMM. What makes
RDRAM so different is its use of a special high-speed data bus called the Rambus channel.
RDRAM memory chips work in parallel to achieve a data rate of 800 MHz, or 1,600 MBps.
Since they operate at such high speeds, they generate much more heat than other types of
chips. To help dissipate the excess heat Rambus chips are fitted with a heat spreader, which
looks like a long thin wafer. Just like there are smaller versions of DIMMs, there are also SORIMMs, designed for notebook computers.
Credit Card Memory: Credit card memory is a proprietary self-contained DRAM memory
module that plugs into a special slot for use in notebook computers.
- 43 -
PCMCIA Memory Card: Another self-contained DRAM module for notebooks, cards of this
type are not proprietary and should work with any notebook computer whose system bus
matches the memory card's configuration.
CMOS RAM: CMOS RAM is a term for the small amount of memory used by your computer
and some other devices to remember things like hard disk settings -- see Why does my
computer need a battery? for details. This memory uses a small battery to provide it with the
power it needs to maintain the memory contents.
VRAM: VideoRAM, also known as multiport dynamic random access memory (MPDRAM), is a type of
RAM used specifically for video adapters or 3-D accelerators. The "multiport" part comes from the fact that
VRAM normally has two independent access ports instead of one, allowing the CPU and graphics
processor to access the RAM simultaneously. VRAM is located on the graphics card and comes in a
variety of formats, many of which are proprietary. The amount of VRAM is a determining factor in the
resolution and color depth of the display. VRAM is also used to hold graphics-specific information such as
3-D geometry data and texture maps. True multiport VRAM tends to be expensive, so today, many
graphics cards use SGRAM (synchronous graphics RAM) instead. Performance is nearly the same, but
SGRAM is cheaper.
- 44 -
How Analog-to-Digital Converter (ADC) Works
Author: Gabriel Torres
www.hardwaresecrets.com
Introduction
Signals in the real world are analog: light, sound, you name it. So, real-world signals must
be converted into digital, using a circuit called ADC (Analog-to-Digital Converter), before
they can be manipulated by digital equipment. In this tutorial we will give an in-depth
explanation about analog-to-digital conversion yet keeping a very easy to follow language.
When you scan a picture with a scanner what the scanner is doing is an analog-to-digital
conversion: it is taking the analog information provided by the picture (light) and converting
into digital.
When you record your voice or use a VoIP solution on your computer, you are using an
analog-to-digital converter to convert your voice, which is analog, into digital information.
Digital information isn’t only restricted to computers. When you talk on the phone, for
example, your voice is converted into digital (at the central office switch, if you use an
analog line, or at you home, if you use a digital line like ISDN or DSL), since your voice is
analog and the communication between the phone switches is done digitally.
When an audio CD is recorded at a studio, once again analog-to-digital is taking place,
converting sounds into digital numbers that will be stored on the disc.
Whenever we need the analog signal back, the opposite conversion – digital-to-analog,
which is done by a circuit called DAC, Digital-to-Analog Converter – is needed. When you
play an audio CD, what the CD player is doing is reading digital information stored on the
disc and converting it back to analog so you can hear the music. When you are talking on
the phone, a digital-to-analog conversion is also taking place (at the central office switch, if
you use an analog line, or at you home, if you use a digital line like ISDN or DSL), so you
can hear what the other party is saying.
But, why digital? There are some basic reasons to use digital signals instead of analog, noise
being the number one.
Since analog signals can assume any value, noise is interpreted as being part of the original
signal. For example, when you listen to a LP record, you hear noise because the needle is
analog and thus don’t know the difference from the music originally recorded from the noise
inserted by dust or cracks.
Digital systems, on the other hand, can only understand two numbers, zero and one.
Anything different from this is discarded. That’s why you won’t hear any unwanted noise
when listening to an audio CD, even if you played it thousands of times before (actually
depending on your sound system you can hear some noise when playing audio CDs, but this
noise, called white noise, isn’t produced by the CD media, but by the CD player, amplifier or
cables used, and is introduced in the audio path after the digital data found on the CD was
already converted back to analog – as you see, the problem lies in the analog part).
Another advantage of digital system against analog is the data compression capability. Since
the digital counterpart of an analog signal is just a bunch of numbers, these numbers can be
compressed, just like you would compress a Word file using WinZip to shrink down the file
size, for example. The compression can be done to save storage space or bandwidth. On all
- 45 -
the examples given so far no compression is used. We will talk again about it when
discussing surround sound.
How It Works: Sampling
For our explanations, consider the analog signal found on Figure 1. Let’s assume that it is an
audio signal, since this the most popular applications for analog-to-digital and digital-toanalog conversions. The “y” axis represents voltage while the “x” axis represents time.
click to enlarge
Figure 1: An analog signal.
What the ADC circuit does is to take samples from the analog signal from time to time. Each
sample will be converted into a number, based on its voltage level. On Figure 2 you see an
example of some sampling points on our analog signal.
click to enlarge
Figure 2: Sampling points.
The frequency on which the sampling will occur is called sampling rate. If a sampling rate of
22,050 Hz is used, for example, this means that in one second 22,050 points will be
sampled. Thus, the distance of each sampling point will be of 1 / 22,050 second (45.35 µs,
in this case). If a sampling rate of 44,100 Hz is used, it means that 44,100 points will be
captured per second. In this case the distance of each point will be of 1 / 44,100 second or
22.675 µs. And so on.
During the digital-to-analog conversion, the numbers will be converted again into voltages.
If you think about it for a while, you will see that the waveform resulted from the digital-toanalog conversion won’t be perfect, as it won’t have all the points from the original analog
signal, just some of them. In other words, the digital-to-analog converter will connect all the
points captured by the analog-to-digital converter, any values that existed originally
between these points will be suppressed.
- 46 -
You can see an example on Figure 3, where we show how the signal would be after being
converted to digital and back to analog. As you can see, the original waveform is more
“rounded”.
click to enlarge
Figure 3: Signal after being converted to digital and back to analog.
So, the more sampling points we use – i.e. the higher the sampling rate –, the more perfect
will be the analog signal produced by the digital-to-analog converter (DAC). However, the
more samples we capture more storage space is necessary to store the resulting digital
data. For example, an analog-to-digital conversion using a 44,100 Hz sampling rate will
generate twice the number of data as a conversion using a 22,050 Hz sampling rate, as it
will capture twice the samples from the original waveform.
If you use a low sampling rate, the waveform generated at the DAC will be very different
from the original analog signal. If it is music, for example, the music you will play will have a
very bad quality.
So, we have this dilemma: if the sampling rate is too high, the output quality will be close to
perfection, but you will need a lot of storage space to hold the generated data (i.e. the
generated file will be very big); if the sampling rate is too low, the output quality will be bad.
How can you know the best sampling rate to be used during analog-to-digital conversions to
have the best storage/quality balance? The answer is the Nyquist Theorem.
This theorem states that the sampling rate on analog-to-digital conversions must be at least
two times the value of the highest frequency you want to capture.
Since the human ear listens to sounds up to the frequency of 20 KHz, for music we need to
use a sampling rate of at least 40,000 Hz. In fact, the CD uses a 44,100 Hz sampling rate,
thus capturing more than our ears can hear (this value was arbitrated by Philips and Sony
when they created the CD). Some professional audio applications use an even higher
sampling rate.
- 47 -
The phone system, on the other hand, was created to transmit only human voice, which has
a lower frequency range, up to 4 KHz. So on the digital part of the phone system, an 8,000
Hz sampling rate is used. That’s why if you try to transmit music thru the phone the quality
is bad: the phone circuitry cancels all frequencies above 4 KHz (ask a friend to put his/her
phone near a stereo playing and you will hear what we are talking about).
How It Works: Resolution
The value of each sampled point will be stored on a fixed-length variable. If this variable
uses eight bits, this means it can hold values from 0 to 255 (2^8 = 256). If this variable
uses 16 bits, this means it can hold values from 0 to 65,535 (2^16 = 65,536). And so on.
So, if you are using an 8-bit analog-to-digital converter, the lowest value will be zero and
the highest value will be 255. If a 16-bit analog-to-digital converter is used, the lowest value
will be zero and the highest value will be 65,535. See Figure 4.
click to enlarge
Figure 4: 8- and 16-bit resolutions comparison.
What the ADC does is to divide the “y” axis in “n” possible parts between the maximum and
the minimum values of the original analog signal, and this “n” is given by the variable size.
If the variable size is too small, what will happen is that two sampling points close to each
other will have the same digital representation, thus not corresponding exactly to the
original value found on the original analog signal, making the analog waveform available at
the DAC output to not have the best quality.
Once again, the highest the variable size, the better the quality will be, but more storage
space will be needed. Using a 16-bit variable will required twice the storage space if an 8-bit
variable was used, but the quality will be far better.
One of the ways to know the necessary number of bits for an ADC is by calculating the
desired noise level. Since the values sampled from the original analog signal will several
times need to be “rounded” to the nearest possible digital equivalent, this provides what is
called quantization noise. The tolerable noise level depends on the application. The phone
system can have a higher noise level than an audio CD, for example, since we want to hear
our CDs with the best possible quality.
The signal-to-noise ratio (SNR), which measures the noise level, can be easily calculated
thru this formula, where n is the number of bits used on the ADC:
- 48 -
SNR = 6.02 x n + 1.76 dB
The higher the SNR, the better. An 8-bit ADC provides a SNR of 49.9 dB, while a 16-bit SNR
provides a SNR of 98 dB (which is, by the way, a virtually no-noise value).
Audio CDs use 16-bit resolution, while the phone system uses 8-bit resolution. High-end and
professional audio applications use 20- or even 24-bit resolution.
In summary, while the sampling rate give us the analog-to-digital “x” axis resolution, the
variable size gives us the “y” axis resolution.
Knowing the sampling rate and the variable size (a.k.a. resolution) you can easily calculate
the storage space (or the bandwidth, in the case of audio transmission) that will be
necessary to store the data generated by the ADC.
The phone system, for example, uses an 8,000 Hz sampling rate and each sample is stored
on an eight-bit variable. So the transmission rate of the analog-to-digital conversion is of
64,000 bits per second (8,000 x 8) or 64 Kbps (this is rounded, since 1 K = 1,024; thus 64
Kbps would be 65,536 bps and not 64,000 bps). If you whish to record a phone
conversation, the space that it would require would be 8,000 bytes per second (64,000 / 8)
or 480,000 bytes per minute (8,000 x 60), i.e. 468.75 KB per minute.
The CD uses a 44,100 Hz sampling rate and each sample is stored on a 16-bit variable. Also,
the CD has two independent channels (left and right, what is played at one channel can be
completely different from what is played at the other). So the transmission rate of the
analog-to-digital conversion of the CD system is of 1,411,200 bps (44,100 x 16 x 2) or 1.41
Mbps (once again this is rounded, since 1 M = 1,048,576). The storage space that is
necessary is of 176,400 bytes per second (1,411,200 / 8) or 10,584,000 bytes per minute
(176,400 x 60), i.e. 10 MB per minute.
Since each CD can hold up to 74 minutes of music, this means that a CD can store 740 MB
of music information (74 minutes x 10 MB per minute). On CD-ROM mode a CD can store
less, 650 MB, because part of its storage space is used for error-correction code (ECC).
The “pure” data obtained from the analog-to-digital conversion is better known as PCM,
Pulse Code Modulation. PCM is also referred as “uncompressed digital audio”. CDs use PCM
audio, as we have been explained so far. DVDs, however, can use PCM audio as an option,
but they can also use compressed audio – which is our next subject.
Surround Audio: Audio Compression
When we made the math to find out how much storage space the CD-quality audio would
need, we had to multiply the required storage space per two, since the CD uses two
independent audio channels. You can record totally different audio streams on each channel
(left and right) of a CD. They are completely independent.
So, imagine how much storage space a surround sound system would need, since they use
four or more independent audio channels. If we make the math for the most popular
surround sound format nowadays, the 5.1 – which is used by DVDs –, we would come to the
conclusion that it would require 441,000 bytes per second of storage space, or 25 MB per
minute, if CD-quality audio is used. If you take a typical one and a half hour movie, you
would need 2.2 GB of storage space just for storing the audio data, not counting the movie
itself!
Just one parenthesis. For the above calculations we considered only five channels of audio.
The sixth channel, the subwoofer channel (a.k.a. LFE, Low Frequency Effects), would require
less storage space, since we can use a lower sampling rate for it, since it is used only for
- 49 -
lower-frequency sounds. That’s why the name is “5.1” and not “6”: the sixth channel isn’t a
“full” channel. If we considered the subwoofer channel, the required storage space would be
even greater.
The solution is to use audio compression, to cut off the amount of required storage space.
All audio compression algorithms available on DVDs are data-loss, i.e. the output signal is
not equal to the original sound. Even though experts claim that a regular user wouldn’t
notice the difference between uncompressed (PCM) audio and data-loss compressed audio,
audiophiles claim that they can hear the difference. That’s why for certain titles 2-channel
PCM audio (i.e. CD-quality audio) is an option.
The two most popular commercial audio compression algorithms are Dolby Digital (also
known as AC3) and DTS (Digital Theater System). Dolby Digital bitrate varies between 384
Kbps and 448 Kbps, although it is theoretically possible to go as high as 640 Kbps. DTS
bitrate varies between 768 Kbps and 1,536 Kbps. Since DTS uses a higher bitrate than AC3,
experts claim that it has a better quality than Dolby Digital, since the higher the bitrate, the
less original data was lost on the compression. Just to put those numbers in perspective, a
5-channel PCM audio with CD-quality has a bit rate of 3,445 Kbps (once again not counting
the LFE channel).
On the practical side, there are other differences. DVDs with DTS-encoded audio can only be
played on home theater receivers capable of decompressing DTS, while all home theater
receivers can play DVDs with Dolby Digital compressed audio. On movies theaters, Dolby
Digital-based movies use an optical audio track with the digital data encoded, while DTSbased movies have just a control track that commands a CD-ROM that has the digital audio
information stored.
You can consider the analog-to-digital converter as a closed box, as shown on Figure 5. But
what is inside the box? That is exactly what we are going to explain now.
There are several ways to build an ADC. We can divide ADC design into four main groups:




Parallel design (also known as Flash ADC);
Digital-to-Analog Converter-based design (e.g. ramp counter, successive
approximation, tracking);
Integrator-based design (e.g. single-slope, dual-slope);
Sigma-delta design (also known as delta-sigma, 1-bit ADC or oversampling ADC).
Parallel Design
The Flash ADC, also called parallel ADC, is very easy to understand. It works by comparing
the input voltage – i.e. the analog signal – to a reference voltage, which would be the
maximum value achieved by the analog signal. For example, if the reference voltage is of 5
- 50 -
volts, this means that the peak of the analog signal would be 5 volts. On an 8-bit ADC when
the input signal reached 5 volts we would find a 255 (11111111) value on the ADC output,
i.e. the maximum value possible.
Then the voltage reference is lowered thru a resistor network and other comparators added,
so the input voltage (analog signal) can be compared to other values.
On Figure 6 you can see a 3-bit Flash ADC. The comparison is done thru an op amp. All
resistors have the same value.
Figure 6: Flash ADC.
The priority encoder can be done using XOR gates and a series of diodes and resistors, like
shown on Figure 7, or a single chip like 74148 (3-line to 8-line priority encoder).
Figure 7: Flash ADC.
- 51 -
Even though Flash ADC uses a very simple design, it requires a lot of components. The
number of required comparers is 2^n-1, where n is the number of output bits. Thus for an
eight-bit Flash ADC 255 comparers would be necessary, and for a 16-bit Flash ADC, 65,535!
On the other hand, Flash ADC is the fastest ADC type available. The digital equivalent of the
analog signal will be available right away at it output (it will only have the propagation delay
inserted by the logic gates) – hence the name “flash”.
Another advantage of Flash ADC is that you can create an ADC with non-linear output.
Usually ADCs have a linear output, i.e. each digital number corresponds to a fixed voltage
increase on the analog input. For example, on the 3-bit ADC shown above with a Vref of 5 V,
each digital number would represent 625 mV (5 V / 2^3). So 0 V = 000, 0.625 V = 001,
1.250 V = 010 and so on up to 5 V = 111.
Since Flash ADC comparisons are set by a set of resistors, one could set different values for
the resistors in order to obtain a non-linear output, i.e. one value would represent a different
voltage step from the other values.
- 52 -
How Relays Work
by Madeline Bullock (HowStuffWorks.com)
A relay is a simple electromechanical switch made up of an electromagnet and a set of contacts. Relays
are found hidden in all sorts of devices. In fact, some of the first computers ever built used relays to
implement Boolean gates.
In this article, we will look at how relays work and a few of their applications.
Relay Construction
Relays are amazingly simple devices. There are four parts in every relay:
Electromagnet
Armature that can be attracted by the electromagnet
Spring
Set of electrical contacts
The following figure shows these four parts in action:
In this figure, you can see that a relay consists of two separate and completely independent circuits. The
first is at the bottom and drives the electromagnet. In this circuit, a switch is controlling power to the
electromagnet. When the switch is on, the electromagnet is on, and it attracts the armature (blue). The
- 53 -
armature is acting as a switch in the second circuit. When the electromagnet is energized, the armature
completes the second circuit and the light is on. When the electromagnet is not energized, the spring pulls
the armature away and the circuit is not complete. In that case, the light is dark.
When you purchase relays, you generally have control over several variables:
The voltage and current that is needed to activate the armature
The maximum voltage and current that can run through the armature and the armature
contacts
The number of armatures (generally one or two)
The number of contacts for the armature (generally one or two -- the relay shown here has
two, one of which is unused)
Whether the contact (if only one contact is provided) is normally open (NO) or normally closed
(NC)
Relay Applications
In general, the point of a relay is to use a small amount of power in the electromagnet -- coming, say, from
a small dashboard switch or a low-power electronic circuit -- to move an armature that is able to switch a
much larger amount of power. For example, you might want the electromagnet to energize using 5 volts
and 50 milliamps (250 milliwatts), while the armature can support 120V AC at 2 amps (240 watts).
Relays are quite common in home appliances where there is an electronic control turning on something
like a motor or a light. They are also common in cars, where the 12V supply voltage means that just about
everything needs a large amount of current. In later model cars, manufacturers have started combining
relay panels into the fuse box to make maintenance easier. For example, the six gray boxes in this photo
of a Ford Windstar fuse box are all relays:
In places where a large amount of power needs to be switched, relays are often cascaded. In this case, a
small relay switches the power needed to drive a much larger relay, and that second relay switches the
power to drive the load.
- 54 -
1900's: The Vacuum Tube.
1905
First electronic diode vacuum tube is built by English
physicist J. Ambrose Fleming, allowing the change of
alternating current into a direct one-way signal.
1906
First electronic triode vacuum tube is built by American
electrical engineer Lee DeForest, allowing signals to be
controlled and amplified. Technology of electronics is born.
Late 1940's: The Transistor.
1947
The point-contact bipolar transistor is invented by Bell
Lab's Bardeen, Shockley, and Brattain.
1951
Junction field-effect transistor (JFET) is invented.
1952
Single-crystal silicon is fabricated.
1954
Oxide masking process is developed.
Late 1950s:
Key IC discoveries.
1958
First silicon integrated circuit is built by Texas
Instrument's Jack Kilby.
1959
Planar process to distribute transistors on silicon, with
passive oxide layers to protect junctions, is developed
by Fairchild Semiconductor's Noyce and Moore. A modern
version of this process is used today.
1960's: Small Scale Integration (SSI), up to 20 gates per chip.
1960
Metal-Oxide-Silicon (MOS) transistor is invented.
1962
Transistor-transistor Logic (TTL) is developed.
1963
Complementary Metal Oxide Silicon (CMOS) is invented.
Late 1960's: Medium Scale Integration (MSI), 20-200 gates per chip.
1968
MOS memory circuits are introduced.
1970's: Large Scale Integration (LSI), 200-5000 gates per chip.
1970
8-bit MOS calculator chips are introduced, 7 micrometer
chip geometries.
1971
16-bit Microprocessors are introduced.
1980's: Very Large Scale Integration (VLSI), over 5000 gates per chip.
1981
Very High Speed Integration (VHSIC), tens's of thousands of
gates per chip, 1.5 micrometer chip geometries.
1984 0.5 micrometer chip geometries.
- 55 -
- 56 -
- 57 -