Layman computer composition principle: establishing a data path (in) - arithmetic instruction + = CPU (Lecture 18)

First, the primer

Last lecture, we see that, to be able to achieve a complete CPU functions, in addition to such an adder circuit, we also need to implement a circuit other functions. Some of these circuits, and we've realized as an adder, to give just the given input,
will be able to obtain a fixed output. Such a circuit, which we call a combinational logic circuit (Combinational Logic Circuit).

1, only combinational logic circuit our CPU look like?

However, the light has a combinational logic circuit is not enough. You can think about, if only combinational logic circuit, our CPU look like? It is determined by the input circuit, an output corresponding to the determined naturally.

So, we have to perform different calculations, it is necessary to manually toggle various switches to change the opened and closed state of the circuit. Such a computer, as we now use powerful computer every day,

Actually more like the old slide rule mechanical or computer, can not do too complicated to work, we can help do some calculations.

2, sequential logic computer to solve the problem?

Thus, we need to introduce a second type of circuit, i.e. sequential logic circuit (Sequential Logic Circuit). Sequential logic circuit can help us solve several problems.

The first is to run automatically issue . The timing circuit may be kept open and close after the switch is turned into a state of automatic operation. This allows us to speak on a controller constantly let the PC read the next instruction register increment possible.

The second is the storage issue . Flip-flop circuit implemented by the timing, calculation results can be stored in a particular circuit inside, rather than a combinational logic circuit as soon as any change is input, a corresponding output will change.

On the third addresses the nature of each function in accordance with the question of timing coordination . Whether it is software instruction program implementation, or to the hardware level, the operation of the various commands have time order requirements. A timing circuit so that different events occur in chronological order.

Second, the hardware implementation of the clock signal

Want to achieve sequential logic circuit, the first step we need is a clock . I said, speaking in the third, CPU clock speed by a crystal oscillator to achieve, and this crystal oscillator signal generating circuit, is our clock signal.

To realize such a circuit, and before we speak, the switching method of producing an electrical signal by magnetic effect is the same. But, where the magnetic switch, the opening is no longer follow the line, but the current line.

1, the clock signal

In the image below, you can see, we usually just put signal input terminal of a switch in the original, put the two switches. A switch A, the beginning is open, by our hand control; another switch B,
a start, the magnetic coil is aligned on a start switch on the closing engagement B.

Thus, once we close the switch A, the magnetic coil will be energized, a magnetic switch B becomes disconnected from the engagement. Once the switch is turned off, the circuit is interrupted, the magnetic coils of the magnetic lost. Then, the switch B will spring back into engagement state. Thus, the circuit is turned on, the magnetic coil there. Our circuit will continue back and forth in the open, switching off these two states.

The process of constantly switching, the downstream circuit, is to continue to produce such new signals 0 and 1. If you are connected to a lamp on the circuit downstream, you will find the stop lamp switch between light and dark.
The signal according to a fixed cycle of constantly switching between 0 and 1, is our clock signal (Clock Signal).

 

2, the feedback circuit

General clock signal thus generated, as you can see in various textbooks legend, it is a 0,1 oscillation signal generated.

 

Such a circuit, in fact, equivalent to the output signal of the circuit as an input signal, and then return to the current circuit. This circuit fabrication approach it, we call feedback circuit (Feedback Circuit).

Next, we will see more feedback circuit. This feedback circuit generally above may be represented by the following schematic drawings, in fact, a result output connected back to the input of the inverter (Inverter-), that is, we have said before NAND gate

 

Third, to achieve storage function through the D flip-flop

1, the circuit has a memory function

With the clock signal, our system will have a like "automatic door" the same switch. Using this same switch and a feedback circuit, we can construct a circuit have a "memory" feature. This circuit has a memory function,
can implement a register for storing the calculation results in the CPU, it can be used to implement a computer memory, one consisting of five portions.

 

Let's look at the following RS flip-flop circuit. The circuit consists of two NOR gate circuits. In Figure I there, it became a standard A and B.

 

1. In this circuit, the beginning, the input switch are closed, the input of the NOR gate (NOR) A is 0 and 0. Corresponds to my column this truth table, the output is 1. NOR gate input B is 0 and the output of 1 A
corresponding to 0 is output. 0 B is fed back to the output A, and does not change until the input, output A is still 1. And the entire circuit output Q , i.e. 0.

2. When we put on the front of the switch R A together, the input A becomes 1 and 0, the output becomes 0, the corresponding input B becomes 0 and 0, the output becomes 1. 1 B is fed back to the output to the A, input A becomes 1 and 1,
the output remains 0. After the switch is closed so the A, the circuit remains stable and does not like that the crystal oscillation, the entire circuit output Q becomes 1 .

3. This time, then if we are in front of the A switch R opens, and becomes A input 1 and 0, the output is 0, B is not input the corresponding change in the output is still 1. 1 B is fed back to the output to the A, input A becomes 1 and 0, the output remains 0. This time, the circuit remains stable. State and the switch above and R S is the same as the first step, but the final output Q remains 1 , and the Q state in the first step is reversed. Our input and the second step of switching states just are not the same, but the output is still output in the step 2 of the reservation has not changed.

4. This time, we go off just below the switch S, it can be seen that, at this time, input B must be a 1, the output B is necessarily 0, i.e. final circuit output Q must be 0 .

2, flip-flop

Such a circuit, which we call the trigger (Flip-Flop). Turning on the switch R, output becomes 1, even if the switch turned off, the output is a constant. Turning on the switch S, the output becomes 0, even when the switch is turned off, the output is still zero. That is,
 when both switches are turned off, the final output, depending on the output before the action, this is what we say memory function . Here's this circuit is the simplest RS flip-flop, also known as complex Flip Flop (Reset-Set Flip Flop). The output of the corresponding truth table, you can see the following table. Can be seen that , when the two switches are 0, the corresponding output is not 0 or 1, but on a state Q and consistent.

 

Beyond this circuit Riga two AND gates and a small clock signal, we can achieve by using a clock signal to the operation of a circuit. This circuit can help us achieve what time can write data to the Q in.

We look at this circuit, the RS flip-flop based on our above, after the switch S and R, the addition of two AND gates, two AND gates simultaneously added to a clock signal CLK as the input circuit

Thus, when the clock signal CLK is at a low level when the input gate there is a 0, the output of the AND gate after two actual R and S must be zero. That is, no matter how we press the switch S and R, in accordance with the truth table of the RS flip-flop, corresponding to the Q output will not change.

Only when the clock signal CLK is at a high level when the input AND gate is a 1, the output switches depends entirely on the R and S. At this time we can, through switches R and S, to determine the corresponding Q output.

 

If this time, we let R and switch S, it is also used to link an inverter, a switch which is controlled by the same R and S. As long as the signal CLK is 1, R and S can set the output Q. When the CLK signal is 0, the R and S regardless of how provided, the output signal Q is constant. Thus, this circuit has become our most popular D-type flip-flop. R and S are used to control the switching of these two signals do, we considered a data input signal D, i.e. Data, which is the origin of the D-type flip-flop.

 

A D-type flip-flop, a read only control bit, but if we take out simultaneously in parallel with a plurality of D flip-flop, and the CLK signal is the same with all the D flip-flop as a control switch, which becomes an N-bit D-type flip-flop, it can control the read and write N bits simultaneously.

CPU registers which can be directly configured by the D type flip-flop. We can on the basis of D flip-flop, adding more switches, to achieve all set to 0 or 1 such shortcuts.

IV Summary extension

Well, here, we can Junichi shun the idea. By introducing a timing circuit, we can finally put the data "store" down. Through the feedback circuit, a clock signal is created, and then use this combination of gates and a clock signal,
to achieve a "State Memory" function. The output signal of the circuit not only depends on the current input signal, but also depending on a state before the output signal. The most common of this circuit is our D flip-flop, which is what we actually achieve implementation of memory function registers in the CPU.

This is a key to modern computer architecture "von Neumann" machines, is that the program needs to be "stored", rather than a fixed line connection or a manual toggle switch, the computer may be implemented and programmable memory function.

Once you have a clock signal and triggers, we are still a "automatic" demand did not materialize. Our computer can not be done automatically kept reading instruction from memory to execute inside. This part, we remain in the next lecture.
Next time, we look at how to make the program automatically up and running.

Guess you like

Origin www.cnblogs.com/luoahong/p/11428904.html