075582814553
How does the CPU Calculate 1+1?

FREE-SKY (HK) ELECTRONICS CO.,LIMITED / 07-09 16:53

The central processing unit (CPU) is an ultra-large-scale integrated circuit. If we want to understand how a computer works, we must first understand how an integrated circuit, which is made up of a huge number of transistors and other electronic components, has computational capacity.To understand the computational capacity of computers, we must first understand how transistors work.

We all know that looking up tables is at the heart of human processes, and the number of tables we can store is restricted. So, how does a computer accomplish four addition and subtraction operations? Is it a checklist as well? The answer is emphatical no! Let's look at how the CPU  calculates 1+1 today.

Electrical computers are modern computers that rely on circuits and electronic components to function. We all know that the processor (CPU) is at the heart of a computer and is responsible for performing activities. The central processing unit (CPU) is an ultra-large-scale integrated circuit. If we want to understand how a computer works, we must first understand how an integrated circuit, which is made up of a huge number of transistors and other electronic components, has computational capacity.

To understand the computational capacity of computers, we must first understand how transistors work.

 

Ⅰ. How transistors  represent 0s and 1s

From the first computers until the   EDVAC, computers relied on components such as tubes and diodes to perform binary computations using the switching properties of these components. Valve components, on the other hand, have a number of severe drawbacks. For example, excessive heat is produced during operation, as well as poor dependability, sluggish computing speed, high cost, and huge size, all of which impede computer progress. As a result, transistors became commonplace in computer components.

The transistor uses electrical signals to control its own opening and closing, and the switching speed may be extremely high, reaching more than 100 GHz in the laboratory. The construction of electronic circuits has substantially improved since the introduction of transistors, and the second generation of transistor-based electronic computers has entered the era.

The transistor, sometimes known as the triode, was conceived by  Shockley and others at  Bell Labs in 1947. The circuit symbol for a transistor is shown below. It's worth noting that transistors come in a variety of shapes and sizes, with each kind subdivided into N-type and P-type. An N-type transistor is represented by the circuit symbol in the accompanying diagram.

1

The transistor circuit has two states: on and off, which can be utilized to create a "binary" system. The transistor still has an amplifying state in analog electricity, but in this case, the transistor is utilized in a digital circuit, and it simply has to be used as a switching circuit, that is, it may be turned on and off.

The c and e electrodes in the transistor are turned off when the voltage at b > the voltage at e, as indicated in the diagram above; when the voltage at b the voltage at e, the c and e electrodes in the transistor are switched on. This is merely a simplified version of the situation. In fact, the forward bias and reverse bias of the two PN junctions, as well as the c-pole voltage, are the requirements for turn-on and turn-off in terms of mode electricity. However, because the e-pole and c-pole voltages are normally constant in digital circuits, either provided by the power supply or grounded, we may simply write "the on-off of the transistor circuit is the comparison between the b-pole voltage and the constant e-pole voltage." "I made a high and low decision." In other words, the transistor will be switched on when the b-pole voltage of this transistor is extremely low relative toe, and it will be turned off when it is extremely high relative to e. It can be observed that the transistor's two states of on and off may be described externally by the relative level of the b-pole voltage, demonstrating that the high-level or low-level state can be used to represent binary. That is, the b pole is an input quantity (independent variable) that may be used as a variable to store two values: high or low; the matching output value (dependent variable) represents the circuit's real change: on or off.

The high level is turned off and the low level is turned on in the N-type transistor mentioned above. If we consider the high level to be "1" and the low level to be "0" at this time. The circuit will then be switched off due to the b-pole input 1. If this circuit is used to turn on and off the computer, the computer will be switched off. Machine language works on this basis.

The majority of transistors used in computers and mobile devices are MOS  FETs (metal-oxide-semiconductor field-effect transistors), which are also split into N-type and P-type, with   NMOS   denoting N-type and   PMOS   denoting P-type. The gate in the MOS  can be compared to the b-pole in a transistor, and its voltage controls the on and off states of the entire MOS  tube.

The  NMOS circuit symbol is as follows:

2

The  PMOS circuit symbol is as follows:

3

When the gate is high, the  NMOS is switched on, and when the gate is low, it is turned off. As a result, in NMOS, the high level equals "1" and the low level equals "0"; in PMOS, the low level equals "1" and the high level equals "0." By now, you should know that "1" and "0" are simply two electrical signals, precisely two voltage levels that can turn the circuit on and off.

 

Ⅱ. Gate circuit

MOS  has just one gate or input, and the output is only a simple circuit turn-on and turn-off function. It cannot output high or low voltage signals, or represent "1" or "0," and hence cannot complete the computation work. The gate circuit is introduced at this point (hint: voltage, level, and electrical signal are the same thing in this article).

In a digital circuit, the gate circuit is the simplest fundamental logic unit. It is capable of establishing a logical link between the output signal and the input signal. The gate circuit, which is made up of diodes, transistors, and other electrical components, is used to create the unit circuit for basic and complicated logic operations. Only the most fundamental gate circuits are discussed here: AND gate, OR gate, NOT gate, and XOR gate are examples of gates.

1. AND gate

An AND gate circuit indicates that something will happen only if all of the requirements are met.

The circuit diagram below is made up of MOS  tubes. A and B are the inputs, whereas Q is the output.

For example, if A inputs a low level and B produces a high level, Q will output a low level; if A inputs 0 and B outputs 1, Q will output 0, and the corresponding C language operation statement is 0&&1 =0.

4.

2. OR gate

When one or more conditions are met, something happens in an OR circuit.

The circuit diagram below is made up of MOS  tubes. A and B are the inputs, whereas Q is the output.

If A inputs a low level and B inputs a high level, Q will output a high level; if converted to binary, A inputs 0, B outputs 1, and Q outputs 1, with the matching C language operation equation 0 ||1=1.

5.

3. NOT gate

The NOT gate circuit is also known as a "no" operation, sometimes known as an "inverse" operation, and is hence referred to as an inverter. Down

The surface is a MOS  tube-based circuit schematic. The NOT gate only has one input, A, and one output, Q.

If A inputs a low level, for example, Q will output a high level; if A inputs 0 in binary, Q will output 1; otherwise, if A inputs 1, Q will get 0, and the analogous C language operation expression is!0=1.

6.


4. XOR gate

The XOR gate circuit checks whether the two inputs are equal, and the "XOR" indicates that the result is correct. That is, a high level is obtained if the two input levels are different, and a low level is obtained if the two input levels are the same.

The circuit diagram below is made up of MOS  tubes. A and B are the inputs, whereas Q is the output.

For instance, if A inputs a low level and B inputs a high level, and Q outputs a high level, A inputs 0, B outputs 1, and Q outputs 1, and the appropriate C language operation expression is 01 =1.

7.

We can execute  Boolean operations using these gates.

 

Ⅲ. Half and full adders

We can conduct logical operations using gates, but not yet added. A more complicated circuit device is required to conduct the addition operation: the adder (the adder has a half adder and a full adder). The adder is a complicated circuit made up of many different gate circuits.

Let's say we want to implement the simplest addition operation, which is computing how many times the binary integer 1+1 equals. At this point, we can utilize a half adder. The basic units of the arithmetic operation circuit are the half adder and complete adder. They're a combinational logic circuit that completes 1-bit binary addition; the 1-bit here refers to the 1bit in the popular "1byte=8bit" formula. We'll need eight full adders to accomplish 8-bit binary operations. The half adder's addition does not take into account the carry from the lower level, which is why it's termed half addition.

The figure below is a circuit diagram of a half adder.

8

An AND gate and an XOR gate circuit make up the half adder. The XOR gate circuit is represented by the box where "=1" is positioned, whereas the AND gate circuit is represented by the box where "&" is located. Because the carry from the low order is not taken into account, the input terminals A and B represent two addends, respectively. S and C0 are the outputs, with S denoting the outcome and C0 denoting the carry.

For example, if A=1, B=0, C0=0, and S=1, then 1+0=1. Carry C0=1, S=0 when A=1, B=1, i.e. 1+1=10. This 10 is binary, and it is denoted by the number 2 in decimal, i.e. 1+1=2. You should now be able to see how the transistor calculates 1+1=2.

Then we put them all together to make a whole adder. The circuit diagram for a full adder is shown below, which only supports 1bit calculations. Ci-1 is the low carry number, Si is the result, and Ci is the high carry number. Ai and Bi are two addends, Ci-1 is the low carry number, Si is the result, and Ci is the high carry number.

9

If we link four adders together, we may generate a 4-bit binary, such as 2+3, which is 0010+0011, and the value calculated by the adder is shown in the table below. The calculation begins with the low order bits, just like with regular addition. 0010 is represented by addend A, and 0011 is represented by addend B.

10

The result of Si: 0101 is decimal 5, and the adder implements the decimal operation 2+3=5.

Summary:

We can now imagine that the CPU's operation unit is a gate circuit made up of various basic electronic components like transistors, and that it is made up of multiple-gate circuits to form a circuit capable of performing various complex operations, and that it completes the operation with the help of the control signal from the control circuit. The greater the number of circuit units, the greater the computational capability.



Processed in 0.053641 Second , 23 querys.