source: sources/test_regression/07122006b/system.cpp @ 57

Last change on this file since 57 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: 1.7 KB
Line 
1
2#include <systemc.h>
3#include <signal.h>
4#include <iostream>
5#include <fstream>
6
7#include "test.h"
8
9using namespace std;
10
11struct inner_test : public sc_module {
12    virtual void transition() {
13        cout << "This function is a virtual one.\n";
14    }
15
16    inner_test(sc_module_name n) {}
17};
18
19
20struct test : public inner_test {
21    sc_in<bool> clk;
22    sc_in<bool> resetn;
23    sc_out<int> o;
24    sc_in<int>  i;
25    sc_signal<int> reg;
26
27    virtual void transition();
28    void gen_moore();
29    void gen_mealy();
30
31    SC_HAS_PROCESS(test);
32    test(sc_module_name n) : inner_test(n) {
33        SC_METHOD(transition);
34        sensitive << clk.pos();
35        dont_initialize();
36   
37        SC_METHOD(gen_moore);
38        sensitive << clk.neg();
39        dont_initialize();
40       
41        SC_METHOD(gen_mealy);
42        sensitive << clk.neg() << i;
43        dont_initialize();
44    }
45};
46
47void test::transition() {
48    std::cout << "transition\n";
49}
50
51void test::gen_moore() {
52    std::cout << "gen_moore\n";
53}
54
55void test::gen_mealy() {
56    std::cout << "gen_mealy\n";
57}
58
59
60
61int sc_main(int argc, char * argv[]) {
62    sc_clock clk("clk");
63    sc_signal<bool> resetn("resetn");
64    sc_signal<int> in ("in");
65    sc_signal<int> out("out");
66
67    test test("test");
68    test.clk(clk);
69    test.resetn(resetn);
70
71    test.i(in);
72    test.o(out);
73
74    sc_start(sc_time(0, sc_core::SC_NS));
75
76    resetn = false;
77    sc_start(sc_time(3, sc_core::SC_NS));
78    resetn = true;
79    sc_start(sc_time(10, sc_core::SC_NS));
80
81    return EXIT_SUCCESS;
82}
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.