Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

edge detection on an asynchronous signal

Status
Not open for further replies.

flyingmonkey1

Newbie level 2
Joined
Apr 19, 2016
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
15
Hi all,
In my design I'm looking for glitches on a test signal (ie signal goes |==|_|===| when it should go |======| if that made any sense :-D). Anyway I was using the following code


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module positive_edge_detector(
    input clk_in,
    input signal_in,
    output out_edge
    );
 
reg signal;
 
always @ (posedge clk_in) begin
    signal <= signal_in;
end
 
assign out_edge = signal_in & (~signal);
 
endmodule


well anyway this works fine when the clk_in is faster than the glitch in the signal however its not able to detect an edge when the glitch is smaller than the clock period. Is there a better way to be doing this? Thank you
 
Last edited by a moderator:

You could use a toggle synchronizer on the input signal.

Code:
always @ (posedge signal_in) begin
    t <= !t;
end

always @ (posedge clk_in) begin
    t1 <= t;
    t2 <= t1
end

assign out_edge = t1 ^ t2;
 
Hi,

As long as the "glitches" high phase is longer than a system_clock_cycle you can be sure to detect each single pulse.

If you want to detect shorter pulses, then you need to treat the signal as a clock_input.
Maybe use a DFF with async_clear. DFF_clk is glitch_signal, DFF_D is 1.

Klaus

- - - Updated - - -

Added:
I just see that FvM's solution is similar, but it needs no external clear.

Klaus
 

Awesome guys it works well! Thank you very much!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top