D
delgeris
Guest
hello
i am trying to synthesize the following code.i am creating 4 differen
clocks by clock division and then i want to get different led output
according to switches change in my virtex2pro fpga
i am kind of new to vhdl and i get the following error
ERROR:Xst:827 - "C:/Xilinx91i/lab3/lcok.vhd" line 150: Signal LEDS<0
cannot be synthesized, bad synchronous description.
here is my code
entity lock is
Port ( SWITCHES : in STD_LOGIC_VECTOR (3 downto 0);
RESET : in STD_LOGIC;
fpga_clock: in STD_LOGIC;
LEDS : out STD_LOGIC_VECTOR (3 downto 0));
end lock;
architecture Behavioral of lock is
signal cur_state: std_logic_vector(2 downto 0);
signal next_state: std_logic_vector(2 downto 0);
signal state1s,state2s,state10s,state_miso,state_tetarto: std_logic;
signal clk,clk_1s,clk_2s,clk_10s,clk_miso,clk_tetarto,blink1: std_logic;
begin
process(fpga_clock)
variable counter2 : integer range 0 to 100000000;
variable counter1 : integer range 0 to 50000000;
variable counter_miso : integer range 0 to 25000000;
variable counter_tetarto : integer range 0 to 12500000;
-- variable a:integer:=0;
begin
-- if (a<1) then cur_state<="000"; else cur_state<=cur_state; end if;
-- a:=a+1;
if (rising_edge(fpga_clock)) then
if (counter1=50000000) then
if (state1s = '1')then
state1s<='0';
clk_1s<='1';
else
state1s<='1';
clk_1s<='0';
end if;
counter1:=1;
else
counter1 := counter1 +1 ;
end if;
if (counter2=100000000) then
if (state2s = '1')then
state2s<='0';
clk_2s<='1';
else
state2s<='1';
clk_2s<='0';
end if;
counter2:=1;
else
counter2 := counter2 +1 ;
end if;
if (counter_miso=25000000) then
if (state_miso = '1')then
state_miso<='0';
clk_miso<='1';
else
state_miso<='1';
clk_miso<='0';
end if;
counter_miso:=1;
else
counter_miso := counter_miso +1 ;
end if;
if (counter_tetarto=12500000) then
if (state_tetarto = '1')then
state_tetarto<='0';
clk_tetarto<='1';
else
state_tetarto<='1';
clk_tetarto<='0';
end if;
counter_tetarto:=1;
else
counter_tetarto := counter_tetarto +1 ;
end if;
end if;
if (reset = '1') then
cur_state <= "000";
end if;
CASE SWITCHES IS
WHEN "0110" => if (cur_state = "000") then cur_state<="001" ;
end if;
WHEN "1001" => if (cur_state = "001") then cur_state<="010" ;
end if;
WHEN "1010" => if (cur_state = "010") then cur_state<="011" ;
end if;
WHEN "0101" => if (cur_state = "100") then cur_state<="101" ;
end if;
WHEN OTHERS => cur_state<="100";
end case;
if ((cur_state = "101") and (reset = '1')) then
cur_state<= "000";
else cur_state<="100";
end if;
next_state<=cur_state;
end process;
process(next_state)
variable seq:integer:=0;
variable c:integer:=0;
begin
CASE next_state IS
WHEN "000" => if ((clk_2s='1') and (c < 1)) then
LEDS(3 downto 0) <= "0000";
c:=c+1;
else if (clk_1s='1') then
LEDS(2 DOWNTO 0)<= NOT ("000");
LEDS(3)<='1';
else
LEDS(3) <='0';
end if;
end if;
WHEN "001" => if (clk_1s = '1') then
LEDS(1 DOWNTO 0)<= "11";
LEDS(3 downto 2)<="11";
else
LEDS(3 downto 2) <="00";
end if;
WHEN "010" => if (clk_1s = '1') then
LEDS(0)<= '1';
LEDS(3 downto 1)<="111";
else
LEDS(3 downto 1) <="000";
end if;
WHEN "011" => if (clk_miso = '1') then
LEDS(3 downto 0)<="1111";
else
LEDS(3 downto 0) <="0000";
end if;
WHEN "100" => if (rising_edge(clk_tetarto)) then
if (seq=0) then
LEDS<= "0111";
seq:=1;
else if
(seq=1) then
LEDS<= "1011";
seq:=2;
else if
(seq=2) then
LEDS<= "1101";
seq:=3;
else if
(seq=3) then
LEDS<= "1110";
seq:=0;
end if;
end if;
end if;
end if;
end if;
WHEN OTHERS => LEDS<="0101";
end case;
end process;
end Behavioral;
any help would be appreciated!
thank you
---------------------------------------
Posted through http://www.FPGARelated.com
i am trying to synthesize the following code.i am creating 4 differen
clocks by clock division and then i want to get different led output
according to switches change in my virtex2pro fpga
i am kind of new to vhdl and i get the following error
ERROR:Xst:827 - "C:/Xilinx91i/lab3/lcok.vhd" line 150: Signal LEDS<0
cannot be synthesized, bad synchronous description.
here is my code
entity lock is
Port ( SWITCHES : in STD_LOGIC_VECTOR (3 downto 0);
RESET : in STD_LOGIC;
fpga_clock: in STD_LOGIC;
LEDS : out STD_LOGIC_VECTOR (3 downto 0));
end lock;
architecture Behavioral of lock is
signal cur_state: std_logic_vector(2 downto 0);
signal next_state: std_logic_vector(2 downto 0);
signal state1s,state2s,state10s,state_miso,state_tetarto: std_logic;
signal clk,clk_1s,clk_2s,clk_10s,clk_miso,clk_tetarto,blink1: std_logic;
begin
process(fpga_clock)
variable counter2 : integer range 0 to 100000000;
variable counter1 : integer range 0 to 50000000;
variable counter_miso : integer range 0 to 25000000;
variable counter_tetarto : integer range 0 to 12500000;
-- variable a:integer:=0;
begin
-- if (a<1) then cur_state<="000"; else cur_state<=cur_state; end if;
-- a:=a+1;
if (rising_edge(fpga_clock)) then
if (counter1=50000000) then
if (state1s = '1')then
state1s<='0';
clk_1s<='1';
else
state1s<='1';
clk_1s<='0';
end if;
counter1:=1;
else
counter1 := counter1 +1 ;
end if;
if (counter2=100000000) then
if (state2s = '1')then
state2s<='0';
clk_2s<='1';
else
state2s<='1';
clk_2s<='0';
end if;
counter2:=1;
else
counter2 := counter2 +1 ;
end if;
if (counter_miso=25000000) then
if (state_miso = '1')then
state_miso<='0';
clk_miso<='1';
else
state_miso<='1';
clk_miso<='0';
end if;
counter_miso:=1;
else
counter_miso := counter_miso +1 ;
end if;
if (counter_tetarto=12500000) then
if (state_tetarto = '1')then
state_tetarto<='0';
clk_tetarto<='1';
else
state_tetarto<='1';
clk_tetarto<='0';
end if;
counter_tetarto:=1;
else
counter_tetarto := counter_tetarto +1 ;
end if;
end if;
if (reset = '1') then
cur_state <= "000";
end if;
CASE SWITCHES IS
WHEN "0110" => if (cur_state = "000") then cur_state<="001" ;
end if;
WHEN "1001" => if (cur_state = "001") then cur_state<="010" ;
end if;
WHEN "1010" => if (cur_state = "010") then cur_state<="011" ;
end if;
WHEN "0101" => if (cur_state = "100") then cur_state<="101" ;
end if;
WHEN OTHERS => cur_state<="100";
end case;
if ((cur_state = "101") and (reset = '1')) then
cur_state<= "000";
else cur_state<="100";
end if;
next_state<=cur_state;
end process;
process(next_state)
variable seq:integer:=0;
variable c:integer:=0;
begin
CASE next_state IS
WHEN "000" => if ((clk_2s='1') and (c < 1)) then
LEDS(3 downto 0) <= "0000";
c:=c+1;
else if (clk_1s='1') then
LEDS(2 DOWNTO 0)<= NOT ("000");
LEDS(3)<='1';
else
LEDS(3) <='0';
end if;
end if;
WHEN "001" => if (clk_1s = '1') then
LEDS(1 DOWNTO 0)<= "11";
LEDS(3 downto 2)<="11";
else
LEDS(3 downto 2) <="00";
end if;
WHEN "010" => if (clk_1s = '1') then
LEDS(0)<= '1';
LEDS(3 downto 1)<="111";
else
LEDS(3 downto 1) <="000";
end if;
WHEN "011" => if (clk_miso = '1') then
LEDS(3 downto 0)<="1111";
else
LEDS(3 downto 0) <="0000";
end if;
WHEN "100" => if (rising_edge(clk_tetarto)) then
if (seq=0) then
LEDS<= "0111";
seq:=1;
else if
(seq=1) then
LEDS<= "1011";
seq:=2;
else if
(seq=2) then
LEDS<= "1101";
seq:=3;
else if
(seq=3) then
LEDS<= "1110";
seq:=0;
end if;
end if;
end if;
end if;
end if;
WHEN OTHERS => LEDS<="0101";
end case;
end process;
end Behavioral;
any help would be appreciated!
thank you
---------------------------------------
Posted through http://www.FPGARelated.com