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 |
|
|
/* - Interval timer mode. */
|
28 |
18 |
olivier.gi |
/* */
|
29 |
|
|
/* Author(s): */
|
30 |
|
|
/* - Olivier Girard, olgirard@gmail.com */
|
31 |
|
|
/* */
|
32 |
|
|
/*---------------------------------------------------------------------------*/
|
33 |
19 |
olivier.gi |
/* $Rev: 19 $ */
|
34 |
|
|
/* $LastChangedBy: olivier.girard $ */
|
35 |
|
|
/* $LastChangedDate: 2009-08-04 23:47:15 +0200 (Tue, 04 Aug 2009) $ */
|
36 |
2 |
olivier.gi |
/*===========================================================================*/
|
37 |
|
|
|
38 |
|
|
`define LONG_TIMEOUT
|
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: RD/WR ACCESS
|
50 |
|
|
//--------------------------------------------------------
|
51 |
|
|
|
52 |
|
|
@(r15==16'h1000);
|
53 |
|
|
if (r4 !== 16'h6900) tb_error("====== WATCHDOG RD/WR ACCESS: WDTCTL != 0x6900 =====");
|
54 |
|
|
if (r5 !== 16'h69d7) tb_error("====== WATCHDOG RD/WR ACCESS: WDTCTL != 0x69d3 =====");
|
55 |
|
|
if (r6 !== 16'h6955) tb_error("====== WATCHDOG RD/WR ACCESS: WDTCTL != 0x6951 =====");
|
56 |
|
|
if (r7 !== 16'h6982) tb_error("====== WATCHDOG RD/WR ACCESS: WDTCTL != 0x6982 =====");
|
57 |
|
|
if (r8 !== 16'h6900) tb_error("====== WATCHDOG RD/WR ACCESS: WDTCTL != 0x6900 =====");
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
// WATCHDOG TEST: INTERVAL MODE /64
|
61 |
|
|
//--------------------------------------------------------
|
62 |
|
|
|
63 |
|
|
@(r15==16'h2000);
|
64 |
|
|
if (r5 !== 16'h3401) tb_error("====== WATCHDOG INTERVAL MODE /64: R5 != 0x3401 =====");
|
65 |
|
|
if (r6 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /64: R6 != 0x0000 =====");
|
66 |
|
|
if (r7 !== 16'h000D) tb_error("====== WATCHDOG INTERVAL MODE /64: R7 != 0x000D =====");
|
67 |
|
|
|
68 |
|
|
@(r15==16'h2001);
|
69 |
|
|
if (r5 !== 16'h0002) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ: R5 != 0x0002 =====");
|
70 |
|
|
if (r6 !== 16'h0001) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ: R6 != 0x0001 =====");
|
71 |
|
|
if (r7 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ: R7 != 0x0000 =====");
|
72 |
|
|
if (r8 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ: R8 != 0x0000 =====");
|
73 |
|
|
|
74 |
|
|
@(r15==16'h2002);
|
75 |
|
|
if (r5 !== 16'h0022) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ HOLD: R5 != 0x0022 =====");
|
76 |
|
|
if (r6 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ HOLD: R6 != 0x0000 =====");
|
77 |
|
|
if (r7 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ HOLD: R7 != 0x0000 =====");
|
78 |
|
|
|
79 |
|
|
@(r15==16'h2003);
|
80 |
|
|
if (r4 !== 16'h0033) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ CNT CLEAR: R4 != 0x0033 =====");
|
81 |
|
|
if (r6 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ CNT CLEAR: R6 != 0x0000 =====");
|
82 |
|
|
if (r7 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ CNT CLEAR: R7 != 0x0000 =====");
|
83 |
|
|
if (r8 !== 16'h0001) tb_error("====== WATCHDOG INTERVAL MODE /64 NO IRQ CNT CLEAR: R8 != 0x0001 =====");
|
84 |
|
|
|
85 |
|
|
$display("Interval mode /64 mode test completed...");
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
// WATCHDOG TEST: INTERVAL MODE /512
|
89 |
|
|
//--------------------------------------------------------
|
90 |
|
|
|
91 |
|
|
@(r15==16'h3000);
|
92 |
|
|
if (r5 !== 16'h3403) tb_error("====== WATCHDOG INTERVAL MODE /512: R5 != 0x3403 =====");
|
93 |
|
|
if (r6 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /512: R6 != 0x0000 =====");
|
94 |
|
|
if (r7 !== 16'h0067) tb_error("====== WATCHDOG INTERVAL MODE /512: R7 != 0x0067 =====");
|
95 |
|
|
|
96 |
|
|
$display("Interval mode /512 mode test completed...");
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
// WATCHDOG TEST: INTERVAL MODE /8192
|
100 |
|
|
//--------------------------------------------------------
|
101 |
|
|
|
102 |
|
|
@(r15==16'h4000);
|
103 |
|
|
if (r5 !== 16'h3404) tb_error("====== WATCHDOG INTERVAL MODE /8192: R5 != 0x3404 =====");
|
104 |
|
|
if (r6 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /8192: R6 != 0x0000 =====");
|
105 |
|
|
if (r7 !== 16'h0667) tb_error("====== WATCHDOG INTERVAL MODE /8192: R7 != 0x0667 =====");
|
106 |
|
|
|
107 |
|
|
$display("Interval mode /8192 mode test completed...");
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
// WATCHDOG TEST: INTERVAL MODE /32768
|
111 |
|
|
//--------------------------------------------------------
|
112 |
|
|
|
113 |
|
|
@(r15==16'h5000);
|
114 |
|
|
if (r5 !== 16'h3405) tb_error("====== WATCHDOG INTERVAL MODE /32768: R5 != 0x3405 =====");
|
115 |
|
|
if (r6 !== 16'h0000) tb_error("====== WATCHDOG INTERVAL MODE /32768: R6 != 0x0000 =====");
|
116 |
|
|
if (r7 !== 16'h199a) tb_error("====== WATCHDOG INTERVAL MODE /32768: R7 != 0x199A =====");
|
117 |
|
|
|
118 |
|
|
$display("Interval mode /32768 mode test completed...");
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
stimulus_done = 1;
|
122 |
|
|
end
|
123 |
|
|
|