source: sources/test_regression/21062005/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.5 KB
Line 
1
2#include <iostream>
3#include <string>
4
5#include "systemc.h"
6#include "test.h"
7
8
9using namespace std;
10
11
12
13struct internal_model : sc_module {
14    sc_in<int> i;
15    sc_out<int> o;
16    internal_model(sc_module_name n) : sc_module(n), i("i"), o("o") {}
17};
18
19
20struct model : sc_module {
21    sc_in<int> i1, i2, i3;
22    sc_out<int> o1, o2, o3;
23    sc_signal<int> r1, r2;
24    internal_model internal1,internal2;
25    sc_signal<int> internal_signal;
26    model(sc_module_name n) : sc_module(n),
27    i1("i1"), i2("i2"), i3("i3"),
28    o1("o1"), o2("o2"), o3("o3"),
29    r1("r1"), r2("r2"),
30    internal1("internal1"),
31    internal2("internal2"),
32    internal_signal("internal_signal") {
33        internal1.i(i3);
34        internal2.i(internal1.o);
35        internal1.o(internal_signal);
36#if defined(ERROR)
37        internal1.o(internal2.i); // SystemC 2.0.1 & 2.1.v1 error: no match for call to `(sc_out<int>) (sc_in<int>&)'
38#endif
39        internal2.o(o3);
40    }
41
42};
43
44
45int sc_main (int argc, char ** argv) {
46    model m("m");
47    sc_clock clk("clock");
48    sc_signal<int> s1("s1"), s2("s2"), s3("s3"), s4("s4");
49
50    m.i1 (s1);
51    m.i2 (s1);
52    m.i3 (s1);
53    m.o1 (s4);
54    m.o2 (s2);
55    m.o3 (s3);
56
57    sc_start(sc_time(0, sc_core::SC_NS));
58
59    sc_start(sc_time(1, sc_core::SC_NS));
60    sc_start(sc_time(10, sc_core::SC_NS));
61
62    cout << "OK" << endl;
63    return 0;
64}
65
66
67/*
68# Local Variables:
69# tab-width: 4;
70# c-basic-offset: 4;
71# c-file-offsets:((innamespace . 0)(inline-open . 0));
72# indent-tabs-mode: nil;
73# End:
74#
75# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
76*/
77
Note: See TracBrowser for help on using the repository browser.