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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [rtl/] [verilog/] [orpsoc_top/] [orpsoc_top.v] - Blame information for rev 831

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 44 julius
//////////////////////////////////////////////////////////////////////
2 360 julius
///                                                               //// 
3
/// ORPSoC top level                                              ////
4
///                                                               ////
5
/// Define I/O ports, instantiate modules                         ////
6
///                                                               ////
7
/// Julius Baxter, julius@opencores.org                           ////
8
///                                                               ////
9 44 julius
//////////////////////////////////////////////////////////////////////
10
////                                                              ////
11 360 julius
//// Copyright (C) 2009, 2010 Authors and OPENCORES.ORG           ////
12 44 julius
////                                                              ////
13
//// This source file may be used and distributed without         ////
14
//// restriction provided that this copyright statement is not    ////
15
//// removed from the file and that any derivative work contains  ////
16
//// the original copyright notice and the associated disclaimer. ////
17
////                                                              ////
18
//// This source file is free software; you can redistribute it   ////
19
//// and/or modify it under the terms of the GNU Lesser General   ////
20
//// Public License as published by the Free Software Foundation; ////
21
//// either version 2.1 of the License, or (at your option) any   ////
22
//// later version.                                               ////
23
////                                                              ////
24
//// This source is distributed in the hope that it will be       ////
25
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
26
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
27
//// PURPOSE.  See the GNU Lesser General Public License for more ////
28
//// details.                                                     ////
29
////                                                              ////
30
//// You should have received a copy of the GNU Lesser General    ////
31
//// Public License along with this source; if not, download it   ////
32
//// from http://www.opencores.org/lgpl.shtml                     ////
33
////                                                              ////
34
//////////////////////////////////////////////////////////////////////
35
 
36 360 julius
`include "orpsoc-defines.v"
37 44 julius
 
38 6 julius
module orpsoc_top
39 360 julius
  (
40
`ifdef JTAG_DEBUG
41
    tdo_pad_o, tms_pad_i, tck_pad_i, tdi_pad_i,
42
`endif
43
`ifdef UART0
44
    uart0_srx_pad_i, uart0_stx_pad_o,
45 6 julius
`endif
46 360 julius
    clk_pad_i,
47
    rst_n_pad_i
48
    );
49 54 julius
 
50 360 julius
`include "orpsoc-params.v"
51 54 julius
 
52 360 julius
   input clk_pad_i;
53
   input rst_n_pad_i;
54
 
55
`ifdef JTAG_DEBUG
56
   output tdo_pad_o;
57
   input  tms_pad_i;
58
   input  tck_pad_i;
59
   input  tdi_pad_i;
60
`endif
61
`ifdef UART0
62
   input  uart0_srx_pad_i;
63
   output uart0_stx_pad_o;
64
`endif
65
 
66
   ////////////////////////////////////////////////////////////////////////
67
   //
68
   // Clock and reset generation module
69
   // 
70
   ////////////////////////////////////////////////////////////////////////
71 54 julius
 
72 360 julius
   //
73
   // Wires
74
   //
75 363 julius
   wire   async_rst;
76
   wire   wb_clk, wb_rst;
77
   wire   dbg_tck;
78 54 julius
 
79 360 julius
 
80
   clkgen clkgen0
81
     (
82
 
83
      .clk_pad_i             (clk_pad_i),
84 363 julius
 
85
      .async_rst_o            (async_rst),
86 54 julius
 
87 360 julius
      .wb_clk_o                  (wb_clk),
88
      .wb_rst_o                  (wb_rst),
89 54 julius
 
90 360 julius
`ifdef JTAG_DEBUG
91
      .tck_pad_i                 (tck_pad_i),
92
      .dbg_tck_o                 (dbg_tck),
93
`endif
94 54 julius
 
95 360 julius
      // Asynchronous active low reset
96
      .rst_n_pad_i               (rst_n_pad_i)
97
      );
98 54 julius
 
99 360 julius
 
100
   ////////////////////////////////////////////////////////////////////////
101
   //
102
   // Arbiter
103
   // 
104
   ////////////////////////////////////////////////////////////////////////
105
 
106
   // Wire naming convention:
107
   // First: wishbone master or slave (wbm/wbs)
108
   // Second: Which bus it's on instruction or data (i/d)
109
   // Third: Between which module and the arbiter the wires are
110
   // Fourth: Signal name
111
   // Fifth: Direction relative to module (not bus/arbiter!)
112
   //        ie. wbm_d_or12_adr_o is address OUT from the or1200
113 54 julius
 
114 360 julius
   // OR1200 instruction bus wires
115
   wire [wb_aw-1:0]            wbm_i_or12_adr_o;
116
   wire [wb_dw-1:0]            wbm_i_or12_dat_o;
117
   wire [3:0]                  wbm_i_or12_sel_o;
118
   wire                       wbm_i_or12_we_o;
119
   wire                       wbm_i_or12_cyc_o;
120
   wire                       wbm_i_or12_stb_o;
121
   wire [2:0]                  wbm_i_or12_cti_o;
122
   wire [1:0]                  wbm_i_or12_bte_o;
123
 
124
   wire [wb_dw-1:0]            wbm_i_or12_dat_i;
125
   wire                       wbm_i_or12_ack_i;
126
   wire                       wbm_i_or12_err_i;
127
   wire                       wbm_i_or12_rty_i;
128 54 julius
 
129 360 julius
   // OR1200 data bus wires   
130
   wire [wb_aw-1:0]            wbm_d_or12_adr_o;
131
   wire [wb_dw-1:0]            wbm_d_or12_dat_o;
132
   wire [3:0]                  wbm_d_or12_sel_o;
133
   wire                       wbm_d_or12_we_o;
134
   wire                       wbm_d_or12_cyc_o;
135
   wire                       wbm_d_or12_stb_o;
136
   wire [2:0]                  wbm_d_or12_cti_o;
137
   wire [1:0]                  wbm_d_or12_bte_o;
138
 
139
   wire [wb_dw-1:0]            wbm_d_or12_dat_i;
140
   wire                       wbm_d_or12_ack_i;
141
   wire                       wbm_d_or12_err_i;
142
   wire                       wbm_d_or12_rty_i;
143 54 julius
 
144 360 julius
   // Debug interface bus wires   
145
   wire [wb_aw-1:0]            wbm_d_dbg_adr_o;
146
   wire [wb_dw-1:0]            wbm_d_dbg_dat_o;
147
   wire [3:0]                  wbm_d_dbg_sel_o;
148
   wire                       wbm_d_dbg_we_o;
149
   wire                       wbm_d_dbg_cyc_o;
150
   wire                       wbm_d_dbg_stb_o;
151
   wire [2:0]                  wbm_d_dbg_cti_o;
152
   wire [1:0]                  wbm_d_dbg_bte_o;
153
 
154
   wire [wb_dw-1:0]            wbm_d_dbg_dat_i;
155
   wire                       wbm_d_dbg_ack_i;
156
   wire                       wbm_d_dbg_err_i;
157
   wire                       wbm_d_dbg_rty_i;
158 54 julius
 
159 360 julius
   // Byte bus bridge master signals
160
   wire [wb_aw-1:0]            wbm_b_d_adr_o;
161
   wire [wb_dw-1:0]            wbm_b_d_dat_o;
162
   wire [3:0]                  wbm_b_d_sel_o;
163
   wire                       wbm_b_d_we_o;
164
   wire                       wbm_b_d_cyc_o;
165
   wire                       wbm_b_d_stb_o;
166
   wire [2:0]                  wbm_b_d_cti_o;
167
   wire [1:0]                  wbm_b_d_bte_o;
168
 
169
   wire [wb_dw-1:0]            wbm_b_d_dat_i;
170
   wire                       wbm_b_d_ack_i;
171
   wire                       wbm_b_d_err_i;
172
   wire                       wbm_b_d_rty_i;
173 54 julius
 
174 360 julius
   // Instruction bus slave wires //
175
 
176
   // rom0 instruction bus wires
177
   wire [31:0]                 wbs_i_rom0_adr_i;
178
   wire [wbs_i_rom0_data_width-1:0] wbs_i_rom0_dat_i;
179
   wire [3:0]                        wbs_i_rom0_sel_i;
180
   wire                             wbs_i_rom0_we_i;
181
   wire                             wbs_i_rom0_cyc_i;
182
   wire                             wbs_i_rom0_stb_i;
183
   wire [2:0]                        wbs_i_rom0_cti_i;
184
   wire [1:0]                        wbs_i_rom0_bte_i;
185
   wire [wbs_i_rom0_data_width-1:0] wbs_i_rom0_dat_o;
186
   wire                             wbs_i_rom0_ack_o;
187
   wire                             wbs_i_rom0_err_o;
188
   wire                             wbs_i_rom0_rty_o;
189 54 julius
 
190 360 julius
   // mc0 instruction bus wires
191
   wire [31:0]                       wbs_i_mc0_adr_i;
192
   wire [31:0]                       wbs_i_mc0_dat_i;
193
   wire [3:0]                        wbs_i_mc0_sel_i;
194
   wire                             wbs_i_mc0_we_i;
195
   wire                             wbs_i_mc0_cyc_i;
196
   wire                             wbs_i_mc0_stb_i;
197
   wire [2:0]                        wbs_i_mc0_cti_i;
198
   wire [1:0]                        wbs_i_mc0_bte_i;
199
   wire [31:0]                       wbs_i_mc0_dat_o;
200
   wire                             wbs_i_mc0_ack_o;
201
   wire                             wbs_i_mc0_err_o;
202
   wire                             wbs_i_mc0_rty_o;
203
 
204
   // Data bus slave wires //
205
 
206
   // mc0 data bus wires
207
   wire [31:0]                       wbs_d_mc0_adr_i;
208
   wire [31:0]                       wbs_d_mc0_dat_i;
209
   wire [3:0]                        wbs_d_mc0_sel_i;
210
   wire                             wbs_d_mc0_we_i;
211
   wire                             wbs_d_mc0_cyc_i;
212
   wire                             wbs_d_mc0_stb_i;
213
   wire [2:0]                        wbs_d_mc0_cti_i;
214
   wire [1:0]                        wbs_d_mc0_bte_i;
215
   wire [31:0]                       wbs_d_mc0_dat_o;
216
   wire                             wbs_d_mc0_ack_o;
217
   wire                             wbs_d_mc0_err_o;
218
   wire                             wbs_d_mc0_rty_o;
219
 
220
   // uart0 wires
221
   wire [31:0]                        wbs_d_uart0_adr_i;
222
   wire [wbs_d_uart0_data_width-1:0] wbs_d_uart0_dat_i;
223
   wire [3:0]                         wbs_d_uart0_sel_i;
224
   wire                              wbs_d_uart0_we_i;
225
   wire                              wbs_d_uart0_cyc_i;
226
   wire                              wbs_d_uart0_stb_i;
227
   wire [2:0]                         wbs_d_uart0_cti_i;
228
   wire [1:0]                         wbs_d_uart0_bte_i;
229
   wire [wbs_d_uart0_data_width-1:0] wbs_d_uart0_dat_o;
230
   wire                              wbs_d_uart0_ack_o;
231
   wire                              wbs_d_uart0_err_o;
232
   wire                              wbs_d_uart0_rty_o;
233 54 julius
 
234 506 julius
 
235
   // intgen wires
236
   wire [31:0]                        wbs_d_intgen_adr_i;
237
   wire [7:0]                         wbs_d_intgen_dat_i;
238
   wire [3:0]                         wbs_d_intgen_sel_i;
239
   wire                              wbs_d_intgen_we_i;
240
   wire                              wbs_d_intgen_cyc_i;
241
   wire                              wbs_d_intgen_stb_i;
242
   wire [2:0]                         wbs_d_intgen_cti_i;
243
   wire [1:0]                         wbs_d_intgen_bte_i;
244
   wire [7:0]                         wbs_d_intgen_dat_o;
245
   wire                              wbs_d_intgen_ack_o;
246
   wire                              wbs_d_intgen_err_o;
247
   wire                              wbs_d_intgen_rty_o;
248 54 julius
 
249 506 julius
 
250 360 julius
   //
251
   // Wishbone instruction bus arbiter
252
   //
253 351 julius
 
254 360 julius
   arbiter_ibus arbiter_ibus0
255 351 julius
     (
256 360 julius
      // Instruction Bus Master
257
      // Inputs to arbiter from master
258
      .wbm_adr_o                        (wbm_i_or12_adr_o),
259
      .wbm_dat_o                        (wbm_i_or12_dat_o),
260
      .wbm_sel_o                        (wbm_i_or12_sel_o),
261
      .wbm_we_o                         (wbm_i_or12_we_o),
262
      .wbm_cyc_o                        (wbm_i_or12_cyc_o),
263
      .wbm_stb_o                        (wbm_i_or12_stb_o),
264
      .wbm_cti_o                        (wbm_i_or12_cti_o),
265
      .wbm_bte_o                        (wbm_i_or12_bte_o),
266
      // Outputs to master from arbiter
267
      .wbm_dat_i                        (wbm_i_or12_dat_i),
268
      .wbm_ack_i                        (wbm_i_or12_ack_i),
269
      .wbm_err_i                        (wbm_i_or12_err_i),
270
      .wbm_rty_i                        (wbm_i_or12_rty_i),
271 351 julius
 
272 360 julius
      // Slave 0
273
      // Inputs to slave from arbiter
274
      .wbs0_adr_i                       (wbs_i_rom0_adr_i),
275
      .wbs0_dat_i                       (wbs_i_rom0_dat_i),
276
      .wbs0_sel_i                       (wbs_i_rom0_sel_i),
277
      .wbs0_we_i                        (wbs_i_rom0_we_i),
278
      .wbs0_cyc_i                       (wbs_i_rom0_cyc_i),
279
      .wbs0_stb_i                       (wbs_i_rom0_stb_i),
280
      .wbs0_cti_i                       (wbs_i_rom0_cti_i),
281
      .wbs0_bte_i                       (wbs_i_rom0_bte_i),
282
      // Outputs from slave to arbiter      
283
      .wbs0_dat_o                       (wbs_i_rom0_dat_o),
284
      .wbs0_ack_o                       (wbs_i_rom0_ack_o),
285
      .wbs0_err_o                       (wbs_i_rom0_err_o),
286
      .wbs0_rty_o                       (wbs_i_rom0_rty_o),
287 351 julius
 
288 360 julius
      // Slave 1
289
      // Inputs to slave from arbiter
290
      .wbs1_adr_i                       (wbs_i_mc0_adr_i),
291
      .wbs1_dat_i                       (wbs_i_mc0_dat_i),
292
      .wbs1_sel_i                       (wbs_i_mc0_sel_i),
293
      .wbs1_we_i                        (wbs_i_mc0_we_i),
294
      .wbs1_cyc_i                       (wbs_i_mc0_cyc_i),
295
      .wbs1_stb_i                       (wbs_i_mc0_stb_i),
296
      .wbs1_cti_i                       (wbs_i_mc0_cti_i),
297
      .wbs1_bte_i                       (wbs_i_mc0_bte_i),
298
      // Outputs from slave to arbiter
299
      .wbs1_dat_o                       (wbs_i_mc0_dat_o),
300
      .wbs1_ack_o                       (wbs_i_mc0_ack_o),
301
      .wbs1_err_o                       (wbs_i_mc0_err_o),
302
      .wbs1_rty_o                       (wbs_i_mc0_rty_o),
303 351 julius
 
304 360 julius
      // Clock, reset inputs
305
      .wb_clk                           (wb_clk),
306
      .wb_rst                           (wb_rst));
307 351 julius
 
308 360 julius
   defparam arbiter_ibus0.wb_addr_match_width = ibus_arb_addr_match_width;
309 351 julius
 
310 360 julius
   defparam arbiter_ibus0.slave0_adr = ibus_arb_slave0_adr; // ROM
311
   defparam arbiter_ibus0.slave1_adr = ibus_arb_slave1_adr; // Main memory
312 351 julius
 
313 360 julius
   //
314
   // Wishbone data bus arbiter
315
   //
316
 
317
   arbiter_dbus arbiter_dbus0
318
     (
319
      // Master 0
320
      // Inputs to arbiter from master
321
      .wbm0_adr_o                       (wbm_d_or12_adr_o),
322
      .wbm0_dat_o                       (wbm_d_or12_dat_o),
323
      .wbm0_sel_o                       (wbm_d_or12_sel_o),
324
      .wbm0_we_o                        (wbm_d_or12_we_o),
325
      .wbm0_cyc_o                       (wbm_d_or12_cyc_o),
326
      .wbm0_stb_o                       (wbm_d_or12_stb_o),
327
      .wbm0_cti_o                       (wbm_d_or12_cti_o),
328
      .wbm0_bte_o                       (wbm_d_or12_bte_o),
329
      // Outputs to master from arbiter
330
      .wbm0_dat_i                       (wbm_d_or12_dat_i),
331
      .wbm0_ack_i                       (wbm_d_or12_ack_i),
332
      .wbm0_err_i                       (wbm_d_or12_err_i),
333
      .wbm0_rty_i                       (wbm_d_or12_rty_i),
334 351 julius
 
335 360 julius
      // Master 0
336
      // Inputs to arbiter from master
337
      .wbm1_adr_o                       (wbm_d_dbg_adr_o),
338
      .wbm1_dat_o                       (wbm_d_dbg_dat_o),
339
      .wbm1_we_o                        (wbm_d_dbg_we_o),
340
      .wbm1_cyc_o                       (wbm_d_dbg_cyc_o),
341
      .wbm1_sel_o                       (wbm_d_dbg_sel_o),
342
      .wbm1_stb_o                       (wbm_d_dbg_stb_o),
343
      .wbm1_cti_o                       (wbm_d_dbg_cti_o),
344
      .wbm1_bte_o                       (wbm_d_dbg_bte_o),
345
      // Outputs to master from arbiter      
346
      .wbm1_dat_i                       (wbm_d_dbg_dat_i),
347
      .wbm1_ack_i                       (wbm_d_dbg_ack_i),
348
      .wbm1_err_i                       (wbm_d_dbg_err_i),
349
      .wbm1_rty_i                       (wbm_d_dbg_rty_i),
350 351 julius
 
351 360 julius
      // Slaves
352 351 julius
 
353 360 julius
      .wbs0_adr_i                       (wbs_d_mc0_adr_i),
354
      .wbs0_dat_i                       (wbs_d_mc0_dat_i),
355
      .wbs0_sel_i                       (wbs_d_mc0_sel_i),
356
      .wbs0_we_i                        (wbs_d_mc0_we_i),
357
      .wbs0_cyc_i                       (wbs_d_mc0_cyc_i),
358
      .wbs0_stb_i                       (wbs_d_mc0_stb_i),
359
      .wbs0_cti_i                       (wbs_d_mc0_cti_i),
360
      .wbs0_bte_i                       (wbs_d_mc0_bte_i),
361
      .wbs0_dat_o                       (wbs_d_mc0_dat_o),
362
      .wbs0_ack_o                       (wbs_d_mc0_ack_o),
363
      .wbs0_err_o                       (wbs_d_mc0_err_o),
364
      .wbs0_rty_o                       (wbs_d_mc0_rty_o),
365
 
366
      .wbs1_adr_i                       (wbm_b_d_adr_o),
367
      .wbs1_dat_i                       (wbm_b_d_dat_o),
368
      .wbs1_sel_i                       (wbm_b_d_sel_o),
369
      .wbs1_we_i                        (wbm_b_d_we_o),
370
      .wbs1_cyc_i                       (wbm_b_d_cyc_o),
371
      .wbs1_stb_i                       (wbm_b_d_stb_o),
372
      .wbs1_cti_i                       (wbm_b_d_cti_o),
373
      .wbs1_bte_i                       (wbm_b_d_bte_o),
374
      .wbs1_dat_o                       (wbm_b_d_dat_i),
375
      .wbs1_ack_o                       (wbm_b_d_ack_i),
376
      .wbs1_err_o                       (wbm_b_d_err_i),
377
      .wbs1_rty_o                       (wbm_b_d_rty_i),
378
 
379
      // Clock, reset inputs
380 351 julius
      .wb_clk                   (wb_clk),
381
      .wb_rst                   (wb_rst));
382 360 julius
 
383
   // These settings are from top level params file
384
   defparam arbiter_dbus0.wb_addr_match_width = dbus_arb_wb_addr_match_width;
385
   defparam arbiter_dbus0.wb_num_slaves = dbus_arb_wb_num_slaves;
386
   defparam arbiter_dbus0.slave0_adr = dbus_arb_slave0_adr;
387
   defparam arbiter_dbus0.slave1_adr = dbus_arb_slave1_adr;
388
 
389
   //
390
   // Wishbone byte-wide bus arbiter
391
   //   
392 351 julius
 
393 360 julius
   arbiter_bytebus arbiter_bytebus0
394
     (
395 351 julius
 
396 360 julius
      // Master 0
397
      // Inputs to arbiter from master
398
      .wbm0_adr_o                       (wbm_b_d_adr_o),
399
      .wbm0_dat_o                       (wbm_b_d_dat_o),
400
      .wbm0_sel_o                       (wbm_b_d_sel_o),
401
      .wbm0_we_o                        (wbm_b_d_we_o),
402
      .wbm0_cyc_o                       (wbm_b_d_cyc_o),
403
      .wbm0_stb_o                       (wbm_b_d_stb_o),
404
      .wbm0_cti_o                       (wbm_b_d_cti_o),
405
      .wbm0_bte_o                       (wbm_b_d_bte_o),
406
      // Outputs to master from arbiter
407
      .wbm0_dat_i                       (wbm_b_d_dat_i),
408
      .wbm0_ack_i                       (wbm_b_d_ack_i),
409
      .wbm0_err_i                       (wbm_b_d_err_i),
410
      .wbm0_rty_i                       (wbm_b_d_rty_i),
411
 
412
      // Byte bus slaves
413
 
414
      .wbs0_adr_i                       (wbs_d_uart0_adr_i),
415
      .wbs0_dat_i                       (wbs_d_uart0_dat_i),
416
      .wbs0_we_i                        (wbs_d_uart0_we_i),
417
      .wbs0_cyc_i                       (wbs_d_uart0_cyc_i),
418
      .wbs0_stb_i                       (wbs_d_uart0_stb_i),
419
      .wbs0_cti_i                       (wbs_d_uart0_cti_i),
420
      .wbs0_bte_i                       (wbs_d_uart0_bte_i),
421
      .wbs0_dat_o                       (wbs_d_uart0_dat_o),
422
      .wbs0_ack_o                       (wbs_d_uart0_ack_o),
423
      .wbs0_err_o                       (wbs_d_uart0_err_o),
424
      .wbs0_rty_o                       (wbs_d_uart0_rty_o),
425
 
426 506 julius
      .wbs1_adr_i                       (wbs_d_intgen_adr_i),
427
      .wbs1_dat_i                       (wbs_d_intgen_dat_i),
428
      .wbs1_we_i                        (wbs_d_intgen_we_i),
429
      .wbs1_cyc_i                       (wbs_d_intgen_cyc_i),
430
      .wbs1_stb_i                       (wbs_d_intgen_stb_i),
431
      .wbs1_cti_i                       (wbs_d_intgen_cti_i),
432
      .wbs1_bte_i                       (wbs_d_intgen_bte_i),
433
      .wbs1_dat_o                       (wbs_d_intgen_dat_o),
434
      .wbs1_ack_o                       (wbs_d_intgen_ack_o),
435
      .wbs1_err_o                       (wbs_d_intgen_err_o),
436
      .wbs1_rty_o                       (wbs_d_intgen_rty_o),
437
 
438 360 julius
      // Clock, reset inputs
439
      .wb_clk                   (wb_clk),
440
      .wb_rst                   (wb_rst));
441
 
442
   defparam arbiter_bytebus0.wb_addr_match_width = bbus_arb_wb_addr_match_width;
443
   defparam arbiter_bytebus0.wb_num_slaves = bbus_arb_wb_num_slaves;
444
 
445
   defparam arbiter_bytebus0.slave0_adr = bbus_arb_slave0_adr;
446
   defparam arbiter_bytebus0.slave1_adr = bbus_arb_slave1_adr;
447
 
448
`ifdef JTAG_DEBUG
449
   ////////////////////////////////////////////////////////////////////////
450
   //
451
   // JTAG TAP
452
   // 
453
   ////////////////////////////////////////////////////////////////////////
454
 
455
   //
456
   // Wires
457
   //
458
   wire                                   dbg_if_select;
459
   wire                                   dbg_if_tdo;
460
   wire                                   jtag_tap_tdo;
461
   wire                                   jtag_tap_shift_dr, jtag_tap_pause_dr,
462 363 julius
                                          jtag_tap_update_dr, jtag_tap_capture_dr;
463 360 julius
   //
464
   // Instantiation
465
   //
466
 
467
   jtag_tap jtag_tap0
468 6 julius
     (
469 360 julius
      // Ports to pads
470
      .tdo_pad_o                        (tdo_pad_o),
471
      .tms_pad_i                        (tms_pad_i),
472
      .tck_pad_i                        (dbg_tck),
473
      .trst_pad_i                       (async_rst),
474
      .tdi_pad_i                        (tdi_pad_i),
475
 
476 363 julius
      .tdo_padoe_o                      (),
477 360 julius
 
478
      .tdo_o                            (jtag_tap_tdo),
479 6 julius
 
480 360 julius
      .shift_dr_o                       (jtag_tap_shift_dr),
481
      .pause_dr_o                       (jtag_tap_pause_dr),
482
      .update_dr_o                      (jtag_tap_update_dr),
483
      .capture_dr_o                     (jtag_tap_capture_dr),
484
 
485
      .extest_select_o                  (),
486
      .sample_preload_select_o          (),
487
      .mbist_select_o                   (),
488
      .debug_select_o                   (dbg_if_select),
489 6 julius
 
490 360 julius
 
491
      .bs_chain_tdi_i                   (1'b0),
492
      .mbist_tdi_i                      (1'b0),
493
      .debug_tdi_i                      (dbg_if_tdo)
494
 
495 54 julius
      );
496 360 julius
 
497
   ////////////////////////////////////////////////////////////////////////
498
`endif //  `ifdef JTAG_DEBUG
499 6 julius
 
500 360 julius
   ////////////////////////////////////////////////////////////////////////
501
   //
502
   // OpenRISC processor
503
   // 
504
   ////////////////////////////////////////////////////////////////////////
505
 
506
   // 
507
   // Wires
508
   // 
509 6 julius
 
510 360 julius
   wire [19:0]                             or1200_pic_ints;
511 351 julius
 
512 360 julius
   wire [31:0]                             or1200_dbg_dat_i;
513
   wire [31:0]                             or1200_dbg_adr_i;
514
   wire                                   or1200_dbg_we_i;
515
   wire                                   or1200_dbg_stb_i;
516
   wire                                   or1200_dbg_ack_o;
517
   wire [31:0]                             or1200_dbg_dat_o;
518
 
519
   wire                                   or1200_dbg_stall_i;
520
   wire                                   or1200_dbg_ewt_i;
521
   wire [3:0]                              or1200_dbg_lss_o;
522
   wire [1:0]                              or1200_dbg_is_o;
523
   wire [10:0]                             or1200_dbg_wp_o;
524
   wire                                   or1200_dbg_bp_o;
525
   wire                                   or1200_dbg_rst;
526
 
527
   wire                                   or1200_clk, or1200_rst;
528
   wire                                   sig_tick;
529
 
530
   //
531
   // Assigns
532
   //
533
   assign or1200_clk = wb_clk;
534
   assign or1200_rst = wb_rst | or1200_dbg_rst;
535 351 julius
 
536 360 julius
   // 
537
   // Instantiation
538
   //    
539 403 julius
   or1200_top or1200_top0
540 360 julius
       (
541
        // Instruction bus, clocks, reset
542
        .iwb_clk_i                      (wb_clk),
543
        .iwb_rst_i                      (wb_rst),
544
        .iwb_ack_i                      (wbm_i_or12_ack_i),
545
        .iwb_err_i                      (wbm_i_or12_err_i),
546
        .iwb_rty_i                      (wbm_i_or12_rty_i),
547
        .iwb_dat_i                      (wbm_i_or12_dat_i),
548
 
549
        .iwb_cyc_o                      (wbm_i_or12_cyc_o),
550
        .iwb_adr_o                      (wbm_i_or12_adr_o),
551
        .iwb_stb_o                      (wbm_i_or12_stb_o),
552
        .iwb_we_o                       (wbm_i_or12_we_o),
553
        .iwb_sel_o                      (wbm_i_or12_sel_o),
554
        .iwb_dat_o                      (wbm_i_or12_dat_o),
555
        .iwb_cti_o                      (wbm_i_or12_cti_o),
556
        .iwb_bte_o                      (wbm_i_or12_bte_o),
557
 
558
        // Data bus, clocks, reset            
559
        .dwb_clk_i                      (wb_clk),
560
        .dwb_rst_i                      (wb_rst),
561
        .dwb_ack_i                      (wbm_d_or12_ack_i),
562
        .dwb_err_i                      (wbm_d_or12_err_i),
563
        .dwb_rty_i                      (wbm_d_or12_rty_i),
564
        .dwb_dat_i                      (wbm_d_or12_dat_i),
565 6 julius
 
566 360 julius
        .dwb_cyc_o                      (wbm_d_or12_cyc_o),
567
        .dwb_adr_o                      (wbm_d_or12_adr_o),
568
        .dwb_stb_o                      (wbm_d_or12_stb_o),
569
        .dwb_we_o                       (wbm_d_or12_we_o),
570
        .dwb_sel_o                      (wbm_d_or12_sel_o),
571
        .dwb_dat_o                      (wbm_d_or12_dat_o),
572
        .dwb_cti_o                      (wbm_d_or12_cti_o),
573
        .dwb_bte_o                      (wbm_d_or12_bte_o),
574
 
575
        // Debug interface ports
576
        .dbg_stall_i                    (or1200_dbg_stall_i),
577
        //.dbg_ewt_i                    (or1200_dbg_ewt_i),
578
        .dbg_ewt_i                      (1'b0),
579
        .dbg_lss_o                      (or1200_dbg_lss_o),
580
        .dbg_is_o                       (or1200_dbg_is_o),
581
        .dbg_wp_o                       (or1200_dbg_wp_o),
582
        .dbg_bp_o                       (or1200_dbg_bp_o),
583 351 julius
 
584 360 julius
        .dbg_adr_i                      (or1200_dbg_adr_i),
585
        .dbg_we_i                       (or1200_dbg_we_i ),
586
        .dbg_stb_i                      (or1200_dbg_stb_i),
587
        .dbg_dat_i                      (or1200_dbg_dat_i),
588
        .dbg_dat_o                      (or1200_dbg_dat_o),
589
        .dbg_ack_o                      (or1200_dbg_ack_o),
590
 
591
        .pm_clksd_o                     (),
592
        .pm_dc_gate_o                   (),
593
        .pm_ic_gate_o                   (),
594
        .pm_dmmu_gate_o                 (),
595
        .pm_immu_gate_o                 (),
596
        .pm_tt_gate_o                   (),
597
        .pm_cpu_gate_o                  (),
598
        .pm_wakeup_o                    (),
599
        .pm_lvolt_o                     (),
600
 
601
        // Core clocks, resets
602
        .clk_i                          (or1200_clk),
603
        .rst_i                          (or1200_rst),
604
 
605
        .clmode_i                       (2'b00),
606
        // Interrupts      
607
        .pic_ints_i                     (or1200_pic_ints),
608
        .sig_tick(sig_tick),
609
        /*
610
         .mbist_so_o                    (),
611
         .mbist_si_i                    (0),
612
         .mbist_ctrl_i                  (0),
613
         */
614
 
615
        .pm_cpustall_i                  (1'b0)
616
 
617
        );
618 351 julius
 
619 360 julius
   ////////////////////////////////////////////////////////////////////////
620 6 julius
 
621
 
622 360 julius
`ifdef JTAG_DEBUG
623
   ////////////////////////////////////////////////////////////////////////
624
   //
625
   // OR1200 Debug Interface
626
   // 
627
   ////////////////////////////////////////////////////////////////////////
628
 
629
   dbg_if dbg_if0
630 6 julius
     (
631 360 julius
      // OR1200 interface
632
      .cpu0_clk_i                       (or1200_clk),
633
      .cpu0_rst_o                       (or1200_dbg_rst),
634
      .cpu0_addr_o                      (or1200_dbg_adr_i),
635
      .cpu0_data_o                      (or1200_dbg_dat_i),
636
      .cpu0_stb_o                       (or1200_dbg_stb_i),
637
      .cpu0_we_o                        (or1200_dbg_we_i),
638
      .cpu0_data_i                      (or1200_dbg_dat_o),
639
      .cpu0_ack_i                       (or1200_dbg_ack_o),
640 6 julius
 
641 44 julius
 
642 360 julius
      .cpu0_stall_o                     (or1200_dbg_stall_i),
643
      .cpu0_bp_i                        (or1200_dbg_bp_o),
644
 
645
      // TAP interface
646
      .tck_i                            (dbg_tck),
647
      .tdi_i                            (jtag_tap_tdo),
648
      .tdo_o                            (dbg_if_tdo),
649
      .rst_i                            (wb_rst),
650
      .shift_dr_i                       (jtag_tap_shift_dr),
651
      .pause_dr_i                       (jtag_tap_pause_dr),
652
      .update_dr_i                      (jtag_tap_update_dr),
653
      .debug_select_i                   (dbg_if_select),
654
 
655
      // Wishbone debug master
656
      .wb_clk_i                         (wb_clk),
657
      .wb_dat_i                         (wbm_d_dbg_dat_i),
658
      .wb_ack_i                         (wbm_d_dbg_ack_i),
659
      .wb_err_i                         (wbm_d_dbg_err_i),
660
      .wb_adr_o                         (wbm_d_dbg_adr_o),
661
      .wb_dat_o                         (wbm_d_dbg_dat_o),
662
      .wb_cyc_o                         (wbm_d_dbg_cyc_o),
663
      .wb_stb_o                         (wbm_d_dbg_stb_o),
664
      .wb_sel_o                         (wbm_d_dbg_sel_o),
665
      .wb_we_o                          (wbm_d_dbg_we_o ),
666
      .wb_cti_o                         (wbm_d_dbg_cti_o),
667
      .wb_cab_o                         (/*   UNUSED  */),
668
      .wb_bte_o                         (wbm_d_dbg_bte_o)
669 54 julius
      );
670 360 julius
 
671
   ////////////////////////////////////////////////////////////////////////   
672
`else // !`ifdef JTAG_DEBUG
673 44 julius
 
674 360 julius
   assign wbm_d_dbg_adr_o = 0;
675
   assign wbm_d_dbg_dat_o = 0;
676
   assign wbm_d_dbg_cyc_o = 0;
677
   assign wbm_d_dbg_stb_o = 0;
678
   assign wbm_d_dbg_sel_o = 0;
679
   assign wbm_d_dbg_we_o  = 0;
680
   assign wbm_d_dbg_cti_o = 0;
681
   assign wbm_d_dbg_bte_o = 0;
682
 
683
   assign or1200_dbg_adr_i = 0;
684
   assign or1200_dbg_dat_i = 0;
685
   assign or1200_dbg_stb_i = 0;
686
   assign or1200_dbg_we_i = 0;
687
   assign or1200_dbg_stall_i = 0;
688
 
689
   ////////////////////////////////////////////////////////////////////////   
690
`endif // !`ifdef JTAG_DEBUG
691
 
692
 
693
   ////////////////////////////////////////////////////////////////////////
694
   //
695
   // ROM
696
   // 
697
   ////////////////////////////////////////////////////////////////////////
698 485 julius
`ifdef BOOTROM
699 360 julius
   rom rom0
700 54 julius
     (
701 360 julius
      .wb_dat_o                         (wbs_i_rom0_dat_o),
702
      .wb_ack_o                         (wbs_i_rom0_ack_o),
703
      .wb_adr_i                         (wbs_i_rom0_adr_i[(wbs_i_rom0_addr_width+2)-1:2]),
704
      .wb_stb_i                         (wbs_i_rom0_stb_i),
705
      .wb_cyc_i                         (wbs_i_rom0_cyc_i),
706
      .wb_cti_i                         (wbs_i_rom0_cti_i),
707
      .wb_bte_i                         (wbs_i_rom0_bte_i),
708
      .wb_clk                           (wb_clk),
709
      .wb_rst                           (wb_rst));
710 44 julius
 
711 360 julius
   defparam rom0.addr_width = wbs_i_rom0_addr_width;
712 485 julius
`else // !`ifdef BOOTROM
713
   assign wbs_i_rom0_dat_o = 0;
714
   assign wbs_i_rom0_ack_o = 0;
715
`endif // !`ifdef BOOTROM
716 360 julius
 
717
   assign wbs_i_rom0_err_o = 0;
718
   assign wbs_i_rom0_rty_o = 0;
719 6 julius
 
720 360 julius
   ////////////////////////////////////////////////////////////////////////
721
 
722 415 julius
`ifdef RAM_WB
723 360 julius
   ////////////////////////////////////////////////////////////////////////
724
   //
725
   // Generic main RAM
726
   // 
727
   ////////////////////////////////////////////////////////////////////////
728
 
729
 
730 439 julius
   ram_wb ram_wb0
731
     (
732
      // Wishbone slave interface 0
733
      .wbm0_dat_i                       (wbs_i_mc0_dat_i),
734
      .wbm0_adr_i                       (wbs_i_mc0_adr_i),
735
      .wbm0_sel_i                       (wbs_i_mc0_sel_i),
736
      .wbm0_cti_i                       (wbs_i_mc0_cti_i),
737
      .wbm0_bte_i                       (wbs_i_mc0_bte_i),
738
      .wbm0_we_i                        (wbs_i_mc0_we_i ),
739
      .wbm0_cyc_i                       (wbs_i_mc0_cyc_i),
740
      .wbm0_stb_i                       (wbs_i_mc0_stb_i),
741
      .wbm0_dat_o                       (wbs_i_mc0_dat_o),
742
      .wbm0_ack_o                       (wbs_i_mc0_ack_o),
743
      .wbm0_err_o                       (wbs_i_mc0_err_o),
744
      .wbm0_rty_o                       (wbs_i_mc0_rty_o),
745
      // Wishbone slave interface 1
746
      .wbm1_dat_i                       (wbs_d_mc0_dat_i),
747
      .wbm1_adr_i                       (wbs_d_mc0_adr_i),
748
      .wbm1_sel_i                       (wbs_d_mc0_sel_i),
749
      .wbm1_cti_i                       (wbs_d_mc0_cti_i),
750
      .wbm1_bte_i                       (wbs_d_mc0_bte_i),
751
      .wbm1_we_i                        (wbs_d_mc0_we_i ),
752
      .wbm1_cyc_i                       (wbs_d_mc0_cyc_i),
753
      .wbm1_stb_i                       (wbs_d_mc0_stb_i),
754
      .wbm1_dat_o                       (wbs_d_mc0_dat_o),
755
      .wbm1_ack_o                       (wbs_d_mc0_ack_o),
756
      .wbm1_err_o                       (wbs_d_mc0_err_o),
757
      .wbm1_rty_o                       (wbs_d_mc0_rty_o),
758
      // Wishbone slave interface 2
759 485 julius
      .wbm2_dat_i                       (32'd0),
760
      .wbm2_adr_i                       (32'd0),
761
      .wbm2_sel_i                       (4'd0),
762
      .wbm2_cti_i                       (3'd0),
763
      .wbm2_bte_i                       (2'd0),
764
      .wbm2_we_i                        (1'd0),
765
      .wbm2_cyc_i                       (1'd0),
766
      .wbm2_stb_i                       (1'd0),
767 439 julius
      .wbm2_dat_o                       (),
768
      .wbm2_ack_o                       (),
769
      .wbm2_err_o                       (),
770
      .wbm2_rty_o                       (),
771
      // Clock, reset
772
      .wb_clk_i                         (wb_clk),
773
      .wb_rst_i                         (wb_rst));
774 360 julius
 
775 439 julius
   defparam ram_wb0.aw = wb_aw;
776
   defparam ram_wb0.dw = wb_dw;
777 360 julius
 
778 439 julius
   defparam ram_wb0.mem_size_bytes = (8192*1024); // 8MB
779
   defparam ram_wb0.mem_adr_width = 23; // log2(8192*1024)
780 360 julius
 
781 6 julius
 
782 360 julius
   ////////////////////////////////////////////////////////////////////////
783 415 julius
`endif
784 360 julius
`ifdef UART0
785
   ////////////////////////////////////////////////////////////////////////
786
   //
787
   // UART0
788
   // 
789
   ////////////////////////////////////////////////////////////////////////
790 55 julius
 
791 360 julius
   //
792
   // Wires
793
   //
794
   wire        uart0_irq;
795
 
796
   //
797
   // Assigns
798
   //
799
   assign wbs_d_uart0_err_o = 0;
800
   assign wbs_d_uart0_rty_o = 0;
801
 
802
   uart16550 uart16550_0
803
     (
804
      // Wishbone slave interface
805
      .wb_clk_i                         (wb_clk),
806
      .wb_rst_i                         (wb_rst),
807
      .wb_adr_i                         (wbs_d_uart0_adr_i[uart0_addr_width-1:0]),
808
      .wb_dat_i                         (wbs_d_uart0_dat_i),
809
      .wb_we_i                          (wbs_d_uart0_we_i),
810
      .wb_stb_i                         (wbs_d_uart0_stb_i),
811
      .wb_cyc_i                         (wbs_d_uart0_cyc_i),
812
      //.wb_sel_i                               (),
813
      .wb_dat_o                         (wbs_d_uart0_dat_o),
814
      .wb_ack_o                         (wbs_d_uart0_ack_o),
815
 
816
      .int_o                            (uart0_irq),
817
      .stx_pad_o                        (uart0_stx_pad_o),
818
      .rts_pad_o                        (),
819
      .dtr_pad_o                        (),
820
      //      .baud_o                           (),
821
      // Inputs
822
      .srx_pad_i                        (uart0_srx_pad_i),
823
      .cts_pad_i                        (1'b0),
824
      .dsr_pad_i                        (1'b0),
825
      .ri_pad_i                         (1'b0),
826
      .dcd_pad_i                        (1'b0));
827
 
828
   ////////////////////////////////////////////////////////////////////////          
829
`else // !`ifdef UART0
830
 
831
   //
832
   // Assigns
833
   //
834
   assign wbs_d_uart0_err_o = 0;
835
   assign wbs_d_uart0_rty_o = 0;
836
   assign wbs_d_uart0_ack_o = 0;
837
   assign wbs_d_uart0_dat_o = 0;
838
 
839
   ////////////////////////////////////////////////////////////////////////       
840
`endif // !`ifdef UART0
841 506 julius
 
842
`ifdef INTGEN
843
 
844
   wire        intgen_irq;
845
 
846
   intgen intgen0
847
     (
848
      .clk_i                           (wb_clk),
849
      .rst_i                           (wb_rst),
850
      .wb_adr_i                        (wbs_d_intgen_adr_i[intgen_addr_width-1:0]),
851
      .wb_cyc_i                        (wbs_d_intgen_cyc_i),
852
      .wb_stb_i                        (wbs_d_intgen_stb_i),
853
      .wb_dat_i                        (wbs_d_intgen_dat_i),
854
      .wb_we_i                         (wbs_d_intgen_we_i),
855
      .wb_ack_o                        (wbs_d_intgen_ack_o),
856
      .wb_dat_o                        (wbs_d_intgen_dat_o),
857
 
858
      .irq_o                           (intgen_irq)
859
      );
860
 
861
`endif //  `ifdef INTGEN
862
   assign wbs_d_intgen_err_o = 0;
863
   assign wbs_d_intgen_rty_o = 0;
864 360 julius
 
865 506 julius
 
866 360 julius
   ////////////////////////////////////////////////////////////////////////
867
   //
868
   // OR1200 Interrupt assignment
869
   // 
870
   ////////////////////////////////////////////////////////////////////////
871
 
872
   assign or1200_pic_ints[0] = 0; // Non-maskable inside OR1200
873
   assign or1200_pic_ints[1] = 0; // Non-maskable inside OR1200
874
`ifdef UART0
875
   assign or1200_pic_ints[2] = uart0_irq;
876
`else
877
   assign or1200_pic_ints[2] = 0;
878 55 julius
`endif
879 360 julius
   assign or1200_pic_ints[3] = 0;
880
   assign or1200_pic_ints[4] = 0;
881
   assign or1200_pic_ints[5] = 0;
882
`ifdef SPI0
883
   assign or1200_pic_ints[6] = spi0_irq;
884
`else
885
   assign or1200_pic_ints[6] = 0;
886
`endif
887
   assign or1200_pic_ints[7] = 0;
888
   assign or1200_pic_ints[8] = 0;
889
   assign or1200_pic_ints[9] = 0;
890
   assign or1200_pic_ints[10] = 0;
891
   assign or1200_pic_ints[11] = 0;
892
   assign or1200_pic_ints[12] = 0;
893
   assign or1200_pic_ints[13] = 0;
894
   assign or1200_pic_ints[14] = 0;
895
   assign or1200_pic_ints[15] = 0;
896
   assign or1200_pic_ints[16] = 0;
897
   assign or1200_pic_ints[17] = 0;
898
   assign or1200_pic_ints[18] = 0;
899 506 julius
`ifdef INTGEN
900
   assign or1200_pic_ints[19] = intgen_irq;
901
`else
902 360 julius
   assign or1200_pic_ints[19] = 0;
903 506 julius
`endif
904 6 julius
 
905 360 julius
endmodule // top
906
 
907
// Local Variables:
908
// verilog-library-directories:("." "../arbiter" "../uart16550" "../or1200" "../dbg_if" "../jtag_tap" "../rom" "../simple_spi" )
909
// verilog-library-files:()
910
// verilog-library-extensions:(".v" ".h")
911
// End:
912
 

powered by: WebSVN 2.1.0

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