Jump to content

clock sensitive messaging


tmp_sc

Recommended Posts

Hi! I need a help with SystemC processes.

If I have the design with several SC_THREADs/METHODs which are sensitive to the clk.posedge_event() (some of them are using non blocking transport), is there a way that we ensure one SC_METHOD to be scheduled "last" among them? All other threads should put some data to the queue, and then SEND thread should send it.

Would this approach (with wait(SC_ZERO_TIME)) help?

void send_m() { // should be called last
  wait(clk.posedge_event());
  wait(SC_ZERO_TIME);
// send things from the queue
}


 

Link to comment
Share on other sites

There is no way to enforce an ordering on thread or method invokation.

One way to achieve this is to make send_m sensitive on the queue (using sc_fifo or tlm_utils::peq*) and let the other processes write into this queue.

Link to comment
Share on other sites

Hi Eyck,
thank you for the hint. Other processes may or may not write to the queue every cycle. Do you have in mind some mechanism which I could use to be sure that send_m is called when all of those who (potentially) write to the queue have written?

Link to comment
Share on other sites

Assuming your processes only write on the posedge clock, you could use an sc_buffer<bool> and make the last process sensitive to the buffer instead of the clock. Every time the queue is written, also write to the buffer (true). Since all the other processes will be enabled at the posedge clock, the buffer will not be processed until one delta-cycle after the clock has been processed. You would probably want to create a simple wrapper for the queue and processing. I suggest using an unbounded tlm_fifo<T> for the queue.

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...