source: latest/test_regression/08092005/system.cpp @ 1

Last change on this file since 1 was 1, checked in by buchmann, 17 years ago

Initial import from CVS repository

File size: 1.0 KB
Line 
1#include "systemc.h"
2
3#define ASSERT(x) \
4  { errnum++; \
5    if (!(x)) \
6    { \
7    cerr << "ASSERT : " #x "\n"; \
8    exit (errnum); \
9    } \
10  }
11
12using namespace std;
13
14struct hard : sc_module
15{
16  sc_in_clk    clk;
17  sc_in <int>  i1, i2;
18  sc_out<int>  o1, o2;
19
20  void f ()
21  {
22    o1 = i1;
23    o2 = i2;
24  }
25
26  SC_HAS_PROCESS(hard);
27  hard(sc_module_name) /*:
28    clk("clk"),
29    i1 ("i1"),
30    i2 ("i2"),
31    o1 ("o1"),
32    o2 ("o2")*/
33  {
34    SC_METHOD(f);
35    dont_initialize();
36    sensitive << i1 << i2;
37#ifdef SYSTEMCASS_SPECIFIC
38    o1 (i1);
39    o2 (i2);
40#endif
41  }
42};
43
44int
45sc_main (int argc, char ** argv)
46{
47  sc_clock        clk("clk");
48  sc_signal<int>  s[10];
49  hard a("a");
50  hard b("b");
51  hard c("c");
52
53  a.clk (clk);
54  b.clk (clk);
55
56  a.i1 (s[0]);
57
58  a.o1 (s[1]);
59  b.i1 (s[1]);
60
61  b.o1 (s[2]);
62
63  b.i2 (s[3]);
64
65  b.o2 (s[4]);
66  a.i2 (s[4]);
67
68  a.o2 (s[5]);
69
70  c.i1 (s[6]);
71  c.o1 (s[7]);
72  c.i2 (s[8]);
73  c.o2 (s[9]);
74
75  sc_initialize ();
76 
77  s[0] = 1;
78  s[3] = 1;
79
80  sc_start (1);
81
82  s[0] = 123;
83  s[3] = 321;
84
85  sc_start (1);
86
87  return 0;
88}
89
Note: See TracBrowser for help on using the repository browser.