新人求助schematic 综合的一点问题

2020-02-17 19:50发布

本帖最后由 pszcmzcm 于 2015-6-29 12:40 编辑

新人求助schematic 综合的一点问题
在综合后 technology schematic中 有数个LUT(如图所示)感觉没有意义属于资源浪费
1.png

EDA为ISE14.7


truetable为
input  output
0        0
1        1

考虑了一下应该是VHDL编写上的问题,大学中虽然涉及了FPGA 也 在Tutorial 中 学了基本的VHDL编写,但对于此类问题还是感觉无从下手,现在自学并为Msc准备中,希望大牛能告知一下解决方法和原理

code为简单的双向交通灯(FSM based)
具体如下:
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;

  3. entity Traffic_light is

  4. port(clk:in std_logic;
  5.           Test: in std_logic;
  6.           Standby:in std_logic;
  7.           R1,Y1,G1:out std_logic;
  8.           R2,Y2,G2:out std_logic);
  9.                   
  10. end Traffic_light;

  11. architecture Behavioral of Traffic_light is


  12. constant time_max  :integer := 2700;
  13. --The frequency of Clk is 60Hz--
  14. constant time_RG   :integer := 1800;  
  15. --time of light change from red & green(s)--
  16. constant time_RY   :integer := 300;
  17. --time of light change from red & yellow(s)--
  18. constant time_GR   :integer := 2700;
  19. --time of light change from green & red(s)--
  20. constant time_YR   :integer := 300;
  21. --time of light change from yellow & red(s)--
  22. constant time_test :integer := 60;
  23. --time for test mode(s)--

  24. type state is (state_RY,state_GR,state_YR,state_RG,state_YY);
  25. signal Pr_state,Nx_state: state;
  26. signal time: integer range 0 to time_max;

  27. begin
  28. --lower section of state machine--
  29. process(clk,standby)
  30.         variable count: integer range 0 to time_max;
  31.         begin
  32.         if (standby = '1') then
  33.                 Pr_state <= state_yy;
  34.         elsif (clk'event and clk= '1') then
  35.                 count := count +1;
  36.                 if (count = time ) then
  37.                 Pr_state <= Nx_state;
  38.                 count := 0;
  39.                 end if;
  40.         end if;
  41. end process;

  42. --upper section of state machine--
  43. process(pr_state,test)
  44.         begin
  45.         case pr_state is
  46.         --state_RY--
  47.         when state_RY =>
  48.         R1 <= '1'; G1 <= '0'; Y1 <= '0';
  49.         R2 <= '0'; G2 <= '0'; Y2 <= '1';
  50.         Nx_state <= state_GR;
  51.         if (test = '0') then time <= time_RY;
  52.         else time <= time_test;
  53.         end if;
  54.         --state_GR--
  55.         when state_GR =>
  56.         R1 <= '0'; G1 <= '1'; Y1 <= '0';
  57.         R2 <= '1'; G2 <= '0'; Y2 <= '0';
  58.         Nx_state <= state_YR;
  59.         if (test = '0') then time <= time_GR;
  60.         else time <= time_test;
  61.         end if;
  62.         --state_YR--
  63.         when state_YR =>
  64.         R1 <= '0'; G1 <= '0'; Y1 <= '1';
  65.         R2 <= '1'; G2 <= '0'; Y2 <= '0';
  66.         Nx_state <= state_RG;
  67.         if (test = '0') then time <= time_YR;
  68.         else time <= time_test;
  69.         end if;
  70.         --state_RG--
  71.         when state_RG =>
  72.         R1 <= '1'; G1 <= '0'; Y1 <= '0';
  73.         R2 <= '0'; G2 <= '1'; Y2 <= '0';
  74.         Nx_state <= state_RY;
  75.         if (test = '0') then time <= time_RG;
  76.         else time <= time_test;
  77.         end if;
  78.         when others =>
  79.         R1 <= '0'; G1 <= '0'; Y1 <= '1';
  80.         R2 <= '0'; G2 <= '0'; Y2 <= '1';
  81.         Nx_state <= state_RY;
  82.         end case;
  83. end process;
  84. end Behavioral;
复制代码
0条回答

一周热门 更多>