template-wait-args-simple.cpp 690 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
43
44
45
#include "systemc.h"
//sc_event e1;

template< unsigned D1, unsigned D2>
SC_MODULE(producer){
    int global;
    sc_out <int> out;
    void f1() {
        int i, j;
        while(true) {
        wait(2, SC_NS);
        wait(D1, SC_NS);
        }
    }
    SC_CTOR(producer) {
        SC_THREAD(f1);
    }
};

SC_MODULE(consumer) {
    sc_in<int> in;
    void f2() {
        int x;
        while(true) {

        }
    }
    SC_CTOR(consumer) {
        SC_THREAD(f2);
    }
};

int sc_main(int argc, char *argv[]) {

    sc_signal<int> s1;

    producer<222,333> p1("producer");
//        producer p1("producer");
//	consumer c1("consumer");

    p1.out(s1);
//	c1.in(s1);

    return 0;
}