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.

How to write a code in Verilog for pulse detection?

Status
Not open for further replies.

gold_kiss

Full Member level 4
Full Member level 4
Joined
Sep 11, 2002
Messages
211
Helped
7
Reputation
14
Reaction score
4
Trophy points
1,298
Activity points
1,789
pulse detection

Hi,

How do I write a code in verilog for pulse detection. The pulse width is assumed to be for 1 clock and is positive pulse.

Thanks,
Gold_kiss
 

Re: pulse detection

declare a variable pulse_d1 and assign to it the value of pulse inside the clocked always block then-
always @(posedge clk)
begin
if(pulse_d1 = 0 && pulse = 1) //pulse edge detected
begin
--------
--------
end
end

hope this helps.
 

Re: pulse detection

hi,
if you want to do it, you have to have a clock which frequency is twice than your sampled clock.
otherwise you can use latch to decide.
 

pulse detection

A latch is great.
the signal will be asserted at least for half of the clock period.
 

Re: pulse detection

The following code can realize your intent:

wire signal_in;
wire signal_posedge_detected;
reg signal d;

always @(posedge clk or negedge rst_n)
begin
if (~rst_n)
signal_d <= #1 1'b0;
else
signal_d <= #1 signal_in;
end

assign signal_posedge_detected = signal_in & (~signal_d);




gold_kiss said:
Hi,

How do I write a code in verilog for pulse detection. The pulse width is assumed to be for 1 clock and is positive pulse.

Thanks,
Gold_kiss
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top