Home › Practice › RTL Design › Register busy bits
Register busy bits
EasyRTLsequentialarchitecture
A processor starts several instructions at once. Before one reads a register, it must be sure no earlier instruction is still about to change that register.
Concept first. A scoreboard keeps track of which registers still have a result on the way from an instruction that has been issued (started) but has not finished. Each register has a busy bit. The bit is set when an instruction that writes the register is issued, and cleared when that result is written back. A later instruction may read a register only when its busy bit is clear; otherwise it would read a stale value (a read-after-write hazard). Think about what should happen if the same register is issued to and written back in one cycle.
What to build.
- Ports:
clk, rst, issue, issue_rd[1:0], wb, wb_rd[1:0], src[1:0]; outputsbusy[3:0]andsrc_ready. Four registers, numbered 0 to 3. rstis synchronous, active-high: all busy bits are cleared.- On a rising edge:
issue = 1setsbusy[issue_rd];wb = 1clearsbusy[wb_rd]. If both name the same register in the same cycle, issue wins (the register stays busy). src_readyis 1 when registersrcis not busy. It follows the state directly.
No install and no sign-up needed. You write your answer in the editor and Nishkam checks it.