tmp_sc Posted April 25 Report Share Posted April 25 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 } Quote Link to comment Share on other sites More sharing options...
Eyck Posted April 25 Report Share Posted April 25 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. Quote Link to comment Share on other sites More sharing options...
tmp_sc Posted April 26 Author Report Share Posted April 26 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? Quote Link to comment Share on other sites More sharing options...
David Black Posted April 30 Report Share Posted April 30 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.