source:
sources/test_regression/08092005/system.cpp
@
58
Last change on this file since 58 was 55, checked in by , 11 years ago | |
---|---|
File size: 1.3 KB |
Rev | Line | |
---|---|---|
[55] | 1 | |
2 | // Circular sensitivity dependency | |
3 | // Does not compile with systemcass | |
4 | ||
[1] | 5 | #include "systemc.h" |
6 | ||
7 | ||
[55] | 8 | #include "test.h" |
9 | ||
[1] | 10 | using namespace std; |
11 | ||
[55] | 12 | struct hard : sc_module { |
13 | sc_in_clk clk; | |
14 | sc_in <int> i1, i2; | |
15 | sc_out<int> o1, o2; | |
[1] | 16 | |
[55] | 17 | void f() { |
18 | o1 = i1; | |
19 | o2 = i2; | |
20 | } | |
[1] | 21 | |
[55] | 22 | SC_HAS_PROCESS(hard); |
23 | hard(sc_module_name) { | |
24 | SC_METHOD(f); | |
25 | sensitive << i1 << i2; | |
26 | dont_initialize(); | |
27 | ||
[1] | 28 | #ifdef SYSTEMCASS_SPECIFIC |
[55] | 29 | o1(i1); |
30 | o2(i2); | |
[1] | 31 | #endif |
[55] | 32 | } |
[1] | 33 | }; |
34 | ||
35 | ||
[55] | 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"); | |
[1] | 42 | |
[55] | 43 | a.clk(clk); |
44 | b.clk(clk); | |
[1] | 45 | |
[55] | 46 | a.i1(s[0]); |
[1] | 47 | |
[55] | 48 | a.o1(s[1]); |
49 | b.i1(s[1]); | |
[1] | 50 | |
[55] | 51 | b.o1(s[2]); |
[1] | 52 | |
[55] | 53 | b.i2(s[3]); |
[1] | 54 | |
[55] | 55 | b.o2(s[4]); |
56 | a.i2(s[4]); | |
[1] | 57 | |
[55] | 58 | a.o2(s[5]); |
[1] | 59 | |
[55] | 60 | c.i1(s[6]); |
61 | c.o1(s[7]); | |
62 | c.i2(s[8]); | |
63 | c.o2(s[9]); | |
[1] | 64 | |
[55] | 65 | sc_start(sc_time(0, sc_core::SC_NS)); |
[1] | 66 | |
[55] | 67 | s[0] = 1; |
68 | s[3] = 1; | |
[1] | 69 | |
[55] | 70 | sc_start(sc_time(0, sc_core::SC_NS)); |
[1] | 71 | |
[55] | 72 | s[0] = 123; |
73 | s[3] = 321; | |
74 | ||
75 | sc_start(sc_time(1, sc_core::SC_NS)); | |
76 | ||
77 | return 0; | |
[1] | 78 | } |
79 | ||
[55] | 80 | |
81 | /* | |
82 | # Local Variables: | |
83 | # tab-width: 4; | |
84 | # c-basic-offset: 4; | |
85 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); | |
86 | # indent-tabs-mode: nil; | |
87 | # End: | |
88 | # | |
89 | # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | |
90 | */ | |
91 |
Note: See TracBrowser
for help on using the repository browser.