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.

VHDL code for D Flip flop to use as counter

Status
Not open for further replies.

kumarji

Newbie
Newbie level 4
Joined
Apr 2, 2007
Messages
5
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,303
I am working on VHDL Libero software. I need to design a counter using D Flip Flop. Can anyone provide the code for that?
 

Code:
process(rst,clk,cntr)
begin
  if(rst = '0') then
    cntr <= (others => '0');
  elsif(rising_egde(clk)) then
    cntr <= cntr + 1;
  end if;
end process;
This code is an example of synchronous MOD 2^n counter with clk as clock, rst as asynchronous reset and cntr can be defined as unsigned(n-1 downto 0) in your code declaration.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top