Вы находитесь на странице: 1из 2

8-bit is named after the fact that there are 8 wires for each value; each wire represents

a power of 2.
If we start at 20, this means that 8-bit computers can only store (unsigned) values up to 255, hence
that lovely glitch that happens at level 256 of every arcade game ever~

Basic arithmetic with binary:

0110 6
+ 0111 7
= 1101 13
Im sure you couldntve possibly known how to do this without me.

Truth table for each digit of a calculation; Cin is the carried digit into this place, Cout is for carrying to
the next digit of the calculation. The general formulae are
=
. . + . . + . . + . .
and =
. . + . . + . . + . .
Where a variable with a line above it represents an inverse; so is the inverse of .
You can make circuits for this; for Cin, A, and B, divide each into two wires, one of which starts with a
NOT gate to represent the inverse and the other is just a normal wire for the normal value.
Dots joining variables means that the variables are plugged into an AND gate; all AND gates for Sum
are dumped into one OR gate to get the sum, and another OR gate is used for summing Cout. This is
an adder circuit in total.
The Cout is the Cin of the next adder. (inb4 the last one loops back to the first.)
Oh, and this set of circuits is called a ripple adder. But if we assume that each transistor is 5
nanoseconds, the pathway of NOT->AND->OR is 5+15+5 nanoseconds (5 for NOT, 10 for NAND+5 for
NOT, 5 for OR because it can work with all of the inputs in parallel), so 25 nanoseconds for just one
adder. This is very inefficient; the other adders are left waiting for a relatively long time, and is not
what we do in reality.

(WIP) Truth table for Adder:

Cin A B Sum Cout


0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1

One may produce a subtractor, in the same way as the adder from earlier was produced. However, it
is possible to use the circuit for Adders for Subtractors too!

Subtracting is effectively the same as computing + + 1; just invert the Cout, as Cout for
addition is only 0 if A is 0 and B is 1, but the ToBorrow value for subtraction (Basically Cout) is only 1
if A is 0 and B is 1!

By the way, lemme blow your mind and say that XOR is basically just a 1-input OR gate where input B
simply determines whether or not input A is inverted.

So theres a new wire going into the adder from earlier, which is at 0 for adding and 1 for
subtracting. Its plugged into Cin to provide the 1 for the addition operation when subtracting. Its
plugged into an XOR gate with B to invert it for the addition operation for subtracting. Finally, Cout is
plugged into an XOR gate with a subline going from the add/sub wire, to invert Cout when
subtracting.

Now this only works for the first adder in a series, so we apparently need to handwave the other
adders in the series re:Cin. The XOR gate in Cout is also missing; the only modification to the others is
apparently the XOR gate for input B.

Reminder: This uses Twos Complement.

Вам также может понравиться