THE VLSI HOMEPAGE

A Practical Guide to VLSI Design and Verification..

Edge Detector

Posted in Digital Design by Nigam on the August 29th, 2007

Let's start with the most fundamental design that is widely used in logic design - the edge detector. The edge detector generates a synchronous one clock cycle pulse upon a change in level (transition) of a signal from high->low or low->high. Edge detectors are used to detect the initial condition and to trigger other logic dependent on this signal - an example would be an active low interrupt where the transition from high to low indicates an interrupt has been asserted.

The edge detect circuit and waves are depicted in the thumbnail below - this detects both rising and falling transitions of the signal.

 

 

 

Edge Detector

Edge Detector Circuit

 

We will now look at the verilog code to implement this logic :

CODE:
  1. always @(posedge CLK or negedge RST_L) begin
  2. if (~RST_L) begin
  3. IN_D1 <= 1'b0;
  4. IN_D2 <= 1'b0;
  5. end
  6. else begin
  7. IN_D1 <= IN;
  8. IN_D2 <= IN_D1;
  9. end
  10. end
  11.  
  12. wire OUT = IN_D1 ^ IN_D2; // detects both rising edge and falling edge transitions
  13. wire OUT_posedge = IN_D1 & ~IN_D2; // detects rising edge
  14. wire OUT_negedge = ~IN_D1 & IN_D2; // detects falling edge

 

 

 

Sphere: Related Content

Leave a Reply


Close
E-mail It