Changeset 55 for sources/test_regression/09092005b/system.cpp
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/09092005b/system.cpp
r1 r55 1 1 2 #include "systemc.h" 2 3 3 #define ASSERT(x) \ 4 { errnum++; \ 5 if (!(x)) \ 6 { \ 7 cerr << "ASSERT : " #x "\n"; \ 8 exit (errnum); \ 9 } \ 10 } 4 #include "test.h" 11 5 12 6 using namespace std; 13 7 14 struct hard : sc_module 15 { 16 sc_in_clk clk; 17 sc_in <int> i1, i2; 18 sc_out<int> o1, o2; 8 struct hard : sc_module { 9 sc_in_clk clk; 10 sc_in <int> i1, i2; 11 sc_out<int> o1, o2; 19 12 20 void f () 21 { 22 o1 = i1; 23 o2 = i2; 24 } 13 void f() { 14 o1 = i1; 15 o2 = i2; 16 } 25 17 26 SC_HAS_PROCESS(hard); 27 hard(sc_module_name) 28 { 29 SC_METHOD(f); 30 dont_initialize(); 31 sensitive << i1 << i2; 18 SC_HAS_PROCESS(hard); 19 20 hard(sc_module_name) { 21 SC_METHOD(f); 22 sensitive << i1 << i2; 23 dont_initialize(); 24 32 25 #ifdef SYSTEMCASS_SPECIFIC 33 o1 (i1);34 o2 (i2);26 o1 (i1); 27 o2 (i2); 35 28 #endif 36 } 29 } 30 37 31 }; 38 32 39 int40 sc_main (int argc, char ** argv)41 {42 sc_clock clk1("clk1");43 sc_clock clk2("clk2", 1, 0.5, 0, false);44 sc_signal<int> s[10];45 hard a("a");46 hard b("b");47 hard c("c");48 33 49 a.clk (clk1); 50 b.clk (clk2); 51 c.clk (clk2); 34 int sc_main (int argc, char ** argv) { 35 sc_clock clk1("clk1"); 36 sc_clock clk2("clk2", 1, 0.5, 0, false); 37 sc_signal<int> s[10]; 38 hard a("a"); 39 hard b("b"); 40 hard c("c"); 52 41 53 a.i1 (s[0]); 42 a.clk(clk1); 43 b.clk(clk2); 44 c.clk(clk2); 54 45 55 a.o1 (s[1]); 56 b.i1 (s[1]); 46 a.i1(s[0]); 57 47 58 b.o1 (s[2]); 48 a.o1(s[1]); 49 b.i1(s[1]); 59 50 60 b.i2 (s[3]);51 b.o1(s[2]); 61 52 62 b.o2 (s[4]); 63 a.i2 (s[4]); 53 b.i2(s[3]); 64 54 65 a.o2 (s[5]); 55 b.o2(s[4]); 56 a.i2(s[4]); 66 57 67 c.i1 (s[6]); 68 c.o1 (s[7]); 69 c.i2 (s[8]); 70 c.o2 (s[9]); 58 a.o2(s[5]); 71 59 72 /* Open trace file */ 73 sc_trace_file *system_trace_file; 74 system_trace_file = sc_create_vcd_trace_file ("trace_file"); 75 76 /* clks waveforms are always useful */ 77 sc_trace(system_trace_file, clk1, "clk1"); 78 sc_trace(system_trace_file, clk2, "clk2"); 60 c.i1(s[6]); 61 c.o1(s[7]); 62 c.i2(s[8]); 63 c.o2(s[9]); 79 64 80 /* others signals */ 81 for (int i = 0; i < 10; ++i) 82 sc_trace(system_trace_file, s[i], sc_gen_unique_name ("s")); 83 84 /* initilization */ 85 sc_initialize (); 65 /* Open trace file */ 66 sc_trace_file *system_trace_file; 67 system_trace_file = sc_create_vcd_trace_file("trace_file"); 86 68 87 s[0] = 1; 88 s[3] = 1; 69 /* clks waveforms are always useful */ 70 sc_trace(system_trace_file, clk1, "clk1"); 71 sc_trace(system_trace_file, clk2, "clk2"); 89 72 90 sc_start (1); 73 /* others signals */ 74 for (int i = 0; i < 10; ++i) { 75 sc_trace(system_trace_file, s[i], sc_gen_unique_name ("s")); 76 } 91 77 92 s[0] = 123;93 s[3] = 321;78 /* initilization */ 79 sc_start(sc_time(0, sc_core::SC_NS)); 94 80 95 sc_start (1); 81 s[0] = 1; 82 s[3] = 1; 96 83 97 return 0; 84 sc_start(sc_time(1, sc_core::SC_NS)); 85 86 s[0] = 123; 87 s[3] = 321; 88 89 sc_start(sc_time(1, sc_core::SC_NS)); 90 91 return 0; 98 92 } 99 93 94 95 /* 96 # Local Variables: 97 # tab-width: 4; 98 # c-basic-offset: 4; 99 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 100 # indent-tabs-mode: nil; 101 # End: 102 # 103 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 104 */ 105
Note: See TracChangeset
for help on using the changeset viewer.