'Need to set default output, but it does not work
I got this code to compile and work, but all leds were on constantly. So I decided it needed to be defaulted, which is why I added: "011101111" to output in sensitivity list. Now the code does not want to compile stating: "Too many outputs". (working with 22v10) Code down below:
--Traffic Light Design Project
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity comboLogic is
port(CLK, VMP, T, S10, S2, LT: in std_logic;
Q:buffer std_logic_vector(8 downto 0):="011101111");
end comboLogic;
architecture DigitalSystem of comboLogic is
begin
process(CLK, VMP, T, S10, S2, LT, Q)
begin
if CLK = '1' and CLK 'event then
case Q is
-- G120, R120L, RMP
when "011101111" =>
if (LT = '0' or T = '1' or VMP = '0' or S10 = '1') then
Q <= "011101111"; -- STAY
elsif((S10 = '0' and T = '0') and (VMP = '1' or LT = '1')) then
Q <= "110101111"; -- Yellow 120
end if;
--Y120, R120L, RMP
when "110101111" =>
if (S2 = '1') then
Q <= "110101111"; --STAY
elsif(S2 = '0' and VMP = '1' and LT = '0' and T = '0') then
Q <= "101011111"; -- Red 120 & 120L, Green MP
end if;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|