Home › Practice › RTL Design › Load-use hazard detector

Load-use hazard detector

EasyRTLcombinationalarchitecture

A load instruction fetches a number from memory. The very next instruction wants to use that number, but it is not back yet.

Concept first. A load gets its data from memory one stage later than an ALU result is ready, so even forwarding cannot deliver it to the instruction right behind it in time. This is a load-use hazard. The fix is to stall for one cycle: freeze the Fetch and Decode stages, and put a bubble (a do-nothing slot) into Execute by flushing it. The hazard exists when the instruction in Execute is a load (the signal memtoreg_e says so) and its destination register is one of the two source registers of the instruction in Decode. The detector's three outputs all fire together.

What to build.

Solve in your browser →

No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.

More in this track

← Forwarding: take the newest valueRegister busy bits →