Last change
on this file since 58 was
55,
checked in by meunier, 11 years ago
|
Tried to clean the test_regression directory:
- Code formatting
- Supressed warnings
- Made comprehensible outputs
- Factorized Makefiles
There's still a lot to do (many tests don't pass for either good or bad reasons)
|
File size:
1.5 KB
|
Line | |
---|
1 | |
---|
2 | #include <iostream> |
---|
3 | #include <fstream> |
---|
4 | #include <vector> |
---|
5 | #include <cstring> //strcmp |
---|
6 | |
---|
7 | #include <systemc.h> |
---|
8 | #include "test.h" |
---|
9 | |
---|
10 | |
---|
11 | using namespace std; |
---|
12 | |
---|
13 | |
---|
14 | struct D : sc_module { |
---|
15 | D (sc_module_name n) {} |
---|
16 | }; |
---|
17 | |
---|
18 | |
---|
19 | struct C : sc_module { |
---|
20 | C(sc_module_name n) {} |
---|
21 | }; |
---|
22 | |
---|
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") {} |
---|
29 | }; |
---|
30 | |
---|
31 | |
---|
32 | struct A : sc_module { |
---|
33 | B b; |
---|
34 | C c; |
---|
35 | A(sc_module_name n) : b("b"), c("c") {} |
---|
36 | }; |
---|
37 | |
---|
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 | } |
---|
45 | }; |
---|
46 | |
---|
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 | } |
---|
60 | }; |
---|
61 | |
---|
62 | |
---|
63 | int sc_main (int argc, char ** argv) { |
---|
64 | if (argc < 1) { |
---|
65 | cerr << "Usage : " << argv[0] << "\n"; |
---|
66 | exit(-1); |
---|
67 | } |
---|
68 | |
---|
69 | sc_clock clk("clock"); |
---|
70 | top_level1 top1("top1"); |
---|
71 | top_level2 top2("top2"); |
---|
72 | |
---|
73 | sc_start(sc_time(0, sc_core::SC_NS)); |
---|
74 | |
---|
75 | return 0; |
---|
76 | } |
---|
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
TracBrowser
for help on using the repository browser.