mips-pipeline-simulator icon indicating copy to clipboard operation
mips-pipeline-simulator copied to clipboard

When hazard protections are on, all `lw` instructions are followed by a stall regardless of hazards

Open KanegaeGabriel opened this issue 3 years ago • 2 comments

The code flow seems to always hit this conditional, because G_MEM.ID_EX_CTRL["MEM_READ"] == 1 (as it should, as it's an lw) and G_MEM.ID_EX["RT"] == if_id_rt (should it? not sure).

https://github.com/KanegaeGabriel/mips-pipeline-simulator/blob/454a821d5f650de567cf83c3b69a50fd7db19ec5/stages.py#L55-L58

A program.asm input to reproduce this issue would be:

lw $t0, 0($sp)
add $t2, $t3, $t4

This does not happen when hazard protections are toggled off (G_UTL.data_hzd), as, in that case, the conditional above would always result to False.

Further investigation needed.

KanegaeGabriel avatar Jun 22 '21 13:06 KanegaeGabriel