test05.cpp revision 12855:588919e0e4aa
1#include "systemc.h" 2 3SC_MODULE(TB) 4{ 5 SC_CTOR(TB) 6 { 7 SC_THREAD(exec); 8 sensitive << m_clk.pos(); 9 } 10 void exec() 11 { 12 for (;;) 13 { 14 wait(2); 15 cout << sc_time_stamp() << endl; 16 wait(4); 17 cout << sc_time_stamp() << endl; 18 wait(1); 19 cout << sc_time_stamp() << endl; 20 wait(1000); 21 cout << sc_time_stamp() << endl; 22 sc_stop(); 23 } 24 } 25 sc_in_clk m_clk; 26}; 27 28int sc_main( int, char*[] ) 29{ 30 sc_clock clock; 31 TB tb("tb"); 32 33 tb.m_clk(clock); 34 sc_start(2000, SC_NS); 35 36 return 0; 37} 38