- #1
keith03
- 31
- 0
This is my first state machine that has an input large than one bit. The simulation tool says that I synthesize my output away. I think I understand why, but don't really know how to fix it.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
--
entity trimoore is
port
(
clk : in std_logic;
x : in std_logic_vector (1 downto 0);
------ mode : in std_logic_vector (2 downto 0);
q : out std_logic_vector(2 downto 0)
);
end trimoore;
--
architecture behave of trimoore is
type state_type is (A, B, C);
signal state: state_type;
begin
process (clk)
begin
if (clk'event and clk ='1') then
case state is
when A =>
if x<="11" then state <= A;
else state <= B;
end if;
when B =>
if x <= "11" then state <= A;
elsif x <= "00" then state <= B;
else state <= C;
end if;
when C =>
if x <= "00" then state <= B;
elsif x <= "01" then state <= C;
else state <= A;
end if;
end case;
end if;
end process;
with state select
q <= "000" when A,
"001" when B,
"110" when C;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
--
entity trimoore is
port
(
clk : in std_logic;
x : in std_logic_vector (1 downto 0);
------ mode : in std_logic_vector (2 downto 0);
q : out std_logic_vector(2 downto 0)
);
end trimoore;
--
architecture behave of trimoore is
type state_type is (A, B, C);
signal state: state_type;
begin
process (clk)
begin
if (clk'event and clk ='1') then
case state is
when A =>
if x<="11" then state <= A;
else state <= B;
end if;
when B =>
if x <= "11" then state <= A;
elsif x <= "00" then state <= B;
else state <= C;
end if;
when C =>
if x <= "00" then state <= B;
elsif x <= "01" then state <= C;
else state <= A;
end if;
end case;
end if;
end process;
with state select
q <= "000" when A,
"001" when B,
"110" when C;