make a four-bit computer yourself
Have you ever wondered why computers are subtraction? Or more directly, what is the principle of the computer?
First, what is binary?
First, from the simplest of words.
The internal computer uses binary, each digit only two possible "0″ and"1″, the arithmetic rule is "every two enters one". For example, there are two bits a and B, and they add up to only four of the results.
This is called the "Truth Table" (Truth Table), where thesumrepresents "and bit",Carryrepresents "rounding". IfAand theB's All0, and is0, so "and bit" and "rounding " are0; ifAand theBthere is one for1, the other is0, and is1, no rounding is required;Aand theB's All1, and isTen, so "and bit" for0, "Carry" is1.
Logical Gate (logic gate)
The rules for Boolean operations (Boolean operation) can be applied to binary addition. There are three basic operators for Boolean operations:and,or,not, also known as "with Gate", "or gate", "Non-gate", collectively " Logic gates. " Their operational rules are:
and : If (A=1 and B=1) , the output is 1 .
OR : If (a=1 OR b=1) , the output is 1 .
NOT : if ( A=1 ) 0
two inputs (a b 1 and (with gate) output 1 ; As long as there is any one input ( a or b ) is 1 or (or gate) on output 1 not (non-gate) function, is to output an input value of the opposite value. Their graphical representation is as follows:
Third, the logical gate of the truth table expression
Now the "Truth table" operation rules are rewritten as the form of logic gates.
Looking at sum(and bit), what we need is a logic: when two inputs are not the same, the output is 1, so the operator should be OR, andwhen two inputs are identical, The output is 0, which can be implemented with two sets of and and not combinations. The final logical combination diagram is as follows:
Then look at carry(carry). It is relatively simple, two inputs a and B are 1 on the output 1, otherwise the output 0, so it's OK to use an and operator.
Now combine sum and carry to get the whole truth table. This is called the "half-adder"because it only takes into account the addition of two bits alone, without considering the possible presence of low-level bits.
Iv. Extended Truth-table and full-adder
If you put the bit in the low position, as the third input (input), that is, in addition to two input values a and B , there is an input ( Input) , then the question becomes how to get the sum of output (carry) in three input cases (and bits) and carry(rounding).
At this point, the truth table is expanded into the following form:
If you understand the design of the half-adder, it is not difficult to extend it to the new truth table, which is the "Full adder" (full-adder).
Five, the full-add device in series
Multiple full-add-in series, it can be binary operation of the multi-bit.
The full add-in is simply written as a block, indicating three inputs (a,B,Cin) and two outputs (S and Cout).
Then, by concatenating the four full adder, a logic diagram of the four-bit adder is obtained.
Six, the logic gate transistor realization
The next step is to use the transistor to make the logic gate circuit.
First look at not. The base of the transistor (base) as input, the collector (collector) as the output, the emitter (emitter) ground. When the input is 1(high), the current flows to the emitter, so the output is 0, andwhen the input is 0(Low), the current flows out of the collector, So the output is 1.
Followed by and. This requires two transistors, and only if the two base inputs are 1(high), the current will flow to the output and get 1.
Finally, or. This also requires two transistors, as long as one of the two bases is 1(high) and the current flows to the output, resulting in 1.
Seven, the circuit of the full-add device
The circuit diagram can be drawn by implementing the transistor of the three logic gates and substituting the design of the full loader.
According to the circuit diagram, the integrated circuit of the full-additive is assembled with transistors and circuit boards.
Three yellow lines on the left, representing three inputs a,B,Cin, andtwo green lines on the right, respectively, representing the output S and Cout.
Eight, the production of computers
The four full Adder circuit in series, is a genuine four-bit transistor computer, you can calculate The addition between the 0000~1111.
There are two sets of four switches at the bottom of the board, labeled "A"and"B", which represents two input numbers. From what you can see,AThe group switch is "up and down", which represents1011( One);BThe group switch is "down and down", which represents +(8). They add up to five of the resultsLEDThe light indicates that the medium is "bright secretly bright", which represents10011( +), it is1011with the +the and.
Ix. Conclusion
Although this four-bit computer is very simple, it is not difficult to understand the principle of modern computer.
To complete the above four-bit addition, you need to use a single transistor. While modern processors contain billions of transistors, they are essentially an accumulation of simple circuits like the one above.
Do your own four-bit computer