|
Post by amitk3553 on May 1, 2013 6:58:36 GMT
Hello all,
Could somebody explain the difference between dynamic and static sensitivities of processes in SystemC with some example.
Thanks
Regards Amit Kumar
|
|
|
Post by Mukesh on May 1, 2013 7:27:08 GMT
Hello amit
The Process in SystemC trigger at some event which is known as sensitivity of the process.
SystemC has two types of sensitivity:
Static
Dynamic.
Static sensitivity is implemented by applying the SystemC sensitive command to an SC_METHOD, SC_THREAD, or SC_CTHREAD at elaboration time (within the constructor).
Dynamic sensitivity lets a simulation process change its sensitivity on the fly. The SC_METHOD implements dynamic sensitivity with a next_trigger command. The SC_THREAD implements dynamic sensitivity with a next command.
|
|
|
Post by prashantjain on May 1, 2013 9:00:15 GMT
Here is an example of dynamic and static sensitivity,
SC_THREAD(P_THREAD); sensitive << clk.pos(); // static sensitivity, trigger for process P_THREAD is already defined SC_METHOD(P_METHOD);
void P_METHOD() { -do-work- next_trigger(evt); // dynamic sensitivity, P_METHOD will rerun when evt event is triggered, }
void P_THREAD() { while(true) { -do-work- evt.notify(); } }
|
|
|
Post by Mukesh on May 1, 2013 9:23:44 GMT
Here is an example of dynamic and static sensitivity, SC_THREAD(P_THREAD); sensitive << clk.pos(); // static sensitivity, trigger for process P_THREAD is already defined SC_METHOD(P_METHOD); void P_METHOD() { -do-work- next_trigger(evt); // dynamic sensitivity, P_METHOD will rerun when evt event is triggered, } void P_THREAD() { while(true) { -do-work- evt.notify(); } } yes prashant is totally right in SC_METHOD dynamic sensitivity is provided by next_trigger(event_name) and in SC_THREAD sensitivity is provided by event_name.notify()
|
|
|
Post by prashantjain on May 1, 2013 10:05:22 GMT
yes prashant is totally right in SC_METHOD dynamic sensitivity is provided by next_trigger(event_name) and in SC_THREAD sensitivity is provided by event_name.notify() u meant , in SC_THREAD dynamic sensitivity is provided by next() method.. right??!!
|
|
|
Post by gchopra on May 1, 2013 10:13:36 GMT
Static sensitivity list is declared when a process is registered with the kernel. Example: Module(sc_module_name _n){ SC_THREAD(thread); sensitive << a << b; }
SystemC supports also dynamic sensitivity list. For example, for threads, the sensitivity may change each time wait() is called. void thread(){ while true { wait(); … wait(10, SC_NS); … wait(e);} };
1. wait() : waits for an event on a port or channel in the sensitivity list. 2. wait(10, SC_NS) : wait for 10 ns, then resume the process. The static sensitivity list is ignored while waiting. 3. wait(e): Wait for event e. While waiting, the static sensitivity list is disabled.
|
|
|
Post by Mukesh on May 1, 2013 10:19:58 GMT
yes prashant is totally right in SC_METHOD dynamic sensitivity is provided by next_trigger(event_name) and in SC_THREAD sensitivity is provided by event_name.notify() u meant , in SC_THREAD dynamic sensitivity is provided by next() method.. right??!! There is no next() function in systemC upto my knowledge. i write it because i read it some where. mainly notify is used to provide dynamic sensitivity .
|
|
|
Post by prashantjain on May 1, 2013 10:31:22 GMT
u meant , in SC_THREAD dynamic sensitivity is provided by next() method.. right??!! There is no next() function in systemC upto my knowledge. i write it because i read it some where. mainly notify is used to provide dynamic sensitivity . You probably are correct. Though I would like to further add to this information and correct a few details, A method process, and only a method process, may call the function next_trigger to create dynamic sensitivity. A thread process instance may call function wait to create dynamic sensitivity.
Source: IEEE Std 1666-2011 LRM, Page - 43
|
|
|
Post by amitk3553 on May 1, 2013 10:45:57 GMT
Hello amit The Process in SystemC trigger at some event which is known as sensitivity of the process. SystemC has two types of sensitivity: Static Dynamic. Static sensitivity is implemented by applying the SystemC sensitive command to an SC_METHOD, SC_THREAD, or SC_CTHREAD at elaboration time (within the constructor). Dynamic sensitivity lets a simulation process change its sensitivity on the fly. The SC_METHOD implements dynamic sensitivity with a next_trigger command. The SC_THREAD implements dynamic sensitivity with a next command. What do you mean by senstivity on the fly?
|
|
|
Post by amitk3553 on May 1, 2013 10:51:30 GMT
Here is an example of dynamic and static sensitivity, SC_THREAD(P_THREAD); sensitive << clk.pos(); // static sensitivity, trigger for process P_THREAD is already defined SC_METHOD(P_METHOD); void P_METHOD() { -do-work- next_trigger(evt); // dynamic sensitivity, P_METHOD will rerun when evt event is triggered, } void P_THREAD() { while(true) { -do-work- evt.notify(); } } next_trigger(evt)...means if evt is notified in first delta cycle....then process will be executed in next delta cycle
|
|
|
Post by amitk3553 on May 1, 2013 10:55:46 GMT
Static sensitivity list is declared when a process is registered with the kernel. Example: Module(sc_module_name _n){ SC_THREAD(thread); sensitive << a << b; } SystemC supports also dynamic sensitivity list. For example, for threads, the sensitivity may change each time wait() is called. void thread(){ while true { wait(); … wait(10, SC_NS); … wait(e);} }; 1. wait() : waits for an event on a port or channel in the sensitivity list. 2. wait(10, SC_NS) : wait for 10 ns, then resume the process. The static sensitivity list is ignored while waiting. 3. wait(e): Wait for event e. While waiting, the static sensitivity list is disabled. Means you are saying we cannot use wait() in case of static sensitivity???
|
|
|
Post by gchopra on May 1, 2013 11:22:15 GMT
Hello Amitk3553, I'm saying use of wait() make process to have dynamic sensitivity.
|
|
|
Post by Mukesh on May 2, 2013 3:55:07 GMT
Hello Amitk3553, I'm saying use of wait() make process to have dynamic sensitivity. Hello Gagan i think wait() is not always provide dynamic sensitivity. dynamic sensitivity is provided by generation of event and wait(event_name). if you used only wait() function in a process then that process will trigger only at the static sensitivity that is provided in constructor !! Correct me if i am wrong !!
|
|
|
Post by gchopra on May 2, 2013 4:58:11 GMT
Hello Mukesh, When we use wait() in the thread process that make process to alive and next time execute as per static sensitivity list. Use of wait (wait(), wait(10, SC_NS), wait(e)) provide us dynamic sensitivity. More on that point in test-bench we define thread without using wait() that means thread process in test-bench have static sensitivity.
|
|
|
Post by Mukesh on May 2, 2013 7:35:02 GMT
Hello Mukesh, When we use wait() in the thread process that make process to alive and next time execute as per static sensitivity list. Use of wait (wait(), wait(10, SC_NS), wait(e)) provide us dynamic sensitivity. More on that point in test-bench we define thread without using wait() that means thread process in test-bench have static sensitivity. Gagan if we used only one wait() function in a thread like it is shown in code below what is the sensitivity static or dynamic ?? void P_THREAD() { while(true) { --do your work-- wait(); } }
|
|