Changing the value of net from X->0

Your code doesn’t work because among other things, it just adds another driver to imp and does not get rid of of DUT driving the X.

The easiest thing to do if you do not want your testbench state to go to X is to use 2-state variables like bit and int instead of logic and integer.

There are other ways of structuring your testbench to be X tolerant like using the === operator andcase inside statement. But we would need to see more code.