W
Winfried Salomon
Hello,
I am a beginner in VHDL and use Xilinx ISE 6.103i. I tried to program a
symmetrical frequency divider by 3 in VHDL, which exists as hardware
tested schematic solution with 3 D-FFs. But the VHDL version doesn't
work at all, only the behavioral simulation with ModelSim works right,
but the post fit simulation and the hardware not at all. The chip is an
CPLD XC9572-15PC84, an Webcase at Xilinx had not yet success. I attached
the code in div3_vhdl.vhd, which is very short and easy to understand.
Why does it not work? The generated circuit is not a synchronous clocked
state machine, there are no memory elements at all like D-FFS and it has
no input, so it must be totally wrong.
To generalize the question, there must be triggered on both rising and
falling edge of clock in one process. Is this possible in VHDL? I
suppose not! But I cannot find in books that this is illegal. Can it be
a compiler dependent problem? I use the XST, perhaps another can solve
the problem? Where is the mistake? Many thanks in advance,
Winfried
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity div3_vhdl is
Port ( clock : in std_logic;
q_out : out std_logic);
end div3_vhdl;
architecture Behavioral of div3_vhdl is
begin
process(clock)
variable stat_count:integer range 0 to 6;
begin
--check Status-Counter
if(stat_count >5) then
stat_count:=0;
end if; --counter
--assign output
if(stat_count < 3) then
q_out <= '0';
else
q_out <= '1';
end if;
--increment Status-Counter
stat_count := stat_count+1;
end process;
end Behavioral;
I am a beginner in VHDL and use Xilinx ISE 6.103i. I tried to program a
symmetrical frequency divider by 3 in VHDL, which exists as hardware
tested schematic solution with 3 D-FFs. But the VHDL version doesn't
work at all, only the behavioral simulation with ModelSim works right,
but the post fit simulation and the hardware not at all. The chip is an
CPLD XC9572-15PC84, an Webcase at Xilinx had not yet success. I attached
the code in div3_vhdl.vhd, which is very short and easy to understand.
Why does it not work? The generated circuit is not a synchronous clocked
state machine, there are no memory elements at all like D-FFS and it has
no input, so it must be totally wrong.
To generalize the question, there must be triggered on both rising and
falling edge of clock in one process. Is this possible in VHDL? I
suppose not! But I cannot find in books that this is illegal. Can it be
a compiler dependent problem? I use the XST, perhaps another can solve
the problem? Where is the mistake? Many thanks in advance,
Winfried
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity div3_vhdl is
Port ( clock : in std_logic;
q_out : out std_logic);
end div3_vhdl;
architecture Behavioral of div3_vhdl is
begin
process(clock)
variable stat_count:integer range 0 to 6;
begin
--check Status-Counter
if(stat_count >5) then
stat_count:=0;
end if; --counter
--assign output
if(stat_count < 3) then
q_out <= '0';
else
q_out <= '1';
end if;
--increment Status-Counter
stat_count := stat_count+1;
end process;
end Behavioral;