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

Subversion Repositories rtftextcontroller

[/] [rtftextcontroller/] [trunk/] [rtl/] [verilog/] [change_det.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 robfinch
/* ===============================================================
2
        (C) 2006 Robert Finch
3
        All rights reserved.
4
        rob@birdcomputer.ca
5
 
6
        change_det.v
7
        - detects a change in a value
8
 
9
        This source code is free for use and modification for
10
        non-commercial or evaluation purposes, provided this
11
        copyright statement and disclaimer remains present in
12
        the file.
13
 
14
        If you do modify the code, please state the origin and
15
        note that you have modified the code.
16
 
17
        NO WARRANTY.
18
        THIS Work, IS PROVIDEDED "AS IS" WITH NO WARRANTIES OF
19
        ANY KIND, WHETHER EXPRESS OR IMPLIED. The user must assume
20
        the entire risk of using the Work.
21
 
22
        IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
23
        ANY INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES
24
        WHATSOEVER RELATING TO THE USE OF THIS WORK, OR YOUR
25
        RELATIONSHIP WITH THE AUTHOR.
26
 
27
        IN ADDITION, IN NO EVENT DOES THE AUTHOR AUTHORIZE YOU
28
        TO USE THE WORK IN APPLICATIONS OR SYSTEMS WHERE THE
29
        WORK'S FAILURE TO PERFORM CAN REASONABLY BE EXPECTED
30
        TO RESULT IN A SIGNIFICANT PHYSICAL INJURY, OR IN LOSS
31
        OF LIFE. ANY SUCH USE BY YOU IS ENTIRELY AT YOUR OWN RISK,
32
        AND YOU AGREE TO HOLD THE AUTHOR AND CONTRIBUTORS HARMLESS
33
        FROM ANY CLAIMS OR LOSSES RELATING TO SUCH UNAUTHORIZED
34
        USE.
35
 
36
=============================================================== */
37
 
38
module change_det(rst, clk, ce, i, cd);
39
        parameter WID=32;
40
        input rst;                      // reset
41
        input clk;                      // clock
42
        input ce;                       // clock enable
43
        input [WID:1] i;        // input signal
44
        output cd;                      // change detected
45
 
46
        reg [WID:1] hold;
47
 
48
        always @(posedge clk)
49
                if (rst)
50
                        hold <= i;
51
                else if (ce)
52
                        hold <= i;
53
 
54
        assign cd = i != hold;
55
 
56
endmodule

powered by: WebSVN 2.1.0

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