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 | #include <signal.h> |
---|
4 | #include <iostream> |
---|
5 | #include <fstream> |
---|
6 | |
---|
7 | #include "test.h" |
---|
8 | |
---|
9 | using namespace std; |
---|
10 | |
---|
11 | struct inner_test : public sc_module { |
---|
12 | virtual void transition() { |
---|
13 | cout << "This function is a virtual one.\n"; |
---|
14 | } |
---|
15 | |
---|
16 | inner_test(sc_module_name n) {} |
---|
17 | }; |
---|
18 | |
---|
19 | |
---|
20 | struct test : public inner_test { |
---|
21 | sc_in<bool> clk; |
---|
22 | sc_in<bool> resetn; |
---|
23 | sc_out<int> o; |
---|
24 | sc_in<int> i; |
---|
25 | sc_signal<int> reg; |
---|
26 | |
---|
27 | virtual void transition(); |
---|
28 | void gen_moore(); |
---|
29 | void gen_mealy(); |
---|
30 | |
---|
31 | SC_HAS_PROCESS(test); |
---|
32 | test(sc_module_name n) : inner_test(n) { |
---|
33 | SC_METHOD(transition); |
---|
34 | sensitive << clk.pos(); |
---|
35 | dont_initialize(); |
---|
36 | |
---|
37 | SC_METHOD(gen_moore); |
---|
38 | sensitive << clk.neg(); |
---|
39 | dont_initialize(); |
---|
40 | |
---|
41 | SC_METHOD(gen_mealy); |
---|
42 | sensitive << clk.neg() << i; |
---|
43 | dont_initialize(); |
---|
44 | } |
---|
45 | }; |
---|
46 | |
---|
47 | void test::transition() { |
---|
48 | std::cout << "transition\n"; |
---|
49 | } |
---|
50 | |
---|
51 | void test::gen_moore() { |
---|
52 | std::cout << "gen_moore\n"; |
---|
53 | } |
---|
54 | |
---|
55 | void test::gen_mealy() { |
---|
56 | std::cout << "gen_mealy\n"; |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | int sc_main(int argc, char * argv[]) { |
---|
62 | sc_clock clk("clk"); |
---|
63 | sc_signal<bool> resetn("resetn"); |
---|
64 | sc_signal<int> in ("in"); |
---|
65 | sc_signal<int> out("out"); |
---|
66 | |
---|
67 | // Setup number of threads open-mp to 1 with the macro threads_omp() |
---|
68 | threads_omp(); |
---|
69 | |
---|
70 | test test("test"); |
---|
71 | test.clk(clk); |
---|
72 | test.resetn(resetn); |
---|
73 | |
---|
74 | test.i(in); |
---|
75 | test.o(out); |
---|
76 | |
---|
77 | sc_start(sc_time(0, sc_core::SC_NS)); |
---|
78 | |
---|
79 | resetn = false; |
---|
80 | sc_start(sc_time(3, sc_core::SC_NS)); |
---|
81 | resetn = true; |
---|
82 | sc_start(sc_time(10, sc_core::SC_NS)); |
---|
83 | |
---|
84 | return EXIT_SUCCESS; |
---|
85 | } |
---|
86 | |
---|
87 | /* |
---|
88 | # Local Variables: |
---|
89 | # tab-width: 4; |
---|
90 | # c-basic-offset: 4; |
---|
91 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); |
---|
92 | # indent-tabs-mode: nil; |
---|
93 | # End: |
---|
94 | # |
---|
95 | # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
96 | */ |
---|
97 | |
---|
Note: See
TracBrowser
for help on using the repository browser.