What exactly is a CPU? Why can it perform mathematical operations?

This article link source: Yang Jianyong’s personal blog

Simple physical circuits

First of all, let’s take a look at a physical circuit diagram that we have learned in junior high school.

We can see from the diagram that this is a simple series and parallel circuit

In the figureabRepresents the control circuit switch, through the control of the two switches to control the light bulb and not light

We use numbers10To represent the state of switch power on and power off,1Represents the power-on state,0Indicates the power failure. Again, we use numbers10To indicate when the light bulb is on or off,1It means the light bulb is on,0Indicates that the light bulb is not working

Then, according to the knowledge of physical circuits we have learned, the three circuits in the figure above respectively have the following three control results:

Control results of circuit 1

Switch to a Switch b The light bulb
0 0 0
0 1 0
1 0 0
1 1 1

Control results of circuit 2

Switch to a Switch b The light bulb
0 0 0
0 1 1
1 0 1
1 1 1

Control results of circuit 3

Switch to a The light bulb
0 0
1 1

The above three tables respectively represent the three circuits in the figure above to control the light bulb by controlling the switch

Don’t underestimate these three simple tables of circuit control results, because this is the physical basis of modern computer generation. It can be said that the modern computer evolved from this. It seems a little strange that a complex CPU should have evolved from such a simple circuit. As for how it evolved, read on…

British mathematicians should be nextGeorge BullAnd an American electronics engineerClaude Elwood ShannonThe stage

First to seeGeorge Bull

George Boole, a mathematician, invented two concepts: one called sets and one called Boolean logic. Let’s look at it firstA collection of. Those who have learned mathematics know that there are three kinds of operations in sets, namely: intersection, union and difference. As shown below: [Also please ignore lame drawing = =!]

The above figure helps to solve the problem of where the AND/OR/NOT operations come from. And what we’re actually using is this great mathematician who came up with this idea of sets and three basic operations. As you can see from the figure above, the first one isintersectionAnd the second one isAnd setAnd the third one isDifference setSet operation of. And the notation used was invented by this mathematician:[a] NOT a good idea. [B] NOT a good idea

Look at theBoolean logic. In Boolean logic, only two values are used, one being 0 and one being 1. What is the use of this simple Boolean logic? Let’s go to the next one calledTruth tableThe table is as follows:

Table 1: [Intersection Operation]

0 1
0 0 0
1 0 1

Table 2: [Union operation]

0 1
0 0 1
1 1 1

What are these two tables talking about? Perhaps careful children’s shoes have found. In fact, the above two tables are the implementation of Boolean logic, the intersection and union between 0 and 1 operations

Then a little more careful children’s shoes may be found. In fact, the calculation results of these two tables are somewhat similar to those of the previous two circuit control results, which may not be understood by some people at the moment, but I will use the following table to express it:

Table 1 [Series circuit corresponds to intersection operation]

0[Power off switch A] 1[Energized switch A]
0[Power off switch B] 0[A light bulb that doesn’t work] 0[A light bulb that doesn’t work]
1[Energized switch B] 0[A light bulb that doesn’t work] 1[Bright light bulb]

Table 2 [Parallel circuit corresponds to union operation]

0[Power off switch A] 1[Energized switch A]
0[Power off switch B] 0[A light bulb that doesn’t work] 1[Bright light bulb]
1[Energized switch B] 1[Bright light bulb] 1[Bright light bulb]

How’s that See here, do you feel very magical, the magical place is:Mathematical operations, and physical logic circuit is exactly the same.This is important, because there is a common ground between mathematics and physics that enables the physical circuit to perform mathematical calculations. And how you do that,Claude Elwood ShannonAppeared. This great electrical engineer createdDigital circuit designThis subject

Claude Elwood Shannon

Claude Elwood ShannonOriginally, I entered the University of Michigan in 1932, where I first learned about itGeorge BullAnd then went to MIT to work on itDifferential analyserResearch work.Differential analyserIt’s a mechanical computer, and don’t underestimate this mechanical computer, which was involved in a lot of important projects, including the Manhattan Project, which built the atomic bomb, and a lot of the calculations were done on these early calculators.Here have to obey our country’s scientific research personnel, because of the technical blockade at that time, our country’s scientific research personnel just use the abacus to knock out the atomic bomb, really is the hard core to not the operation.

After all that talk, thenClaude Elwood ShannonWhat are the specific contributions. We already know a few things from the long explanation above: the on and off of electronic switches can be represented by 1 and 0; Boolean logic is also 1 and 0; The on and off of the electronic switch to control the light bulb, and the truth table calculation results are the same; 1 and 0 happen to be binary. Shannon’s contribution was to introduce electronic control over what had been a mechanical computer, and to simulate Boolean logic operations with electronic switches

There is no further explanation here as to why circuits can perform operations. To tell the truth, digital circuit design did not buy books to learn, here is not a disgrace.

digression

How can complex mathematical calculations be achieved through physical circuits

If a computer can do simple one-bit binary addition, how can it do more complex math? We have mathematicians to thank for that. Mathematicians reduce complex mathematical operations to mathematical addition operations [our country’s atomic bomb is the complex function of the abacus]. Mathematicians use a variety of mathematical tools, such as Fourier transform, square root calculus and so on, to replace the calculation of data with addition

That is to say, mathematically complex operations can be simplified to the addition operation through a variety of mathematical tools, so it can be realized through the design of the circuit, which also makes the computer has more powerful computing power.

What the CPU is. In essence, a CPU is a complex set of circuits. And why can realize the calculation, through the design of the circuit to realize the calculation

Welcome to my blog [Yang Jianyong’s personal blog http://yangjianyong.cn]