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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [sing-op_reti.v] - Diff between revs 134 and 192

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 134 Rev 192
Line 27... Line 27...
/*                                                                           */
/*                                                                           */
/* Author(s):                                                                */
/* Author(s):                                                                */
/*             - Olivier Girard,    olgirard@gmail.com                       */
/*             - Olivier Girard,    olgirard@gmail.com                       */
/*                                                                           */
/*                                                                           */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
/* $Rev: 134 $                                                                */
/* $Rev: 192 $                                                                */
/* $LastChangedBy: olivier.girard $                                          */
/* $LastChangedBy: olivier.girard $                                          */
/* $LastChangedDate: 2012-03-22 21:31:06 +0100 (Thu, 22 Mar 2012) $          */
/* $LastChangedDate: 2013-12-17 21:15:28 +0100 (Tue, 17 Dec 2013) $          */
/*===========================================================================*/
/*===========================================================================*/
 
 
integer    i;
integer    i;
reg [15:0] temp_val;
reg [15:0] temp_val;
 
 
Line 72... Line 72...
 
 
      // Test interruption 0
      // Test interruption 0
      //--------------------------
      //--------------------------
      @(r15==16'h3000);
      @(r15==16'h3000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[0] = 1'b1;
      irq[`IRQ_NR-16:0] = {`IRQ_NR-16+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[0] = 1'b0;
      irq[`IRQ_NR-16:0] = {`IRQ_NR-16+1{1'b0}};
 
 
      @(r15==16'h3001);
      @(r15==16'h3001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  0: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  0: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  0: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  0: GIE value     =====");
      if (r6    !==16'h5678)             tb_error("====== IRQ  0: R6 value      =====");
      if (r6    !==16'h5678)             tb_error("====== IRQ  0: R6 value      =====");
Line 88... Line 88...
 
 
      // Test interruption 1
      // Test interruption 1
      //--------------------------
      //--------------------------
      @(r15==16'h4000);
      @(r15==16'h4000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[1:0] = {2{1'b1}};
      irq[`IRQ_NR-15:0] = {`IRQ_NR-15+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[1:0] = 1'b0;
      irq[`IRQ_NR-15:0] = {`IRQ_NR-15+1{1'b0}};
 
 
      @(r15==16'h4001);
      @(r15==16'h4001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  1: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  1: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  1: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  1: GIE value     =====");
      if (r6    !==16'h9abc)             tb_error("====== IRQ  1: R6 value      =====");
      if (r6    !==16'h9abc)             tb_error("====== IRQ  1: R6 value      =====");
Line 104... Line 104...
 
 
      // Test interruption 2
      // Test interruption 2
      //--------------------------
      //--------------------------
      @(r15==16'h5000);
      @(r15==16'h5000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[2:0] = {3{1'b1}};
      irq[`IRQ_NR-14:0] = {`IRQ_NR-14+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[2:0] = 1'b0;
      irq[`IRQ_NR-14:0] = {`IRQ_NR-14+1{1'b0}};
 
 
      @(r15==16'h5001);
      @(r15==16'h5001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  2: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  2: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  2: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  2: GIE value     =====");
      if (r6    !==16'hdef1)             tb_error("====== IRQ  2: R6 value      =====");
      if (r6    !==16'hdef1)             tb_error("====== IRQ  2: R6 value      =====");
Line 120... Line 120...
 
 
      // Test interruption 3
      // Test interruption 3
      //--------------------------
      //--------------------------
      @(r15==16'h6000);
      @(r15==16'h6000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[3:0] = {4{1'b1}};
      irq[`IRQ_NR-13:0] = {`IRQ_NR-13+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[3:0] = 1'b0;
      irq[`IRQ_NR-13:0] = {`IRQ_NR-13+1{1'b0}};
 
 
      @(r15==16'h6001);
      @(r15==16'h6001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  3: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  3: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  3: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  3: GIE value     =====");
      if (r6    !==16'h2345)             tb_error("====== IRQ  3: R6 value      =====");
      if (r6    !==16'h2345)             tb_error("====== IRQ  3: R6 value      =====");
Line 136... Line 136...
 
 
      // Test interruption 4
      // Test interruption 4
      //--------------------------
      //--------------------------
      @(r15==16'h7000);
      @(r15==16'h7000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[4:0] = {5{1'b1}};
      irq[`IRQ_NR-12:0] = {`IRQ_NR-12+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[4:0] = 1'b0;
      irq[`IRQ_NR-12:0] = {`IRQ_NR-12+1{1'b0}};
 
 
      @(r15==16'h7001);
      @(r15==16'h7001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  4: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  4: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  4: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  4: GIE value     =====");
      if (r6    !==16'h6789)             tb_error("====== IRQ  4: R6 value      =====");
      if (r6    !==16'h6789)             tb_error("====== IRQ  4: R6 value      =====");
Line 152... Line 152...
 
 
      // Test interruption 5
      // Test interruption 5
      //--------------------------
      //--------------------------
      @(r15==16'h8000);
      @(r15==16'h8000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[5:0] = {6{1'b1}};
      irq[`IRQ_NR-11:0] = {`IRQ_NR-11+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[5:0] = 1'b0;
      irq[`IRQ_NR-11:0] = {`IRQ_NR-11+1{1'b0}};
 
 
      @(r15==16'h8001);
      @(r15==16'h8001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  5: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  5: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  5: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  5: GIE value     =====");
      if (r6    !==16'habcd)             tb_error("====== IRQ  5: R6 value      =====");
      if (r6    !==16'habcd)             tb_error("====== IRQ  5: R6 value      =====");
Line 168... Line 168...
 
 
      // Test interruption 6
      // Test interruption 6
      //--------------------------
      //--------------------------
      @(r15==16'h9000);
      @(r15==16'h9000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[6:0] = {7{1'b1}};
      irq[`IRQ_NR-10:0] = {`IRQ_NR-10+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[6:0] = 1'b0;
      irq[`IRQ_NR-10:0] = {`IRQ_NR-10+1{1'b0}};
 
 
      @(r15==16'h9001);
      @(r15==16'h9001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  6: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  6: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  6: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  6: GIE value     =====");
      if (r6    !==16'hef12)             tb_error("====== IRQ  6: R6 value      =====");
      if (r6    !==16'hef12)             tb_error("====== IRQ  6: R6 value      =====");
Line 184... Line 184...
 
 
      // Test interruption 7
      // Test interruption 7
      //--------------------------
      //--------------------------
      @(r15==16'ha000);
      @(r15==16'ha000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[7:0] = {8{1'b1}};
      irq[`IRQ_NR-9:0] = {`IRQ_NR-9+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[7:0] = 1'b0;
      irq[`IRQ_NR-9:0] = {`IRQ_NR-9+1{1'b0}};
 
 
      @(r15==16'ha001);
      @(r15==16'ha001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  7: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  7: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  7: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  7: GIE value     =====");
      if (r6    !==16'h3456)             tb_error("====== IRQ  7: R6 value      =====");
      if (r6    !==16'h3456)             tb_error("====== IRQ  7: R6 value      =====");
Line 200... Line 200...
 
 
      // Test interruption 8
      // Test interruption 8
      //--------------------------
      //--------------------------
      @(r15==16'hb000);
      @(r15==16'hb000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[8:0] = {9{1'b1}};
      irq[`IRQ_NR-8:0] = {`IRQ_NR-8+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[8:0] = 1'b0;
      irq[`IRQ_NR-8:0] = {`IRQ_NR-8+1{1'b0}};
 
 
      @(r15==16'hb001);
      @(r15==16'hb001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  8: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  8: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  8: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  8: GIE value     =====");
      if (r6    !==16'h789a)             tb_error("====== IRQ  8: R6 value      =====");
      if (r6    !==16'h789a)             tb_error("====== IRQ  8: R6 value      =====");
Line 216... Line 216...
 
 
      // Test interruption 9
      // Test interruption 9
      //--------------------------
      //--------------------------
      @(r15==16'hc000);
      @(r15==16'hc000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[9:0] = {10{1'b1}};
      irq[`IRQ_NR-7:0] = {`IRQ_NR-7+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[9:0] = 1'b0;
      irq[`IRQ_NR-7:0] = {`IRQ_NR-7+1{1'b0}};
 
 
      @(r15==16'hc001);
      @(r15==16'hc001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  9: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ  9: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  9: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ  9: GIE value     =====");
      if (r6    !==16'hbcde)             tb_error("====== IRQ  9: R6 value      =====");
      if (r6    !==16'hbcde)             tb_error("====== IRQ  9: R6 value      =====");
Line 232... Line 232...
 
 
      // Test interruption 10
      // Test interruption 10
      //--------------------------
      //--------------------------
      @(r15==16'hd000);
      @(r15==16'hd000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[10:0] = {11{1'b1}};
      irq[`IRQ_NR-6:0] = {`IRQ_NR-6+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[10:0] = 1'b0;
      irq[`IRQ_NR-6:0] = {`IRQ_NR-6+1{1'b0}};
 
 
      @(r15==16'hd001);
      @(r15==16'hd001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ 10: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ 10: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ 10: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ 10: GIE value     =====");
      if (r6    !==16'hf123)             tb_error("====== IRQ 10: R6 value      =====");
      if (r6    !==16'hf123)             tb_error("====== IRQ 10: R6 value      =====");
Line 248... Line 248...
 
 
      // Test interruption 11
      // Test interruption 11
      //--------------------------
      //--------------------------
      @(r15==16'he000);
      @(r15==16'he000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[11:0] = {12{1'b1}};
      irq[`IRQ_NR-5:0] = {`IRQ_NR-5+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[11:0] = 1'b0;
      irq[`IRQ_NR-5:0] = {`IRQ_NR-5+1{1'b0}};
 
 
      @(r15==16'he001);
      @(r15==16'he001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ 11: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ 11: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ 11: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ 11: GIE value     =====");
      if (r6    !==16'h4567)             tb_error("====== IRQ 11: R6 value      =====");
      if (r6    !==16'h4567)             tb_error("====== IRQ 11: R6 value      =====");
Line 264... Line 264...
 
 
      // Test interruption 12
      // Test interruption 12
      //--------------------------
      //--------------------------
      @(r15==16'hf000);
      @(r15==16'hf000);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[12:0] = {13{1'b1}};
      irq[`IRQ_NR-4:0] = {`IRQ_NR-4+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[12:0] = 1'b0;
      irq[`IRQ_NR-4:0] = {`IRQ_NR-4+1{1'b0}};
 
 
      @(r15==16'hf001);
      @(r15==16'hf001);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ 12: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ 12: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ 12: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ 12: GIE value     =====");
      if (r6    !==16'h89ab)             tb_error("====== IRQ 12: R6 value      =====");
      if (r6    !==16'h89ab)             tb_error("====== IRQ 12: R6 value      =====");
Line 280... Line 280...
 
 
      // Test interruption 13
      // Test interruption 13
      //--------------------------
      //--------------------------
      @(r15==16'hf100);
      @(r15==16'hf100);
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[13:0] = {14{1'b1}};
      irq[`IRQ_NR-3:0] = {`IRQ_NR-3+1{1'b1}};
      repeat(15) @(posedge mclk);
      repeat(15) @(posedge mclk);
      irq[13:0] = 1'b0;
      irq[`IRQ_NR-3:0] = {`IRQ_NR-3+1{1'b0}};
 
 
      @(r15==16'hf101);
      @(r15==16'hf101);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ 13: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== IRQ 13: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ 13: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== IRQ 13: GIE value     =====");
      if (r6    !==16'hcdef)             tb_error("====== IRQ 13: R6 value      =====");
      if (r6    !==16'hcdef)             tb_error("====== IRQ 13: R6 value      =====");
Line 299... Line 299...
  `ifdef NMI
  `ifdef NMI
      @(r15==16'hf200);
      @(r15==16'hf200);
      repeat(2) @(negedge mclk);
      repeat(2) @(negedge mclk);
      nmi       = 1'b1;
      nmi       = 1'b1;
      @(posedge nmi_detect);
      @(posedge nmi_detect);
      irq[13:0] = {14{1'b1}};
      irq[`IRQ_NR-3:0] = {`IRQ_NR-3+1{1'b1}};
      repeat(8) @(posedge mclk);
      repeat(8) @(posedge mclk);
      nmi       = 1'b0;
      nmi       = 1'b0;
      repeat(2) @(posedge mclk);
      repeat(2) @(posedge mclk);
      irq[13:0] = 1'b0;
      irq[`IRQ_NR-3:0] = {`IRQ_NR-3+1{1'b0}};
 
 
      @(r15==16'hf201);
      @(r15==16'hf201);
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== NMI: SP value      =====");
      if (r1    !==(`PER_SIZE+16'h0052)) tb_error("====== NMI: SP value      =====");
      if (r2[3] !==1'b1)                 tb_error("====== NMI: GIE value     =====");
      if (r2[3] !==1'b1)                 tb_error("====== NMI: GIE value     =====");
      if (r6    !==16'h0123)             tb_error("====== NMI: R6 value      =====");
      if (r6    !==16'h0123)             tb_error("====== NMI: R6 value      =====");

powered by: WebSVN 2.1.0

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