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 comment
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 comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...