Administrator
|
Imagine that you have a really slow clock, or perhaps you have a button that you can press in order to generate exactly one clock cycle.
So reset the PC to 0 and then are sitting there waiting to press your button for the first time. While you are waiting the instruction at ROM address 0 (@0) is on the instruction line and all of your control signals see it and are acting on it. So the muxes and load signals are all sitting there ready to put a 0 into the A register. But at the same time there is some value (we just don't know what it is) already in the A register and that value is sitting there being used as the address line on the RAM and so the value stored in RAM at that address is sitting there on the inM data bus. Depending on what your control logic is doing as far as the A/M mux and the control signals for the ALU, that value may also be affecting the output of the ALU right now. But this doesn't matter because your control signals are NOT enabling writing to the D register or the RAM or anything else. Furthermore, the PC is sitting there waiting to increment the value of its internal counter.
Now you press your button and the value that is already sitting at the input of the A register is loaded into the A register because the load signal to it is already enabled. At the same time, the PC increments and the address lines to the instruction ROM change from 0 to 1 and so the new instruction (D=M) appears on the instruction line. It has no effect on anything else yet because by the time it appears on the instruction bus all of the other action related to the previous instruction that was there has occurred and the rising edge of the clock is too far in the past already for anything to be sensitive to what is there now.
However, the decode logic is combinatorial, so it proceeds to decode the new instruction and configure the various control signals appropriately. Since the A register now has the value 0 stored in it, this appears on the addressM bus and the value stored in RAM[0] appears on the inM bus as fast as it can. At the same time, the decoded instruction is setting the A/M mux to pass the signal on the inM line to the Y input of the ALU and the ALU control signals are being configured to make the output of the ALU equal to the Y input. The output of the ALU is then applied to both the input of the D register and also the input of the A register (through the ALU/inst mux), but while the D register load signal is enabled the A register load signal is not. All of this happens in the time between the of the prior rising clock edge and the next rising clock edge (which hasn't happened yet because you haven't pressed the button again yet). It doesn't happen instantly, but it does happen pretty quickly. Eventually the contents of RAM[0] is sitting at the input of the D register and the load signal on the D register is enabled. As long as you wait long enough for that to all settle out, then when you push the button the next time the contents of RAM[A] will get loaded into D.
The longest the amount of time you have to wait for things to settle down across all of the possible instructions determines the minimum amount of time you have to wait between successive clock pulses, which it turn is the maximum clock rate you can run your machine at.
|