source: sources/test_regression/15062006/system.cpp @ 55

Last change on this file since 55 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.0 KB
Line 
1// QM : je ne sais ce que cherche à tester ce test
2// Dans le doute j'applique un traitement par défaut (diff sc) avec un cout "OK"
3
4#include <systemc.h>
5
6#include "test.h"
7
8
9using namespace std;
10
11template<typename datatype>
12class module_base : public sc_module {
13
14    public:
15    sc_in_clk clk;
16    sc_in<datatype> i1;
17    sc_out<datatype> o1;
18    sc_signal<datatype> reg1;
19
20    private:
21    void trans_module_base() {}
22    void gen_module_base() {
23        this->kikoo ();
24    }
25    virtual void kikoo() = 0;
26
27
28    public:
29    SC_HAS_PROCESS(module_base);
30    module_base (sc_module_name n) : sc_module (n),
31        clk("clk"), i1("i1"), o1("o1"), reg1("reg1") {
32        SC_METHOD(trans_module_base);
33        sensitive << clk.pos();
34        dont_initialize();
35
36        SC_METHOD(gen_module_base);
37        sensitive << clk.neg();
38        dont_initialize();
39    }
40};
41
42
43template<typename datatype>
44class test : public module_base<datatype> {
45
46    public:
47    sc_in<datatype> i2;
48    sc_out<datatype> o2;
49    sc_signal<datatype> reg2;
50
51    private:
52    void trans() {}
53
54    void gen() {}
55
56    virtual void kikoo() {}
57
58    public:
59    SC_HAS_PROCESS(test);
60    test(sc_module_name n) : module_base<datatype> (n),
61    i2("i2"), 
62    o2("o2"),
63    reg2("reg2") {
64        SC_METHOD(trans);
65        this->sensitive << this->clk.pos();
66        this->dont_initialize();
67
68        SC_METHOD(gen);
69        this->sensitive << this->clk.neg();
70        this->dont_initialize();
71    }
72};
73
74
75int sc_main(int argc, char * argv[]) {
76    sc_clock signal_clk("my_clock");
77    sc_signal<int> s01("s01"), s02("s02"), s03("s03"), s04("s04");
78
79    test<int> test1("test1");
80    test1.clk(signal_clk);
81    test1.i1(s01);
82    test1.i2(s02);
83    test1.o1(s03);
84    test1.o2(s04);
85
86    // Init & run
87    sc_start(sc_time(0, sc_core::SC_NS));
88
89    cout << "OK" << endl;
90    return EXIT_SUCCESS;
91}
92
93
94/*
95# Local Variables:
96# tab-width: 4;
97# c-basic-offset: 4;
98# c-file-offsets:((innamespace . 0)(inline-open . 0));
99# indent-tabs-mode: nil;
100# End:
101#
102# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
103*/
104
Note: See TracBrowser for help on using the repository browser.