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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [8051/] [oc8051_top.v] - Blame information for rev 12

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

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

powered by: WebSVN 2.1.0

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