finite state machine- bad synch description

Joined
Oct 17, 2012
Messages
1
Reaction score
0
I have to design a fsm that reduces the frequency of the input clock by 4 (outclk=inclk/4)

I tried to do that using following vhdl code:

-------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;


entity top_mod is
Port ( inclk : in STD_LOGIC;
outclk : out STD_LOGIC;
clr: in std_logic
);

end top_mod;

architecture Behavioral of top_mod is

begin
process (clr,inclk)
variable f1,f2: std_logic;
begin
if(clr='1') then
f1:='0';
f2:='0';
outclk<='0';

else
if(rising_edge(inclk)) then
if(f1='0' and f2='0') then
f1:='0'; f2:='1';
elsif(f1='0' and f2='1') then
f1:='1'; f2:='0';
elsif(f1='1' and f2='0') then
f1:='1'; f2:='1';
outclk:='1';
elsif(f1='1' and f2='1') then
f1:='0'; f2:='0';

end if;
elsif(falling_edge(inclk) and f1='1' and f2='1') then
outclk<='0';
end if;
end if;
end process;

end Behavioral;
----------------------------------


There's no problem with the syntax. But when i tried to view the RTL schematic, i encountered following error:

"Signal outclk cannot be synthesized, bad synchronous description. The description style you are using to describe a synchronous element (register, memory, etc.) is not supported in the current software release."


What is wrong with my code?
Please help
:trytofly:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top