method-as-member-variable.cpp 777 Bytes
Newer Older
rmrf's avatar
rmrf committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "systemc.h"
#include <iostream>

SC_MODULE( member_variable ) {
  void print() {
    std::cout << "This is an SC object as member variable" << std::endl;
  }

  void var() {
    std::cout << "I'm var?" << std::endl;
  }

  SC_CTOR( member_variable) {
  SC_METHOD(var);
  }
};

SC_MODULE( test ){
    sc_in<int> in;
    sc_out<int> out;
    sc_signal<int> test_signal;
    member_variable mv;

    void entry_function_1() {
      std::cout << "ef1: " << std::endl;
 //     mv.print();
    }

    SC_CTOR( test ): mv("mv") {
        SC_METHOD(entry_function_1);
    }
};

int sc_main(int argc, char *argv[]) {
    sc_signal<int> sig1;
    test test_instance("testing");
    test_instance.in(sig1);
    test_instance.out(sig1);

    sc_start(100, SC_NS);
    return 0;
}