I have a variable in systemverilog that I am setting from a task and reading from another task. The read and the writes are independent. I want to ensure if both read and write are called at the same timestamp I get the updated value.
I can see that by design, this is going into a race condition where I have no control on what the read value would be. I am aware of non-blocking assignment that would ensure I always get the old value of the variable. Is there something with which I can ensure I get the new value of the variable.
I am using system verilog/UVM.
Any suggestion/pointers is highly appreciated :)