6. (5 points) The following instruction sequence is to be executed:

or $2,$0,$0
and $7,$3,$11
sub $8,$8,$3
sw $5,0x800($2)
lw $7,0x804($0)
add $8, $8, $8
bne $7, $4, 0x040
How many clock cycles would be required to execute this sequence on the multi-cycle data path if each state that is used requires one clock cycle to complete?

Respuesta :

Answer:

11 cycles.

Explanation:

One interesting thing to observe in this is that, there is no data hazard because here in any of the two consecutive instruction, they do not share any common register and hence no collision.

Also assuming each this program starts with address 0, so that condition checking at the end which is "bne $7, $4, 0x040" will not lead to branching which repeats the loop. Which means this sequence of 7 instructions run only once.

Now if there is no pipeline hazard (which is the case here) and there are n instruction with s stages in pipeline with each stage take 1 cycle, then total cycle required to finish the program will be n+(s-1)=n+s-1

Here number of instruction n=7 and in multicycle datapath usually pipeline stages s=5.

Then number of cycles needed to execute this sequence will be = 7 +5 -1 = 11 cycles

ACCESS MORE