Stall or bubble in MIPS

How many stalls do I need to complete correctly. I am a little confused by what I did, so I am here to see expert answers.

lw $ 1.0 ($ 2);

beq $ 1, $ 2, Label;

Please note that checking whether the branch will occur or not will be performed at the decoding stage. But the original register rs beq, which $1 in this case will be updated after the write back stage of the lw instruction. So we need to send new data from the memory at the memory stage to the decoding stage of the beq instruction.

Here is the data path diagram:

enter image description here

+4
source share
1 answer

The value that is retrieved from the memory is written to the register file during the writeback phase of the pipeline. Writing to the register file occurs in the first half of the clock cycle, while reading from the register file occurs in the second half of the clock cycle.

Thus, the value written to the register file can be read in the same measure as in the register file. So forwarding is not efficient here .

As for the number of kiosks required, you need to insert two bubbles into the pipeline, since the lw command should be at the recording stage, when the beq command is at the decoding stage.

Hope this answers your question.

+1
source

All Articles