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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [src/] [dma_resp.v] - Blame information for rev 202

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 202 olivier.gi
/*===========================================================================*/
2
/* Copyright (C) 2001 Authors                                                */
3
/*                                                                           */
4
/* This source file may be used and distributed without restriction provided */
5
/* that this copyright statement is not removed from the file and that any   */
6
/* derivative work contains the original copyright notice and the associated */
7
/* disclaimer.                                                               */
8
/*                                                                           */
9
/* This source file is free software; you can redistribute it and/or modify  */
10
/* it under the terms of the GNU Lesser General Public License as published  */
11
/* by the Free Software Foundation; either version 2.1 of the License, or    */
12
/* (at your option) any later version.                                       */
13
/*                                                                           */
14
/* This source is distributed in the hope that it will be useful, but WITHOUT*/
15
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     */
16
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public       */
17
/* License for more details.                                                 */
18
/*                                                                           */
19
/* You should have received a copy of the GNU Lesser General Public License  */
20
/* along with this source; if not, write to the Free Software Foundation,    */
21
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA        */
22
/*                                                                           */
23
/*===========================================================================*/
24
/*                              DMA INTERFACE                                */
25
/*---------------------------------------------------------------------------*/
26
/* Test the DMA interface:                                                   */
27
/*                        - Check transfer response.                         */
28
/*                                                                           */
29
/* Author(s):                                                                */
30
/*             - Olivier Girard,    olgirard@gmail.com                       */
31
/*                                                                           */
32
/*---------------------------------------------------------------------------*/
33
/* $Rev$                                                                */
34
/* $LastChangedBy$                                          */
35
/* $LastChangedDate$          */
36
/*===========================================================================*/
37
 
38
`define VERY_LONG_TIMEOUT
39
 
40
integer jj, kk;
41
reg [15:0] data_val;
42
 
43
initial
44
   begin
45
      $display(" ===============================================");
46
      $display("|                 START SIMULATION              |");
47
      $display(" ===============================================");
48
`ifdef DMA_IF_EN
49
      // Disable automatic DMA verification
50
      #10;
51
      dma_verif_on = 0;
52
 
53
      repeat(30) @(posedge mclk);
54
      stimulus_done = 0;
55
 
56
      //-------------------------------------------------------------
57
      // LOW/HIGH PRIORITY DMA
58
      //-------------------------------------------------------------
59
      for ( jj=0; jj<=1; jj=jj+1)
60
        begin
61
           if (jj==0)
62
             begin
63
                dma_priority=0;
64
                $display("\n\n---------------------------------------");
65
                $display("   LOW Priority 16B DMA transfer tests");
66
                $display("---------------------------------------\n");
67
             end
68
           else
69
             begin
70
                dma_priority=1;
71
                $display("\n\n---------------------------------------");
72
                $display("   HIGH Priority 16B DMA transfer tests");
73
                $display("---------------------------------------\n");
74
             end
75
 
76
           // READ ACCESS (whole 64kB address range)
77
           //--------------------------------------------------------
78
           $display("READ ACCESS (whole 64kB address range)");
79
 
80
           for ( kk=0; kk<='hfffe; kk=kk+2)
81
             begin
82
                if      (kk<(`PER_SIZE+`DMEM_SIZE)) dma_read_val_16b(kk, 1'b0); // OKAY response in Peripheral and Data memory space
83
                else if (kk>=('h10000-`PMEM_SIZE))  dma_read_val_16b(kk, 1'b0); // OKAY response in Program memory space
84
                else                                dma_read_val_16b(kk, 1'b1); // ERROR response otherwise
85
             end
86
        end
87
 
88
      // WRITE ACCESS (whole 64kB address range)
89
      // (we just do it in high priority mode as PMEM will be overwriten anyway)
90
      //-------------------------------------------------------------------------
91
      $display("WRITE ACCESS (whole 64kB address range)");
92
 
93
      for ( kk=0; kk<='hfffe; kk=kk+2)
94
        begin
95
 
96
           case(kk)
97
             'h0056     : data_val  = 16'h0000; // BCSCTL1 (avoid reconfiguration of the MCLK frequency)
98
             'h0058     : data_val  = 16'h0000; // BCSCTL1 (avoid reconfiguration of the MCLK frequency)
99
             'h0120     : data_val  = 16'h5A80; // WDTCTL (avoid reset when writing to watchdog control register)
100
             default    : data_val  =  kk;
101
           endcase
102
 
103
           if      (kk<(`PER_SIZE+`DMEM_SIZE)) dma_write_16b(kk, data_val, 1'b0); // OKAY response in Peripheral and Data memory space
104
           else if (kk>=('h10000-`PMEM_SIZE))  dma_write_16b(kk, data_val, 1'b0); // OKAY response in Program memory space
105
           else                                dma_write_16b(kk, data_val, 1'b1); // ERROR response otherwise
106
        end
107
 
108
 
109
      // End of test
110
      //--------------------------------------------------
111
      $display("\n");
112
      repeat(3000) @(posedge mclk);
113
 
114
      // Put small program in memory
115
      dma_write_16b(16'hfff0, 16'h4303, 1'b0); // nop
116
 
117
      dma_write_16b(16'hfff2, 16'h4030, 1'b0); // br #0xffff
118
      dma_write_16b(16'hfff4, 16'hffff, 1'b0); //
119
 
120
      dma_write_16b(16'hfffe, 16'hfff0, 1'b0); // Reset vector
121
 
122
      // Apply reset and wait for end of execution
123
      dma_write_16b(16'h0120, 16'h0000, 1'b0); // WDTCTL      
124
 
125
      stimulus_done = 1;
126
`else
127
       tb_skip_finish("|      (DMA interface support not included)    |");
128
`endif
129
   end
130
 

powered by: WebSVN 2.1.0

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