Uncover the mysteries of the computer

Source: Internet
Author: User

write in front of the words: from the touch of computer, has been full of curiosity about the computer. When the computer is connected to the power, press the Start button, we can do all the things we want to do, play games, write articles, watch movies, build a Web server, write their own programs and so on. As the time of contact with the computer longer, but more unfamiliar to the computer, and constantly ask themselves, how the computer is composed? Why is it possible to implement these features? How many years ago would I have to build a computer? Just a few days after reading this book "Code:the hidden Language of computer hardware and software", indeed a good book, a lot of doubts to be solved, this blog wrote about those who touched me deeply, I think, understand these points, Understand the whole book, and then understand how the computer is going.

===== Body begins ========

1. Relays

Look at the following two pictures:

  

(1) Left: an iron core, wrapped in some coils, when there is no power, switch A is disconnected, the out end has no voltage, we think the output is 0.

(2) Right: When the coil is energized, the iron core is magnetized, equivalent to become a magnet, which can attract the above switch a,out terminal voltage, we think the output is 1.

So a little simple thing above is the relay, it's very important, because we can control it artificially : output 0 and 1 .

Although in the computer, relays are gradually replaced by vacuum tubes, transistors, but they are to achieve the same effect: output 0 and 1.

2. binary

We use decimal in our lives, but computing in Computers uses binary, which I think is a very important change. Take a look at the following logic:

(1) binary only 0 and 1, which in turn result in binary subtraction results only 0 and 1, binary and or non-results are only 0 and 1

  (2) in turn, binary subtraction and binary can be equivalent to or not

(3) and relays can be output 0 and 1, so the relay can be a variety of "variable pattern of combination" to achieve a variety of and or non-

(4) Therefore, the subtraction operation of the binary system can be realized by various combinations of "changing patterns" of relays.

Understanding the above logic, the next thing to do is to implement the required functionality. How to realize the function, but also just time, the following a few pictures, show how to realize the complex logical structure through the relay, as a realization of the idea of the introduction, and to achieve a variety of their own logic, after a few nights of thought, is can think out, if you do not want to think, then you can look at code a book, counted as a shortcut.

            Relay realization Logic and relays implement Logic or                        

relay realizes half-add device relays implement full-add -on devices                        

Do not be frightened by the above figure, they are just the combination of the change of the relay, if we sink down, we can also achieve such a combination, and even achieve more we need, such as 8-bit adder, subtraction, multiplier, divider and so on.

  So we have been able to achieve an important function of the CPU in the computer: logical operation.

However, the above operations, such as input, require us to operate artificially, we can imagine: a person sitting there, dialing the switch, the operation is how boring. If the implementation of automatic operation, that is, no man-made operation, to achieve 0, 1 of the output , is how good a thing clear, we can really do, and then look down.

3. Another way to connect the relay: Feedback

  Look at the following two pictures:

On the left, when the relay does not have power, the switch B above the relay is closed; On the right, once the relay is energized (that is, switch A is closed), the wonderful thing happens:

(1) The relay is energized, it will attract the above switch B, thereby disconnecting the circuit.

(2) Once the circuit is disconnected, Switch B is restored to its original position and the circuit is connected. (Note that switch A is always closed)

(3) The above two processes are automatically repeated.

It is possible that the output of the relay can be automatically completed between 0 and 1, and the root cause of the automatic completion lies in the following two points:

(1) relay in the case of power loss, Switch B is closed (normally closed type relay), and the front of the relay in the case of power outages, switch B is disconnected (normally open type relay), which is a little different.

(2) The input and output of the relay are not separated, but a circuit is formed, the exact saying is: there is feedback.

After two little changes, we can use this idea to implement a range of other required functions:

(1) We can implement the RS trigger (2) We can implement D flip-flop: To achieve the preservation of 1-bit data.

             

The D trigger can be called a 1-bit latch, and by the combination of various variations of D flip-flop, we can realize the trigger of edge power trigger, and realize the multi-position latch.

By feeding the output of the D flip-flop triggered by the edge to the input, we can implement the divider, and the counter can be used as the clock trigger signal of each part.

If we ignore the above details, we know we can already implement latches, counters, clock signals.

The latch then forms the registers in the CPU and the RAM in the computer and the memory ram of the video card;

The counter and clock signal make up the clock driving signal in the computer.

4. Bus

  Above we can say that the CPU and RAM (memory, graphics) have been realized, once the CPU and RAM are connected, the CPU and RAM can work together to achieve the required functions with the help of the clock signal that can run automatically. After the CPU and RAM are connected, both the output of RAM can be used to compute the CPU, and the output of CPU can be stored to RAM.

These inputs and outputs are connected by a real wire . In order not to make the wires are very difficult to identify, we can all the circuit components "a variety of different combinations of patterns", and the line comb clear, summarized as three kinds of lines: Data bus, control bus, address bus.

(1) Data bus: The above is the transmission of information, if capable of transmitting 8 bits, then said data bit width is 8 bits. Of course, the 8 bits here are also corresponding to the number of latches mentioned earlier, or to the number of registers in the CPU is corresponding, in fact, all the same.

(2) Address bus: Address bus is also a root of the actual wire, through these wires, it can be convenient to select a particular latch in RAM; the number of address bus determines the maximum amount of RAM that can be addressed.

(3) Control bus: Transmit control signals for specific control functions, such as determining whether to read data in RAM or to write data to ram.

Still say the last sentence: These lines are real wires.

5. Machine language

  The bus transmits 0 and 1 signals, through various transformations of the 0 and 1 signals, indicating the transmission of different information; RAM has the function of storing, so we can store the information of 0 and 1 in RAM, so that we can let the CPU to execute the command, these commands can be called machine language.

Machine language 0 and 1 we can be written in RAM through a variety of ways, such as the RAM can be stored information, if each write 01 is too cumbersome and inconvenient, so the 01 of the code with a specific symbol, the assembly language, assembly language into 01 code machine language, It needs to be implemented by assembler, and assembler compiles the source program into machine code, actually to check the machine code and assembly symbols of the control table.

With the development of time, the high-level language also appeared correspondingly.

The CPU is essentially composed of relays, the exact point is the transistor composition, different companies of different engineers to build the CPU, the corresponding composition will have some differences, resulting in the machine instruction code is different, so there are different instruction sets, such as X86 instruction set, RISC instruction set and so on.

6. External storage media

  The previously mentioned RAM, which is essentially made up of relays, is made up of semiconductors, which do not matter, they all have a common feature: when the power outage moment, everything is gone, why? Because this thing is strange, say no, if you want to store data for a long time, need other ways: for example, by magnetic material to store, so there is a tape, disk, through the optical information to store I information, such as CD, and other things: such as ROM, flash and so on.

The composition of the computer is becoming more and more complex to conceal the initial curiosity and impulse in our hearts.

  

Uncover the mysteries of the computer

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.