-
Notifications
You must be signed in to change notification settings - Fork 2
/
reg_exe_mem.h
145 lines (115 loc) · 3.42 KB
/
reg_exe_mem.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#ifndef REG_EXE_MEM_H
#define REG_EXE_MEM_H
/**
*
* reg_exe_mem_t module interface.
*/
#include <systemc.h>
#include "regT.h"
/**
* reg_exe_mem_t module.
* reg_exe_mem_t module is the EXE/MEM pipeline register.
*/
SC_MODULE(reg_exe_mem_t) {
// Ports
sc_in < bool > clk;
sc_in < bool > reset;
sc_in < bool > enable;
sc_in < sc_uint<32> > aluOut_exe, regb_exe; //, BranchTarget_exe;
sc_out < sc_uint<32> > aluOut_mem, regb_mem; //, BranchTarget_mem;
sc_in < sc_uint<5> > WriteReg_exe;
sc_out < sc_uint<5> > WriteReg_mem;
sc_in < bool > MemRead_exe, MemWrite_exe, MemtoReg_exe, RegWrite_exe;
sc_out < bool > MemRead_mem, MemWrite_mem, MemtoReg_mem, RegWrite_mem;
//sc_in < bool > Zero_exe;
//sc_out < bool > Zero_mem;
sc_in < sc_uint<32> > PC_exe; // only for visualization purposes
sc_out < sc_uint<32> > PC_mem; // only for visualization purposes
sc_in < bool > valid_exe; // only for visualization purposes
sc_out < bool > valid_mem; // only for visualization purposes
// Modules
regT < sc_uint<32> > *aluOut, *regb; //, *BranchTarget;
regT < sc_uint<5> > *WriteReg;
regT < bool > *MemRead, *MemWrite, *MemtoReg, *RegWrite;
regT < sc_uint<32> > *PC; // only for visualization purposes
regT < bool > *valid; // only for visualization purposes
SC_CTOR(reg_exe_mem_t) {
aluOut = new regT < sc_uint<32> > ("aluOut");;
aluOut->din(aluOut_exe);
aluOut->dout(aluOut_mem);
aluOut->clk(clk);
aluOut->enable(enable);
aluOut->reset(reset);
regb = new regT < sc_uint<32> > ("regb");;
regb->din(regb_exe);
regb->dout(regb_mem);
regb->clk(clk);
regb->enable(enable);
regb->reset(reset);
WriteReg = new regT < sc_uint<5> > ("WriteReg");;
WriteReg->din(WriteReg_exe);
WriteReg->dout(WriteReg_mem);
WriteReg->clk(clk);
WriteReg->enable(enable);
WriteReg->reset(reset);
/* BranchTarget = new regT < sc_uint<32> > ("BranchTarget");;
BranchTarget->din(BranchTarget_exe);
BranchTarget->dout(BranchTarget_mem);
BranchTarget->clk(clk);
BranchTarget->enable(enable);
BranchTarget->reset(reset);
*/
MemRead = new regT < bool >("MemRead");
MemRead->din(MemRead_exe);
MemRead->dout(MemRead_mem);
MemRead->clk(clk);
MemRead->enable(enable);
MemRead->reset(reset);
MemWrite = new regT < bool >("MemWrite");
MemWrite->din(MemWrite_exe);
MemWrite->dout(MemWrite_mem);
MemWrite->clk(clk);
MemWrite->enable(enable);
MemWrite->reset(reset);
MemtoReg = new regT < bool >("MemtoReg");
MemtoReg->din(MemtoReg_exe);
MemtoReg->dout(MemtoReg_mem);
MemtoReg->clk(clk);
MemtoReg->enable(enable);
MemtoReg->reset(reset);
/*
Branch = new regT < bool >("Branch");
Branch->din(Branch_exe);
Branch->dout(Branch_mem);
Branch->clk(clk);
Branch->enable(enable);
Branch->reset(reset);
Zero = new regT < bool >("Zero");
Zero->din(Zero_exe);
Zero->dout(Zero_mem);
Zero->clk(clk);
Zero->enable(enable);
Zero->reset(reset);
*/
RegWrite = new regT < bool >("RegWrite");
RegWrite->din(RegWrite_exe);
RegWrite->dout(RegWrite_mem);
RegWrite->clk(clk);
RegWrite->enable(enable);
RegWrite->reset(reset);
// Visualization only
PC = new regT < sc_uint<32> > ("PC");;
PC->din(PC_exe);
PC->dout(PC_mem);
PC->clk(clk);
PC->enable(enable);
PC->reset(reset);
valid = new regT < bool > ("valid");;
valid->din(valid_exe);
valid->dout(valid_mem);
valid->clk(clk);
valid->enable(enable);
valid->reset(reset);
}
};
#endif