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;
Run Code Online (Sandbox Code Playgroud)
我写了这段代码,编译器说:
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.
Run Code Online (Sandbox Code Playgroud)
我搜索了stackoverflow,他们说``错误的同步描述错误''通常意味着您描述了一个硬件中不存在的寄存器(时钟元素)。但是我不知道如何解决我的问题。
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;
Run Code Online (Sandbox Code Playgroud)
就您的代码而言,您似乎没有使用异步重置,因此模板可以简化为:
process (clk) is
begin
if rising_edge(clk) then
... -- Update at clock
end if;
end process;
Run Code Online (Sandbox Code Playgroud)
现在,练习是使您的代码适合该模板,但是很遗憾,很难根据提供的代码确定确切的意图。
| 归档时间: |
|
| 查看次数: |
1078 次 |
| 最近记录: |