Jump to content

dependency betweenthreads


Meir

Recommended Posts

hey all.

lets say i have the following SC_THREADS, with the sensitivity of rising clock edge.

thread 1: takes a variable 'cur_address' and uses it to access a memory.

thread 2: updates the value of 'cur_address' depending on a given logic.

since i cant tell the order of which the threads execute, is it possible that thread 1 will be invoked twice (for example) before the 'cur_address' variable updates ?

 

thank you in advance,

  Meir

Link to comment
Share on other sites

Each thread will invoked once since they are sensitive to clock. If you use here plain C++ types you will run into issues as you mentioned since it is not specified in which order the threads are activated. Therefor you need to use a signal to cummunicate between the threads: if you write to a signal you will still read the old value until the update phase is executed. This is followed by the next eavaluate phase in the next delta cycle or timestep. This way it doesn't matter in which order the threads are invoked.

You should (re-)read some books or check with some online tutorials about SystemC as this mechanism builds the foundation of the simulation semantics,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...