source: sources/test_regression/16122005/system.cpp@ 50

Last change on this file since 50 was 35, checked in by buchmann, 17 years ago

Code cleanup.

Add --dynamiclink option to systemcass executable.

File size: 1.4 KB
Line 
1#include <systemc.h>
2#include <iostream>
3#include <fstream>
4#include <vector>
5#include <cstring> //strcmp
6
7#define ASSERT(x) { if (!(x)) { \
8 cerr << "ASSERT : " #x \
9 << " in function '" << __FUNCTION__ \
10 << "'\n"; exit (-1); \
11 } \
12 }
13
14
15using namespace std;
16
17struct D : sc_module
18{
19 D (sc_module_name n)
20 {
21 }
22};
23
24struct C : sc_module
25{
26 C (sc_module_name n)
27 {
28 }
29};
30
31struct 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 }
39};
40
41struct A : sc_module
42{
43 B b;
44 C c;
45 A (sc_module_name n) : b("b"), c("c")
46 {
47 }
48};
49
50struct 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 }
58};
59
60struct 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 }
74};
75
76int
77sc_main (int argc, char ** argv)
78{
79 if (argc < 1)
80 {
81 cerr << "Usage : " << argv[0] << "\n";
82 exit (-1);
83 }
84
85 sc_clock clk("clock");
86 top_level1 top1("top1");
87 top_level2 top2("top2");
88
89 sc_start(0);
90
91 return 0;
92}
93
Note: See TracBrowser for help on using the repository browser.