Recently, I am studying systemc and have a question on semaphore channel.
I found an example on asic world (http://www.asic-world.com/systemc/channels3.html) but have a little confused.
At the first 1ns for this example, the first process bus_semaphore() works and can print out two lines "@1 ns ....". At the same time, the semaphore value (bus) changes into 2 (bus.post()) and then wait for the next clock posedge.
For the second process, do_read(), also at the 1ns, the first "@" line can be printed out normally, but then what about the trywait() in the next if-statement? The first and second process should be executed simultaneously, that is to say we cannot determine whether the trywait() executes before or after the bus.post() statement of the first process, so we don't know if the second "@" line of the second process will be printed out.
But the answer shown at the bottom of the page means that the trywait() will execute after the bus.post() executes so that the second "@..." statement will be printed out. How can I be sure that the trywait() will executed after the bus.post()'s execution?
Thanks in advance!