075582814553
What Makes a CPU?

FREE-SKY (HK) ELECTRONICS CO.,LIMITED / 06-09 14:29

Have you ever considered that every time you come home and turn on the lights, you can literally develop a complicated CPU  with a simple switch you press? The number necessary, however, will be far higher, in the billions.


Ⅰ. A great invention

What has been humanity's most important invention in the last 200 years? What is a steam engine? Is it possible to use electric light? Rocket? Almost certainly none of them, and possibly the most crucial is this:

Figure. 1

Figure. 1

transistor is the name for this little device. What is the purpose of a transistor  , you might wonder?

In fact, the transistor's function is so basic that it can't be any simpler. The current can pass through the other two ends if one end is powered on; otherwise, the current cannot pass through, thus the device is essentially a switch.

The discovery of this small device earned three people the Nobel Prize in Physics, demonstrating its importance.

The functions carried by the software are finally fulfilled by the simple opening and closing of this little object, no matter how sophisticated the program created by the programmer is. I'm at a loss for words and can only think of "magic."

 

Ⅱ.  AND, OR, NOT

You can easily make these three combinations now that you have a transistor.  which is a switch, because you can build blocks on this basis:

The current will only pass and the light will turn on if both switches  are switched on at the same time.

The current can travel through and the light will be on as long as one of the two switches  is switched on.

When the switch is closed, the current flowing through the light is on; when the switch is opened, the current cannot flow and the light is turned off.

The following are the combos you've created: AND gate, AND Gate  , OR gate, OR gate, NOT gate, NOT gate, which is represented by symbols:

Figure. 2.

Figure. 2

 

Ⅲ. Two in one, three in two, three in all

The most astounding thing is that any logic function may be expressed by AND, OR, and NOT at the end of any of the three types of circuits you design at random. This is what is known as logical completeness, and it is quite wonderful.

That is, any logic function may be implemented with enough AND, OR, and NOT gates. Furthermore, no other types of logic gate circuits are required. We regard AND, OR, and NOT gates to be logically complete at this moment. of.

The conclusion of this paper sounded the computer revolution's horn. This conclusion implies that computers may be built using simple AND, OR, and NOT gates, and that these simple logic gate circuits are similar to genes.

Figure. 3.

Figure. 3

Tao produces one, one produces two, two produces three, and three produces everything, according to  Lao Tzu.

Do we really need to implement all logical operations with AND, OR, NOT gates, despite the fact that we can do so with AND, OR, NOT gates? Obviously not, and it's also not very practical.

 

Ⅳ. How does computing power come about?

We set out to build the most essential capability of the CPU: computation, using addition as an example. Now that the NAND gate, the basic element that can generate anything, has appeared, we set out to develop the most important capability of the CPU  : computation.

What are the binary addition combinations, since the CPU  only recognizes 0 and 1, which is binary?

0 + 0, the result is 0, the carry is 0;

0 + 1, the result is 1, the carry is 0;

1 + 0, the result is 1, the carry is 0;

1 + 1, the result is 0, the carry is 1, binary!

Keep an eye on the carry column. The carry is 1 only when the value of the two inputs is 1. Take a look at the three circuits you created using combinational logic. The AND gate is what it sounds like. Is there any at all?

Examine the result column once more. When the two inputs have distinct values, the result is 1, and when they have the same value, the result is 0. Is there any? This is  XOR ! We've already established that the NAND or NOR gate is logically complete and capable of producing any result.  XOR logic, of course, is not a problem. Binary addition can be achieved with an AND gate and an XOR gate:

Figure. 4.

Figure. 4

The given circuit is a simple adder; whether it is magical or not is up to you. NOR gates can be used to implement addition, as well as other functions. The logic is finished.

Aside from addition, we can create various arithmetic operations as desired. The circuit that does the calculations is known as an arithmetic/logic unit, or ALU, and the CPU  module that is specifically responsible for the operation is essentially the same as the simple circuit above. There's no difference; it's just more difficult.

Now, computer power is obtained by combining NOR gates, and this is how computing power is obtained.

However, computing power alone is not enough, the circuit needs to be able to remember the information.

 

Ⅴ. Amazing memory ability

Until now, the combinational circuits you've developed, such as adders, haven't had a method to store data. They merely get the output from the input, but the input and output must both have a location to keep information, necessitating the use of a circuit to do so.

How can information be stored in circuits? You don't know how to design, and this dilemma isn't helping you sleep. You think when you eat, when you walk, and when you squat, until one day you encounter a British scientist in your dream, and he gives you some advice. Here's a circuit similar to yours that's simple yet really magical:

Figure. 5.

Figure. 5

Don't worry, this is a combination of two NAND gates; NAND is also a combination of NAND gates that you constructed. The NAND gate is a NAND gate that is ANDed first and then negated. Given inputs 1 and 0, the result of the While operation is 0, and the result of the NOT operation is 1. This is the NAND gate, and the rest of the components are unimportant.

The circuit's combination is what makes it special. One NAND gate's output is the input of two NAND gates. This circuit's combination will have an intriguing feature. This circuit will work as long as 1 is fed into the S and R segments. There are just two possible outcomes:

Either the a side is 1, at this time B=0, A=1, b=0;

Either the a side is 0, then B=1, A=0, b=1;

Because there is no other option, we use the value of terminal an as the circuit's output.

After that, if you set the S terminal to 0 (the R terminal remains 1), the circuit's output, i.e. the a terminal, is always 1. At this point, we may say that 1 has been stored in the circuit; and if the R segment is set to 1, the circuit is complete. If it is 0 (S remains 1), the circuit's output at this moment, i.e. the a terminal, will always be 0. We can say that 0 is stored in the circuit at this point.

Regardless of whether you believe it is magical or not, the circuit has the potential to store data.

Now, in order to preserve the information, you must set both the S and R terminals, but your input already has one (which stores a bit), so you have made a simple circuit modification:

Figure. 6.

Figure. 6

When D is 0, the entire circuit saves 0; otherwise, it saves 1.

 

Ⅵ. The birth of registers and memory

It's not easy to store many bits now that your circuit can store one bit; simply copy and paste: 

Figure. 7.

Figure. 7

we name this combinational circuit a register. Yes, you read that correctly. This is the register, as we call it.

If you're not happy, you have to keep building more sophisticated circuits to store more data and give addressing functions, which is how memory came to be.

The registers and memory are inextricably linked to the previous section's simple circuit. The information is saved in this circuit as long as the power is turned on, but it is obviously lost once the power is switched off. You should now be able to see why the memory is unable to save data after the power has been switched off.

 

Ⅶ. Hardware or software?

Our circuits can now calculate data and store information, but there is a problem: despite the fact that we can express all logic functions using AND, OR, and NOT, we still need to include all logic operations in our circuits. Is it possible to implement it with an AND-NOR gate? This is simply implausible.

For all computational logic, we do not need to implement corresponding hardware. Only the most basic functions are required of the hardware. Finally, these fundamental functions can be used to express any computer logic in software. This is the so-called software word. According to the source, hardware is unchangeable, but software is. The hardware remains constant, but different software can enable the system to perform new functions.

Humans are really too smart. Next we look at how the hardware provides the so-called basic functions.

 

Ⅷ. Basics of hardware

Consider this: how does the CPU  know that it is going to add two integers and which two numbers to add?

Obviously, you must inform the CPU.  but how do you do that? Do you recall the chef's recipe from the previous section? That's accurate, the CPU  requires a recipe to determine what it should do next. The recipe in this case is the machine instructions, which are carried out by the combinational circuit we created earlier.

Next, we have another issue: there should be a lot of these instructions, which is absurd. Take the addition instruction, for example; you can have the CPU  calculate 1+1, 1+2, and so on; in actuality, only the addition instruction exists. There are innumerable conceivable combinations, and the  CPU  will obviously be unable to implement all of them.

In fact, the  CPU only needs to provide the addition operation; you can provide the operand; the CPU says, "I can hit people," and you tell it who to hit; the CPU says, "I can sing," and you tell it what to sing; the CPU says, "I can hit people," and you tell it who to hit; the CPU says, "I can hit people," and you tell it who to hit; the CPU says, "I can hit people," and you tell it who to hit; the CPU says, You tell the CPU what to cook, and the CPU responds, "I can trade stocks," and you tell the CPU to get out of the way.

As a result, we can observe that the CPU just gives methods or functions (such as beating people, singing, cooking, adding, subtracting, and jumping), while we provide tactics (who to hit, song name, dish name, operand, jump address).

The instruction set is used to implement the CPU expression mechanism.

 

Ⅸ. Instruction Set

The instruction set specifies the instructions the CPU can execute as well as the operands that each instruction requires. The instruction sets of different CPUs are varied.

The painting style is generally like this: The directions in the instruction set are actually pretty basic, and the painting style is generally like this:

Read a number from memory, abc is the address;

add two integers together;

Verify that a number is more than six;

Save this number at the address abc in memory.

etc

It appears as though there are any thoughts. These are instructions for the machine. A program written in a high-level language, such as sorting an array, will eventually be equivalently transformed into the above broken thoughts instructions, which will then be executed one by one by the CPU

Next, we'll have a look at a probable machine command:

Figure. 8.

Figure. 8

The first four bits of this instruction tell the CPU that it is an addition instruction, which means that the CPU's instruction set can contain 24 or 16 machine instructions, and the remaining bits tell the CPU what to do, which is to add the values in register R6 and register R2 and write to register R6.

As you can see, machine instructions are inconvenient, thus modern programmers design programs in high-level languages.

 

Ⅹ. Conductor: Let's play a song

There is still one difficulty that has not been solved now that our circuit has compute, storage, and the ability to tell the circuit what operation to conduct through instructions.

Our circuit is made up of several components that are used for calculation and storage. As an example, consider the most basic addition. Let's say we want to find 1+1. These two figures are from the R1 and R2 registers, respectively. It's important to understand that the registers can save data. How can we be certain that when the adder starts operating, both R1 and R2 are holding 1 and not any other numbers?

That is, on what do we rely to synchronize or coordinate the various components of the circuit so that they work together? A conductor is required for a good symphony performance, and our computational combinatorial circuits are no exception.

The commanding function is performed by the clock signal.

In the conductor's hand, the clock signal is like a baton. When the baton is waved, the entire band performs an action in response. Similarly, each register in the entire circuit (that is, the entire circuit's status) will be updated whenever the voltage of the clock signal changes, allowing us to ensure that the entire circuit functions together.

You should now understand what the CPU's main frequency is. The most important frequency is the number of times the baton is waved in a second. The higher the primary frequency, the more operations the CPU can perform in a single second.

We now have an ALU that can execute various calculations, a register that can store data, and a clock signal that regulates how they interact. The  Central Processing Unit , or CPU for short, is the name given to all of these components.



Processed in 0.058533 Second , 23 querys.