Last change
on this file since 64 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
|
Rev | Line | |
---|
[55] | 1 | |
---|
[1] | 2 | #include "systemc.h" |
---|
| 3 | |
---|
[55] | 4 | #include "test.h" |
---|
[1] | 5 | |
---|
| 6 | using namespace std; |
---|
| 7 | |
---|
[55] | 8 | struct hard : sc_module { |
---|
| 9 | sc_in_clk clk; |
---|
| 10 | sc_in <int> i1, i2; |
---|
| 11 | sc_out<int> o1, o2; |
---|
[1] | 12 | |
---|
[55] | 13 | void f() { |
---|
| 14 | o1 = i1; |
---|
| 15 | o2 = i2; |
---|
| 16 | } |
---|
[1] | 17 | |
---|
[55] | 18 | SC_HAS_PROCESS(hard); |
---|
| 19 | |
---|
| 20 | hard(sc_module_name) { |
---|
| 21 | SC_METHOD(f); |
---|
| 22 | sensitive << i1 << i2; |
---|
| 23 | dont_initialize(); |
---|
| 24 | |
---|
[1] | 25 | #ifdef SYSTEMCASS_SPECIFIC |
---|
[55] | 26 | o1 (i1); |
---|
| 27 | o2 (i2); |
---|
[1] | 28 | #endif |
---|
[55] | 29 | } |
---|
| 30 | |
---|
[1] | 31 | }; |
---|
| 32 | |
---|
| 33 | |
---|
[55] | 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"); |
---|
[1] | 41 | |
---|
[60] | 42 | // Setup number of threads open-mp to 1 with the macro threads_omp() |
---|
| 43 | threads_omp(); |
---|
| 44 | |
---|
[55] | 45 | a.clk(clk1); |
---|
| 46 | b.clk(clk2); |
---|
| 47 | c.clk(clk2); |
---|
[1] | 48 | |
---|
[55] | 49 | a.i1(s[0]); |
---|
[1] | 50 | |
---|
[55] | 51 | a.o1(s[1]); |
---|
| 52 | b.i1(s[1]); |
---|
[1] | 53 | |
---|
[55] | 54 | b.o1(s[2]); |
---|
[1] | 55 | |
---|
[55] | 56 | b.i2(s[3]); |
---|
[1] | 57 | |
---|
[55] | 58 | b.o2(s[4]); |
---|
| 59 | a.i2(s[4]); |
---|
[1] | 60 | |
---|
[55] | 61 | a.o2(s[5]); |
---|
[1] | 62 | |
---|
[55] | 63 | c.i1(s[6]); |
---|
| 64 | c.o1(s[7]); |
---|
| 65 | c.i2(s[8]); |
---|
| 66 | c.o2(s[9]); |
---|
[1] | 67 | |
---|
[55] | 68 | /* Open trace file */ |
---|
| 69 | sc_trace_file *system_trace_file; |
---|
| 70 | system_trace_file = sc_create_vcd_trace_file("trace_file"); |
---|
[1] | 71 | |
---|
[55] | 72 | /* clks waveforms are always useful */ |
---|
| 73 | sc_trace(system_trace_file, clk1, "clk1"); |
---|
| 74 | sc_trace(system_trace_file, clk2, "clk2"); |
---|
[1] | 75 | |
---|
[55] | 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 | } |
---|
[1] | 80 | |
---|
[55] | 81 | /* initilization */ |
---|
| 82 | sc_start(sc_time(0, sc_core::SC_NS)); |
---|
[1] | 83 | |
---|
[55] | 84 | s[0] = 1; |
---|
| 85 | s[3] = 1; |
---|
[1] | 86 | |
---|
[55] | 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; |
---|
[1] | 95 | } |
---|
| 96 | |
---|
[55] | 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.