Self-developed computer-the essence of Computer Science

Source: Internet
Author: User

What is a computer? Is computer science very advanced? You may think of integrated circuits, assembly languages, operating systems, and so on. However, a real computer is essentially very simple, and you can do it yourself, the so-called integrated circuit is only one way to implement a computer. It can make the computer faster and smaller. It belongs to another category. As for programming languages, it is another category, if you understand the nature of computers, you will not feel difficult to understand these concepts.
In this article, I am working on a computer that can be "programmed" with the same person who wants to understand the essence. First of all, the computer is not necessarily electronic. It can be completely mechanical. In this article, the machine I made is not electronic, because if you want to create an electronic computer, I really have to learn the integrated circuit. My machine is electrical + mechanical, But it implements many features of the Von noriman model, such as command storage and sequential execution, however, it is very simple after all, but it is enough to understand the computer operating mechanism.

If I say that the electric lamp is also a computer specialist, I must think that I am insulting their discipline. In fact, it is indeed a computer, why? When you press the switch, the light turns on. When you turn off the switch, the light turns off. Your action is the command, and the light turns out and outputs, but it is not automatic, it relies on you to press the switch to issue instructions. If it can be turned on or off by itself, it will be perfect. If data can be stored in a programmable manner, tape recorders or DVD players are in this category. However, all data stored on the media does not include instructions. For such machines, there is no "command" to say that the motor is constantly rotating, driving the forward of the tape or rotating the disc, so the data is constantly changing and different sounds or pictures appear. To implement a Feng's machine, two points must be achieved: 1. the commands can be stored on the media; 2. the commands can be executed sequentially. Start with the following:

Background

1.
There are several wires, several dry batteries, several rough nails, several pieces of iron that can be cut with scissors, several light springs, several bulbs, a large piece of wood, and scissors on the hand, planer, thin plastic board;

2.
In my mind, I learned about the anpei and lorunz power in middle school, the flow of current, and the knowledge about electromagnetic induction;

3.
I have never heard of transistors and diodes, I have never heard of integrated circuits, I don't know about binary coding, and I don't even know what programming languages are;

4.
I used transformers when I was a child.

What is the relationship between the fourth point and the computer? Transformer is not just a toy, but its designer must be a genius. Such fine organs are properly combined, and eventually they work together to make transformer various shapes, it makes me always want to do something similar to transformers by myself. One is to recall my childhood, and the other is to have no other bad hobbies.

Preparations:

1.
Wrap the wire on a rough wire, and connect the two ends of the wire to power on. This is a magnet. When it is not powered on, the magnetic will disappear. You can try it yourself.
(
I try to avoid any technical terms, such as electromagnets, relays, left-right-hand rules, etc. Otherwise, I will face theoretical physics after escaping from the integrated circuit.
)
As shown in, there is an iron on the power-on Coil that can be automatically reset to the horizontal position:


2.
Above
1
In, the battery is reversed, and the magnetic pole will reverse, but no matter how powered it is, it will attract the above iron. It can also be proved by experiments.

3.
The magnetic properties produced by the power-on coil are sufficient to attract iron.

The circuit diagram of my computer is as follows:


The legend is as follows:

Dark black thick wire: hard iron rod

Dark black thin wire: hard plastic stick

Dark black round ball: Iron Conductive Body

Light black thin wire: Soft guide wire

Large coil: Coil
1

Small coil: Coil
2

Switch with a Reset Spring above the large coil:
G1

The iron block carrying paper tape above the small coil: iron block
1

Orange circle: light bulb

The operating principle is as follows:

1. G1
Closed, coil
1
Generate magnetic properties.
1
Attracting; Coil
2
Produce magnetic, tie the iron block with tape
1
Attracting;

2.
Due to iron slice
1
Attracted, just like iron.
3
Position
1
At this time, if there is a small block of iron at this position, the loop
2
Closed, light on, if there is no small Square iron, the loop
2
Open Circuit, light unavailable;

3.
Due to iron slice
1
Attracted, coil
1
The current is gradually decreasing.
(
This is because the magnetic flux changes, causing the induced current.
)
, Iron slice
1
As spring elasticity and magnetic force gradually decrease back to the horizontal position,
G1
Closed again;

4.
Due to iron slice
1
Attracted, coil
2
The current gradually decreases. When the magnetic force is small enough to be equal to the static friction of the iron block, the iron block carrying the tape stops moving;

4.
Iron slice
1
Bounce back,
G1
Closed, coil
1
And Coil
2
Powered, iron slice
1
Attractive, tape-carrying iron block
1
Coil
2
To the next position;

5 ....
Repeat until the tape ends.

Although this computer is small, it has two major modules, namely "Finger fetch" and "execution", and even an indispensable module, including "Power Supply" and "Clock, take the finger and execute interact with each other, that is, the difference between it and the tape recorder, otherwise I can design a mechanical device that can move the tape 1 cm per second, and then put it and the coil
1
Independent, independent installation, although this can achieve the same effect as my above design, but its module and coil
1
Is independent, that is, if the coil
1
As a clock generator, it will be difficult or unable
G1
That is, the clock signal is transmitted to the module to affect it, and it is not easy to implement "branch" or "jump"
(
Based on the execution result
-
Loop
2
Affect the coil
2
Power-on or power-off to achieve continuous attraction to iron Blocks
1
Make "command"
-
Tape arrives at a specific location
)
.



Another problem is that the "computer" connected according to the above circuit diagram may not necessarily be executed as you wish, because of the roughness of the board and the coil
2
The number of winding circles and the thickness of the dingtalk affect the sliding distance of the small chunk with a tape, which affects the timing sequence of "take the finger" and "execute". However, it is true that it is reasonable for a long time, if you want to achieve the desired results, you have to make some minor adjustments.



This computer fully implements "command storage", and whether there are small blocks of iron on the tape is an instruction. If the small blocks of iron on the tape are arranged in the following format in each grid:

"Small Square iron slice
+
Small Square iron slice
+
White Paper
+
Small Square iron slice
+
White Paper"

Then the sequence of the light bulb is "bright and bright"



A well-designed computer is capable of moving the whole body. The "one-stop" here is the "Clock" that can be "switched and oscillating ", the "Whole Body" is the "coil" that is disconnected or closed due to the impact of the "Clock ".
2
"," Coil
X
"
...
The execution order of the machine is different from the flow chart we are familiar with. For each command, the machine is executed "once, once the clock has a signal, the finger fetch will automatically take out a command, and then all the other circuits responsible for executing the command almost start to work together to complete the command execution. In addition, the execution module and the finger-taking module can affect each other to achieve the purpose of redirection. However, this function must be implemented, we have to repeat the line to make it more modular. We need to separate the clock from the finger-taking module, for example:


Then, according to the form of a modern processor, both the fetch and execution are encapsulated into modules. Even in the form of a modern computer, the memory concept is introduced and replaced with the memory concept, as shown in:


However, is it easy to implement the branch and jump we mentioned above? There are two problems: first, the tape is a mechanical device, while the memory is stored
0
And
1
That is, the element in the memory itself is a voltage.
(1)
Or an equipotential body.
(0)
It is not a "small block iron" or "No small block iron", so it is necessary to turn the memory itself into a "coil". Let's talk about it later. Second, the execution result of our branches and jumps affects the next execution. This requires mutual influence between the execution module and the retrieval module, and the branch needs to be determined, the jump requires the concept of "Address", which are all problems to be solved.



However, the above problems are no longer important for us to understand the nature of computers. They belong to the scope of computer design, but I will give a brief description of them to do things and make compositions. To address the two problems mentioned above, first of all, you have to learn the knowledge of digital circuits. In fact, three circuits are very important, other complex circuits cannot escape the combination of the three. They are three door circuits, which are non-door, gate, or door. Tao shengyi, with a door, God said two life, so there is a right and a wrong, so there is a binary, not a door so born, and the door and or door is just the product of God's Sunday, since then, there has been no other invention that will make god proud. Our world is composed of both non-and non-components. Even we are ourselves. Computers have not undergone our complex evolution. Therefore, they can only start from basic and non-tasks and form the entire computer system, therefore, as long as we can use the battery and coil to construct these three door circuits, we can create a supercomputer similar to Galaxy 3 through their different combinations. How can we achieve this? For example, it is very simple, in the following:


And the door? See:


Or door? As follows:

Think about it, haha.

What can we do if we have these three options? What is "Address? It is nothing more than a string in the world of right and wrong
0
And
1
Next, we will return to the origin of the address, which is nothing more than an index.
2
Location
(
Interpreting computer coding from another perspective
-
Complement code
Blog
Take
8
The number and address represented by the computer.
2
Yes
00000010)
What do we need to do to read the numbers stored here? First, we need to implement a memory node, and then we need to implement a multi-path selector and multi-channel multiplexing, which is nothing more than a matrix, generally, I want to design a subtle structure, but the rest is that you have the patience to make your design. If you do, you will see that your computer has enough
N
The house is so big
(N> 3)
You will be surprised to finish it yourself.
20
In the middle of the century, you only need patience. After all, you only need devices that can be bought everywhere, such as batteries, iron sheets, and iron nails, however, the most important thing you need to pay is not to figure out how these devices can be equivalent to an integrated circuit.
(
Actually, it is equivalent.
)
But to understand how to combine them, this is the most important thing, the real computer scientists do this thing, so in the middle of the last century, even if those scientists are better than the present, but they can only create machines as big as several houses.
(
Now, any student can use a core processor.
)
If you can get Modern processor drawings, the rest of the work will be endless connections and welding.



In my most basic design, is there any small block of iron on the tape?
1
And
0
It can be seen that the whole machine only needs to "Clock" for continuous operation, and the pull and execution are all in an orderly manner. The whole process does not rely on any external factors, what is the result depends entirely on where your tape is attached with a small block iron. One day, someone found that there was a material in nature that could realize these three so-called basic "Doors", so this material was widely used, therefore, integrated circuit science is born by operation, and computers no longer need to use tie nails, coils and other semi-mechanical and semi-electrical switches. The magic of nature has done a lot for us.



As for programming, this is even simpler. The programming language and the interface of machine hardware are instruction sets. We know that,
Intel
And
AMD
Two processor companies have different processor implementations, but they can run a set of commands on their processors.
Ia32
Compatible commands involve the concept of an instruction set. An Instruction Set is just an interface. It doesn't matter how it is implemented. Different vendors can implement it differently, if the same input can get the same output, for example, a command is
A B (
Yes
Add)
It is encoded
Xyyx (X, Y
Is
0
Or
1)
, This
Xyyx
In the command register, for example
0110
When it is executed, the instruction register will separately issue the"
0 V
","
12 V
","
12 V
","
0 V
"Voltage to represent
0110
In this way, these voltages will affect the subsequent execution sequence. If
Xyyx
Yes
Add (
And
A
Is a register
)
Encoding, then this
0
,
12
,
12
,
0
The voltage must affect the register.
A
Causes the value
1
All of this is caused by a combination of three doors, and all of this happens at the same time!



From the underlying hardware of the machine to the instruction set, the speed is fast.
C
What do you think is unexpected about language? No! But I don't want to go into detail.
C
Language, just a key point, that is
C
The most important thing about a language is to provide a convenient way to operate the memory address rather than the register.
C
The language is separated from the specific machine. Assembler programmers consider registers and addresses, while
C
What language programmers consider is pointers.
(
Another name of the address
)
, Then
Java
What about it? It does not even have a pointer. It focuses on "objects ". From Jenny spinning machine to supercomputer
N
From a professional to a student in the past century, it is really a great improvement in machine intelligence, so do not blame
Java
Programmers do not understand the processor assembly line. It is with a group of people dedicated to the assembly line that another group will be freed up to engage in professional business. This is an excellent product of the social division of labor!

Reference: Charles Petzold: coding: Language hiding behind computer software and hardware

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.