112855Sgabeblack@google.com 212855Sgabeblack@google.com#include <systemc.h> 312855Sgabeblack@google.com 412855Sgabeblack@google.comsc_trace_file* sc_tf; 512855Sgabeblack@google.com 612855Sgabeblack@google.comclass Mod : public sc_module 712855Sgabeblack@google.com{ 812855Sgabeblack@google.com public: 912855Sgabeblack@google.com 1012855Sgabeblack@google.com sc_in_clk clk; 1112855Sgabeblack@google.com 1212855Sgabeblack@google.com sc_in<sc_uint<37> > a; 1312855Sgabeblack@google.com sc_inout<bool > b; 1412855Sgabeblack@google.com 1512855Sgabeblack@google.com 1612855Sgabeblack@google.com 1712855Sgabeblack@google.com SC_HAS_PROCESS(Mod); 1812855Sgabeblack@google.com 1912855Sgabeblack@google.com void foo() 2012855Sgabeblack@google.com { 2112855Sgabeblack@google.com cout << sc_time_stamp() << "\n"; 2212855Sgabeblack@google.com cout << " a = " << a << " b = " << b << "\n"; 2312855Sgabeblack@google.com cout << "\n"; 2412855Sgabeblack@google.com return; 2512855Sgabeblack@google.com } // foo() 2612855Sgabeblack@google.com 2712855Sgabeblack@google.com Mod(const sc_module_name& name) : sc_module(name), a("a") 2812855Sgabeblack@google.com { 2912855Sgabeblack@google.com SC_METHOD(foo); 3012855Sgabeblack@google.com sensitive << clk.pos(); 3112855Sgabeblack@google.com dont_initialize(); 3212855Sgabeblack@google.com } 3312855Sgabeblack@google.com 3412855Sgabeblack@google.com void start_of_simulation() { 3512855Sgabeblack@google.com 3612855Sgabeblack@google.com sc_trace(sc_tf, a, a.name()); 3712855Sgabeblack@google.com sc_trace(sc_tf, b, b.name()); 3812855Sgabeblack@google.com } 3912855Sgabeblack@google.com 4012855Sgabeblack@google.com}; // class Mod 4112855Sgabeblack@google.com 4212855Sgabeblack@google.com 4312855Sgabeblack@google.com 4412855Sgabeblack@google.com 4512855Sgabeblack@google.com 4612855Sgabeblack@google.comint sc_main(int argc, char* argv[]) 4712855Sgabeblack@google.com 4812855Sgabeblack@google.com{ 4912855Sgabeblack@google.com sc_clock clk("clk", 50, SC_NS, 0.5, 0, SC_NS); 5012855Sgabeblack@google.com sc_signal<sc_uint<37> > a; 5112855Sgabeblack@google.com sc_signal<bool> b; 5212855Sgabeblack@google.com sc_tf = sc_create_vcd_trace_file("test14"); 5312855Sgabeblack@google.com Mod mod("mod"); 5412855Sgabeblack@google.com mod.clk(clk); 5512855Sgabeblack@google.com mod.a(a); 5612855Sgabeblack@google.com mod.b(b); 5712855Sgabeblack@google.com sc_trace(sc_tf, clk, clk.name()); 5812855Sgabeblack@google.com sc_start(50, SC_NS); 5912855Sgabeblack@google.com a = 12; 6012855Sgabeblack@google.com b = true; 6112855Sgabeblack@google.com sc_start(50, SC_NS); 6212855Sgabeblack@google.com return 0; 6312855Sgabeblack@google.com} // sc_main() 6412855Sgabeblack@google.com 6512855Sgabeblack@google.com 66