beginner asking for help

Discussion in 'Homework Help' started by Jardel, Feb 13, 2014.

  1. Jardel

    Thread Starter New Member

    Feb 13, 2014
    1
    0
    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.
    Code ( (Unknown Language)):
    1.  
    2. (vhdl)
    3. ----------------------------------------------------------------------------------
    4. -- Company:
    5. -- Engineer:
    6. --
    7. -- Create Date:    13:47:47 02/13/2014
    8. -- Design Name:
    9. -- Module Name:    main - Behavioral
    10. -- Project Name:
    11. -- Target Devices:
    12. -- Tool versions:
    13. -- Description:
    14. --
    15. -- Dependencies:
    16. --
    17. -- Revision:
    18. -- Revision 0.01 - File Created
    19. -- Additional Comments:
    20. --
    21. ----------------------------------------------------------------------------------
    22. library IEEE;
    23. use IEEE.STD_LOGIC_1164.ALL;
    24. use IEEE.NUMERIC_STD.ALL;
    25. use IEEE.STD_LOGIC_ARITH.ALL;
    26.  
    27.  
    28. -- Uncomment the following library declaration if using
    29. -- arithmetic functions with Signed or Unsigned values
    30. --use IEEE.NUMERIC_STD.ALL;
    31.  
    32. -- Uncomment the following library declaration if instantiating
    33. -- any Xilinx primitives in this code.
    34. --library UNISIM;
    35. --use UNISIM.VComponents.all;
    36.  
    37. entity main is
    38.     Port ( clk : in  STD_LOGIC;
    39.            BAP : in  STD_LOGIC;
    40.            RESET : in  STD_LOGIC;
    41.            FPV : out  STD_LOGIC; -- feu principal vert
    42.            FPO : out  STD_LOGIC; -- feu principal oranger
    43.            FPR : out  STD_LOGIC; -- feu principal rouge
    44.            FSV : out  STD_LOGIC; -- feu secondaire vert
    45.            FSO : out  STD_LOGIC; -- feu secondaire oranger
    46.            FSR : out  STD_LOGIC; -- feu secondaire rouge
    47.            SA : out  STD_LOGIC; -- signal d'activation de la priorite des pietons
    48.            FPTP : out  STD_LOGIC); -- feu de priorite des pietons
    49. end main;
    50.  
    51. architecture Behavioral of main is
    52.  
    53.  
    54. signal counter : integer RANGE 0 TO 400000000 := 0;
    55. signal cnt1 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
    56. signal cnt2 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
    57. signal cnt3 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
    58. signal cnt4 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
    59. signal cnt5 : integer RANGE 0 TO 30 := 15; -- ou (-1)?
    60. signal new_clk : STD_LOGIC;
    61. signal FPV1 : STD_LOGIC;
    62. signal FPO1 : STD_LOGIC;
    63. signal FPR1 : STD_LOGIC;
    64. signal FSV1 : STD_LOGIC;
    65. signal FSO1 : STD_LOGIC;
    66. signal FSR1 : STD_LOGIC;
    67. signal SA1  : STD_LOGIC;
    68. signal FPTP1: STD_LOGIC;
    69. begin
    70.  
    71. process (clk,RESET,counter) begin
    72.   if rising_edge(clk) then
    73.         if (RESET='1') then
    74.              counter<=0;
    75.            
    76.         elsif (counter=0) then
    77.              new_clk<= '1';
    78.         elsif (counter = 200000000) then
    79.              new_clk <= '0' ;
    80.         elsif (counter= 400000000) then
    81.               counter <= 0 ;
    82.         else
    83.             counter <= counter + 1;
    84.         end if;
    85.   end if;        
    86.  
    87.   end process;
    88.  
    89. process(counter,cnt1,cnt2,cnt3,cnt4,cnt5,SA1) --les compteurs
    90. begin
    91. if (counter = 400000000) then
    92.      cnt1<=cnt1 + 1 ;
    93.       cnt2<=cnt2 + 1 ;
    94.       cnt3<=cnt3 + 1 ;
    95.       cnt4<=cnt4 + 1 ;
    96.       cnt5<=cnt5 + 1 ;
    97. elsif (cnt1=4) then
    98.       cnt2<=0;  -- ou (-1)?
    99. elsif (cnt2=1) then
    100.       cnt3<=0;  -- ou (-1)?
    101. elsif (cnt3=3) then
    102.       cnt4<=0;  -- ou (-1)?
    103. elsif (cnt4=1) then
    104.       if (SA1='1') then
    105.                cnt5<=0; -- ou (-1)?
    106.       elsif(SA1='0') then
    107.             cnt1<=0; -- ou (-1)?
    108.       end if;              
    109. elsif (cnt5=4) then
    110.       cnt1<=0;  -- ou (-1)?
    111. end if;    
    112.      
    113.  
    114. end process;
    115. Process (cnt1,cnt2,cnt3,cnt4) --feux
    116. begin
    117. if (cnt1 < 5) then
    118.     FPV1<='1';
    119.      FPO1<='0';
    120.      FPR1<='0';
    121.      FSV1<='0';
    122.      FSO1<='0';
    123.      FSR1<='1';
    124. elsif (cnt2 < 2) then
    125.     FPV1<='0';
    126.      FPO1<='1';
    127.      FPR1<='0';
    128.      FSV1<='0';
    129.      FSO1<='0';
    130.      FSR1<='1';  
    131. elsif (cnt3 < 4) then
    132.     FPV1<='0';
    133.      FPO1<='0';
    134.      FPR1<='1';
    135.      FSV1<='1';
    136.      FSO1<='0';
    137.      FSR1<='0';
    138. elsif (cnt4 < 2) then
    139.     FPV1<='0';
    140.      FPO1<='0';
    141.      FPR1<='1';
    142.      FSV1<='0';
    143.      FSO1<='1';
    144.      FSR1<='0';
    145. end if;
    146. end process;
    147. FPV <= FPV1 ;
    148. FPO <= FPO1 ;
    149. FPR <= FPR1 ;
    150. FSV <= FSV1 ;
    151. FSO <= FSO1 ;
    152. FSR <= FSR1 ;
    153. process (BAP,cnt4)--signal d'activation
    154. begin
    155. if (BAP='1') then
    156.      while(cnt4 /= 1) loop
    157.       SA1 <= '1';
    158.       End loop ;
    159. end if;
    160.    
    161. end process;
    162. SA<=SA1;
    163. process (cnt5,new_clk)-- feu de priorite de pietons
    164. begin
    165. if (cnt5<=3) then
    166.     FPTP1<='1';
    167. elsif ((cnt5>=2) and (cnt5<=4)) then
    168.     FPTP1<= not(new_clk) ;
    169. else FPTP1<='0';
    170. end if;
    171. end process;
    172. FPTP<=FPTP1;
    173. end Behavioral;
    174. (/vhdl)
    175.  
     
    Last edited by a moderator: Feb 14, 2014
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    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?
     
Loading...