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:
2.2 KB
|
Rev | Line | |
---|
[55] | 1 | |
---|
[1] | 2 | #include <signal.h> |
---|
| 3 | |
---|
[55] | 4 | #include "systemc.h" |
---|
| 5 | #include "test.h" |
---|
| 6 | |
---|
[1] | 7 | using namespace std; |
---|
| 8 | |
---|
[55] | 9 | struct M1_1i1o : sc_module { |
---|
| 10 | sc_in_clk clk; |
---|
| 11 | sc_in<bool> i1; |
---|
| 12 | sc_out<bool> o1; |
---|
[1] | 13 | |
---|
[55] | 14 | void eval_mealy1() { |
---|
| 15 | o1 = ~i1; |
---|
| 16 | }; |
---|
[1] | 17 | |
---|
[55] | 18 | SC_CTOR (M1_1i1o) : clk("clk"), i1("i1"), o1("o1") { |
---|
| 19 | SC_METHOD(eval_mealy1); |
---|
| 20 | sensitive << clk.neg(); |
---|
| 21 | sensitive << i1; |
---|
| 22 | dont_initialize(); |
---|
[1] | 23 | #ifdef SYSTEMCASS_SPECIFIC |
---|
[55] | 24 | o1(i1); |
---|
[1] | 25 | #endif |
---|
[55] | 26 | } |
---|
| 27 | |
---|
[1] | 28 | }; |
---|
| 29 | |
---|
| 30 | |
---|
[55] | 31 | struct M2_1i1o : sc_module { |
---|
| 32 | sc_in_clk clk; |
---|
| 33 | sc_in<bool> i1; |
---|
| 34 | sc_out<bool> o1; |
---|
[1] | 35 | |
---|
[55] | 36 | sc_signal<bool> reg; |
---|
[1] | 37 | |
---|
[55] | 38 | void tr_moore1() { |
---|
| 39 | reg = ~i1; |
---|
| 40 | } |
---|
[1] | 41 | |
---|
[55] | 42 | void gen_moore1() { |
---|
| 43 | o1 = ~reg; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | SC_CTOR (M2_1i1o) : clk("clk"), i1("i1"), o1("o1") { |
---|
| 47 | SC_METHOD(tr_moore1); |
---|
| 48 | sensitive << clk.pos(); |
---|
| 49 | dont_initialize(); |
---|
| 50 | |
---|
| 51 | SC_METHOD(gen_moore1); |
---|
| 52 | sensitive << clk.neg(); |
---|
| 53 | dont_initialize(); |
---|
| 54 | } |
---|
[1] | 55 | }; |
---|
| 56 | |
---|
| 57 | |
---|
[55] | 58 | int sc_main (int argc, char * argv[]) { |
---|
| 59 | sc_clock signal_clk("my_clock"); |
---|
| 60 | sc_signal<bool> s1 ("s01"), |
---|
| 61 | s2 ("s02"), |
---|
| 62 | s3 ("s03"), |
---|
| 63 | s4 ("s04"), |
---|
| 64 | s5 ("s05"), |
---|
| 65 | s6 ("s06"), |
---|
| 66 | s7 ("s07"), |
---|
| 67 | s8 ("s08"), |
---|
| 68 | s9 ("s09"), |
---|
| 69 | s10("s10"), |
---|
| 70 | s11("s11"), |
---|
| 71 | s12("s12"), |
---|
| 72 | s13("s13"), |
---|
| 73 | s14("s14"), |
---|
| 74 | s15("s15"); |
---|
[1] | 75 | |
---|
[60] | 76 | // Setup number of threads open-mp to 1 with the macro threads_omp() |
---|
| 77 | threads_omp(); |
---|
[1] | 78 | |
---|
[55] | 79 | M1_1i1o a("a"); |
---|
| 80 | M1_1i1o b("b"); |
---|
| 81 | M1_1i1o c("c"); |
---|
| 82 | M1_1i1o d("d"); |
---|
| 83 | M1_1i1o e("e"); |
---|
| 84 | M2_1i1o f("f"); |
---|
| 85 | M1_1i1o g("g"); |
---|
[1] | 86 | |
---|
[55] | 87 | a.clk(signal_clk); |
---|
| 88 | b.clk(signal_clk); |
---|
| 89 | c.clk(signal_clk); |
---|
| 90 | d.clk(signal_clk); |
---|
| 91 | e.clk(signal_clk); |
---|
| 92 | f.clk(signal_clk); |
---|
| 93 | g.clk(signal_clk); |
---|
| 94 | |
---|
| 95 | a.i1(s1); |
---|
| 96 | |
---|
| 97 | a.o1(s2); |
---|
| 98 | b.i1(s2); |
---|
| 99 | d.i1(s2); |
---|
| 100 | |
---|
| 101 | b.o1(s3); |
---|
| 102 | c.i1(s3); |
---|
| 103 | |
---|
| 104 | c.o1(s4); |
---|
| 105 | |
---|
| 106 | d.o1(s5); |
---|
| 107 | e.i1(s5); |
---|
| 108 | |
---|
| 109 | e.o1(s6); |
---|
| 110 | f.i1(s6); |
---|
| 111 | |
---|
| 112 | f.o1(s7); |
---|
| 113 | g.i1(s7); |
---|
| 114 | |
---|
| 115 | g.o1(s8); |
---|
| 116 | |
---|
| 117 | // Init & run |
---|
| 118 | sc_start(sc_time(0, sc_core::SC_NS)); |
---|
| 119 | |
---|
[1] | 120 | return EXIT_SUCCESS; |
---|
[55] | 121 | } |
---|
[1] | 122 | |
---|
| 123 | |
---|
[55] | 124 | /* |
---|
| 125 | # Local Variables: |
---|
| 126 | # tab-width: 4; |
---|
| 127 | # c-basic-offset: 4; |
---|
| 128 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); |
---|
| 129 | # indent-tabs-mode: nil; |
---|
| 130 | # End: |
---|
| 131 | # |
---|
| 132 | # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 133 | */ |
---|
[1] | 134 | |
---|
Note: See
TracBrowser
for help on using the repository browser.