I have a question about systemC sc_method schedule.
In my work, event A will trigger sc_method A, event B will trigger sc_method B; and sc_method A and B both will modify a same global variable. My question is what if event A and B happens at the same time? which sc_method will be scheduled first? Can I control this schedule myself?
If I understood you correctly, two SC_METHODs can modify a shared variable.
-what if event A and B happens at the same time?
Based on SystemC simulation kernel, these two SC_METHODs are moved from waiting state into ready state.
-which sc_method will be scheduled first?
Then one by one processes are randomly taken from the ready pool by designating them as running and invoked. Although not truly random.
-Can I control this schedule myself?
You've to manage access to shared resources via inter-process communication. It usually involves the use of signals which may lead to "wait()" calls that aren't allowed in SC_METHOD. Thus you might have to change these processes into SC_THREAD or SC_CTHREAD based on your design requirements coupled with a sensitivity list or clock edge.
Hope this helps!
Note: Global variables aren't supported by Cadence C-to-Silicon Compiler.