Principle and Implementation of a four-digit computer

Source: Internet
Author: User

 

Have you ever wondered why Computers add, subtract, multiply, and divide? Or, more directly, what is the principle of the computer?

Waitingforfriday has a detailed tutorial on how to create a four-digit computer by yourself. We can see how binary, mathematical logic, and electronics are combined to form the foundation of modern computers.

1. What is binary?

First, let's start with the simplest one.

The computer uses binary data. Each digit has only two possibilities: "0" and "1". The calculation rule is "every two to one ". For example, there are two bits A and B, and they can only have four results.

This table is called "truth table", where sum indicates "and bit", and carry indicates "carry ". If both A and B are 0, and the sum is 0, then both "and bit" and "carry" are 0. If one of A and B is 1 and the other is 0, and the sum is 1, carry is not required. If both A and B are 1 and 10, "and bit" is 0, and "carry" is 1.

Ii. Logic Gate)

Boolean operation rules can be applied to binary addition. Boolean operations have three basic operators: AND, OR, NOT, also known as "AND", "OR", AND "non-Gate", collectively referred to as "logic gate ". Their calculation rules are:

AND: if (A = 1 and B = 1), the output result is 1.

OR: if (A = 1 or B = 1), the output result is 1.

NOT: if (A = 1), the output result is 0.

When both input (a and B) are 1, AND (AND gate), 1 is output. If any input (a or B) is 1, OR (OR gate), 1 is output; the function of NOT (non-gate) is to output the opposite value of an input value. Their graphical representation is as follows:

3. logical gate representation of truth table

Now, the calculation rule of "truth table" is rewritten to the logic gate form.

First, let's look at sum (and bit). What we need is this logic: When two inputs are not the same, the output is 1, so the operator should be OR. When two inputs are the same, the output is 0, which can be implemented by combining the two groups of and not. The final logical combination diagram is as follows:

Let's look at carry ). It is relatively simple. If both input a and input B are 1, 1 is output; otherwise, 0 is output, so you can use an AND operator.

Now combine sum and carry to get the whole truth table. This is called the half-adder, because it only considers the addition of two separate bits, and does not consider the possibility that there may be a bit of low bits.

4. Extended truth tables and full Processors

If we use the low-level incoming bits as the third input (input), that is to say, in addition to two input values A and B, there is also an input carry, the problem is how to get the sum (sum) and carry (carry) of the output (output) with three inputs ).

In this case, the truth table is extended into the following form:

If you understand the design concept of the half-adder, it is not difficult to extend it to the new truth table. This is the "full-adder.

V. Series of full Processors

Multiple full processors are connected in tandem to perform binary multi-bit operations.

First, describe the all processors in the form of squares, indicating three inputs (A, B, Cin) and two outputs (S and Cout ).

Then, the four encoders are connected in series to obtain the logic diagram of the four encoder.

Vi. Transistor Implementation of logic gate

The next step is to use a transistor to make a logic gate circuit.

NOT first. The Base of the transistor is used as the input, the collector is used as the output, and the emitter is grounded. When the input is 1 (high), the current flows to the emission pole, so the output is 0; when the input is 0 (low), the current flows out from the collector, so the output is 1.

AND. This requires two transistors. Only when the input of the two base poles is 1 (high level) will the current flow to the output end and get 1.

The last is OR. This also requires two transistors. As long as one of the two base poles is 1 (high level), the current will flow to the output end and get 1.

VII. Circuit of the all-processors

The three logic gate transistor implementation, into the full amplifier design, you can draw a circuit diagram.

(Click to view the big picture)

According to the circuit diagram, an integrated circuit with a transistor and a circuit board is assembled into a full amplifier.

The three yellow lines on the left represent three inputs A, B, and Cin, and the two green lines on the right represent output S and Cout respectively.

8. Create a computer

Concatenate the circuits of the four full processors into a real four-bit transistor computer. The computation is 0000 ~ The addition between 1111.

There are two groups of four switches under the circuit board, marked with "A" and "B", representing the number of two inputs. As you can see, the switch in group A is "Up and down", representing 1011 (11); the switch in Group B is "Up and down", representing 1000 (8 ). The result of their addition is represented by five LED lights. The center is "bright, dark, bright", representing 10011 (19), which is the sum of 1011 and 1000.

IX. Conclusion

Although the four computers are very simple, it is not difficult to understand the principles of modern computers.

88 transistors are required to complete the above four-bit addition. Although contemporary processors contain hundreds of millions of transistors, they are essentially the accumulation of such simple circuits.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.