cours2: mux21_32.h
File mux21_32.h, 361 bytes (added by , 15 years ago) |
---|
Line | |
---|---|
1 | #ifndef _MUX21_32_H |
2 | #define _MUX21_32_H |
3 | #include "systemc.h" |
4 | |
5 | SC_MODULE(mux21_32) |
6 | { |
7 | sc_in<sc_uint<32> > IN0; |
8 | sc_in<sc_uint<32> > IN1; |
9 | sc_in<bool> COM; |
10 | sc_out<sc_uint<32> > S; |
11 | |
12 | SC_CTOR(mux21_32) |
13 | { |
14 | SC_METHOD(mWrite); |
15 | sensitive << IN0 << IN1 << COM ; |
16 | } |
17 | |
18 | void mWrite() |
19 | { |
20 | S.write(COM ? IN1.read() : IN0.read()) ; |
21 | } |
22 | }; |
23 | #endif |
24 |