1 |
221 |
olivier.gi |
//----------------------------------------------------------------------------
|
2 |
|
|
// Copyright (C) 2009 , Olivier Girard
|
3 |
|
|
//
|
4 |
|
|
// Redistribution and use in source and binary forms, with or without
|
5 |
|
|
// modification, are permitted provided that the following conditions
|
6 |
|
|
// are met:
|
7 |
|
|
// * Redistributions of source code must retain the above copyright
|
8 |
|
|
// notice, this list of conditions and the following disclaimer.
|
9 |
|
|
// * Redistributions in binary form must reproduce the above copyright
|
10 |
|
|
// notice, this list of conditions and the following disclaimer in the
|
11 |
|
|
// documentation and/or other materials provided with the distribution.
|
12 |
|
|
// * Neither the name of the authors nor the names of its contributors
|
13 |
|
|
// may be used to endorse or promote products derived from this software
|
14 |
|
|
// without specific prior written permission.
|
15 |
|
|
//
|
16 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
17 |
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
18 |
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
19 |
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
20 |
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
21 |
|
|
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
22 |
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
23 |
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
24 |
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
25 |
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
26 |
|
|
// THE POSSIBILITY OF SUCH DAMAGE
|
27 |
|
|
//
|
28 |
|
|
//----------------------------------------------------------------------------
|
29 |
|
|
//
|
30 |
|
|
// *File Name: omsp_wakeup_cell.v
|
31 |
|
|
//
|
32 |
|
|
// *Module Description:
|
33 |
|
|
// Generic Wakeup cell
|
34 |
|
|
//
|
35 |
|
|
// *Author(s):
|
36 |
|
|
// - Olivier Girard, olgirard@gmail.com
|
37 |
|
|
//
|
38 |
|
|
//----------------------------------------------------------------------------
|
39 |
|
|
// $Rev: 103 $
|
40 |
|
|
// $LastChangedBy: olivier.girard $
|
41 |
|
|
// $LastChangedDate: 2011-03-05 15:44:48 +0100 (Sat, 05 Mar 2011) $
|
42 |
|
|
//----------------------------------------------------------------------------
|
43 |
|
|
`ifdef OMSP_NO_INCLUDE
|
44 |
|
|
`else
|
45 |
|
|
`include "openMSP430_defines.v"
|
46 |
|
|
`endif
|
47 |
|
|
|
48 |
|
|
module omsp_wakeup_cell (
|
49 |
|
|
|
50 |
|
|
// OUTPUTs
|
51 |
|
|
wkup_out, // Wakup signal (asynchronous)
|
52 |
|
|
|
53 |
|
|
// INPUTs
|
54 |
|
|
scan_clk, // Scan clock
|
55 |
|
|
scan_mode, // Scan mode
|
56 |
|
|
scan_rst, // Scan reset
|
57 |
|
|
wkup_clear, // Glitch free wakeup event clear
|
58 |
|
|
wkup_event // Glitch free asynchronous wakeup event
|
59 |
|
|
);
|
60 |
|
|
|
61 |
|
|
// OUTPUTs
|
62 |
|
|
//=========
|
63 |
|
|
output wkup_out; // Wakup signal (asynchronous)
|
64 |
|
|
|
65 |
|
|
// INPUTs
|
66 |
|
|
//=========
|
67 |
|
|
input scan_clk; // Scan clock
|
68 |
|
|
input scan_mode; // Scan mode
|
69 |
|
|
input scan_rst; // Scan reset
|
70 |
|
|
input wkup_clear; // Glitch free wakeup event clear
|
71 |
|
|
input wkup_event; // Glitch free asynchronous wakeup event
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
//=============================================================================
|
75 |
|
|
// 1) AND GATE
|
76 |
|
|
//=============================================================================
|
77 |
|
|
|
78 |
|
|
// Scan stuff for the ASIC mode
|
79 |
|
|
`ifdef ASIC
|
80 |
|
|
wire wkup_rst;
|
81 |
|
|
omsp_scan_mux scan_mux_rst (
|
82 |
|
|
.scan_mode (scan_mode),
|
83 |
|
|
.data_in_scan (scan_rst),
|
84 |
|
|
.data_in_func (wkup_clear),
|
85 |
|
|
.data_out (wkup_rst)
|
86 |
|
|
);
|
87 |
|
|
|
88 |
|
|
wire wkup_clk;
|
89 |
|
|
omsp_scan_mux scan_mux_clk (
|
90 |
|
|
.scan_mode (scan_mode),
|
91 |
|
|
.data_in_scan (scan_clk),
|
92 |
|
|
.data_in_func (wkup_event),
|
93 |
|
|
.data_out (wkup_clk)
|
94 |
|
|
);
|
95 |
|
|
|
96 |
|
|
`else
|
97 |
|
|
wire wkup_rst = wkup_clear;
|
98 |
|
|
wire wkup_clk = wkup_event;
|
99 |
|
|
`endif
|
100 |
|
|
|
101 |
|
|
// Wakeup capture
|
102 |
|
|
reg wkup_out;
|
103 |
|
|
always @(posedge wkup_clk or posedge wkup_rst)
|
104 |
|
|
if (wkup_rst) wkup_out <= 1'b0;
|
105 |
|
|
else wkup_out <= 1'b1;
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
endmodule // omsp_wakeup_cell
|
109 |
|
|
|
110 |
|
|
`ifdef OMSP_NO_INCLUDE
|
111 |
|
|
`else
|
112 |
|
|
`include "openMSP430_undefines.v"
|
113 |
|
|
`endif
|