H
Hammer
Well
I managed to make the traffic light only with 3 warnings ARE THEY
DANGEROUS(Tomorrow I will go to university to test the code)
WARNING:Xst:1426 - The value init of the FF/Latch y hinder the constant
cleaning in the block count1.
You should achieve better results by setting this init to 1.
WARNING:Xst:1988 - Unit <count1>: instances <Mcompar__n0018>,
<Mcompar__n0025> of unit <LPM_COMPARE_2> and unit <LPM_COMPARE_7> are
dual, second instance is removed
WARNING:Xst:1988 - Unit <count1>: instances <Mcompar__n0023>,
<Mcompar__n0026> of unit <LPM_COMPARE_5> and unit <LPM_COMPARE_8> are
dual, second instance is removed
Loading device for application Rf_Device from file '3s200.nph' in
environment C:\Xilinx.
THE REST I OK, here's the code:
entity count1 is
Port ( clock : in STD_LOGIC;
key : in STD_LOGIC;
yellow : out STD_LOGIC :='0';
green : out STD_LOGIC :='1';
red : out STD_LOGIC :='0';
pred : out STD_LOGIC :='1';
pgreen : out STD_LOGIC :='0');
end count1;
architecture Behavioral of count1 is
signal sec : integer range 0 to 50 :=0;
signal nsec : integer range 1 to 50000000 :=1;
signal x : std_logic :='0';
signal y : std_logic :='0';
begin
process (clock,key,x,y)
begin
if rising_edge(key) then
y<='1';
end if;
if ((key='0' and x='1') or y='0') then
nsec<=1;
sec<=0;
else
if rising_edge(clock) then
if nsec = 5 then
nsec <= 1;
sec <= sec+1;
else
nsec <= nsec + 1;
end if;
if sec>=38 then
x<='1';
end if;
if sec<38 then
x<='0';
end if;
if ((sec<=2) or (sec>=34 and sec<=36)) then
yellow<='1';
else
yellow<='0';
end if;
if (sec>2 and sec<=36) then
red<='1';
else
red<='0';
end if;
if (sec>2 and sec<=36) then
red<='1';
else
red<='0';
end if;
if (sec>36) then
green<='1';
else
green<='0';
end if;
if (sec>5 and sec<=30) then
pgreen<='1';
pred<='0';
else
pgreen<='0';
pred<='1';
end if;
end if;
end if;
end process;
end Behavioral;
I managed to make the traffic light only with 3 warnings ARE THEY
DANGEROUS(Tomorrow I will go to university to test the code)
WARNING:Xst:1426 - The value init of the FF/Latch y hinder the constant
cleaning in the block count1.
You should achieve better results by setting this init to 1.
WARNING:Xst:1988 - Unit <count1>: instances <Mcompar__n0018>,
<Mcompar__n0025> of unit <LPM_COMPARE_2> and unit <LPM_COMPARE_7> are
dual, second instance is removed
WARNING:Xst:1988 - Unit <count1>: instances <Mcompar__n0023>,
<Mcompar__n0026> of unit <LPM_COMPARE_5> and unit <LPM_COMPARE_8> are
dual, second instance is removed
Loading device for application Rf_Device from file '3s200.nph' in
environment C:\Xilinx.
THE REST I OK, here's the code:
entity count1 is
Port ( clock : in STD_LOGIC;
key : in STD_LOGIC;
yellow : out STD_LOGIC :='0';
green : out STD_LOGIC :='1';
red : out STD_LOGIC :='0';
pred : out STD_LOGIC :='1';
pgreen : out STD_LOGIC :='0');
end count1;
architecture Behavioral of count1 is
signal sec : integer range 0 to 50 :=0;
signal nsec : integer range 1 to 50000000 :=1;
signal x : std_logic :='0';
signal y : std_logic :='0';
begin
process (clock,key,x,y)
begin
if rising_edge(key) then
y<='1';
end if;
if ((key='0' and x='1') or y='0') then
nsec<=1;
sec<=0;
else
if rising_edge(clock) then
if nsec = 5 then
nsec <= 1;
sec <= sec+1;
else
nsec <= nsec + 1;
end if;
if sec>=38 then
x<='1';
end if;
if sec<38 then
x<='0';
end if;
if ((sec<=2) or (sec>=34 and sec<=36)) then
yellow<='1';
else
yellow<='0';
end if;
if (sec>2 and sec<=36) then
red<='1';
else
red<='0';
end if;
if (sec>2 and sec<=36) then
red<='1';
else
red<='0';
end if;
if (sec>36) then
green<='1';
else
green<='0';
end if;
if (sec>5 and sec<=30) then
pgreen<='1';
pred<='0';
else
pgreen<='0';
pred<='1';
end if;
end if;
end if;
end process;
end Behavioral;