The bits in the micro instructions sets up the swicthes in the datapath and make the data "flow" in different directionrs.
Let us consider the full picture and see:
We will study the setting and the data flow in each case and analyse the micro-instructions used in each case to setup the datapath.
You must realise that in each case, the datapath is sequenced the same way, namely under the direction of the 4-phase clock. And yet, the datapath will behave (operate) differently due to the setting made by the bits in the micro-instruction.
You have to study the bits in the MIR very carefully. Each bit controls some part of the datapath.
Remember also that different parts of the CPU are activated (instructed to update itself) at different times - in the order given by the 4-phase clock. So looking in the above figure, and following the signals of the 4-phase clock, you will see the following happening (I have colored the different parts that are updated with 4 different colors to make things easier to follow):
The control signals that is important in phase 1 are the A and B fields, which select the registers 0001 (R1) and 0010 (R2)
BTW: the reason why these signals are important in phase 1 is because the A- and B-latches are updated in the next phase and the input input the A- and B-latches are selected by the A and B fields.
The second use of phase 3 is to update the MAR, this does not happen in this micro-instruction. We will see one such instruction below.
NOTE: you can use cs355-demo-dp2 to see this instruction in life action. Select instruction 3.
Again, study the bits in the MIR very carefully first. I will now guide you through the execution.... The datapath is going to do the same things again as the previous example. However, because values of the different controlling bits are different, different things will happen !
The control signals that is important in phase 1 are the A and B fields, which select the registers 0001 (R1) and 0010 (R2)
Simultaneously, the MAR is updated with the value of the B-latch (= R2) because the MAR bit in the micro-instruction is 1 and allow the phase 3 clock to trigger update to the MAR.
|
The transference of data proceeds under a very rigid sequence of operation called "bus protocol". Bus protocols will be studied after we completed the discussion on the CPU architecture
But sometimes it is necessary to run the CPU to "refresh" the data stored in various registers. In that case, a "dummy" micro-instruction can be used to run the CPU that "does not do any harm". You can only do harm when you update values in registers.... So by blocking out all the update bits MAR, MBR and ENC in the micro-instruction, the datapath will do the transfer and compute normally, but the result will not be used to update any register.
The following is an example of a "dummy" micro-instruction that make the datapath go through its normal operational cycle but does not update any registers:
/home/cs355001/demo/datapath/cs355-demo-dp2.Wr Click the ' key to run Click the / key 4 times At the very end of the 3rd phase: observe mar[15..0] is updated with B At the very end of the 3rd phase: observe mbr[15..0] is updated with A |
The read operation is somewhat different from the write operation because the CPU needs to wait for the memory to return the data read in MBR before it can proceed to update the destination register (which is R5 in this example)....
The CPU must execute at least two micro-instructions to read data from memory.
Also, depending on how fast the memory can return the data requested, the CPU may or may not need to wait even longer...
I will now guide you through the execution.... The datapath is going to do the same things again as the previous example. However, because values of the different controlling bits are different, different things will happen !
The control signals that is important in phase 1 is the B field, which select the registers 0010 (R2) for the B-latch (because this is how the address will be loaded into the MAR in phase 3).
Notice that the destination register R5 is not written by this micro-instruction ! The data must come into MBR first before it gets transfered into R5 !
Simultaneously, (and that is what is really important in the read opeartion) the MAR is updated with the value of the B-latch (= R2) because the MAR bit in the micro-instruction is 1 and allow the phase 3 clock to trigger update to the MAR.
So the data will be ready on the databus during phase 4 and we can update the MBR with the data on data bus.
The destination in this micro-instruction is the MBR, you can tell this from the fact that the MBR bit of the micro-instruction is 1 (update MBR).
Note:
|
/home/cs355001/demo/datapath/cs355-demo-dp2.Rd
Click the ' key to run
Click the / key 4 times
At the very end of the 3rd phase: observe mar[15..0] is updated with B
At the very end of the 4rd phase: observe mbr[15..0] is updated with
1100110011001100 (data from DataBus)
|