Changeset 55 for sources/test_regression/16122005/system.cpp
- Timestamp:
- May 28, 2013, 11:17:14 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/test_regression/16122005/system.cpp
r35 r55 1 #include <systemc.h> 1 2 2 #include <iostream> 3 3 #include <fstream> … … 5 5 #include <cstring> //strcmp 6 6 7 #define ASSERT(x) { if (!(x)) { \ 8 cerr << "ASSERT : " #x \ 9 << " in function '" << __FUNCTION__ \ 10 << "'\n"; exit (-1); \ 11 } \ 12 } 7 #include <systemc.h> 8 #include "test.h" 13 9 14 10 15 11 using namespace std; 16 12 17 struct D : sc_module 18 { 19 D (sc_module_name n) 20 { 21 } 13 14 struct D : sc_module { 15 D (sc_module_name n) {} 22 16 }; 23 17 24 struct C : sc_module 25 { 26 C (sc_module_name n) 27 { 28 } 18 19 struct C : sc_module { 20 C(sc_module_name n) {} 29 21 }; 30 22 31 struct B : sc_module 32 { 33 D d1; 34 D d2; 35 C c; 36 B (sc_module_name n) : d1("d1"), d2("d2"), c("c") 37 { 38 } 23 24 struct B : sc_module { 25 D d1; 26 D d2; 27 C c; 28 B(sc_module_name n) : d1("d1"), d2("d2"), c("c") {} 39 29 }; 40 30 41 struct A : sc_module 42 { 43 B b; 44 C c; 45 A (sc_module_name n) : b("b"), c("c") 46 { 47 } 31 32 struct A : sc_module { 33 B b; 34 C c; 35 A(sc_module_name n) : b("b"), c("c") {} 48 36 }; 49 37 50 struct top_level1 : sc_module 51 { 52 A a; 53 D d; 54 top_level1(sc_module_name insname) : sc_module (insname), a("a"), d("d") 55 { 56 ASSERT(strcmp ((const char*)insname,"top1") == 0); 57 } 38 39 struct top_level1 : sc_module { 40 A a; 41 D d; 42 top_level1(sc_module_name insname) : sc_module (insname), a("a"), d("d") { 43 ASSERT(strcmp((const char *) insname, "top1") == 0); 44 } 58 45 }; 59 46 60 struct top_level2 : sc_module 61 { 62 B b1; 63 B b2; 64 C c; 65 top_level2(sc_module_name insname) : b1("b1"), b2("b2"), c("c") 66 { 67 ASSERT(strcmp ((const char*)insname,"top2") == 0); 68 ofstream o; 69 o.open ("results.txt"); 70 o << (const char*)insname << endl; 71 o << insname << endl; 72 o.close (); 73 } 47 48 struct top_level2 : sc_module { 49 B b1; 50 B b2; 51 C c; 52 top_level2(sc_module_name insname) : b1("b1"), b2("b2"), c("c") { 53 ASSERT(strcmp ((const char *) insname, "top2") == 0); 54 ofstream o; 55 o.open("results.txt"); 56 o << (const char *) insname << endl; 57 o << insname << endl; 58 o.close(); 59 } 74 60 }; 75 61 76 int77 sc_main (int argc, char ** argv)78 {79 if (argc < 1)80 {81 cerr << "Usage : " << argv[0] << "\n";82 exit (-1);83 }84 62 85 sc_clock clk("clock"); 86 top_level1 top1("top1"); 87 top_level2 top2("top2"); 63 int sc_main (int argc, char ** argv) { 64 if (argc < 1) { 65 cerr << "Usage : " << argv[0] << "\n"; 66 exit(-1); 67 } 88 68 89 sc_start(0); 69 sc_clock clk("clock"); 70 top_level1 top1("top1"); 71 top_level2 top2("top2"); 90 72 91 return 0; 73 sc_start(sc_time(0, sc_core::SC_NS)); 74 75 return 0; 92 76 } 93 77 78 79 /* 80 # Local Variables: 81 # tab-width: 4; 82 # c-basic-offset: 4; 83 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 84 # indent-tabs-mode: nil; 85 # End: 86 # 87 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 88 */ 89
Note: See TracChangeset
for help on using the changeset viewer.