Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Help with frequency divider

Reply
Thread Tools

Help with frequency divider

 
 
DaMeN DaMeN is offline
Junior Member
Join Date: Aug 2009
Posts: 1
 
      08-04-2009
I just started to learn VHDL and I realy need to write a program that hase 1 input and 1 output, the program hase to divide the input frequency by 4 and send it to the output.
I have couple of idias of how to do it but I wasnt able to write it.

Code:
entity NAME_OF_ENTITY is
     port (FreqIn: in std_logic;
             FreqOut: out std_logic);

end NAME_OF_ENTITY;

architecture architecture_name of NAME_OF_ENTITY is
    signal Freq: std_logic_vector (1 downto 0);
begin
if (rising_edge(FeqIn)) then
   Freq<=Freq+1;
end if;
if (Freq="11")
   FreqOut<="1"
   Freq<="00";
elsif (Freq\="11")
   FreqOut<="0";
end if;
end architecture_name;
This code does not work...
Please help
 
Reply With Quote
 
 
 
 
i3igAnt i3igAnt is offline
Junior Member
Join Date: Aug 2009
Posts: 2
 
      08-06-2009
entity NAME_OF_ENTITY is
port (FreqIn: in std_logic;
FreqOut: out std_logic);
end NAME_OF_ENTITY;

architecture architecture_name of NAME_OF_ENTITY is
signal Freq: std_logic_vector (1 downto 0);
begin

if (rising_edge(FeqIn)) then
Freq<=Freq+1;
end if;

FreqOut <= Freq(1);

end architecture_name;
 
Reply With Quote
 
 
 
 
i3igAnt i3igAnt is offline
Junior Member
Join Date: Aug 2009
Posts: 2
 
      08-06-2009
I missed this in the first post, you need a process statement for your counter.

process(FreqIn) is
begin
if rising_edge(FreqIn) then
Freq<=Freq+1;
end if;
end process;

FreqOut <= Freq(1);
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
frequency divider Gandalf VHDL 6 09-24-2008 04:32 AM
VHDL-problem with symmetrical frequency divider by 3 Winfried Salomon VHDL 12 08-29-2007 02:50 PM
Frequency Divider Simulation problem using ModelSIM Kyle H. VHDL 3 09-26-2006 03:25 PM
MCU clock divider vs. VHDL divider Matt Clement VHDL 3 04-28-2006 01:24 PM
Frequency divider Patrick VHDL 6 05-21-2004 05:32 AM



Advertisments