Currently coding washing machine code shown below for project. I am new to VHDL and need help with an error message.
"Unresolved signal is multiply driven"
library IEEE; --Basic Standard Logic Package
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity Washing_Machine is
port (Clk : in STD_LOGIC; --Clk
Reset : in STD_LOGIC; --Reset - Makes the Current State reset back to the start e.g. Soak.
DoubleWash: in STD_LOGIC; --Button pressed to change state
START_STOP : in STD_LOGIC; -- Start/Stop switch
LidSensor: in STD_LOGIC; -- Lidsensor -> Checks if Lid Open or Close
LEDs: out STD_LOGIC_VECTOR (3 downto 0); --LEDs shows State
Segment: out STD_LOGIC_Vector (6 downto 0)); --7-Segmenet shows State
end Washing_Machine;
architecture Behavioral of Washing_Machine is
type state_type is (Soak, Wash, Rinse, Spin, Idle, SecondWash, SecondRinse, Done); --State types defined
signal Next_State, Curr_State: State_Type;
signal Counter : unsigned(26 downto 0);
-- Time durations
constant Soak_Duration : unsigned(26 downto 0) := to_unsigned(100000000, 27); -- 1 Second
constant Wash_Duration : unsigned(26 downto 0) := to_unsigned(300000000, 27); -- 3 Seconds
constant Rinse_Duration : unsigned(26 downto 0) := to_unsigned(500000000, 27); -- 5 Seconds
constant Spin_Duration : unsigned(26 downto 0) := to_unsigned(900000000, 27); -- 9 Seconds
begin
process(Clk, Reset) --The logic for Clk and Reset
begin
if Reset = '1' then --If reset is HIGH -> State go backs to Soak -> Start of Sequence
Curr_State <= Idle;
Counter <= (others => '0');
elsif rising_edge(Clk) then
if START_STOP = '1' and LidSensor = '0' then
Curr_State <= Next_State;
Counter <= (others => '0');
elsif LidSensor ='1' then
Curr_State <= Idle;
end if;
end if;
end process;
process(DoubleWash, Curr_State)
begin
if DoubleWash = '1' then
case Curr_State is
when Idle =>
if START_STOP = '1' then
Curr_State <= Soak;
Counter <= (others => '0');
end if;
when Soak =>
if Counter < Soak_Duration then
Counter <= Counter + 1;
else
Next_State <= Wash;
Counter <= (others => '0');
end if;
when Wash =>
if Counter < Wash_Duration then
Counter <= Counter + 1;
else
Next_State <= Rinse;
Counter <= (others => '0');
end if;
when Rinse =>
if Counter < Rinse_Duration then
Counter <= Counter + 1;
else
Next_State <= SecondWash;
end if;
when SecondWash =>
if Counter < Wash_Duration then
Counter <= Counter + 1;
else
Next_State <= SecondRinse;
Counter <= (others => '0');
end if;
when SecondRinse =>
if Counter < Rinse_Duration then
Counter <= Counter + 1;
else
Next_State <= Spin;
end if;
when Spin =>
if Counter < Spin_Duration then
Counter <= Counter + 1;
else
Next_State <= Idle;
Counter <= (others => '0');
end if;
when others =>
Curr_State <= Idle;
end case;
end if;
end process;
process(Curr_State, START_STOP) --Logic for Curr_State and START_STOP Button
begin
case Curr_State is
when Idle => --Idle
if START_STOP = '1' then
Curr_State <= Soak;
Counter <= (others => '0');
end if;
when Soak=> --Soak
if Counter < Soak_Duration then
Counter <= Counter + 1;
else
Next_State <= Wash;
Counter <= (others => '0');
end if;
when Wash=>
if Counter < Wash_Duration then
Counter <= Counter + 1;
else
Next_State <= Rinse;
Counter <= (others => '0');
end if;
when Rinse =>
if Counter < Rinse_Duration then
Counter <= Counter + 1;
else
Next_State <= Spin;
Counter <= (others => '0');
end if;
when Spin =>
if Counter < Spin_Duration then
Counter <= Counter + 1;
else
Next_State <= Idle;
Counter <= (others => '0');
end if;
when others =>
Curr_State <= Idle;
end case;
end process;
process(Curr_State) --State shown physically via LEDs
begin
case Curr_State is
when Soak =>
LEDs <= "0001"; -- Binary -> Decimal Number -> LED lights up as 1 -> First LEDs in sequence
Segment <= "1001111"; -- Binary -> 7-Segment Display-> 7-Segment lights up as 1 -> First LEDs in sequence
when Wash =>
LEDs <= "0010"; -- Binary -> Decimal Number -> LED lights up as 2 -> Second LEDs in sequence
Segment <= "0010010"; -- Binary -> 7-Segment Display -> 7-Segment lights up as 2 -> Second LEDs in sequence
when Rinse =>
LEDs <= "0100"; -- Binary -> Decimal Number -> LED lights up as 3 -> Third LEDs in sequence
Segment <= "0000110"; -- Binary -> 7-Segment Display -> 7-Segment lights up as 3 -> Third LEDs in sequence
when Spin =>
LEDs <= "1000"; -- Binary -> Decimal Number -> LED lights up as 4 -> Fourth LEDs in sequence
Segment <= "0000110"; -- Binary -> 7-Segment Display-> 7-Segment lights up as 4 -> Fourth LEDs in sequence
when others =>
LEDs <= "0000"; -- Binary -> Decimal Number -> LED lights up as 0 -> No LEDs in sequence
Segment <= "0000001"; -- Binary -> 7-Segment Display -> 7-Segment lights up as 0 -> No LEDs in sequence
end case;
end process;
end Behavioral;
I want it to be able to function similar to a normal washing machine.
I also would like to add Token Deposit in future.