URL
https://opencores.org/ocsvn/thor/thor/trunk
[/] [thor/] [trunk/] [FT64/] [rtl/] [lib/] [change_det.v] - Blame information for rev 59
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
46 |
robfinch |
// ============================================================================
|
2 |
|
|
// 2006 Robert Finch
|
3 |
|
|
// robfinch@<remove>sympatico.ca
|
4 |
|
|
//
|
5 |
|
|
// change_det.v
|
6 |
|
|
// - detects a change in a value
|
7 |
|
|
//
|
8 |
|
|
// This source file is free software: you can redistribute it and/or modify
|
9 |
|
|
// it under the terms of the GNU Lesser General Public License as published
|
10 |
|
|
// by the Free Software Foundation, either version 3 of the License, or
|
11 |
|
|
// (at your option) any later version.
|
12 |
|
|
//
|
13 |
|
|
// This source file is distributed in the hope that it will be useful,
|
14 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
// GNU General Public License for more details.
|
17 |
|
|
//
|
18 |
|
|
// You should have received a copy of the GNU General Public License
|
19 |
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20 |
|
|
//
|
21 |
|
|
// ============================================================================
|
22 |
|
|
//
|
23 |
|
|
module change_det(rst, clk, ce, i, cd);
|
24 |
|
|
parameter WID=32;
|
25 |
|
|
input rst; // reset
|
26 |
|
|
input clk; // clock
|
27 |
|
|
input ce; // clock enable
|
28 |
|
|
input [WID:1] i; // input signal
|
29 |
|
|
output cd; // change detected
|
30 |
|
|
|
31 |
|
|
reg [WID:1] hold;
|
32 |
|
|
|
33 |
|
|
always @(posedge clk)
|
34 |
|
|
if (rst)
|
35 |
|
|
hold <= i;
|
36 |
|
|
else if (ce)
|
37 |
|
|
hold <= i;
|
38 |
|
|
|
39 |
|
|
assign cd = i != hold;
|
40 |
|
|
|
41 |
|
|
endmodule
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.