Why can't an always block be used inside a program block?
Why can't an always block be used inside a program block?
Model answer
A program block models a test: it starts stimulus and **ends** when all its initial blocks finish, which then terminates the simulation. An always block never finishes by itself, so it is illegal inside a program (compile error). Use initial with a forever loop (with break or disable to leave it) instead. Programs also schedule their execution in the Reactive region, which avoids races with the DUT.