FF /锁存:信号(xxx)的常数值为0 - VHDL综合

时间:2013-12-20 17:12:52

标签: vhdl xilinx synthesis

此问题之前已被问过,但我仍然无法解决代码中的问题。我的代码有什么问题,这是警告吗?

use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.all;

use work.switch_param.all;


entity fault_gen is
port (
  clk           : in  std_logic;
  rst           : in  std_logic;
  buff_free     : in  std_logic;
  i_fault_gen   : in  std_logic_vector(NUM_PORTS -1 downto 0);
  o_sel         : out std_logic_vector(NUM_PORTS -1 downto 0);
  o_valid       : out std_logic;
  o_fault_gen   : out flit_t
  );
end fault_gen;

architecture Behavioral of fault_gen is
type ftgen_state is (idle, compt, final);
signal current_state, next_state : ftgen_state;
signal ft_current, ft_next : flit_t;
signal temp_gen : std_logic_vector(FT_INFO_BITS - 1 downto 0);
signal enable : std_logic;

begin
proc_state: process(clk, rst)
begin 
    if (rst = '1') then
        current_state <= idle;
        ft_current <= (others => '0');
    elsif (clk'event and clk='1') then
        current_state <= next_state;
        ft_current <= ft_next;
    end if;
end process proc_state;


proc_fault: process(current_state, ft_current, i_fault_gen, buff_free)
begin
    temp_gen <= (others => '0');
    o_sel <= (others => '0');
    o_valid <= '0';
    enable <= '0';
    ft_next <= ft_current;

    case current_state is

      when idle     =>
        if (buff_free = '1')  then
            if (i_fault_gen = (i_fault_gen'range => '0')) then
                next_state <= idle;
            else
                next_state <= compt;
            end if;
        else
          next_state <= idle;
        end if;

      when compt    =>
        next_state <= final;
        ftgen_inst: for i in NUM_PORTS -1 downto 0 loop
            if (i_fault_gen(i) = '1')  then
              temp_gen <= std_logic_vector(to_unsigned(i,FT_INFO_BITS));
              o_sel(i) <= '1';
              enable <= '1';
              exit ftgen_inst;
            end if;
        end loop;  -- i

      when final    =>
        next_state <= idle;
        if (enable = '1') then
            ft_next <= FT_INFO & link_fault & temp_gen & switch_ID & reserved_bits;
            o_valid <= '1';
        else
            next_state <= idle;
        end if;

      when others   =>
        next_state <= idle;

    end case;
end process proc_fault;

o_fault_gen <= ft_current;    

end Behavioral;

在此程序中,信号temp_gen的值正在变化,其余参数不变。

开关参数是:

package switch_param is
constant NUM_PORTS    : natural       := 5;
constant FLIT_WIDTH   : natural:= 36;
subtype flit_t is std_logic_vector(FLIT_WIDTH - 1 downto 0);
constant FT_INFO : std_logic_vector(3 downto 0) := "0011";
constant link_fault : std_logic_vector(2 downto 0) := "000";
constant reserved_bits : std_logic_vector(17 downto 0) := (others => '0');
constant FT_INFO_BITS : integer := 3;
constant switch_ID : std_logic_vector(7 downto 0)       := "11111111";    -- switch ID

end switch_param;

警告是:

WARNING:Xst:2404 -  FFs/Latches <ft_current<35:34>> (without init value) have a constant value of 0 in block <fault_gen>.
WARNING:Xst:1710 - FF/Latch <ft_current_31> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_30> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_29> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_17> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_16> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_15> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_14> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_13> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_12> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_11> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_10> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_9> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_8> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_7> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_6> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_5> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_4> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_3> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_2> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_1> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_0> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1710 - FF/Latch <ft_current_18> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_26> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_27> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_28> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1710 - FF/Latch <ft_current_18> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_26> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_27> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_28> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1710 - FF/Latch <ft_current_18> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_26> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_27> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_28> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1710 - FF/Latch <ft_current_18> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_26> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_27> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <ft_current_28> (without init value) has a constant value of 0 in block <fault_gen>. This FF/Latch will be trimmed during the optimization process.

1 个答案:

答案 0 :(得分:2)

从包裹值中我生成了这个:

    -- Field      Size              Contents         ft_next range   static?
    ------------------------------------------------------------------------
    -- FT_INFO    (3 downto 0)      "0011"            35 downto 32 static
    -- link_fault (2 downto 0)      "000"             31 downto 29 static
    -- temp_gen   (2 downto 0)      "011"             28 downto 26 changeable
    -- switch_ID  (7 downto 0)      "11111111"        25 downto 18 static
    -- reserved_bits (17 downto 0)  (other s=> '0')   17 downto 0  static


       ft_next <= FT_INFO & link_fault & temp_gen & switch_ID & reserved_bits;

只有三个非静态位分配给ft_next(temp_gen - 可能的值“100”,“011”,“010”,“001”和“000”)。

所有其余的局部静态(在分析时已知),这意味着它们不需要触发器。你最终得到了三个。

我最初得到了向后TO_UNISIGNED参数的顺序,但在完成之后(并且它告诉你验证你在答案中依赖的所有内容)你会注意到循环:

  when compt    =>
    next_state <= final;
    ftgen_inst: for i in NUM_PORTS -1 downto 0 loop
        if (i_fault_gen(i) = '1')  then
          temp_gen <= std_logic_vector(to_unsigned(i,FT_INFO_BITS));
          o_sel(i) <= '1';
          enable <= '1';
          exit ftgen_inst;
        end if;
    end loop;  -- i

在流程语句中分配信号的一个特征是信号只有一个未来值。这意味着最后一个带有'1'的fault_gen(i)是实际报告的那个,优先级递增到0。你可以考虑将temp_gen替换为i_fault_gen,这是不可接受的。

无论如何,你定义ft_next的方式,只需要三个触发器,其余的位都是静态的。