[an error occurred while processing this directive]
[an error occurred while processing this directive]
|
Takoi vot voprosik.
Namudril takuu vot mashinku
funkcionalnii test prohodit bez problem a v post-rout-simuliacione
vivalivautsia kakieto levie chisla. (kak budto chtoto gdeto ne uspevaet perecluchatsia) chip xc4085. chastota vhodnih vozdeistvii 40MHz.
proboval bez 'toutput' a srazu v output, tozhe ne pomogaet.
prosba postavit na put istinniy
--------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
entity fsa is
port (clock : in std_logic;
reset : in std_logic;
input : in std_logic_vector (3 downto 0);
output : out std_logic_vector(6 downto 0)
);
end fsa;
architecture behavioral of fsa is
signal cur_state, next_state : std_logic_vector (2 downto 0);
signal toutput: std_logic_vector(6 downto 0);
begin
process (clock, reset)
begin
if rising_edge(clock) then
if reset = '0' then
cur_state <= "000";
else
output<=toutput;
cur_state <= next_state;
end if;
end if;
end process;
process (cur_state,input)
begin
case cur_state is
--00000000000000000000000000000000000000000000000000000000000
--00000000000000000000000000000000000000000000000000000000000
when "000" =>
case input is
-------------------------------------------------------------
when "0001" =>
next_state <= "001";
toutput<= "0010011";
-------------------------------------------------------------
when "0101" =>
next_state <= "010";
toutput<= "0011011";
-------------------------------------------------------------
when "0100" =>
next_state <= "100";
toutput<= "0000000";
------------------------------------------------------------
when others =>
next_state <= "000";
toutput<= "0000000";
end case;
--11111111111111111111111111111111111111111111111111111111111
--11111111111111111111111111111111111111111111111111111111111
when "001" =>
case input is
-------------------------------------------------------------
when "0010" =>
next_state <= "000";
toutput<= "0100001";
------------------------------------------------------------
when "0011" =>
next_state <= "001";
toutput<= "0010001";
-------------------------------------------------------------
when "0111" =>
next_state <= "010";
toutput<= "0001001";
-------------------------------------------------------------
when "0110" =>
next_state <= "011";
toutput<= "0001001";
-------------------------------------------------------------
when others =>
next_state <= "000";
toutput<= "0000000";
end case;
--22222222222222222222222222222222222222222222222222222222222
--22222222222222222222222222222222222222222222222222222222222
when "010" =>
case input is
when "1010" =>
next_state <= "000";
toutput<= "0100000";
when "1011" =>
next_state <= "001";
toutput<= "0010001";
-------------------------------------------------------------
when "1110" =>
next_state <= "011";
toutput<= "0010101";
-------------------------------------------------------------
when "1111" =>
next_state <= "010";
toutput<= "0000001";
-------------------------------------------------------------
when others =>
next_state <= "000";
toutput<= "0000000";
end case;
--33333333333333333333333333333333333333333333333333333333333
--33333333333333333333333333333333333333333333333333333333333
when "011" =>
case input is
------------------------------------------------------------
when "1101" =>
next_state <= "010";
toutput<= "0010001";
------------------------------------------------------------
when "1100" =>
next_state <= "011";
toutput<= "0000000";
------------------------------------------------------------
when "1001" =>
next_state <= "001";
toutput<= "0000001";
------------------------------------------------------------
when "1000" =>
next_state <= "000";
toutput<= "0000000";
------------------------------------------------------------
when others =>
next_state <= "000";
toutput<= "0000000";
end case;
--44444444444444444444444444444444444444444444444444444444444
--44444444444444444444444444444444444444444444444444444444444
when "100" =>
case input is
-------------------------------------------------------------
when "1000" =>
next_state <= "000";
toutput<= "1000000";
-------------------------------------------------------------
when "1001" =>
next_state <= "001";
toutput<= "0000001";
-------------------------------------------------------------
when "1101" =>
next_state <= "010";
toutput<= "0011011";
-------------------------------------------------------------
when "1100" =>
next_state <= "100";
toutput<= "0000000";
-------------------------------------------------------------
when others =>
next_state <= "000";
toutput<= "0000000";
end case;
when others => null;
end case;
end process;
end behavioral;
E-mail: info@telesys.ru