Last change
on this file since 56 was
55,
checked in by meunier, 11 years ago
|
Tried to clean the test_regression directory:
- Code formatting
- Supressed warnings
- Made comprehensible outputs
- Factorized Makefiles
There's still a lot to do (many tests don't pass for either good or bad reasons)
|
File size:
2.1 KB
|
Line | |
---|
1 | |
---|
2 | #include <signal.h> |
---|
3 | |
---|
4 | #include "systemc.h" |
---|
5 | #include "test.h" |
---|
6 | |
---|
7 | using namespace std; |
---|
8 | |
---|
9 | struct M1_1i1o : sc_module { |
---|
10 | sc_in_clk clk; |
---|
11 | sc_in<bool> i1; |
---|
12 | sc_out<bool> o1; |
---|
13 | |
---|
14 | void eval_mealy1() { |
---|
15 | o1 = ~i1; |
---|
16 | }; |
---|
17 | |
---|
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(); |
---|
23 | #ifdef SYSTEMCASS_SPECIFIC |
---|
24 | o1(i1); |
---|
25 | #endif |
---|
26 | } |
---|
27 | |
---|
28 | }; |
---|
29 | |
---|
30 | |
---|
31 | struct M2_1i1o : sc_module { |
---|
32 | sc_in_clk clk; |
---|
33 | sc_in<bool> i1; |
---|
34 | sc_out<bool> o1; |
---|
35 | |
---|
36 | sc_signal<bool> reg; |
---|
37 | |
---|
38 | void tr_moore1() { |
---|
39 | reg = ~i1; |
---|
40 | } |
---|
41 | |
---|
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 | } |
---|
55 | }; |
---|
56 | |
---|
57 | |
---|
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"); |
---|
75 | |
---|
76 | |
---|
77 | M1_1i1o a("a"); |
---|
78 | M1_1i1o b("b"); |
---|
79 | M1_1i1o c("c"); |
---|
80 | M1_1i1o d("d"); |
---|
81 | M1_1i1o e("e"); |
---|
82 | M2_1i1o f("f"); |
---|
83 | M1_1i1o g("g"); |
---|
84 | |
---|
85 | a.clk(signal_clk); |
---|
86 | b.clk(signal_clk); |
---|
87 | c.clk(signal_clk); |
---|
88 | d.clk(signal_clk); |
---|
89 | e.clk(signal_clk); |
---|
90 | f.clk(signal_clk); |
---|
91 | g.clk(signal_clk); |
---|
92 | |
---|
93 | a.i1(s1); |
---|
94 | |
---|
95 | a.o1(s2); |
---|
96 | b.i1(s2); |
---|
97 | d.i1(s2); |
---|
98 | |
---|
99 | b.o1(s3); |
---|
100 | c.i1(s3); |
---|
101 | |
---|
102 | c.o1(s4); |
---|
103 | |
---|
104 | d.o1(s5); |
---|
105 | e.i1(s5); |
---|
106 | |
---|
107 | e.o1(s6); |
---|
108 | f.i1(s6); |
---|
109 | |
---|
110 | f.o1(s7); |
---|
111 | g.i1(s7); |
---|
112 | |
---|
113 | g.o1(s8); |
---|
114 | |
---|
115 | // Init & run |
---|
116 | sc_start(sc_time(0, sc_core::SC_NS)); |
---|
117 | |
---|
118 | return EXIT_SUCCESS; |
---|
119 | } |
---|
120 | |
---|
121 | |
---|
122 | /* |
---|
123 | # Local Variables: |
---|
124 | # tab-width: 4; |
---|
125 | # c-basic-offset: 4; |
---|
126 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); |
---|
127 | # indent-tabs-mode: nil; |
---|
128 | # End: |
---|
129 | # |
---|
130 | # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
131 | */ |
---|
132 | |
---|
Note: See
TracBrowser
for help on using the repository browser.