Jump to content

Systemc Threads


ankushKumar

Recommended Posts

SC_THREAD(A)

SC_THREAD( B )

SC_THREAD( C )

 

A(){

       while(1){

                     wait(e_A);

                     e_B.notify(SC_ZERO_TIME);

                     e_C.notify(SC_ZERO_TIME);

                     -------

                    }

}

 

 

B(){

       while(1){

                     wait(e_B );

                     -------

                     -------

                    }

}

 

C(){

       while(1){

                     wait(e_C);

                     -------

                     -------

                    }

}

 

In the above case acc. to systemc scheduler the threads will be notified in delta phase.

Now my question is, whether its a nodeterminstic condition which of the thread will run 1st b or c , or is it like that the one notified 1st will get the control 1st.

Link to post
Share on other sites

Hi,

 

 

Now my question is, whether its a nodeterminstic condition which of the thread will run 1st b or c , or is it like that the one notified 1st will get the control 1st.

 

Actually neither nor. The order of execution of threads in one delta cycle is not defined.

 

First, execution order does not depend on the notification order. Changing the order of notification will not change the thread execution order.

 

Second, the execution order is not fully nondeterministic. If you do not change the model (and the simulator), the order will allways be the same. This depends on the thread lists in the simulation kernel and the order of thread instantiation. BUT YOU SHOULD NOT RELY ON THIS ORDER since different simulators may use different orders.

 

Greetings

Ralph

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...