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

Subversion Repositories 8051

[/] [8051/] [trunk/] [rtl/] [verilog/] [oc8051_top.v] - Blame information for rev 174

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

Line No. Rev Author Line
1 72 simont
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  8051 cores top level module                                 ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/8051/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  8051 definitions.                                           ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////    nothing                                                   ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Simon Teran, simont@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 54 simont
// $Log: not supported by cvs2svn $
47 174 simont
// Revision 1.31  2003/06/17 14:17:22  simont
48
// BIST signals added.
49
//
50 172 simont
// Revision 1.30  2003/06/03 16:51:24  simont
51
// include "8051_defines" added.
52
//
53 148 simont
// Revision 1.29  2003/05/07 12:36:03  simont
54
// chsnge comp.des to des1
55
//
56 144 simont
// Revision 1.28  2003/05/06 09:41:35  simont
57
// remove define OC8051_AS2_PCL, chane signal src_sel2 to 2 bit wide.
58
//
59 141 simont
// Revision 1.27  2003/05/05 15:46:37  simont
60
// add aditional alu destination to solve critical path.
61
//
62 139 simont
// Revision 1.26  2003/04/29 11:24:31  simont
63
// fix bug in case execution of two data dependent instructions.
64
//
65 134 simont
// Revision 1.25  2003/04/25 17:15:51  simont
66
// change branch instruction execution (reduse needed clock periods).
67
//
68 132 simont
// Revision 1.24  2003/04/11 10:05:59  simont
69
// deifne OC8051_ROM added
70
//
71 122 simont
// Revision 1.23  2003/04/10 12:43:19  simont
72
// defines for pherypherals added
73
//
74 120 simont
// Revision 1.22  2003/04/09 16:24:04  simont
75
// change wr_sft to 2 bit wire.
76
//
77 118 simont
// Revision 1.21  2003/04/09 15:49:42  simont
78
// Register oc8051_sfr dato output, add signal wait_data.
79
//
80 117 simont
// Revision 1.20  2003/04/03 19:13:28  simont
81
// Include instruction cache.
82
//
83 107 simont
// Revision 1.19  2003/04/02 15:08:30  simont
84
// raname signals.
85
//
86 102 simont
// Revision 1.18  2003/01/13 14:14:41  simont
87
// replace some modules
88
//
89 82 simont
// Revision 1.17  2002/11/05 17:23:54  simont
90
// add module oc8051_sfr, 256 bytes internal ram
91
//
92 76 simont
// Revision 1.16  2002/10/28 14:55:00  simont
93
// fix bug in interface to external data ram
94
//
95 72 simont
// Revision 1.15  2002/10/23 16:53:39  simont
96
// fix bugs in instruction interface
97
//
98 62 simont
// Revision 1.14  2002/10/17 18:50:00  simont
99
// cahnge interface to instruction rom
100
//
101 54 simont
// Revision 1.13  2002/09/30 17:33:59  simont
102
// prepared header
103 72 simont
//
104
//
105
 
106
// synopsys translate_off
107
`include "oc8051_timescale.v"
108
// synopsys translate_on
109
 
110 148 simont
`include "oc8051_defines.v"
111 72 simont
 
112 102 simont
module oc8051_top (wb_rst_i, wb_clk_i,
113
//interface to instruction rom
114 120 simont
                wbi_adr_o,
115
                wbi_dat_i,
116
                wbi_stb_o,
117
                wbi_ack_i,
118
                wbi_cyc_o,
119
                wbi_err_i,
120
 
121 102 simont
//interface to data ram
122 120 simont
                wbd_dat_i,
123
                wbd_dat_o,
124
                wbd_adr_o,
125
                wbd_we_o,
126 132 simont
                wbd_ack_i,
127 120 simont
                wbd_stb_o,
128
                wbd_cyc_o,
129
                wbd_err_i,
130
 
131 102 simont
// interrupt interface
132 120 simont
                int0_i,
133
                int1_i,
134
 
135
 
136 102 simont
// port interface
137 120 simont
  `ifdef OC8051_PORTS
138
        `ifdef OC8051_PORT0
139
                p0_i,
140
                p0_o,
141
        `endif
142
 
143
        `ifdef OC8051_PORT1
144
                p1_i,
145
                p1_o,
146
        `endif
147
 
148
        `ifdef OC8051_PORT2
149
                p2_i,
150
                p2_o,
151
        `endif
152
 
153
        `ifdef OC8051_PORT3
154
                p3_i,
155
                p3_o,
156
        `endif
157
  `endif
158
 
159 102 simont
// serial interface
160 120 simont
        `ifdef OC8051_UART
161 102 simont
                rxd_i, txd_o,
162 120 simont
        `endif
163
 
164 102 simont
// counter interface
165 120 simont
        `ifdef OC8051_TC01
166
                t0_i, t1_i,
167
        `endif
168 72 simont
 
169 120 simont
        `ifdef OC8051_TC2
170 148 simont
                t2_i, t2ex_i,
171 120 simont
        `endif
172 148 simont
 
173 172 simont
// BIST
174
`ifdef OC8051_BIST
175
         scanb_rst,
176
         scanb_clk,
177
         scanb_si,
178
         scanb_so,
179
         scanb_en,
180
`endif
181 148 simont
// external access (active low)
182
                ea_in
183 120 simont
                );
184 72 simont
 
185
 
186 120 simont
 
187 102 simont
input         wb_rst_i,         // reset input
188
              wb_clk_i,         // clock input
189
              int0_i,           // interrupt 0
190
              int1_i,           // interrupt 1
191
              ea_in,            // external access
192
              wbd_ack_i,        // data acknowalge
193
              wbi_ack_i,        // instruction acknowlage
194
              wbd_err_i,        // data error
195 120 simont
              wbi_err_i;        // instruction error
196 72 simont
 
197 120 simont
input [7:0]   wbd_dat_i; // ram data input
198 102 simont
input [31:0]  wbi_dat_i; // rom data input
199 72 simont
 
200 102 simont
output        wbd_we_o,         // data write enable
201
              wbd_stb_o,        // data strobe
202
              wbd_cyc_o,        // data cycle
203
              wbi_stb_o,        // instruction strobe
204
              wbi_cyc_o;        // instruction cycle
205 82 simont
 
206 120 simont
output [7:0]  wbd_dat_o; // data output
207 102 simont
 
208
output [15:0] wbd_adr_o, // data address
209
              wbi_adr_o;        // instruction address
210
 
211 120 simont
`ifdef OC8051_PORTS
212 102 simont
 
213 120 simont
`ifdef OC8051_PORT0
214
input  [7:0]  p0_i;              // port 0 input
215
output [7:0]  p0_o;              // port 0 output
216
`endif
217 72 simont
 
218 120 simont
`ifdef OC8051_PORT1
219
input  [7:0]  p1_i;              // port 1 input
220
output [7:0]  p1_o;              // port 1 output
221
`endif
222 72 simont
 
223 120 simont
`ifdef OC8051_PORT2
224
input  [7:0]  p2_i;              // port 2 input
225
output [7:0]  p2_o;              // port 2 output
226
`endif
227 72 simont
 
228 120 simont
`ifdef OC8051_PORT3
229
input  [7:0]  p3_i;              // port 3 input
230
output [7:0]  p3_o;              // port 3 output
231
`endif
232 72 simont
 
233 120 simont
`endif
234 72 simont
 
235
 
236
 
237
 
238
 
239
 
240 120 simont
`ifdef OC8051_UART
241
input         rxd_i;            // receive
242
output        txd_o;            // transnmit
243
`endif
244 72 simont
 
245 120 simont
`ifdef OC8051_TC01
246
input         t0_i,             // counter 0 input
247
              t1_i;             // counter 1 input
248
`endif
249 72 simont
 
250 120 simont
`ifdef OC8051_TC2
251
input         t2_i,             // counter 2 input
252
              t2ex_i;           //
253
`endif
254 72 simont
 
255 172 simont
`ifdef OC8051_BIST
256
input   scanb_rst;
257
input   scanb_clk;
258
input   scanb_si;
259
output  scanb_so;
260
input   scanb_en;
261 174 simont
wire    scanb_soi;
262 172 simont
`endif
263
 
264 148 simont
wire [7:0]  dptr_hi,
265 120 simont
            dptr_lo,
266
            ri,
267
            data_out,
268
            op1,
269
            op2,
270
            op3,
271
            acc,
272
            p0_out,
273
            p1_out,
274
            p2_out,
275
            p3_out,
276
            sp,
277
            sp_w;
278 72 simont
 
279 148 simont
wire [31:0] idat_onchip;
280
 
281 120 simont
wire [15:0] pc;
282 72 simont
 
283 120 simont
assign wbd_cyc_o = wbd_stb_o;
284 72 simont
 
285 120 simont
wire        src_sel3;
286 141 simont
wire [1:0]  wr_sfr,
287
            src_sel2;
288 120 simont
wire [2:0]  ram_rd_sel,  // ram read
289
            ram_wr_sel, // ram write
290
            src_sel1;
291
 
292
wire [7:0]  ram_data,
293
            ram_out,    //data from ram
294
            sfr_out,
295
            wr_dat,
296
            wr_addr,    //ram write addres
297
            rd_addr;    //data ram read addres
298
wire        sfr_bit;
299
 
300
wire [1:0]  cy_sel,      //carry select; from decoder to cy_selct1
301
            bank_sel;
302
wire        rom_addr_sel,       //rom addres select; alu or pc
303
            rmw,
304
            ea_int;
305
 
306
wire        reti,
307
            intr,
308
            int_ack,
309
            istb;
310
wire [7:0]  int_src;
311
 
312
wire        mem_wait;
313
wire [2:0]  mem_act;
314
wire [3:0]  alu_op;      //alu operation (from decoder)
315
wire [1:0]  psw_set;    //write to psw or not; from decoder to psw (through register)
316
 
317
wire [7:0]  src1,        //alu sources 1
318
            src2,       //alu sources 2
319
            src3,       //alu sources 3
320 139 simont
            des_acc,
321 120 simont
            des1,       //alu destination 1
322 132 simont
            des2;       //alu destinations 2
323 120 simont
wire        desCy,      //carry out
324
            desAc,
325
            desOv,      //overflow
326
            alu_cy,
327
            wr,         //write to data ram
328
            wr_o;
329
 
330
wire        rd,         //read program rom
331
            pc_wr;
332
wire [2:0]  pc_wr_sel;   //program counter write select (from decoder to pc)
333
 
334
wire [7:0]  op1_n, //from memory_interface to decoder
335
            op2_n,
336
            op3_n;
337
 
338
wire [1:0]  comp_sel;    //select source1 and source2 to compare
339
wire        eq,         //result (from comp1 to decoder)
340
            srcAc,
341
            cy,
342
            rd_ind,
343 132 simont
            wr_ind,
344
            comp_wait;
345 120 simont
wire [2:0]  op1_cur;
346
 
347
wire        bit_addr,   //bit addresable instruction
348
            bit_data,   //bit data from ram to ram_select
349
            bit_out,    //bit data from ram_select to alu and cy_select
350
            bit_addr_o,
351
            wait_data;
352
 
353 72 simont
//
354 107 simont
// cpu to cache/wb_interface
355
wire        iack_i,
356
            istb_o,
357
            icyc_o;
358
wire [31:0] idat_i;
359
wire [15:0] iadr_o;
360 72 simont
 
361
 
362
//
363
// decoder
364 120 simont
oc8051_decoder oc8051_decoder1(.clk(wb_clk_i),
365
                               .rst(wb_rst_i),
366
                               .op_in(op1_n),
367
                               .op1_c(op1_cur),
368
                               .ram_rd_sel_o(ram_rd_sel),
369
                               .ram_wr_sel_o(ram_wr_sel),
370
                               .bit_addr(bit_addr),
371 72 simont
 
372 120 simont
                               .src_sel1(src_sel1),
373
                               .src_sel2(src_sel2),
374
                               .src_sel3(src_sel3),
375 72 simont
 
376 120 simont
                               .alu_op_o(alu_op),
377
                               .psw_set(psw_set),
378
                               .cy_sel(cy_sel),
379
                               .wr_o(wr),
380
                               .pc_wr(pc_wr),
381
                               .pc_sel(pc_wr_sel),
382
                               .comp_sel(comp_sel),
383
                               .eq(eq),
384
                               .wr_sfr_o(wr_sfr),
385
                               .rd(rd),
386
                               .rmw(rmw),
387
                               .istb(istb),
388
                               .mem_act(mem_act),
389
                               .mem_wait(mem_wait),
390
                               .wait_data(wait_data));
391
 
392
 
393 148 simont
wire [7:0] sub_result;
394 72 simont
//
395
//alu
396 148 simont
oc8051_alu oc8051_alu1(.rst(wb_rst_i),
397 139 simont
                       .clk(wb_clk_i),
398 120 simont
                       .op_code(alu_op),
399 132 simont
                       .src1(src1),
400 148 simont
                       .src2(src2),
401
                       .src3(src3),
402
                       .srcCy(alu_cy),
403 120 simont
                       .srcAc(srcAc),
404 139 simont
                       .des_acc(des_acc),
405 148 simont
                       .sub_result(sub_result),
406 132 simont
                       .des1(des1),
407
                       .des2(des2),
408 120 simont
                       .desCy(desCy),
409 148 simont
                       .desAc(desAc),
410
                       .desOv(desOv),
411 120 simont
                       .bit_in(bit_out));
412 72 simont
 
413
//
414
//data ram
415 134 simont
oc8051_ram_top oc8051_ram_top1(.clk(wb_clk_i),
416 148 simont
                               .rst(wb_rst_i),
417
                               .rd_addr(rd_addr),
418 120 simont
                               .rd_data(ram_data),
419 148 simont
                               .wr_addr(wr_addr),
420
                               .bit_addr(bit_addr_o),
421
                               .wr_data(wr_dat),
422 120 simont
                               .wr(wr_o && (!wr_addr[7] || wr_ind)),
423 148 simont
                               .bit_data_in(desCy),
424 172 simont
                               .bit_data_out(bit_data)
425
`ifdef OC8051_BIST
426
         ,
427
         .scanb_rst(scanb_rst),
428
         .scanb_clk(scanb_clk),
429 174 simont
         .scanb_si(scanb_soi),
430 172 simont
         .scanb_so(scanb_so),
431
         .scanb_en(scanb_en)
432
`endif
433
                               );
434 72 simont
 
435
//
436
 
437 148 simont
oc8051_alu_src_sel oc8051_alu_src_sel1(.clk(wb_clk_i),
438
                                       .rst(wb_rst_i),
439 120 simont
                                       .rd(rd),
440 82 simont
 
441 120 simont
                                       .sel1(src_sel1),
442
                                       .sel2(src_sel2),
443
                                       .sel3(src_sel3),
444 82 simont
 
445 120 simont
                                       .acc(acc),
446
                                       .ram(ram_out),
447
                                       .pc(pc),
448
                                       .dptr({dptr_hi, dptr_lo}),
449
                                       .op1(op1_n),
450
                                       .op2(op2_n),
451
                                       .op3(op3_n),
452
 
453
                                       .src1(src1),
454
                                       .src2(src2),
455
                                       .src3(src3));
456
 
457
 
458 72 simont
//
459
//
460 120 simont
oc8051_comp oc8051_comp1(.sel(comp_sel),
461 132 simont
                         .eq(eq),
462
                         .b_in(bit_out),
463
                         .cy(cy),
464
                         .acc(acc),
465 148 simont
                         .des(sub_result)
466 132 simont
                         );
467 72 simont
 
468
 
469
//
470
//program rom
471 122 simont
`ifdef OC8051_ROM
472
  oc8051_rom oc8051_rom1(.rst(wb_rst_i),
473
                       .clk(wb_clk_i),
474
                       .ea_int(ea_int),
475 120 simont
                       .addr(iadr_o),
476 148 simont
                       .data_o(idat_onchip)
477
                       );
478 122 simont
`else
479
  assign ea_int = 1'b0;
480 148 simont
  assign idat_onchip = 32'h0;
481 122 simont
`endif
482 72 simont
 
483
//
484
//
485 120 simont
oc8051_cy_select oc8051_cy_select1(.cy_sel(cy_sel),
486
                                   .cy_in(cy),
487
                                   .data_in(bit_out),
488
                                   .data_out(alu_cy));
489 72 simont
//
490
//
491 120 simont
oc8051_indi_addr oc8051_indi_addr1 (.clk(wb_clk_i),
492
                                    .rst(wb_rst_i),
493
                                    .wr_addr(wr_addr),
494 139 simont
                                    .data_in(wr_dat),
495 134 simont
                                    .wr(wr_o),
496 120 simont
                                    .wr_bit(bit_addr_o),
497 139 simont
                                    .ri_out(ri),
498
                                    .sel(op1_cur[0]),
499 120 simont
                                    .bank(bank_sel));
500 72 simont
 
501
 
502 107 simont
 
503
assign icyc_o = istb_o;
504 72 simont
//
505
//
506 120 simont
oc8051_memory_interface oc8051_memory_interface1(.clk(wb_clk_i),
507
                       .rst(wb_rst_i),
508 107 simont
// internal ram
509 120 simont
                       .wr_i(wr),
510
                       .wr_o(wr_o),
511
                       .wr_bit_i(bit_addr),
512
                       .wr_bit_o(bit_addr_o),
513
                       .wr_dat(wr_dat),
514 139 simont
                       .des_acc(des_acc),
515 132 simont
                       .des1(des1),
516 120 simont
                       .des2(des2),
517 139 simont
                       .rd_addr(rd_addr),
518 120 simont
                       .wr_addr(wr_addr),
519
                       .wr_ind(wr_ind),
520 139 simont
                       .bit_in(bit_data),
521 120 simont
                       .in_ram(ram_data),
522 139 simont
                       .sfr(sfr_out),
523
                       .sfr_bit(sfr_bit),
524 134 simont
                       .bit_out(bit_out),
525 120 simont
                       .iram_out(ram_out),
526 72 simont
 
527 107 simont
// external instrauction rom
528 120 simont
                       .iack_i(iack_i),
529
                       .iadr_o(iadr_o),
530
                       .idat_i(idat_i),
531
                       .istb_o(istb_o),
532 82 simont
 
533 107 simont
// internal instruction rom
534 148 simont
                       .idat_onchip(idat_onchip),
535 82 simont
 
536 107 simont
// data memory
537 139 simont
                       .dadr_o(wbd_adr_o),
538 120 simont
                       .ddat_o(wbd_dat_o),
539 139 simont
                       .dwe_o(wbd_we_o),
540 120 simont
                       .dstb_o(wbd_stb_o),
541 139 simont
                       .ddat_i(wbd_dat_i),
542 120 simont
                       .dack_i(wbd_ack_i),
543 107 simont
 
544
// from decoder
545 139 simont
                       .rd_sel(ram_rd_sel),
546
                       .wr_sel(ram_wr_sel),
547 134 simont
                       .rn({bank_sel, op1_cur}),
548
                       .rd_ind(rd_ind),
549 120 simont
                       .rd(rd),
550 139 simont
                       .mem_act(mem_act),
551 120 simont
                       .mem_wait(mem_wait),
552 107 simont
 
553
// external access
554 139 simont
                       .ea(ea_in),
555 120 simont
                       .ea_int(ea_int),
556 107 simont
 
557
// instructions outputs to cpu
558 139 simont
                       .op1_out(op1_n),
559
                       .op2_out(op2_n),
560 120 simont
                       .op3_out(op3_n),
561 82 simont
 
562 107 simont
// interrupt interface
563 120 simont
                       .intr(intr),
564
                       .int_v(int_src),
565
                       .int_ack(int_ack),
566
                       .istb(istb),
567
                       .reti(reti),
568 107 simont
 
569 82 simont
//pc
570 120 simont
                       .pc_wr_sel(pc_wr_sel),
571 132 simont
                       .pc_wr(pc_wr & comp_wait),
572 120 simont
                       .pc(pc),
573 82 simont
 
574 107 simont
// sfr's
575 120 simont
                       .sp_w(sp_w),
576
                       .dptr({dptr_hi, dptr_lo}),
577
                       .ri(ri),
578 139 simont
                       .acc(acc),
579 120 simont
                       .sp(sp)
580
                       );
581 82 simont
 
582 107 simont
 
583 72 simont
//
584
//
585
 
586 120 simont
oc8051_sfr oc8051_sfr1(.rst(wb_rst_i),
587
                       .clk(wb_clk_i),
588
                       .adr0(rd_addr[7:0]),
589
                       .adr1(wr_addr[7:0]),
590 139 simont
                       .dat0(sfr_out),
591
                       .dat1(wr_dat),
592
                       .dat2(des2),
593
                       .des_acc(des_acc),
594
                       .we(wr_o && !wr_ind),
595 120 simont
                       .bit_in(desCy),
596
                       .bit_out(sfr_bit),
597 134 simont
                       .wr_bit(bit_addr_o),
598
                       .ram_rd_sel(ram_rd_sel),
599 120 simont
                       .ram_wr_sel(ram_wr_sel),
600
                       .wr_sfr(wr_sfr),
601 132 simont
                       .comp_sel(comp_sel),
602
                       .comp_wait(comp_wait),
603 76 simont
// acc
604 120 simont
                       .acc(acc),
605 76 simont
// sp
606 120 simont
                       .sp(sp),
607
                       .sp_w(sp_w),
608 76 simont
// psw
609 120 simont
                       .bank_sel(bank_sel),
610
                       .desAc(desAc),
611
                       .desOv(desOv),
612
                       .psw_set(psw_set),
613
                       .srcAc(srcAc),
614
                       .cy(cy),
615 76 simont
// ports
616 172 simont
                       .rmw(rmw),
617 120 simont
 
618
  `ifdef OC8051_PORTS
619
        `ifdef OC8051_PORT0
620
                       .p0_out(p0_o),
621
                       .p0_in(p0_i),
622
        `endif
623
 
624
        `ifdef OC8051_PORT1
625
                       .p1_out(p1_o),
626
                       .p1_in(p1_i),
627
        `endif
628
 
629
        `ifdef OC8051_PORT2
630
                       .p2_out(p2_o),
631
                       .p2_in(p2_i),
632
        `endif
633
 
634
        `ifdef OC8051_PORT3
635
                       .p3_out(p3_o),
636
                       .p3_in(p3_i),
637
        `endif
638
  `endif
639
 
640 76 simont
// uart
641 120 simont
        `ifdef OC8051_UART
642
                       .rxd(rxd_i), .txd(txd_o),
643
        `endif
644
 
645 76 simont
// int
646 172 simont
                       .int_ack(int_ack),
647
                       .intr(intr),
648
                       .int0(int0_i),
649 120 simont
                       .int1(int1_i),
650 148 simont
                       .reti(reti),
651 120 simont
                       .int_src(int_src),
652
 
653
// t/c 0,1
654
        `ifdef OC8051_TC01
655
                       .t0(t0_i),
656
                       .t1(t1_i),
657
        `endif
658
 
659
// t/c 2
660
        `ifdef OC8051_TC2
661 172 simont
                       .t2(t2_i),
662 120 simont
                       .t2ex(t2ex_i),
663
        `endif
664
 
665 76 simont
// dptr
666 172 simont
                       .dptr_hi(dptr_hi),
667 120 simont
                       .dptr_lo(dptr_lo),
668
                       .wait_data(wait_data)
669
                       );
670 72 simont
 
671 82 simont
 
672 107 simont
 
673
 
674
`ifdef OC8051_CACHE
675
 
676
 
677 148 simont
  oc8051_icache oc8051_icache1(.rst(wb_rst_i), .clk(wb_clk_i),
678
  // cpu
679 107 simont
        .adr_i(iadr_o),
680
        .dat_o(idat_i),
681
        .stb_i(istb_o),
682
        .ack_o(iack_i),
683
        .cyc_i(icyc_o),
684 148 simont
  // pins
685 107 simont
        .dat_i(wbi_dat_i),
686
        .stb_o(wbi_stb_o),
687
        .adr_o(wbi_adr_o),
688
        .ack_i(wbi_ack_i),
689 174 simont
        .cyc_o(wbi_cyc_o)
690
`ifdef OC8051_BIST
691
         ,
692
         .scanb_rst(scanb_rst),
693
         .scanb_clk(scanb_clk),
694
         .scanb_si(scanb_si),
695
         .scanb_so(scanb_soi),
696
         .scanb_en(scanb_en)
697
`endif
698
        );
699 107 simont
 
700 148 simont
  defparam oc8051_icache1.ADR_WIDTH = 6;  // cache address wihth
701
  defparam oc8051_icache1.LINE_WIDTH = 2; // line address width (2 => 4x32)
702
  defparam oc8051_icache1.BL_NUM = 15; // number of blocks (2^BL_WIDTH-1); BL_WIDTH = ADR_WIDTH - LINE_WIDTH
703
  defparam oc8051_icache1.CACHE_RAM = 64; // cache ram x 32 (2^ADR_WIDTH)
704 107 simont
 
705 174 simont
 
706
 
707
        `ifdef OC8051_SIMULATION
708
          initial
709
            $display("   Instruction cache enabled");
710
 
711
 
712
        `endif
713
 
714
 
715 107 simont
//
716
//    no cache
717
//
718
`else
719
 
720 174 simont
  `ifdef OC8051_BIST
721
       assign scanb_soi=scanb_si;
722
  `endif
723
 
724 148 simont
  `ifdef OC8051_WB
725
 
726
    oc8051_wb_iinterface oc8051_wb_iinterface(.rst(wb_rst_i), .clk(wb_clk_i),
727
    // cpu
728 107 simont
        .adr_i(iadr_o),
729
        .dat_o(idat_i),
730
        .stb_i(istb_o),
731
        .ack_o(iack_i),
732
        .cyc_i(icyc_o),
733 148 simont
    // external rom
734 107 simont
        .dat_i(wbi_dat_i),
735
        .stb_o(wbi_stb_o),
736
        .adr_o(wbi_adr_o),
737
        .ack_i(wbi_ack_i),
738
        .cyc_o(wbi_cyc_o));
739
 
740 174 simont
        `ifdef OC8051_SIMULATION
741
          initial
742
            $display("   Wishbone instruction interface enabled");
743
 
744
 
745
        `endif
746
 
747 148 simont
  `else
748 107 simont
 
749 148 simont
    assign wbi_adr_o = iadr_o    ;
750
    assign idat_i    = wbi_dat_i ;
751
    assign wbi_stb_o = 1'b1      ;
752
    assign iack_i    = wbi_ack_i ;
753
    assign wbi_cyc_o = 1'b1      ;
754
 
755 174 simont
    `ifdef OC8051_SIMULATION
756
      initial
757
        $display("   Pipelined instruction interface enabled");
758
 
759
    `endif
760
 
761
 
762 148 simont
  `endif
763
 
764 107 simont
`endif
765
 
766
 
767
 
768 72 simont
endmodule

powered by: WebSVN 2.1.0

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