Logic Gate Basic 02
Logic Gate Basic 02
a
b
NAND
NAND
OFF
This is a representation of a gate. The two wires on the
left (a and b) are the inputs, and the wire on the right
(c) is the output. All three wires are bits, which means
that they are either on or off. Each input bit comes
from somewhere else in the computer and is either on or
off depending on what is happening where it came from,
and then this gate sets its output on or off depending
on the states of its two inputs.
Sometimes it is useful to make a little chart that shows
how the various input combinations create the output,
like this:
Simple Variations
As mentioned, this gate is the only thing you need to
build a computer, but you need a lot of them, and they
have to be wired together in an intelligent manner in
order to be able to make them do something useful. What
we are going to do here is to show two simple things
that are done many times inside any computer.
This first one is very simple. Take the gate above, and
take the two input wires, a and b, and tie them
together. Thus a and b will always be the same. They
can still be changed on and off, but a and b can
never be different. A and b can either both be on,
or both be off. Thus the chart of this combination only
has two lines on it, two possibilities:
a
b
NAND
NOT
NAND
NOT
i
i
i
i
i
i
i
i
M
M
M
M
M
M
M
M
0
0
0
0
0
0
0
0
i
i
i
i
i
i
i
i
0
0
0
0
0
0
0
0
s
This assembly has a name; it is called a byte, thus the
B in the diagram. There are several conflicting
explanations of exactly where this word came from, but
since it sounds just like the word bite, you can just
think of it as a whole mouthful compared with a smaller
unit, a bit. Just to show you that computer designers do
have a sense of humor, when they use four bits as a
unit, they call it a nibble. So you can eat a tiny bit
of cherry pie, or have a nibble or take a whole byte.
When we had a bit, we would just say that its state was
either 0 or 1. Now that we have a byte, we will write
the contents of the byte like this: 0000 0000, and you
can see why we switched from using off/on to 0/1. That
shows the contents of each of the eight bits, in this
case they are all zeros. The space in the middle is just
there to make it a little easier to read. The left hand
0 or 1 would correspond to the top bit in our byte, and
the rightmost 0 or 1 would represent the bottom bit.
As you had better know by now, a bit has two possible
states that it can be in on or off. If you have two
bits, there are four possible states that those two bits
can be in. Do you remember the chart we drew for the
inputs of the NAND gate? There were four lines on the
chart, one for each possible combination of the two
input bits to the gate, 0-0, 0-1, 1-0 and 1-1.
Notice that the order of the bits does matter that is,
if you look at two bits and only ask how many bits are
on, there are only three possibilities: no bits on, one
bit on or two bits on. That would be calling the 1-0 and
0-1 combinations the same thing. For the purpose of
using multiple bits to implement a code, we definitely
care about the order of the bits in a byte. When there
are two bits, we want to use all four possibilities, so
we have to keep the bits in order.
How many different possibilities are there when you use
eight bits? If all you have is one bit, it can be in one
of two states. If you add a second bit, the pair has
twice as many states as before because the old bit has
its two states while the new bit is one way, and then
the old bit has its two states while the new bit is the
other way. So two bits have four states. When you add a
third bit, the first two have four states with the new
bit off and four states with the new bit on, for a total
of eight states. Every time you add a bit, you just
double the number of possible states. Four bits have 16
states, five have 32, six have 64, seven have 128, eight
have 256, nine have 512 states, and so on.
We are going to take eight bits, and call it a byte.
Since a bit is a thing that has a location in space,
that can be in one of two states, then a byte is a thing
that has eight separate locations in space, each of
which can be on or off, that are kept in the same order.
The byte, taken as a whole, is a location in space that
can be in any one of 256 states at any given time, and
may be made to change its state over time.