shubham_v Posted June 11, 2019 Report Posted June 11, 2019 Hi, I have declared and defined the clock in my example and able to generate and transport the transactions successfullly. As its is a blocking transport interface of tlm,so we are using wait statement. But what i observed here is, i am not able to control the triggering of process by using clocks for both the modules.Thiugh , i am able to controll the thread awakening by using delay statements. What if i want to use clocks to controll the trigger ,thats why i had put them in the sensitivity list. Please let me know,what would be my approach for the triggering by clocks.? do i need to look out for other interface method in tlm or should i go back to system c interface approach ? Please help me out with this. Thanks & regards, Shubham Ps:- I am attaching the code along with the block diagram below,please let me know the solution for it.The block diagram represents 2 blocks of initiator and target modules with clock supplied. Iam able to compile and run the code succesfully,if you get any error while compiling i might have done mistake while copying. initiator.h.txt main.cpp.txt target.h.txt initiator2.h.txt target2.h.txt top.h.txt Quote
Eyck Posted June 11, 2019 Report Posted June 11, 2019 You should consult the LRM again.:SC_THREAD does not have a sensitivity list. Moreover you create a memory leak creating the transaction object using new and not deleting it. And your thread ends after 10 accesses. Basically you need to wait for the clock explicitly while (1) { // wait for the rising edge wait(clk.posedge_event()); tlm::tlm_generic_payload trans; // setup the transaction ... // execute the access i_socket->b_transport(*trans, delay); } In your solution the loop in your threads are based on timed delays hence it is not reactiong on your clocks at all. Best regards shubham_v 1 Quote
shubham_v Posted June 12, 2019 Author Report Posted June 12, 2019 Hi @eyck, As far as lrm is concerned with,i can see sensitive list in sc_thread.It is as follows , So, i had missed this concept of posedge event. When i included pos_edge event ,i was able to controll the process. Just to cross check ,i included only wait() without any arguments in second thread,during that time my second thread was not running.So ,process is controlled by clock now. Yes, i had forgotten to delete the pointer created payload.Thank you for pointing it out. Regards, Shubham Quote
Eyck Posted June 12, 2019 Report Posted June 12, 2019 My fault, SC_THREAD has a sensitivity list and you can call wait() for the default event. In my experience -and this guided my answer- it is better to have no sensitivity list and wait explicitly for events. When specifying a port in the sensitivity list you need to use an event finder (with .pos()) as the port is not bound yet and hence does not have an event associated. In the thread itself you can use the pos_edge event. So your code shown above is correct. BR shubham_v 1 Quote
shubham_v Posted June 13, 2019 Author Report Posted June 13, 2019 Hi @Eyck, Yes for clock based events,this would be much better approach and it worked. Thanks a lot for your help 🙂 Regards, Shubham Quote
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.