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

Subversion Repositories blue

[/] [blue/] [trunk/] [blue8/] [switchsync.v] - Blame information for rev 4

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

Line No. Rev Author Line
1 2 wd5gnr
/*
2
    This file is part of Blue8.
3
 
4
    Foobar is free software: you can redistribute it and/or modify
5
    it under the terms of the GNU Lesser General Public License as published by
6
    the Free Software Foundation, either version 3 of the License, or
7
    (at your option) any later version.
8
 
9
    Foobar is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU Lesser General Public License for more details.
13
 
14
    You should have received a copy of the GNU Lesser General Public License
15
    along with Blue8.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
    Blue8 by Al Williams alw@al-williams.com
18
 
19
*/
20
 
21
// this synchronizes a "switch" which may be async and
22
// long, and this outputs a single pulse. The switch is assmed
23
// to already be debounced
24
module switchsync(clk,d,q);
25
input clk,d;
26
output q;
27
reg q;
28
reg s0;
29
initial q=0;
30
initial s0=0;
31
always @(posedge clk) begin
32
  if (s0==1'b0 && d==1'b1) q=1'b1; else q=1'b0;
33
  s0=d;
34
end
35
endmodule

powered by: WebSVN 2.1.0

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