-
Notifications
You must be signed in to change notification settings - Fork 2
/
decode.h
47 lines (39 loc) · 1.09 KB
/
decode.h
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
46
47
#ifndef DECODEMOD_H
#define DECODEMOD_H
/**
*
* Decode module interface.
*/
#include <systemc.h>
/**
* Decode module.
* Decode module splits instruction in its fields.
* - input ports
* - \c sc_uint<32> \c inst - instruction
* - output ports
* - \c sc_uint<5> \c rs - instruction rs field
* - \c sc_uint<5> \c rd - instruction rd field
* - \c sc_uint<5> \c rt - instruction rt field
* - \c sc_uint<16> \c imm - instruction imm field
* - \c sc_uint<6> \c opcode - instruction opcode field
* - \c sc_uint<5> \c funct - instruction funct field
* - \c sc_uint<6> \c shamt - instruction shamt field
*/
SC_MODULE(decode) {
sc_in< sc_uint<32> > inst;
sc_out< sc_uint<5> > rs;
sc_out< sc_uint<5> > rt;
sc_out< sc_uint<5> > rd;
sc_out< sc_uint<16> > imm;
sc_out< sc_uint<6> > opcode;
sc_out< sc_uint<5> > shamt;
sc_out< sc_uint<6> > funct;
sc_out< sc_uint<26> > jump;
SC_CTOR(decode)
{
SC_METHOD(entry);
sensitive << inst;
}
void entry();
};
#endif