source: sources/test_regression/08092005/system.cpp

Last change on this file was 60, checked in by meunier, 7 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
RevLine 
[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]10using namespace std;
11
[55]12struct 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]36int 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
[60]43    // Setup number of threads open-mp to 1 with the macro threads_omp()
44    threads_omp();
45
[55]46    a.clk(clk);
47    b.clk(clk);
[1]48
[55]49    a.i1(s[0]);
[1]50
[55]51    a.o1(s[1]);
52    b.i1(s[1]);
[1]53
[55]54    b.o1(s[2]);
[1]55
[55]56    b.i2(s[3]);
[1]57
[55]58    b.o2(s[4]);
59    a.i2(s[4]);
[1]60
[55]61    a.o2(s[5]);
[1]62
[55]63    c.i1(s[6]);
64    c.o1(s[7]);
65    c.i2(s[8]);
66    c.o2(s[9]);
[1]67
[55]68    sc_start(sc_time(0, sc_core::SC_NS));
[1]69
[55]70    s[0] = 1;
71    s[3] = 1;
[1]72
[55]73    sc_start(sc_time(0, sc_core::SC_NS));
[1]74
[55]75    s[0] = 123;
76    s[3] = 321;
77
78    sc_start(sc_time(1, sc_core::SC_NS));
79
80    return 0;
[1]81}
82
[55]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.