Last change
on this file since 65 was
60,
checked in by meunier, 8 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.8 KB
|
Line | |
---|
1 | |
---|
2 | #include "systemc.h" |
---|
3 | |
---|
4 | #include "test.h" |
---|
5 | |
---|
6 | using namespace std; |
---|
7 | |
---|
8 | struct hard : sc_module { |
---|
9 | sc_in_clk clk; |
---|
10 | sc_in <int> i1, i2; |
---|
11 | sc_out<int> o1, o2; |
---|
12 | |
---|
13 | void f() { |
---|
14 | o1 = i1; |
---|
15 | o2 = i2; |
---|
16 | } |
---|
17 | |
---|
18 | SC_HAS_PROCESS(hard); |
---|
19 | |
---|
20 | hard(sc_module_name) { |
---|
21 | SC_METHOD(f); |
---|
22 | sensitive << i1 << i2; |
---|
23 | dont_initialize(); |
---|
24 | |
---|
25 | #ifdef SYSTEMCASS_SPECIFIC |
---|
26 | o1 (i1); |
---|
27 | o2 (i2); |
---|
28 | #endif |
---|
29 | } |
---|
30 | |
---|
31 | }; |
---|
32 | |
---|
33 | |
---|
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"); |
---|
41 | |
---|
42 | // Setup number of threads open-mp to 1 with the macro threads_omp() |
---|
43 | threads_omp(); |
---|
44 | |
---|
45 | a.clk(clk1); |
---|
46 | b.clk(clk2); |
---|
47 | c.clk(clk2); |
---|
48 | |
---|
49 | a.i1(s[0]); |
---|
50 | |
---|
51 | a.o1(s[1]); |
---|
52 | b.i1(s[1]); |
---|
53 | |
---|
54 | b.o1(s[2]); |
---|
55 | |
---|
56 | b.i2(s[3]); |
---|
57 | |
---|
58 | b.o2(s[4]); |
---|
59 | a.i2(s[4]); |
---|
60 | |
---|
61 | a.o2(s[5]); |
---|
62 | |
---|
63 | c.i1(s[6]); |
---|
64 | c.o1(s[7]); |
---|
65 | c.i2(s[8]); |
---|
66 | c.o2(s[9]); |
---|
67 | |
---|
68 | /* Open trace file */ |
---|
69 | sc_trace_file *system_trace_file; |
---|
70 | system_trace_file = sc_create_vcd_trace_file("trace_file"); |
---|
71 | |
---|
72 | /* clks waveforms are always useful */ |
---|
73 | sc_trace(system_trace_file, clk1, "clk1"); |
---|
74 | sc_trace(system_trace_file, clk2, "clk2"); |
---|
75 | |
---|
76 | /* others signals */ |
---|
77 | for (int i = 0; i < 10; ++i) { |
---|
78 | sc_trace(system_trace_file, s[i], sc_gen_unique_name ("s")); |
---|
79 | } |
---|
80 | |
---|
81 | /* initilization */ |
---|
82 | sc_start(sc_time(0, sc_core::SC_NS)); |
---|
83 | |
---|
84 | s[0] = 1; |
---|
85 | s[3] = 1; |
---|
86 | |
---|
87 | sc_start(sc_time(1, sc_core::SC_NS)); |
---|
88 | |
---|
89 | s[0] = 123; |
---|
90 | s[3] = 321; |
---|
91 | |
---|
92 | sc_start(sc_time(1, sc_core::SC_NS)); |
---|
93 | |
---|
94 | return 0; |
---|
95 | } |
---|
96 | |
---|
97 | |
---|
98 | /* |
---|
99 | # Local Variables: |
---|
100 | # tab-width: 4; |
---|
101 | # c-basic-offset: 4; |
---|
102 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); |
---|
103 | # indent-tabs-mode: nil; |
---|
104 | # End: |
---|
105 | # |
---|
106 | # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
107 | */ |
---|
108 | |
---|
Note: See
TracBrowser
for help on using the repository browser.