In reply to sv_beginner:
The while() statement I provided earlier is incorrect. If you need to wait until wr_complete and rd_complete are both high, then you want:
while (!(wr_complete && rd_complete)) @(posedge clk);
The wait() statement is immediately evaluated when called. If it passes, then execution continues. If it doesn’t pass, then it will block. If you do a simultaneous read and write, then both while() statements will pass, but then one if statement will fail due to a race condition.
You don’t have to post your entire testbench. Just a small code example that shows the problem you are having.