OpenCores
URL https://opencores.org/ocsvn/edge/edge/trunk

Subversion Repositories edge

[/] [edge/] [trunk/] [HW/] [Verilog/] [mem_wb_pipereg.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 heshamelma
//////////////////////////////////////////////////////////////////
2
//                                                              //
3
//  MEM/WB pipeline register                                    //
4
//                                                              //
5
//  This file is part of the Edge project                       //
6
//  http://www.opencores.org/project,edge                       //
7
//                                                              //
8
//  Description                                                 //
9
//  Pipeline register lies between memory and write back stages //
10
//                                                              //
11
//  Author(s):                                                  //
12
//      - Hesham AL-Matary, heshamelmatary@gmail.com            //
13
//                                                              //
14
//////////////////////////////////////////////////////////////////
15
//                                                              //
16
// Copyright (C) 2014 Authors and OPENCORES.ORG                 //
17
//                                                              //
18
// This source file may be used and distributed without         //
19
// restriction provided that this copyright statement is not    //
20
// removed from the file and that any derivative work contains  //
21
// the original copyright notice and the associated disclaimer. //
22
//                                                              //
23
// This source file is free software; you can redistribute it   //
24
// and/or modify it under the terms of the GNU Lesser General   //
25
// Public License as published by the Free Software Foundation; //
26
// either version 2.1 of the License, or (at your option) any   //
27
// later version.                                               //
28
//                                                              //
29
// This source is distributed in the hope that it will be       //
30
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
31
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
32
// PURPOSE.  See the GNU Lesser General Public License for more //
33
// details.                                                     //
34
//                                                              //
35
// You should have received a copy of the GNU Lesser General    //
36
// Public License along with this source; if not, download it   //
37
// from http://www.opencores.org/lgpl.shtml                     //
38
//                                                              //
39
//////////////////////////////////////////////////////////////////
40
 
41
module mem_wb_pipereg
42
#
43
(
44
  parameter N=32, /* most registers sizes */
45
  parameter M=5
46
) /* regfile address */
47
(
48
  input clk,
49
  input reset,
50
  input en,
51
 
52
  input[N-1:0] ReadData_in,
53
  input[N-1:0] ALUout_in,
54
  input[M-1:0] WriteReg_in,
55
  input RegWrite_in,
56
  input[1:0] WBResultSelect_in,
57
  input[2:0] BHW_in, /* byte or halfword or word ? */
58
  input[N-1:0] lo_in,
59
  input[N-1:0] hi_in,
60
  input[N-1:0] pcplus4_in,
61
  input link_in,
62
 
63
  /* Coprocessor0 and exceptions signals */
64
  input undefinedEx_in,
65
  input breakEx_in,
66
  input divbyZero_in,
67
  input syscallEx_in,
68
 
69
  input[M-1:0] CP0_wa_in,
70
  input[M-1:0] CP0_ra_in,
71
  input[1:0] CP0_Inst_in,
72
  input[N-1:0] CP0_dout_in,
73
  input[N-1:0] CP0_din_in,
74
 
75
  input[1:0] MemRefSize_in,
76
 
77
  output[N-1:0] ReadData_out,
78
  output[N-1:0] ALUout_out,
79
  output[M-1:0] WriteReg_out,
80
  output RegWrite_out,
81
  output[1:0] WBResultSelect_out,
82
  output[2:0] BHW_out, /* byte or halfword or word ? */
83
  output[N-1:0] lo_out,
84
  output[N-1:0] hi_out,
85
  output[N-1:0] pcplus4_out,
86
  output link_out,
87
 
88
  /* Coprocessor0 and exceptions signals */
89
  output undefinedEx_out,
90
  output breakEx_out,
91
  output divbyZero_out,
92
  output syscallEx_out,
93
 
94
  output[M-1:0] CP0_wa_out,
95
  output[M-1:0] CP0_ra_out,
96
  output[1:0] CP0_Inst_out,
97
  output[N-1:0] CP0_dout_out,
98
  output[N-1:0] CP0_din_out,
99
 
100
  output[1:0] MemRefSize_out
101
);
102
 
103
/* Read data from memory in case of load instruction */
104
register ReadData
105
(
106
  .clk(clk), .reset(reset), .en(en),
107
  .d(ReadData_in),
108
  .q(ReadData_out)
109
);
110
 
111
/* ALU output R-type */
112
register ALUout
113
(
114
  .clk(clk), .reset(reset), .en(en),
115
  .d(ALUout_in),
116
  .q(ALUout_out)
117
);
118
 
119
/* PC plus 4 */
120
register pcplus4
121
(
122
  .clk(clk), .reset(reset), .en(en),
123
  .d(pcplus4_in),
124
  .q(pcplus4_out)
125
);
126
 
127
/* hi, lo special purpose registers */
128
register lo(.clk(clk), .reset(reset), .en(en), .d(lo_in), .q(lo_out));
129
register hi(.clk(clk), .reset(reset), .en(en), .d(hi_in), .q(hi_out));
130
 
131
/* Write Register Address */
132
register #(5)
133
WriteReg
134
(
135
  .clk(clk), .reset(reset), .en(en),
136
  .d(WriteReg_in),
137
  .q(WriteReg_out)
138
);
139
 
140
/* Control Signal */
141
register #(1)
142
link
143
(
144
  .clk(clk), .reset(reset), .en(en),
145
  .d(link_in),
146
  .q(link_out)
147
);
148
 
149
register #(1)
150
RegWrite
151
(
152
  .clk(clk), .reset(reset), .en(en),
153
  .d(RegWrite_in),
154
  .q(RegWrite_out)
155
);
156
 
157
register #(2)
158
WBResultSelect
159
(
160
  .clk(clk), .reset(reset), .en(en),
161
  .d(WBResultSelect_in),
162
  .q(WBResultSelect_out)
163
);
164
 
165
register #(3)
166
BHW
167
(
168
  .clk(clk), .reset(reset), .en(en),
169
  .d(BHW_in),
170
  .q(BHW_out)
171
);
172
 
173
/* Coprocessor zero related */
174
register #(1)
175
undefinedEx
176
(
177
  .clk(clk), .reset(reset), .en(en),
178
  .d(undefinedEx_in),
179
  .q(undefinedEx_out)
180
);
181
 
182
register #(1)
183
breakEx
184
(
185
  .clk(clk), .reset(reset), .en(en),
186
  .d(breakEx_in),
187
  .q(breakEx_out)
188
);
189
 
190
register #(1)
191
divbyZero
192
(
193
  .clk(clk), .reset(reset), .en(en),
194
  .d(divbyZero_in),
195
  .q(divbyZero_out)
196
);
197
 
198
register #(1)
199
syscallEx
200
(
201
  .clk(clk), .reset(reset), .en(en),
202
  .d(syscallEx_in),
203
  .q(syscallEx_out)
204
);
205
 
206
register #(5)
207
CP0_wa
208
(
209
  .clk(clk), .reset(reset), .en(en),
210
  .d(CP0_wa_in),
211
  .q(CP0_wa_out)
212
);
213
 
214
register #(5)
215
CP0_ra
216
(
217
  .clk(clk), .reset(reset), .en(en),
218
  .d(CP0_ra_in),
219
  .q(CP0_ra_out)
220
);
221
 
222
register #(2)
223
CP0_Inst
224
(
225
  .clk(clk), .reset(reset), .en(en),
226
  .d(CP0_Inst_in),
227
  .q(CP0_Inst_out)
228
);
229
 
230
register CP0_dout
231
(
232
  .clk(clk), .reset(reset), .en(en),
233
  .d(CP0_dout_in),
234
  .q(CP0_dout_out)
235
);
236
 
237
register CP0_din
238
(
239
  .clk(clk), .reset(reset), .en(en),
240
  .d(CP0_din_in),
241
  .q(CP0_din_out)
242
);
243
 
244
/* Memory referece sizes */
245
register #(2)
246
MemRefSize
247
(
248
  .clk(clk), .reset(reset), .en(en),
249
  .d(MemRefSize_in),
250
  .q(MemRefSize_out)
251
);
252
 
253
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.