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

Subversion Repositories openmsp430

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

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

Line No. Rev Author Line
1 2 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
/*                            WATCHDOG TIMER                                 */
25
/*---------------------------------------------------------------------------*/
26
/* Test the Watdog timer:                                                    */
27
/*                        - Clock source selection.                          */
28
/*===========================================================================*/
29
 
30
`define LONG_TIMEOUT
31
 
32
integer mclk_counter;
33
always @ (posedge mclk)
34
  mclk_counter <=  mclk_counter+1;
35
 
36
integer r5_counter;
37
always @ (posedge r5[0] or negedge r5[0])
38
  r5_counter <=  r5_counter+1;
39
 
40
initial
41
   begin
42
      $display(" ===============================================");
43
      $display("|                 START SIMULATION              |");
44
      $display(" ===============================================");
45
      repeat(5) @(posedge mclk);
46
      stimulus_done = 0;
47
 
48
 
49
      // WATCHDOG TEST INTERVAL MODE /64 - SMCLK == MCLK/2
50
      //--------------------------------------------------------
51
 
52
      @(r15 === 16'h0001);
53
      @(posedge r5[0]);
54
      @(negedge mclk);
55
      mclk_counter = 0;
56
      r5_counter   = 0;
57
      repeat(1024) @(negedge mclk);
58
      if (mclk_counter !== 1024) tb_error("====== WATCHDOG TEST INTERVAL MODE /64 - SMCLK =====");
59
      if (r5_counter   !== 8)    tb_error("====== WATCHDOG TEST INTERVAL MODE /64 - SMCLK =====");
60
 
61
 
62
      // WATCHDOG TEST INTERVAL MODE /64 - ACLK == LFXTCLK/1
63
      //--------------------------------------------------------
64
 
65
      @(r15 === 16'h1001);
66
      @(negedge r5[0]);
67
      @(negedge mclk);
68
      mclk_counter = 0;
69
      r5_counter   = 0;
70
      repeat(7813) @(negedge mclk);
71
      if (mclk_counter !== 7813) tb_error("====== WATCHDOG TEST INTERVAL MODE /64 - ACLK =====");
72
      if (r5_counter   !== 4)    tb_error("====== WATCHDOG TEST INTERVAL MODE /64 - ACLK =====");
73
 
74
 
75
 
76
      stimulus_done = 1;
77
   end
78
 

powered by: WebSVN 2.1.0

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