首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FF/闩锁:信号(xxx)的恒定值为0- VHDL合成。

FF/闩锁:信号(xxx)的恒定值为0- VHDL合成。
EN

Stack Overflow用户
提问于 2013-12-20 17:12:51
回答 1查看 9.2K关注 0票数 0

这个问题已经问过了,但是我仍然无法在我的代码中解决这个问题。在我的代码中有什么不对,它会发出这些警告吗?

代码语言:javascript
复制
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的值是变化的,其余的参数是恒定的。

开关参数如下:

代码语言:javascript
复制
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;

警告如下:

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-12-21 17:56:11

我从您的包值中生成了以下内容:

代码语言:javascript
复制
    -- 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的参数顺序,但在得到了这个顺序(它告诉您验证您在回答中所依赖的所有内容)之后,您会注意到这个循环:

代码语言:javascript
复制
  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的方式,只需要三个触发器,其余的位都是静态的。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20708668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档