FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-27-2005, 06:37 PM
Ash12
Guest
 
Posts: n/a
Default Divide by 2 counter

Hi, how are we all??

Im looking for some help / tips....

Could somone help me design a divide by 2 counter using VHDL.

Im looking to divide a clock input by 2, 4, 6, and 8...

Any help would be greatly appreciated

Reply With Quote
  #2 (permalink)  
Old 02-28-2005, 05:43 AM
Jerry Coffin
Guest
 
Posts: n/a
Default Re: Divide by 2 counter

Ash12 wrote:
> Hi, how are we all??
>
> Im looking for some help / tips....
>
> Could somone help me design a divide by 2 counter using VHDL.


Define a variable of appropriate width. At reset, set it and the output
to 0. At each clock cycle, add one to the variable. When it's equal to
the number you want to divide by, reset it to 0 and toggle the output.

> Im looking to divide a clock input by 2, 4, 6, and 8...


The same basic code works for more or less arbitrary numbers. Note that
if you're coding for something like a recent FPGA, you may be able to
use a built-in clock manager instead of building it yourself.

--
Later,
Jerry.

The universe is a figment of its own imagination.

Reply With Quote
  #3 (permalink)  
Old 02-28-2005, 06:00 AM
aaaaaa
Guest
 
Posts: n/a
Default Re: Divide by 2 counter

Further u can devide the clock by lpm_counter of multibit output.
bit 0 will be a clock devide by 2.
Bit 1 will be a clock devide by 4.
Bit 2 will be a clock devide by 8.

For clock devide by 6 u can use the vhdl code as


PROCESS (reset, clk16mh_b) --PROCESS no 1
BEGIN
IF reset = '0' THEN
count <= 0 ;
clk8mh_s <= '0' ;
ELSIF rising_edge(clk16mh_b) THEN
count <= count + 1 ;
IF count = (devideby/2)-1 THEN
clk8mh_s <= NOT clk8mh_s ;
count <= 0 ;
END IF ;
END IF ;
END PROCESS ;
clk8mh <= clk8mh_s ;

"devideby" is a constant that can be instantiated in generic.

I think it should be helpful.

Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Need about reconfiguring the PLL with prescale counter n andmultiply counter m [email protected] FPGA 0 04-16-2008 09:06 AM
verilog source code/ fsm for "divide by n counter" S45 Verilog 2 04-02-2007 03:50 PM
How to Divide a clock by 2 [email protected] Verilog 8 02-17-2006 05:10 AM
Divide by n Mushmech VHDL 2 04-12-2004 12:54 PM


All times are GMT +1. The time now is 12:18 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved