#include SC_MODULE (sc_semaphore_example) { sc_in clock; sc_semaphore bus; int cnt; void bus_semaphore() { while (true) { wait(); cout << "@" << sc_time_stamp() <<" Check if semaphore is 0 " << endl; if (bus.get_value() == 0) { cout << "@" << sc_time_stamp() <<" Posting 2 to semaphore " << endl; bus.post(); bus.post(); if (cnt >= 3) { sc_stop(); // sc_stop triggers end of simulation } cnt ++; } } } void do_read() { while (true) { wait(); cout << "@" << sc_time_stamp() <<" Checking semaphore for intance 0"<