The data_out value is updating in the next clock edge which is supposed to update as soon as b is assigned, why?
You are updating data_out and b simultaneously on posedge clk which means at every positive edge of clk, data_out will be assigned the value of b and b will be assigned the memory[address], therefore data_out is assigned the old value of b

To get correct results, you can do this:

Do not update data_out &lt;= b in first always block
Instead assign data_out &lt;= memory[address] inside second always block itself.