I have to design Posedge detector.I googled to clear understanding but nothing found usefull.I have question why we have to use this circuit for edge detection if we have D-Flip Flop.Simply put that signal in sensitivity of Always block and when posedge will come always block will run
Using external signals as clock is not a good design practice. Only use the real clock signal for posedge or negedge. For normal (slow) signals (e.g. pixel_ready, adc_done or spi_csn) it's often necessary to use a synchronizer and an edge detector as you described.
Yes i understand little bit...Can we put clock signal in sensitivity list for sync and the signal for whoom i am detecting his posedge to be putted in if condition just like this
Always @(posedge clk) Begin If ( s==1 ) ..........
When posedge of s will be detected then we can do anytask...Is this right?
Always @(posedge clk) Begin If ( s==1 ) ..........
I think this will only detect the high-level of s.
When posedge of s will be detected then we can do anytask...Is this right?
To detect an edge on signal 's', I would use something like this:
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
Simply put that signal in sensitivity of Always block and when posedge will come always block will run
You have a very software oriented view of HDL. In reality you won't get a "block" of something in hardware. And of course you won't get something that "runs" somehow. Instead in your FGPA you only have logic blocks (LUT) and D-flipflops to generate your own functions.
And when you look in the synthesizers user manual you will find that this code
1 |
|
2 |
|
3 |
|
4 |
|
is the "Verilog-Way" to describe a D-flipflop.
And no, it is not a good idea to write
1 |
|
2 |
|
3 |
|
4 |
|
because then you will get the d flipflop also, but you will get the d on the clock input. So as desired the flipflop will be set with a rising edge of the d signal. But you will not find a reliable way to reset it properly.
Reply
Please log in before posting.
