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

Last change on this file since 60 was 60, checked in by meunier, 7 years ago
  • Intégration des modifications de Clément, qui a intégré la version parallélisée de systemcass faite par Manuel.
File size: 1.6 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
11using namespace std;
12
13
14struct D : sc_module {
15    D (sc_module_name n) {}
16};
17
18
19struct C : sc_module {
20    C(sc_module_name n) {}
21};
22
23
24struct 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
32struct A : sc_module {
33    B b;
34    C c;
35    A(sc_module_name n) : b("b"), c("c") {}
36};
37
38
39struct 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
48struct 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
63int sc_main (int argc, char ** argv) {
64    if (argc < 1) {
65        cerr << "Usage : " << argv[0] << "\n";
66        exit(-1);
67    }
68
69    // Setup number of threads open-mp to 1 with the macro threads_omp()
70    threads_omp();
71
72    sc_clock clk("clock");
73    top_level1 top1("top1");
74    top_level2 top2("top2");
75
76    sc_start(sc_time(0, sc_core::SC_NS));
77
78    return 0;
79}
80
81
82/*
83# Local Variables:
84# tab-width: 4;
85# c-basic-offset: 4;
86# c-file-offsets:((innamespace . 0)(inline-open . 0));
87# indent-tabs-mode: nil;
88# End:
89#
90# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
91*/
92
Note: See TracBrowser for help on using the repository browser.