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

Subversion Repositories 8051

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

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

powered by: WebSVN 2.1.0

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