source: sources/test_regression/07122006/system2.cpp @ 34

Last change on this file since 34 was 34, checked in by buchmann, 15 years ago

Remove an unused regression test.
Update some other tests.
Add a TODO section into README file.
Disable some debugging compiler options for common users.

File size: 1.4 KB
Line 
1#include <systemc.h>
2#include <signal.h>
3#include <iostream>
4#include <fstream>
5
6#define ASSERT(x) \
7  { \
8    if (!(x)) \
9    { \
10    cerr << "ASSERT : '" #x "' at cycle number " << sc_simulation_time () << "\n"; \
11    exit (1); \
12    } \
13  }
14
15using namespace std;
16
17struct inner_test : public sc_module
18{
19  virtual void transition ()
20  {
21    cout << "This function is a virtual one.\n";
22  };
23  inner_test(sc_module_name n)
24  {
25  };
26};
27
28struct test : public inner_test
29{
30  sc_in<bool>     clk;
31  sc_in<bool>     resetn;
32  sc_out<int>     o;
33  sc_in <int>     i;
34  sc_signal<int>  reg;
35
36  void transition ();
37  void gen_moore  ();
38  void gen_mealy  ();
39
40  SC_HAS_PROCESS(test);
41  test(sc_module_name n) : inner_test (n)
42  {
43    SC_METHOD(transition);
44    sensitive << clk.pos();
45    SC_METHOD(gen_moore);
46    sensitive << clk.neg();
47    SC_METHOD(gen_mealy);
48    sensitive << clk.neg() << i;
49  }
50};
51
52void test::transition ()
53{
54  std::cout << "transition\n";
55}
56
57void test::gen_moore ()
58{
59  std::cout << "gen_moore\n";
60}
61
62void test::gen_mealy ()
63{
64  std::cout << "gen_mealy\n";
65}
66
67
68
69int sc_main (int argc, char *argv[])
70{
71  sc_clock        clk("clk");
72  sc_signal<bool> resetn("resetn");
73  sc_signal<int>  in ("in");
74  sc_signal<int>  out("out");
75 
76  test test("test");
77  test.clk    (clk);
78  test.resetn (resetn);
79
80  test.i (in);
81  test.o (out);
82
83  sc_initialize ();
84
85  resetn = false;
86  sc_start (3);
87  resetn = true;
88  sc_start (10);
89
90  cout << "Test OK.\n";
91        return EXIT_SUCCESS;
92}
Note: See TracBrowser for help on using the repository browser.