cours2: mux21_5.h
| File mux21_5.h, 456 bytes (added by , 16 years ago) |
|---|
| Line | |
|---|---|
| 1 | #ifndef _MUX21_5_H |
| 2 | #define _MUX21_5_H |
| 3 | #include "systemc.h" |
| 4 | |
| 5 | SC_MODULE(mux21_5) |
| 6 | { |
| 7 | sc_in<sc_uint<5> > IN0; |
| 8 | sc_in<sc_uint<5> > IN1; |
| 9 | sc_in<bool> COM; |
| 10 | sc_out<sc_uint<5> > S; |
| 11 | |
| 12 | SC_CTOR(mux21_5) |
| 13 | { |
| 14 | SC_METHOD(mWrite); |
| 15 | sensitive << IN0 << IN1 << COM ; |
| 16 | } |
| 17 | |
| 18 | void mWrite() |
| 19 | { |
| 20 | int com=(int)COM.read(); |
| 21 | |
| 22 | switch (com) |
| 23 | { |
| 24 | case 0: |
| 25 | S.write(IN0.read()); break; |
| 26 | case 1: |
| 27 | S.write(IN1.read()); break; |
| 28 | } |
| 29 | } |
| 30 | }; |
| 31 | #endif |
| 32 |
![(please configure the [header_logo] section in trac.ini)](/trac/sesi-systemc/chrome/site/your_project_logo.png)