I have a thread which is sensitive to an array of ports. In this thread I want to find out which port had triggered this thread so that i can read the value of that port?
Is there a way to determine this?
Example code given below. What should be the logic to determine which port triggered thread_name() ?
tb.h ----------------
class tb :: public sc_core :: sc_module
{
sc_core :: sc_out<uint32_t> port_name[10];
void thread_name();
};
tb.cpp --------------
tb :: tb (...)
{
SC_THREAD(thread_name);
for(int i=0;i<10;i++)
sensitive >> port[i];
dont_initialize();
}
void tb::thread_name()
{
// print data of the port that triggered this thread
// in this case, only port[2] should be read and data 5 should be printed
}
int main()
{
tb tb("");
tb->port_name[2]->write(5);
}