In reply to rustyguru:
You’ve forked off two threads in parallel with no timing. There’s nothing to synchronize execution of the two loops, so the simulator is free to execute the read loop first before the wright loop ever executes.
To get this to work you need to introduce a clock or some sort of delay so that the write happens before the read.