Search the Community
Showing results for tags 'sc_event_queue'.
-
Hello, I am having an SC_THREAD as follows // // SC_THREAD(my_proc); sensitive << event_1; dont_initialize(); // // // void my_proc() { while(1) { wait(10,SC_NS); cout << " Display ok"; wait(event_1); } } My question is i am having an situation where this event get triggered repetedly in short instance of time, lets say at time t=2 ns it get triggered then SC_THREAD starts, then again it get triggered at t=4ns, but this triggerring of event goes unnoticed. I saw some post and from them i got to know that i cant even use sc_event_queue as i am using wait in my thread. What can be alternative to implement this logic. Thanks.
- 2 replies
-
- systemc
- sc_event_queue
-
(and 2 more)
Tagged with:
-
Hi, I have some questions on systemC syntax. 1. sc_event_queue. I found a lot of examples for sc_event_queue on some systemC coursewares (even threads on this forum), like below, SC_MODULE(somemod){ sc_event_queue eq; ... void process1(){ while(true){ ... wait(eq); // here got a message: cannot convert from 'sc_core::sc_event_queue' to 'const sc_core::sc_event' , ... } } void process2(){ while(true){ ... eq.notify(5,SC_NS); eq.notify(8,SC_NS); ... } } SC_CTOR(somemod){ ... } }; If I change "wait(eq)" into "wait(eq.default_event())" or just use "wait()" meanwhile add eq into the sensitive list, it will work. Is it correct? 2. sc_semaphore channel. I see an example from the book systemc from the ground up like this, SC_MODULE(gas_station) { sc_semaphore pump(12); // here seems define a function which will return a sc_semaphore instance void customer1_thread { for(;; ) { // wait till tank empty … // find an available gas pump pump.wait(); // fill tank & pay } }; But this seems that it cannot work at all. Then if I use a new form like below it will work, SC_MODULE(gas_station) { sc_semaphore pump; void customer1_thread { for(;; ) { // wait till tank empty … // find an available gas pump pump.wait(); // fill tank & pay } SC_CTOR: pump(12){ ... } }; So if I want to use the form of sc_semaphore pump(12) to the module, what should I do on the constructor? Another question for the semaphore channel: does the sc_semaphore value have a upper limit or what is the size of this channel? Thanks a lot! Wayne