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.

Verilog to detect double rising edge

Status
Not open for further replies.
Looks good in general. If EDGE is asnychronous to clk, you should observe what's said about double registering. Otherwise, random errors can occur, either triggering of the output on first pulse or ignorance of input events.

Yes, EDGES is asynchronous to CLK. Can you explain more about what you mean by double registering?A google search for verilog double registering didn't seem to return any relevant results.
 

Code:
always @(posedge CLK)
	edges_reg <= EDGES;

wire  pos_pulse =  EDGES & !edges_reg;

if your CLK edge is close to transition time of EDGES signal (what must
happen from time to time if the signals are asynchronous )
the 'pos_pulse' will be very short and 'not seen' by rest of your logic;

you should done something like this

edges_reg[0] <= EDGES
edges_reg[1] <= edges_reg[0];

pos_pulse = (edges_reg == 2'b01);

if your CLK is very fast ( >200-250MHz) you should have even
3 registers 'edges_reg'

J.A
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top