module_method_after_sc_start.cpp revision 12855:588919e0e4aa
1#include "systemc.h" 2 3SC_MODULE(Y) 4{ 5public: 6 sc_in<bool> in; 7 SC_CTOR(Y) : in("in") 8 { 9 SC_METHOD(comb); 10 sensitive << in; 11 init = 1; 12 } 13 int init; 14 void comb() 15 { 16 if ( init ) 17 { 18 init = 0; 19 SC_METHOD(dork); 20 } 21 } 22 void dork() 23 { 24 cout << "dork" << endl; 25 } 26}; 27 28int sc_main(int argc, char* arg[]) 29{ 30 sc_clock clock; 31 Y y("y"); 32 y.in(clock); 33 34 35 sc_start(10, SC_NS); 36 cerr << "Program completed" << endl; 37 38 return 0; 39} 40 41