source: sources/test_regression/14092005/system.cpp @ 60

Last change on this file since 60 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: 2.0 KB
Line 
1// Le test échoue
2// Par ailleurs, la référence est la trace de systemcass ; je pense qu'il faudrait changer ça
3
4#include "systemc.h"
5
6#include "test.h"
7
8
9using namespace std;
10
11struct hard : sc_module {
12    sc_in_clk      clk;
13    sc_in<bool>    resetn;
14    sc_in <int>    i1;
15    sc_out<int>    o1;
16    sc_signal<int> r1;
17
18    void fg() {
19        o1 = r1;
20    }
21
22    void ft() {
23        if (resetn.read()) {
24            r1 = i1;
25        }
26        else {
27            r1 = 0x0;
28        }
29    }
30
31    SC_HAS_PROCESS(hard);
32
33    hard(sc_module_name) {
34        SC_METHOD(ft);
35        sensitive << clk.pos();
36        dont_initialize();
37
38        SC_METHOD(fg);
39        sensitive << clk.neg();
40        dont_initialize();
41    }
42};
43
44
45int sc_main (int argc, char ** argv) {
46    sc_clock clk1("clk1", 1, 0.5, 0, true);
47    sc_signal<bool> resetn;
48    sc_signal<int> s[10];
49    hard a("a");
50
51    // Setup number of threads open-mp to 1 with the macro threads_omp()
52    threads_omp();
53
54    a.clk(clk1);
55    a.resetn(resetn);
56
57    a.i1(s[0]);
58    a.o1(s[1]);
59
60    /* Open trace file */
61    sc_trace_file * system_trace_file;
62    system_trace_file = sc_create_vcd_trace_file("trace_file");
63
64    /* clks waveforms are always useful */
65    sc_trace(system_trace_file, resetn, "resetn");
66    sc_trace(system_trace_file, s[0], "i1");
67    sc_trace(system_trace_file, s[1], "o1");
68    sc_trace(system_trace_file, clk1, "clk1");
69
70    /* initilization */
71    sc_start(sc_time(0, sc_core::SC_NS));
72
73    s[0] = 0;
74    resetn = 0;
75
76    sc_start(sc_time(5, sc_core::SC_NS));
77
78    s[0] = 0x7B;
79    resetn = 1;
80
81    sc_start(sc_time(1, sc_core::SC_NS));
82
83    for (int i = 0; i < 10; i++) {
84        s[0] = i;
85        sc_start(sc_time(1, sc_core::SC_NS));
86        ASSERT(s[1].read() == i);
87    }
88
89    return 0;
90}
91
92
93/*
94# Local Variables:
95# tab-width: 4;
96# c-basic-offset: 4;
97# c-file-offsets:((innamespace . 0)(inline-open . 0));
98# indent-tabs-mode: nil;
99# End:
100#
101# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
102*/
103
Note: See TracBrowser for help on using the repository browser.