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 |
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 |
|
|
integer mclk_counter;
|
41 |
|
|
always @ (posedge mclk)
|
42 |
|
|
mclk_counter <= mclk_counter+1;
|
43 |
|
|
|
44 |
|
|
integer r5_counter;
|
45 |
|
|
always @ (posedge r5[0] or negedge r5[0])
|
46 |
|
|
r5_counter <= r5_counter+1;
|
47 |
|
|
|
48 |
|
|
initial
|
49 |
|
|
begin
|
50 |
|
|
$display(" ===============================================");
|
51 |
|
|
$display("| START SIMULATION |");
|
52 |
|
|
$display(" ===============================================");
|
53 |
|
|
repeat(5) @(posedge mclk);
|
54 |
|
|
stimulus_done = 0;
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
// WATCHDOG TEST INTERVAL MODE /64 - SMCLK == MCLK/2
|
58 |
|
|
//--------------------------------------------------------
|
59 |
|
|
|
60 |
|
|
@(r15 === 16'h0001);
|
61 |
|
|
@(posedge r5[0]);
|
62 |
|
|
@(negedge mclk);
|
63 |
|
|
mclk_counter = 0;
|
64 |
|
|
r5_counter = 0;
|
65 |
|
|
repeat(1024) @(negedge mclk);
|
66 |
|
|
if (mclk_counter !== 1024) tb_error("====== WATCHDOG TEST INTERVAL MODE /64 - SMCLK =====");
|
67 |
|
|
if (r5_counter !== 8) tb_error("====== WATCHDOG TEST INTERVAL MODE /64 - SMCLK =====");
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
// WATCHDOG TEST INTERVAL MODE /64 - ACLK == LFXTCLK/1
|
71 |
|
|
//--------------------------------------------------------
|
72 |
|
|
|
73 |
|
|
@(r15 === 16'h1001);
|
74 |
|
|
@(negedge r5[0]);
|
75 |
|
|
@(negedge mclk);
|
76 |
|
|
mclk_counter = 0;
|
77 |
|
|
r5_counter = 0;
|
78 |
|
|
repeat(7813) @(negedge mclk);
|
79 |
|
|
if (mclk_counter !== 7813) tb_error("====== WATCHDOG TEST INTERVAL MODE /64 - ACLK =====");
|
80 |
|
|
if (r5_counter !== 4) tb_error("====== WATCHDOG TEST INTERVAL MODE /64 - ACLK =====");
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
stimulus_done = 1;
|
85 |
|
|
end
|
86 |
|
|
|