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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [rtl/] [cpu/] [wbwatchdog.v] - Blame information for rev 53

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

Line No. Rev Author Line
1 50 dgisselq
////////////////////////////////////////////////////////////////////////////////
2 3 dgisselq
//
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 50 dgisselq
////////////////////////////////////////////////////////////////////////////////
33 3 dgisselq
//
34 50 dgisselq
// Copyright (C) 2015,2017, Gisselquist Technology, LLC
35 3 dgisselq
//
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 50 dgisselq
// You should have received a copy of the GNU General Public License along
47
// with this program.  (It's in the $(ROOT)/doc directory.  Run make with no
48
// target there if the PDF file isn't present.)  If not, see
49
// <http://www.gnu.org/licenses/> for a copy.
50
//
51 3 dgisselq
// License:     GPL, v3, as defined and found on www.gnu.org,
52
//              http://www.gnu.org/licenses/gpl.html
53
//
54
//
55 50 dgisselq
////////////////////////////////////////////////////////////////////////////////
56 3 dgisselq
//
57 50 dgisselq
//
58 3 dgisselq
module  wbwatchdog(i_clk, i_rst, i_ce, i_timeout, o_int);
59
        parameter       BW = 32;
60
        input                   i_clk, i_rst, i_ce;
61
        // Inputs (these were at one time wishbone controlled ...)
62
        input   [(BW-1):0]       i_timeout;
63
        // Interrupt line
64
        output  reg             o_int;
65
 
66
        reg     [(BW-1):0]       r_value;
67
        initial r_value = 0;
68
        always @(posedge i_clk)
69
                if (i_rst)
70
                        r_value <= i_timeout[(BW-1):0];
71
                else if ((i_ce)&&(~o_int))
72
                        r_value <= r_value + {(BW){1'b1}}; // r_value - 1;
73
 
74
        // Set the interrupt on our last tick.
75
        initial o_int   = 1'b0;
76
        always @(posedge i_clk)
77
                if ((i_rst)||(~i_ce))
78
                        o_int <= 1'b0;
79
                else
80
                        o_int <= (r_value == { {(BW-1){1'b0}}, 1'b1 });
81
 
82
endmodule

powered by: WebSVN 2.1.0

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