beginner asking for help

Thread Starter

Jardel

Joined Feb 13, 2014
1
Hello everyone I have a project to do :Traffic lights : WORKING ON A VIRTEX 5 I recieved warnings I don't understand.
Here's my code, and my chronograms attached so you understand how I coded.
Rich (BB code):
(vhdl)
----------------------------------------------------------------------------------
-- Company: 
-- Engineer: 
-- 
-- Create Date:    13:47:47 02/13/2014 
-- Design Name: 
-- Module Name:    main - Behavioral 
-- Project Name: 
-- Target Devices: 
-- Tool versions: 
-- Description: 
--
-- Dependencies: 
--
-- Revision: 
-- Revision 0.01 - File Created
-- Additional Comments: 
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;


-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity main is
    Port ( clk : in  STD_LOGIC;
           BAP : in  STD_LOGIC;
           RESET : in  STD_LOGIC;
           FPV : out  STD_LOGIC; -- feu principal vert
           FPO : out  STD_LOGIC; -- feu principal oranger
           FPR : out  STD_LOGIC; -- feu principal rouge 
           FSV : out  STD_LOGIC; -- feu secondaire vert
           FSO : out  STD_LOGIC; -- feu secondaire oranger
           FSR : out  STD_LOGIC; -- feu secondaire rouge
           SA : out  STD_LOGIC; -- signal d'activation de la priorite des pietons
           FPTP : out  STD_LOGIC); -- feu de priorite des pietons
end main;

architecture Behavioral of main is


signal counter : integer RANGE 0 TO 400000000 := 0;
signal cnt1 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
signal cnt2 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
signal cnt3 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
signal cnt4 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
signal cnt5 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
signal new_clk : STD_LOGIC;
signal FPV1 : STD_LOGIC;
signal FPO1 : STD_LOGIC;
signal FPR1 : STD_LOGIC; 
signal FSV1 : STD_LOGIC;
signal FSO1 : STD_LOGIC;
signal FSR1 : STD_LOGIC;
signal SA1  : STD_LOGIC;
signal FPTP1: STD_LOGIC;
begin

process (clk,RESET,counter) begin
  if rising_edge(clk) then
        if (RESET='1') then
             counter<=0;
            
        elsif (counter=0) then
             new_clk<= '1';
        elsif (counter = 200000000) then
             new_clk <= '0' ;
        elsif (counter= 400000000) then
              counter <= 0 ;
        else 
            counter <= counter + 1;
        end if;
  end if;		  

  end process;

process(counter,cnt1,cnt2,cnt3,cnt4,cnt5,SA1) --les compteurs
begin
if (counter = 400000000) then
     cnt1<=cnt1 + 1 ;
	  cnt2<=cnt2 + 1 ;
	  cnt3<=cnt3 + 1 ;
	  cnt4<=cnt4 + 1 ;
	  cnt5<=cnt5 + 1 ;
elsif (cnt1=4) then
      cnt2<=0;	-- ou (-1)?
elsif (cnt2=1) then
      cnt3<=0;	-- ou (-1)?
elsif (cnt3=3) then
      cnt4<=0;	-- ou (-1)?
elsif (cnt4=1) then
      if (SA1='1') then
		       cnt5<=0; -- ou (-1)?
      elsif(SA1='0') then
            cnt1<=0; -- ou (-1)?
      end if;				
elsif (cnt5=4) then
      cnt1<=0;	-- ou (-1)?	
end if;		
	  

end process;
Process (cnt1,cnt2,cnt3,cnt4) --feux
begin
if (cnt1 < 5) then
    FPV1<='1';
	 FPO1<='0';
	 FPR1<='0';
	 FSV1<='0';
	 FSO1<='0'; 
	 FSR1<='1';
elsif (cnt2 < 2) then
    FPV1<='0';
	 FPO1<='1';
	 FPR1<='0';
	 FSV1<='0';
	 FSO1<='0';
	 FSR1<='1';	 
elsif (cnt3 < 4) then
    FPV1<='0';
	 FPO1<='0';
	 FPR1<='1';
	 FSV1<='1';
	 FSO1<='0';
	 FSR1<='0';
elsif (cnt4 < 2) then
    FPV1<='0';
	 FPO1<='0';
	 FPR1<='1';
	 FSV1<='0';
	 FSO1<='1';
	 FSR1<='0';
end if;
end process;
FPV <= FPV1 ;
FPO <= FPO1 ;
FPR <= FPR1 ;
FSV <= FSV1 ;
FSO <= FSO1 ;
FSR <= FSR1 ;
process (BAP,cnt4)--signal d'activation
begin
if (BAP='1') then 
     while(cnt4 /= 1) loop
	  SA1 <= '1';
	  End loop ;
end if;	
    
end process;
SA<=SA1;
process (cnt5,new_clk)-- feu de priorite de pietons
begin
if (cnt5<=3) then
    FPTP1<='1';
elsif ((cnt5>=2) and (cnt5<=4)) then
    FPTP1<= not(new_clk) ;
else FPTP1<='0';
end if;
end process;
FPTP<=FPTP1;
end Behavioral;
(/vhdl)
 

Attachments

Last edited by a moderator:

tshuck

Joined Oct 18, 2012
3,534
Why don't you use code tags (the # icon) and provide us with those warnings you were talking about and we can go from there?
 
Top