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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [rtl/] [cpu/] [wbwatchdog.v] - Blame information for rev 52

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

Line No. Rev Author Line
1 21 dgisselq
///////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    wbwatchdog.v
4
//
5
// Project:     Zip CPU -- a small, lightweight, RISC CPU soft core
6
//
7
// Purpose:     A Zip timer, redesigned to be a bus watchdog
8
//
9
//      This is a **really** stripped down Zip Timer.  All options for external
10
//      control have been removed.  This timer may be reset, and ... that's 
11
//      about it.  The goal is that this stripped down timer be used as a bus
12
//      watchdog element.  Even at that, it's not really fully featured.  The
13
//      rest of the important features can be found in the zipsystem module.
14
//
15
//      As a historical note, the wishbone watchdog timer began as a normal
16
//      timer, with some fixed inputs.  This makes sense, if you think about it:
17
//      if the goal is to interrupt a stalled wishbone transaction by inserting
18
//      a bus error, then you can't use the bus to set it up or configure it
19
//      simply because the bus in question is ... well, unreliable.  You're
20
//      trying to make it reliable.
21
//
22
//      The problem with using the ziptimer in a stripped down implementation
23
//      was that the fixed inputs caused the synthesis tool to complain about
24
//      the use of registers values would never change.  This solves that
25
//      problem by explicitly removing the cruft that would otherwise
26
//      just create synthesis warnings and errors.
27
//
28
//
29
// Creator:     Dan Gisselquist, Ph.D.
30
//              Gisselquist Technology, LLC
31
//
32
///////////////////////////////////////////////////////////////////////////
33
//
34
// Copyright (C) 2015, Gisselquist Technology, LLC
35
//
36
// This program is free software (firmware): you can redistribute it and/or
37
// modify it under the terms of  the GNU General Public License as published
38
// by the Free Software Foundation, either version 3 of the License, or (at
39
// your option) any later version.
40
//
41
// This program is distributed in the hope that it will be useful, but WITHOUT
42
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
43
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
44
// for more details.
45
//
46
// License:     GPL, v3, as defined and found on www.gnu.org,
47
//              http://www.gnu.org/licenses/gpl.html
48
//
49
//
50
///////////////////////////////////////////////////////////////////////////
51
//
52
module  wbwatchdog(i_clk, i_rst, i_ce, i_timeout, o_int);
53
        parameter       BW = 32;
54
        input                   i_clk, i_rst, i_ce;
55
        // Inputs (these were at one time wishbone controlled ...)
56
        input   [(BW-1):0]       i_timeout;
57
        // Interrupt line
58
        output  reg             o_int;
59
 
60
        reg     [(BW-1):0]       r_value;
61
        initial r_value = 0;
62
        always @(posedge i_clk)
63
                if (i_rst)
64
                        r_value <= i_timeout[(BW-1):0];
65
                else if ((i_ce)&&(~o_int))
66
                        r_value <= r_value + {(BW){1'b1}}; // r_value - 1;
67
 
68
        // Set the interrupt on our last tick.
69
        initial o_int   = 1'b0;
70
        always @(posedge i_clk)
71
                if ((i_rst)||(~i_ce))
72
                        o_int <= 1'b0;
73
                else
74
                        o_int <= (r_value == { {(BW-1){1'b0}}, 1'b1 });
75
 
76
endmodule

powered by: WebSVN 2.1.0

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