【问题标题】:Signal temp2 cannot be synthesized, bad synchronous description信号 temp2 无法合成,同步描述错误
【发布时间】:2017-01-05 18:21:22
【问题描述】:
entity timer is
    Port ( click : in  STD_LOGIC;
           clear : out  STD_LOGIC;
           t_unlock : out  STD_LOGIC);
end timer;

architecture Behavioral of timer is
    signal temp2 : integer range 0 to 20 := 0;
begin
    process
    begin
        if rising_edge(click) then
            temp2<=0;
            clear<='0';
            t_unlock<='0';
        else
            temp2<=temp2+1 after 15 ns;
        end if;
        if temp2=6 then
            clear<='1';
        elsif temp2=20 then
            t_unlock<='1';
        end if;
    end process;
end Behavioral;

我写了这段代码。编译器说:

Signal temp2 cannot be synthesized, bad synchronous description. The description style you are using to describe a synchronous element (register, memory, etc.) is not supported in the current software release.

我在stackoverflow上搜索过。他们说The error 'bad synchronous description' usually means that you have described a register (clocked element) that does not exist in the hardware.但我不知道如何解决我的问题。

【问题讨论】:

  • 将信号 click & temp2 添加到敏感列表中,并在 15 ns 后删除 。你用什么合成的?

标签: vhdl


【解决方案1】:

VHDL 必须遵循一些综合工具特定的编码指南,以便该工具能够将 VHDL 代码转换为 FPGA 实现。对于异步复位触发器的实现,样式可以是:

process (clk, rst) is
begin
  -- Clock
  if rising_edge(clk) then
    ... -- Update at clock
  end if;
  -- Asynchronous reset
  if rst = '1' then
    ... -- Update at reset
  end if;
end process;

就您的代码而言,您似乎没有使用异步重置,因此模板可能会简化为:

process (clk) is
begin
  if rising_edge(clk) then
    ... -- Update at clock
  end if;
end process;

现在的练习是让您将代码适合该模板,不幸的是,根据提供的代码很难确定确切的意图。

【讨论】:

  • 当然应该是这样的形式;如果重置然后--- elsifrising_edge(clk) 然后--- 如果结束。否则你会抛出一个多驱动错误?
  • 不,if rst = '1' then ... elsif rising_edge(clk) then ... end if; 形式意味着未由复位部分驱动的信号必须在复位时保持稳定,即使在 clk 上升时也是如此,因为那时永远不会到达时钟部分。这需要保持/锁存操作,这可能不是本意。使用if rising_edge(clk) then ... end if; if rst = '1' then ... end if; 形式,未通过复位更新的信号只能通过时钟更新,这与普通触发器操作相匹配。不会有多个驱动程序,因为所有驱动程序都在同一个进程中。
  • 非常感谢 - 巧合的是,它与我正在处理的问题几乎完全相同!
  • @MortenZilmer 两种形式都产生相同的硬件......你提到的区别是概念性的,但不是真实的。不会推断保持/锁存。
  • @JHBonarius 提到的是真的吗?即使您执行“if rst .. elsif”舞蹈,它是否不会推断出闩锁而是带有异步重置的实际翻转?还是取决于综合工具的聪明才智,回答的代码更惯用,因此可以使用更多的综合工具?
【解决方案2】:

您的代码似乎混合了 HDL 和“软件”语言的概念。我不确定它应该做什么,但我会将它重构为下面的代码

architecture Behavioral of timer is
    constant COUNTER_VALUE_TO_REACH_15ns : integer := <some value>;

    signal temp2   : integer range 0 to 20 := 0;
    signal divider : std_logic_vector(7 downto 0) := (others => '0');
begin
    process
    begin
        -- Everything happens when the clock ticks, except for reset
        if rising_edge(click) then
            temp2    <= 0;
            clear    <= '0';
            t_unlock <= '0';

            -- Count how many cycles until we need to increment temp2
            if divider = COUNTER_VALUE_TO_REACH_15ns then
                temp2   <= temp2 + 1;
                divider <= (others => '0'); -- Reset the counter when we reach the required amount of time
            else
                divider <= divider + 1;
            end if;

            if temp2 = 6 then
                clear <= '1';
            elsif temp2 = 20 then
                t_unlock <= '1';
            end if;

        else
        end if;
    end process;
end Behavioral;

【讨论】:

  • 此代码包含许多错误。我提出了修改建议,但被拒绝了。
猜你喜欢
  • 2014-10-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-15
相关资源
最近更新 更多