Jump to content


  • Content Count

  • Joined

  • Last visited

About Khushi

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi I am trying to understand the max_num_extension() return value. When I create a payload object and use set_extension and then call max_num_extensions(), then it returns 2. I tried to debug and noticed that even if we didn't have any module, it still gives 2. The following piece of code prints 2. why it is so ? //#include "top.hpp" #include "tlm.h" #include "systemc.h" int sc_main(int argc, char** argv){ std::cout<<tlm::max_num_extensions()<<std::endl; sc_start(); return 0; } LRM@496 syas "The function max_num_extensions shall return the number of extension types, that is, the size of the extension array. As a consequence, the extension types shall be numbered from 0 to max_num_extensions()-1". Thanks Khushi
  2. Thanks. I was following the examples/tlm/lt_temporal_decouple example in SystemC package and there the global quantum is set in initiator constructor instead of main. This is why I asked this particular question whether the initiator is allowed to set the global quantum. May be we can update this example to put the global quantum setting in sc_main. Thanks Khushi
  3. Yes agreed wrt LRM But why "at any time" instead of "at same time" ? Thanks Khushi
  4. my point is that if multiple threads write to same port at same time than this error make sense but when multiple threads write to same port at different time than it should be ok as there is no race in that case. It is as good as same thread write to that port at different time stamp. I am trying to understand the logic behind this error when threads are competing for the same resource in different time points.
  5. Just to add, in my use case it is guaranteed that the different threads write to same port(signal) at different time stamp. Thanks Khushi
  6. Hi I have a use case where multiple threads are writing on a signal port and I get the sc_signal<T> cannot have more than one driver error. To avoid that I started to use sc_mutex and use lock/unlock., but still I get the same error. Here is what I tried to reproduce my use case with a small example. Can you help me to understand what is going wrong even after using mutex and how to avoid this issue. #include"systemc.h" using namespace std; using namespace sc_core; class module : public sc_module { public: sc_signal<bool> sig; sc_mutex m; explicit module(sc_module_name name): sc_module(name),sig("sig"){ SC_HAS_PROCESS(module); SC_THREAD(p1); SC_THREAD(p2); } void p1(){ while(1){ wait(10,SC_NS); m.lock(); sig.write(1); m.unlock(); } } void p2(){ while(1){ wait(10,SC_NS); m.lock(); sig.write(0); m.unlock(); } } ~module(){ } }; int sc_main(int, char**){ module m("m"); sc_start(); return 0; } Thanks Khushi
  7. Hi I am a bit curious to know if it is possible to do HW modeling using c++11 threads without using systemC/TLM library ? Any model example will be a great help. Thanks Khushi
  8. Hi Eyck This is clear. But if the initiator is using quantum keeper and the global quantum is not set in sc_main, then there will be a lot to context switching in that initiator because it get the global quantum as 0. Can we check the global quantum in the initiator (with get_global_quantum) and if it is 0, set it explicitly in the initiator constructor ? Is this a good modeling recommendation ? Thanks Khushi
  9. Hi While modeling an initiator can we assume that the top.cpp/main.cpp somewhere have set the global quantum value ? I see a case where an initiator is using quantum keeper to sync on multiple of global quantum and global quantum is not set in main.cpp and due to this the initiator is syncing after every b_transport call because the need_sync() always returns true because the global quantum is not set and it defaults is 0. I can set the global quantum explicitly in the initiators but to what value, as each initiator is developed independently and can set different values global quantum values and also it will override the global quantum defined at the top. Is there any strict guide line we need to follow ? Thanks Khushi
  10. Hi Guys Do we need to have one quantum keeper per SC_THREAD in a module or only one per module is sufficient? Thanks Khushi
  11. Hello In the following code, how I can make sure that slave thread get its turn after master so that slave gets the correct value. The below code output 0 instead of 0x11223344. In general how to make sure that the threads are executed in a specific order once a pos edge is detected. For example if we have 10 threads all are sensitive to posedge of the clock. How to make sure the threads are always executed in order 1,2,3,4,5,6,7,8,9,10 so that the behavior is deterministic. #include <iostream> #include "systemc.h" class master : public sc_module { public: sc_in<bool> clk; sc_out<uint32_t> data_out; master(sc_module_name name):clk("clk"),data_out("data_out"){ SC_HAS_PROCESS(master); SC_THREAD(run); } void run(){ wait(clk.posedge_event()); data_out.write(0x11223344); } ~master(){ } }; class slave : public sc_module { public: sc_in<bool> clk; sc_in<uint32_t> data_in; slave(sc_module_name name):clk("clk"),data_in("data_in"){ SC_HAS_PROCESS(slave); SC_THREAD(run); } void run(){ wait(clk.posedge_event()); cout<<hex<<data_in.read()<<endl; } ~slave(){ } }; class top : public sc_module{ public: master m; slave s; sc_clock clk; sc_signal<bool> valid; sc_signal<uint32_t> data; top(sc_module_name name):m("m"),s("s"),clk("clk",sc_time(5,SC_NS)),data("data"){ m.clk(clk); s.clk(clk); m.data_out(data); s.data_in(data); } ~top(){ } }; Thanks Khushi
  12. Hi I am trying to understand the difference between event based simulation vs cycle based simulation. I have following questions - which one is faster and why - TLM2 LT is event based or cycle based - TLM2 AT is event based or cycle based - Cycle accurate/approximate is event based or cycle based Can you prove a small example or pointer to better understand this. Thanks Khushi
  13. Thanks David I have few connected questions There are lot of people talk about cycle accurate models to speed up the simulation. What are those cycle accurate models? Are those written in SystemC ? If not can you explain a bit on this. Can we connect an untimed tlm model to a rtl block and simulate it seamlessly. Do we need to take care few things in untimed tlm model to make it work in a cosimu environment? I remember someone implementing a SystemC model with individual axi pins as sc_bv/sc_lv types instead of using the tlm2 socket. What are the usage of such models? Suppose I connect a tlm2 socket to a rtl axi interface using some adapter eg tlm2axi, in this case do we need cycle accurate or approximate model on tlm side for a smooth operation. Thank khushi
  14. Does SystemC SC_CTHREAD( clocked thread) has something to do with cycle accurate modeling? If no, then what is the use of SC_CTHREAD?
  15. Hi i am trying to understand how we can insert timings in an untimed model any example will be a great help thanks khushi
  • Create New...