|
Last change
on this file since 60 was
60,
checked in by meunier, 9 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.4 KB
|
| Line | |
|---|
| 1 | |
|---|
| 2 | // Circular sensitivity dependency |
|---|
| 3 | // Does not compile with systemcass |
|---|
| 4 | |
|---|
| 5 | #include "systemc.h" |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | #include "test.h" |
|---|
| 9 | |
|---|
| 10 | using namespace std; |
|---|
| 11 | |
|---|
| 12 | struct hard : sc_module { |
|---|
| 13 | sc_in_clk clk; |
|---|
| 14 | sc_in <int> i1, i2; |
|---|
| 15 | sc_out<int> o1, o2; |
|---|
| 16 | |
|---|
| 17 | void f() { |
|---|
| 18 | o1 = i1; |
|---|
| 19 | o2 = i2; |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | SC_HAS_PROCESS(hard); |
|---|
| 23 | hard(sc_module_name) { |
|---|
| 24 | SC_METHOD(f); |
|---|
| 25 | sensitive << i1 << i2; |
|---|
| 26 | dont_initialize(); |
|---|
| 27 | |
|---|
| 28 | #ifdef SYSTEMCASS_SPECIFIC |
|---|
| 29 | o1(i1); |
|---|
| 30 | o2(i2); |
|---|
| 31 | #endif |
|---|
| 32 | } |
|---|
| 33 | }; |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | int sc_main(int argc, char ** argv) { |
|---|
| 37 | sc_clock clk("clk"); |
|---|
| 38 | sc_signal<int> s[10]; |
|---|
| 39 | hard a("a"); |
|---|
| 40 | hard b("b"); |
|---|
| 41 | hard c("c"); |
|---|
| 42 | |
|---|
| 43 | // Setup number of threads open-mp to 1 with the macro threads_omp() |
|---|
| 44 | threads_omp(); |
|---|
| 45 | |
|---|
| 46 | a.clk(clk); |
|---|
| 47 | b.clk(clk); |
|---|
| 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 | sc_start(sc_time(0, sc_core::SC_NS)); |
|---|
| 69 | |
|---|
| 70 | s[0] = 1; |
|---|
| 71 | s[3] = 1; |
|---|
| 72 | |
|---|
| 73 | sc_start(sc_time(0, sc_core::SC_NS)); |
|---|
| 74 | |
|---|
| 75 | s[0] = 123; |
|---|
| 76 | s[3] = 321; |
|---|
| 77 | |
|---|
| 78 | sc_start(sc_time(1, sc_core::SC_NS)); |
|---|
| 79 | |
|---|
| 80 | return 0; |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | /* |
|---|
| 85 | # Local Variables: |
|---|
| 86 | # tab-width: 4; |
|---|
| 87 | # c-basic-offset: 4; |
|---|
| 88 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); |
|---|
| 89 | # indent-tabs-mode: nil; |
|---|
| 90 | # End: |
|---|
| 91 | # |
|---|
| 92 | # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
|---|
| 93 | */ |
|---|
| 94 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.