1 | #ifndef _IR_REG_32_H |
---|
2 | #define _IR_REG_32_H |
---|
3 | #include "systemc.h" |
---|
4 | |
---|
5 | SC_MODULE(ir_reg_32) |
---|
6 | { |
---|
7 | sc_in<sc_uint<32> > D; |
---|
8 | sc_in<bool> regWrite; |
---|
9 | sc_in<bool> clk; |
---|
10 | sc_out<sc_uint<32> > Q; |
---|
11 | sc_out<sc_uint<16> > Q15_0; |
---|
12 | sc_out<sc_uint<5> > Q15_11; |
---|
13 | sc_out<sc_uint<5> > Q20_16; |
---|
14 | sc_out<sc_uint<5> > Q25_21; |
---|
15 | |
---|
16 | SC_CTOR(ir_reg_32) |
---|
17 | { |
---|
18 | SC_METHOD(mWrite); |
---|
19 | sensitive << clk.pos(); |
---|
20 | } |
---|
21 | |
---|
22 | void mWrite() |
---|
23 | { |
---|
24 | if (regWrite) |
---|
25 | { |
---|
26 | sc_uint<32> din=D.read(); |
---|
27 | Q = D; |
---|
28 | Q15_0.write(din.range(15,0)); |
---|
29 | Q15_11.write(din.range(15,11)); |
---|
30 | Q20_16.write(din.range(20,16)); |
---|
31 | Q25_21.write(din.range(25,21)); |
---|
32 | } |
---|
33 | } |
---|
34 | }; |
---|
35 | #endif |
---|
36 | |
---|