1 |
2 |
tobil |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// OR1200 Top Level ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the OpenRISC 1200 project ////
|
6 |
|
|
//// http://www.opencores.org/cores/or1k/ ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Description ////
|
9 |
|
|
//// OR1200 Top Level ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// To Do: ////
|
12 |
|
|
//// - make it smaller and faster ////
|
13 |
|
|
//// ////
|
14 |
|
|
//// Author(s): ////
|
15 |
|
|
//// - Damjan Lampret, lampret@opencores.org ////
|
16 |
|
|
//// ////
|
17 |
|
|
//////////////////////////////////////////////////////////////////////
|
18 |
|
|
//// ////
|
19 |
|
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
20 |
|
|
//// ////
|
21 |
|
|
//// This source file may be used and distributed without ////
|
22 |
|
|
//// restriction provided that this copyright statement is not ////
|
23 |
|
|
//// removed from the file and that any derivative work contains ////
|
24 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
25 |
|
|
//// ////
|
26 |
|
|
//// This source file is free software; you can redistribute it ////
|
27 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
28 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
29 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
30 |
|
|
//// later version. ////
|
31 |
|
|
//// ////
|
32 |
|
|
//// This source is distributed in the hope that it will be ////
|
33 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
34 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
35 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
36 |
|
|
//// details. ////
|
37 |
|
|
//// ////
|
38 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
39 |
|
|
//// Public License along with this source; if not, download it ////
|
40 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
41 |
|
|
//// ////
|
42 |
|
|
//////////////////////////////////////////////////////////////////////
|
43 |
|
|
//
|
44 |
|
|
// CVS Revision History
|
45 |
|
|
//
|
46 |
|
|
// $Log: or1200_top.v,v $
|
47 |
|
|
// Revision 1.13 2004/06/08 18:17:36 lampret
|
48 |
|
|
// Non-functional changes. Coding style fixes.
|
49 |
|
|
//
|
50 |
|
|
// Revision 1.12 2004/04/05 08:29:57 lampret
|
51 |
|
|
// Merged branch_qmem into main tree.
|
52 |
|
|
//
|
53 |
|
|
// Revision 1.10.4.9 2004/02/11 01:40:11 lampret
|
54 |
|
|
// preliminary HW breakpoints support in debug unit (by default disabled). To enable define OR1200_DU_HWBKPTS.
|
55 |
|
|
//
|
56 |
|
|
// Revision 1.10.4.8 2004/01/17 21:14:14 simons
|
57 |
|
|
// Errors fixed.
|
58 |
|
|
//
|
59 |
|
|
// Revision 1.10.4.7 2004/01/17 19:06:38 simons
|
60 |
|
|
// Error fixed.
|
61 |
|
|
//
|
62 |
|
|
// Revision 1.10.4.6 2004/01/17 18:39:48 simons
|
63 |
|
|
// Error fixed.
|
64 |
|
|
//
|
65 |
|
|
// Revision 1.10.4.5 2004/01/15 06:46:38 markom
|
66 |
|
|
// interface to debug changed; no more opselect; stb-ack protocol
|
67 |
|
|
//
|
68 |
|
|
// Revision 1.10.4.4 2003/12/09 11:46:49 simons
|
69 |
|
|
// Mbist nameing changed, Artisan ram instance signal names fixed, some synthesis waning fixed.
|
70 |
|
|
//
|
71 |
|
|
// Revision 1.10.4.3 2003/12/05 00:08:44 lampret
|
72 |
|
|
// Fixed instantiation name.
|
73 |
|
|
//
|
74 |
|
|
// Revision 1.10.4.2 2003/07/11 01:10:35 lampret
|
75 |
|
|
// Added three missing wire declarations. No functional changes.
|
76 |
|
|
//
|
77 |
|
|
// Revision 1.10.4.1 2003/07/08 15:36:37 lampret
|
78 |
|
|
// Added embedded memory QMEM.
|
79 |
|
|
//
|
80 |
|
|
// Revision 1.10 2002/12/08 08:57:56 lampret
|
81 |
|
|
// Added optional support for WB B3 specification (xwb_cti_o, xwb_bte_o). Made xwb_cab_o optional.
|
82 |
|
|
//
|
83 |
|
|
// Revision 1.9 2002/10/17 20:04:41 lampret
|
84 |
|
|
// Added BIST scan. Special VS RAMs need to be used to implement BIST.
|
85 |
|
|
//
|
86 |
|
|
// Revision 1.8 2002/08/18 19:54:22 lampret
|
87 |
|
|
// Added store buffer.
|
88 |
|
|
//
|
89 |
|
|
// Revision 1.7 2002/07/14 22:17:17 lampret
|
90 |
|
|
// Added simple trace buffer [only for Xilinx Virtex target]. Fixed instruction fetch abort when new exception is recognized.
|
91 |
|
|
//
|
92 |
|
|
// Revision 1.6 2002/03/29 15:16:56 lampret
|
93 |
|
|
// Some of the warnings fixed.
|
94 |
|
|
//
|
95 |
|
|
// Revision 1.5 2002/02/11 04:33:17 lampret
|
96 |
|
|
// Speed optimizations (removed duplicate _cyc_ and _stb_). Fixed D/IMMU cache-inhibit attr.
|
97 |
|
|
//
|
98 |
|
|
// Revision 1.4 2002/02/01 19:56:55 lampret
|
99 |
|
|
// Fixed combinational loops.
|
100 |
|
|
//
|
101 |
|
|
// Revision 1.3 2002/01/28 01:16:00 lampret
|
102 |
|
|
// Changed 'void' nop-ops instead of insn[0] to use insn[16]. Debug unit stalls the tick timer. Prepared new flag generation for add and and insns. Blocked DC/IC while they are turned off. Fixed I/D MMU SPRs layout except WAYs. TODO: smart IC invalidate, l.j 2 and TLB ways.
|
103 |
|
|
//
|
104 |
|
|
// Revision 1.2 2002/01/18 07:56:00 lampret
|
105 |
|
|
// No more low/high priority interrupts (PICPR removed). Added tick timer exception. Added exception prefix (SR[EPH]). Fixed single-step bug whenreading NPC.
|
106 |
|
|
//
|
107 |
|
|
// Revision 1.1 2002/01/03 08:16:15 lampret
|
108 |
|
|
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
|
109 |
|
|
//
|
110 |
|
|
// Revision 1.13 2001/11/23 08:38:51 lampret
|
111 |
|
|
// Changed DSR/DRR behavior and exception detection.
|
112 |
|
|
//
|
113 |
|
|
// Revision 1.12 2001/11/20 00:57:22 lampret
|
114 |
|
|
// Fixed width of du_except.
|
115 |
|
|
//
|
116 |
|
|
// Revision 1.11 2001/11/18 08:36:28 lampret
|
117 |
|
|
// For GDB changed single stepping and disabled trap exception.
|
118 |
|
|
//
|
119 |
|
|
// Revision 1.10 2001/10/21 17:57:16 lampret
|
120 |
|
|
// Removed params from generic_XX.v. Added translate_off/on in sprs.v and id.v. Removed spr_addr from dc.v and ic.v. Fixed CR+LF.
|
121 |
|
|
//
|
122 |
|
|
// Revision 1.9 2001/10/14 13:12:10 lampret
|
123 |
|
|
// MP3 version.
|
124 |
|
|
//
|
125 |
|
|
// Revision 1.1.1.1 2001/10/06 10:18:35 igorm
|
126 |
|
|
// no message
|
127 |
|
|
//
|
128 |
|
|
// Revision 1.4 2001/08/13 03:36:20 lampret
|
129 |
|
|
// Added cfg regs. Moved all defines into one defines.v file. More cleanup.
|
130 |
|
|
//
|
131 |
|
|
// Revision 1.3 2001/08/09 13:39:33 lampret
|
132 |
|
|
// Major clean-up.
|
133 |
|
|
//
|
134 |
|
|
// Revision 1.2 2001/07/22 03:31:54 lampret
|
135 |
|
|
// Fixed RAM's oen bug. Cache bypass under development.
|
136 |
|
|
//
|
137 |
|
|
// Revision 1.1 2001/07/20 00:46:21 lampret
|
138 |
|
|
// Development version of RTL. Libraries are missing.
|
139 |
|
|
//
|
140 |
|
|
//
|
141 |
|
|
|
142 |
|
|
// synopsys translate_off
|
143 |
|
|
`include "timescale.v"
|
144 |
|
|
// synopsys translate_on
|
145 |
|
|
`include "or1200_defines.v"
|
146 |
|
|
|
147 |
|
|
module or1200_top_cm4_top(
|
148 |
|
|
cmls,
|
149 |
|
|
// System
|
150 |
|
|
clk_i, rst_i, pic_ints_i, clmode_i,
|
151 |
|
|
|
152 |
|
|
// Instruction WISHBONE INTERFACE
|
153 |
|
|
//iwb_clk_i, iwb_rst_i,
|
154 |
|
|
iwb_ack_i, iwb_err_i, iwb_rty_i, iwb_dat_i,
|
155 |
|
|
iwb_cyc_o, iwb_adr_o, iwb_stb_o, iwb_we_o, iwb_sel_o, iwb_dat_o,
|
156 |
|
|
`ifdef OR1200_WB_CAB
|
157 |
|
|
iwb_cab_o,
|
158 |
|
|
`endif
|
159 |
|
|
`ifdef OR1200_WB_B3
|
160 |
|
|
iwb_cti_o, iwb_bte_o,
|
161 |
|
|
`endif
|
162 |
|
|
// Data WISHBONE INTERFACE
|
163 |
|
|
//dwb_clk_i, dwb_rst_i,
|
164 |
|
|
dwb_ack_i, dwb_err_i, dwb_rty_i, dwb_dat_i,
|
165 |
|
|
dwb_cyc_o, dwb_adr_o, dwb_stb_o, dwb_we_o, dwb_sel_o, dwb_dat_o,
|
166 |
|
|
`ifdef OR1200_WB_CAB
|
167 |
|
|
dwb_cab_o,
|
168 |
|
|
`endif
|
169 |
|
|
`ifdef OR1200_WB_B3
|
170 |
|
|
dwb_cti_o, dwb_bte_o,
|
171 |
|
|
`endif
|
172 |
|
|
|
173 |
|
|
// External Debug Interface
|
174 |
|
|
dbg_stall_i, dbg_ewt_i, dbg_lss_o, dbg_is_o, dbg_wp_o, dbg_bp_o,
|
175 |
|
|
dbg_stb_i, dbg_we_i, dbg_adr_i, dbg_dat_i, dbg_dat_o, dbg_ack_o,
|
176 |
|
|
|
177 |
|
|
`ifdef OR1200_BIST
|
178 |
|
|
// RAM BIST
|
179 |
|
|
mbist_si_i, mbist_so_o, mbist_ctrl_i,
|
180 |
|
|
`endif
|
181 |
|
|
// Power Management
|
182 |
|
|
pm_cpustall_i,
|
183 |
|
|
pm_clksd_o, pm_dc_gate_o, pm_ic_gate_o, pm_dmmu_gate_o,
|
184 |
|
|
pm_immu_gate_o, pm_tt_gate_o, pm_cpu_gate_o, pm_wakeup_o, pm_lvolt_o
|
185 |
|
|
|
186 |
|
|
);
|
187 |
|
|
|
188 |
|
|
input [1:0] cmls;
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
parameter dw = `OR1200_OPERAND_WIDTH;
|
192 |
|
|
parameter aw = `OR1200_OPERAND_WIDTH;
|
193 |
|
|
parameter ppic_ints = `OR1200_PIC_INTS;
|
194 |
|
|
|
195 |
|
|
//
|
196 |
|
|
// I/O
|
197 |
|
|
//
|
198 |
|
|
|
199 |
|
|
//
|
200 |
|
|
// System
|
201 |
|
|
//
|
202 |
|
|
input clk_i;
|
203 |
|
|
input rst_i;
|
204 |
|
|
input [1:0] clmode_i; // 00 WB=RISC, 01 WB=RISC/2, 10 N/A, 11 WB=RISC/4
|
205 |
|
|
input [ppic_ints-1:0] pic_ints_i;
|
206 |
|
|
|
207 |
|
|
//
|
208 |
|
|
// Instruction WISHBONE interface
|
209 |
|
|
//
|
210 |
|
|
//input iwb_clk_i; // clock input
|
211 |
|
|
//input iwb_rst_i; // reset input
|
212 |
|
|
wire iwb_clk_i = clk_i;
|
213 |
|
|
wire iwb_rst_i = rst_i;
|
214 |
|
|
|
215 |
|
|
input iwb_ack_i; // normal termination
|
216 |
|
|
input iwb_err_i; // termination w/ error
|
217 |
|
|
input iwb_rty_i; // termination w/ retry
|
218 |
|
|
input [dw-1:0] iwb_dat_i; // input data bus
|
219 |
|
|
output iwb_cyc_o; // cycle valid output
|
220 |
|
|
output [aw-1:0] iwb_adr_o; // address bus outputs
|
221 |
|
|
output iwb_stb_o; // strobe output
|
222 |
|
|
output iwb_we_o; // indicates write transfer
|
223 |
|
|
output [3:0] iwb_sel_o; // byte select outputs
|
224 |
|
|
output [dw-1:0] iwb_dat_o; // output data bus
|
225 |
|
|
`ifdef OR1200_WB_CAB
|
226 |
|
|
output iwb_cab_o; // indicates consecutive address burst
|
227 |
|
|
`endif
|
228 |
|
|
`ifdef OR1200_WB_B3
|
229 |
|
|
output [2:0] iwb_cti_o; // cycle type identifier
|
230 |
|
|
output [1:0] iwb_bte_o; // burst type extension
|
231 |
|
|
`endif
|
232 |
|
|
|
233 |
|
|
//
|
234 |
|
|
// Data WISHBONE interface
|
235 |
|
|
//
|
236 |
|
|
//input dwb_clk_i; // clock input
|
237 |
|
|
//input dwb_rst_i; // reset input
|
238 |
|
|
wire dwb_clk_i = clk_i;
|
239 |
|
|
wire dwb_rst_i = rst_i;
|
240 |
|
|
|
241 |
|
|
input dwb_ack_i; // normal termination
|
242 |
|
|
input dwb_err_i; // termination w/ error
|
243 |
|
|
input dwb_rty_i; // termination w/ retry
|
244 |
|
|
input [dw-1:0] dwb_dat_i; // input data bus
|
245 |
|
|
output dwb_cyc_o; // cycle valid output
|
246 |
|
|
output [aw-1:0] dwb_adr_o; // address bus outputs
|
247 |
|
|
output dwb_stb_o; // strobe output
|
248 |
|
|
output dwb_we_o; // indicates write transfer
|
249 |
|
|
output [3:0] dwb_sel_o; // byte select outputs
|
250 |
|
|
output [dw-1:0] dwb_dat_o; // output data bus
|
251 |
|
|
`ifdef OR1200_WB_CAB
|
252 |
|
|
output dwb_cab_o; // indicates consecutive address burst
|
253 |
|
|
`endif
|
254 |
|
|
`ifdef OR1200_WB_B3
|
255 |
|
|
output [2:0] dwb_cti_o; // cycle type identifier
|
256 |
|
|
output [1:0] dwb_bte_o; // burst type extension
|
257 |
|
|
`endif
|
258 |
|
|
|
259 |
|
|
//
|
260 |
|
|
// External Debug Interface
|
261 |
|
|
//
|
262 |
|
|
input dbg_stall_i; // External Stall Input
|
263 |
|
|
input dbg_ewt_i; // External Watchpoint Trigger Input
|
264 |
|
|
output [3:0] dbg_lss_o; // External Load/Store Unit Status
|
265 |
|
|
output [1:0] dbg_is_o; // External Insn Fetch Status
|
266 |
|
|
output [10:0] dbg_wp_o; // Watchpoints Outputs
|
267 |
|
|
output dbg_bp_o; // Breakpoint Output
|
268 |
|
|
input dbg_stb_i; // External Address/Data Strobe
|
269 |
|
|
input dbg_we_i; // External Write Enable
|
270 |
|
|
input [aw-1:0] dbg_adr_i; // External Address Input
|
271 |
|
|
input [dw-1:0] dbg_dat_i; // External Data Input
|
272 |
|
|
output [dw-1:0] dbg_dat_o; // External Data Output
|
273 |
|
|
output dbg_ack_o; // External Data Acknowledge (not WB compatible)
|
274 |
|
|
|
275 |
|
|
`ifdef OR1200_BIST
|
276 |
|
|
//
|
277 |
|
|
// RAM BIST
|
278 |
|
|
//
|
279 |
|
|
input mbist_si_i;
|
280 |
|
|
input [`OR1200_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;
|
281 |
|
|
output mbist_so_o;
|
282 |
|
|
`endif
|
283 |
|
|
|
284 |
|
|
//
|
285 |
|
|
// Power Management
|
286 |
|
|
//
|
287 |
|
|
input pm_cpustall_i;
|
288 |
|
|
output [3:0] pm_clksd_o;
|
289 |
|
|
output pm_dc_gate_o;
|
290 |
|
|
output pm_ic_gate_o;
|
291 |
|
|
output pm_dmmu_gate_o;
|
292 |
|
|
output pm_immu_gate_o;
|
293 |
|
|
output pm_tt_gate_o;
|
294 |
|
|
output pm_cpu_gate_o;
|
295 |
|
|
output pm_wakeup_o;
|
296 |
|
|
output pm_lvolt_o;
|
297 |
|
|
|
298 |
|
|
or1200_top_cm4 or1200_top_cm4i(
|
299 |
|
|
.clk_i_cml_1(clk_i),
|
300 |
|
|
.clk_i_cml_2(clk_i),
|
301 |
|
|
.clk_i_cml_3(clk_i),
|
302 |
|
|
.cmls(cmls),
|
303 |
|
|
.clk_i(clk_i),
|
304 |
|
|
.rst_i(rst_i),
|
305 |
|
|
.pic_ints_i(pic_ints_i),
|
306 |
|
|
.clmode_i(clmode_i),
|
307 |
|
|
.iwb_ack_i(iwb_ack_i),
|
308 |
|
|
.iwb_err_i(iwb_err_i),
|
309 |
|
|
.iwb_rty_i(iwb_rty_i),
|
310 |
|
|
.iwb_dat_i(iwb_dat_i),
|
311 |
|
|
.iwb_cyc_o(iwb_cyc_o),
|
312 |
|
|
.iwb_adr_o(iwb_adr_o),
|
313 |
|
|
.iwb_stb_o(iwb_stb_o),
|
314 |
|
|
.iwb_we_o(iwb_we_o),
|
315 |
|
|
.iwb_sel_o(iwb_sel_o),
|
316 |
|
|
.iwb_dat_o(iwb_dat_o),
|
317 |
|
|
`ifdef OR1200_WB_CAB
|
318 |
|
|
.iwb_cab_o(iwb_cab_o),
|
319 |
|
|
`endif
|
320 |
|
|
`ifdef OR1200_WB_B3
|
321 |
|
|
.iwb_cti_o(iwb_cti_o),
|
322 |
|
|
.iwb_bte_o(iwb_bte_o),
|
323 |
|
|
`endif
|
324 |
|
|
.dwb_ack_i(dwb_ack_i),
|
325 |
|
|
.dwb_err_i(dwb_err_i),
|
326 |
|
|
.dwb_rty_i(dwb_rty_i),
|
327 |
|
|
.dwb_dat_i(dwb_dat_i),
|
328 |
|
|
.dwb_cyc_o(dwb_cyc_o),
|
329 |
|
|
.dwb_adr_o(dwb_adr_o),
|
330 |
|
|
.dwb_stb_o(dwb_stb_o),
|
331 |
|
|
.dwb_we_o(dwb_we_o),
|
332 |
|
|
.dwb_sel_o(dwb_sel_o),
|
333 |
|
|
.dwb_dat_o(dwb_dat_o),
|
334 |
|
|
`ifdef OR1200_WB_CAB
|
335 |
|
|
.dwb_cab_o(dwb_cab_o),
|
336 |
|
|
`endif
|
337 |
|
|
`ifdef OR1200_WB_B3
|
338 |
|
|
.dwb_cti_o(dwb_cti_o),
|
339 |
|
|
.dwb_bte_o(dwb_bte_o),
|
340 |
|
|
`endif
|
341 |
|
|
|
342 |
|
|
.dbg_stall_i(dbg_stall_i),
|
343 |
|
|
.dbg_ewt_i(dbg_ewt_i),
|
344 |
|
|
.dbg_lss_o(dbg_lss_o),
|
345 |
|
|
.dbg_is_o(dbg_is_o),
|
346 |
|
|
.dbg_wp_o(dbg_wp_o),
|
347 |
|
|
.dbg_bp_o(dbg_bp_o),
|
348 |
|
|
.dbg_stb_i(dbg_stb_i),
|
349 |
|
|
.dbg_we_i(dbg_we_i),
|
350 |
|
|
.dbg_adr_i(dbg_adr_i),
|
351 |
|
|
.dbg_dat_i(dbg_dat_i),
|
352 |
|
|
.dbg_dat_o(dbg_dat_o),
|
353 |
|
|
.dbg_ack_o(dbg_ack_o),
|
354 |
|
|
|
355 |
|
|
`ifdef OR1200_BIST
|
356 |
|
|
// RAM BIST
|
357 |
|
|
.mbist_si_i(mbist_si_i),
|
358 |
|
|
.mbist_so_o(mbist_so_o),
|
359 |
|
|
.mbist_ctrl_i(mbist_ctrl_i),
|
360 |
|
|
`endif
|
361 |
|
|
|
362 |
|
|
.pm_cpustall_i(pm_cpustall_i),
|
363 |
|
|
.pm_clksd_o(pm_clksd_o),
|
364 |
|
|
.pm_dc_gate_o(pm_dc_gate_o),
|
365 |
|
|
.pm_ic_gate_o(pm_ic_gate_o),
|
366 |
|
|
.pm_dmmu_gate_o(pm_dmmu_gate_o),
|
367 |
|
|
.pm_immu_gate_o(pm_immu_gate_o),
|
368 |
|
|
.pm_tt_gate_o(pm_tt_gate_o),
|
369 |
|
|
.pm_cpu_gate_o(pm_cpu_gate_o),
|
370 |
|
|
.pm_wakeup_o(pm_wakeup_o),
|
371 |
|
|
.pm_lvolt_o(pm_lvolt_o));
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
endmodule
|