Rules | Recent posts | topic RSS | Search | Register  | Log in

Dual edge counter in VHDL?


Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Dual edge counter in VHDL?
Author Message
Mehdi1357



Joined: 18 Jan 2008
Posts: 25
Helped: 1
Location: the Earth


Post26 Aug 2008 8:17   

vhdl dual edge


Hi everbody
How can write a process in VHDL for dual edge counter(counter increases its value each time a rising or falling edge occurs)?
thanks
Back to top
avimit



Joined: 16 Nov 2005
Posts: 417
Helped: 69
Location: Fleet, UK


Post26 Aug 2008 9:59   

vhdl rising edge


You will have to have 2 counters, one which work on -ive edge, and the other which work on +ive edge. Each counter will increment the count by 2. One will start with 0 the other will start with 1. You can then multiplx the o/p value as desired.
kr,
Avi
Back to top
Mehdi1357



Joined: 18 Jan 2008
Posts: 25
Helped: 1
Location: the Earth


Post27 Aug 2008 13:33   

vhdl double edge


Hi
I appreciate your answer.is there a more simple solution for processing of both edges of a input signal in a PROCESS block.please write VHDL code.
best regards.
Back to top
avimit



Joined: 16 Nov 2005
Posts: 417
Helped: 69
Location: Fleet, UK


Post27 Aug 2008 14:33   

edgecounter


No there is no simpler answer or a method to do this in a single procedural code, which will be synthesizeable
Kr,
Avi
Back to top
FvM



Joined: 22 Jan 2008
Posts: 5044
Helped: 751
Location: Bochum, Germany


Post27 Aug 2008 14:36   

verilog dual edge flip flop


There have been various threads on the same topic, e. g. http://www.edaboard.com/viewtopic.php?t=323994
Back to top
mmarco76



Joined: 04 Jan 2008
Posts: 85
Helped: 6


Post27 Aug 2008 15:21   

vhdl edge


Your question is very simple.
If the signal you wanna count is a clock simply your code will be something like this:

process(reset, clk).
begin
if reset = '1' then
counter <= (others =>'0');
elsif clk'event then
counter <= counter +1;
end if;
end process;

If you wanna count a signal that is not a clock, but it's clocked by your clock under certain condition (signal last at least 3 clk before changing state) you can detect the 2 front and then increase your counter by them.

Hoping to help you with this simple answer.
If need more help ask with more details.
Back to top
lucbra



Joined: 30 Oct 2003
Posts: 160
Helped: 6
Location: Belgium


Post05 Sep 2008 15:22   

vhdl rising and falling clock edge


Yes but this code is NOT synthesisable. There is no hardware FF that supports this.
Back to top
karikalan_t79



Joined: 20 Oct 2008
Posts: 99
Helped: 1


Post22 Oct 2008 5:27   

dual edge counter


tool will tell this is impoosible to attend a ff in the design and result in error
Back to top
Mehdi1357



Joined: 18 Jan 2008
Posts: 25
Helped: 1
Location: the Earth


Post22 Oct 2008 11:12   

edge counter vhdl


mmarco76 wrote:
Your question is very simple.
If the signal you wanna count is a clock simply your code will be something like this:

process(reset, clk).
begin
if reset = '1' then
counter <= (others =>'0');
elsif clk'event then
counter <= counter +1;
end if;
end process;


I appreciate you for your answer , but your code isn't synthesizeble in ISE version 10.1 (related to Xilinx's productions).
this problem will solve by using two processes , one for rising edge and another for falling edge then we must mix these results together.
best regards.
Back to top
Google
AdSense
Google Adsense




Post22 Oct 2008 11:12   

Ads




Back to top
Core1



Joined: 17 Oct 2008
Posts: 1


Post22 Dec 2008 23:12   

vhdl edge counter


Mehdi1357 wrote:
Hi everbody
How can write a process in VHDL for dual edge counter(counter increases its value each time a rising or falling edge occurs)?
thanks


it's not the synthesizer, it's the target
look at this simple code: (sorry, I'm a verilog guy)

always @(posedge clk or negedge clk)
x = x + 1;

It is synthesizable and it does work in some CPLD's like XC2Sxx (Xilinx)
The target you point the synthesizer to must have dual-edge support.
Back to top
Nir Dahan



Joined: 19 May 2008
Posts: 74
Helped: 6
Location: Munich, Germany


Post23 Dec 2008 9:38   

fpga dual edge ff


one could create a dual edge flop as described here:
http://asicdigitaldesign.wordpress.com/2007/07/31/the-double-edge-flip-flop/
or here:
http://asicdigitaldesign.wordpress.com/2008/09/22/another-look-at-the-dual-edge-flip-flop/
ND.
http://asicdigitaldesign.wordpress.com
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> Dual edge counter in VHDL?
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Counter with asynchronous edge-triggered reset in VHDL (2)
counter in vhdl (3)
WRITE A COUNTER IN VHDL (6)
4-bit counter code in VHDL (1)
4-bit counter code in VHDL (1)
Philosophical placement of counter in vhdl (1)
counter design with negative and positive edge (6)
dual clock counter (5)
Special counter: set&reset triggered by rising edge of p (3)
Neg edge and pos edge DFF in the same clock tree (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS