无法推断寄存器... at ...,因为它在时钟边沿之外不保存其值
这肯定是刚接触 VHDL 的人最常见的问题,但我不明白我在这里做错了什么!这似乎符合我在正确的状态机设计中看到的所有习惯用法。我正在 Altera Quartus 9.2 中进行编译,无论其价值如何。实际错误是:
“无法推断 [文件] [行] 处的“spiclk_out”寄存器,因为它在时钟边缘之外不保存其值”
ENTITY spi_state_machine IS
PORT(
spiclk_internal : IN STD_LOGIC;
reset : IN STD_LOGIC;
spiclk_out : BUFFER STD_LOGIC
);
END spi_state_machine;
PROCESS(spiclk_internal, reset)
BEGIN
IF reset = '1' THEN
spiclk_out <= '0';
END IF;
IF spiclk_internal = '1' AND spiclk_internal'EVENT THEN --error here
spiclk_out <= NOT spiclk_out;
END IF;
END PROCESS;
感谢您的宝贵时间。
This must be the most common problem among people new to VHDL, but I don't see what I'm doing wrong here! This seems to conform to all of the idioms that I've seen on proper state machine design. I'm compiling in Altera Quartus 9.2, for what it's worth. The actual error is:
"Can't infer register for "spiclk_out" at [file] [line] because it does not hold its value outside the clock edge"
ENTITY spi_state_machine IS
PORT(
spiclk_internal : IN STD_LOGIC;
reset : IN STD_LOGIC;
spiclk_out : BUFFER STD_LOGIC
);
END spi_state_machine;
PROCESS(spiclk_internal, reset)
BEGIN
IF reset = '1' THEN
spiclk_out <= '0';
END IF;
IF spiclk_internal = '1' AND spiclk_internal'EVENT THEN --error here
spiclk_out <= NOT spiclk_out;
END IF;
END PROCESS;
Thanks for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如所写,即使
reset
处于活动状态,该过程也会导致spiclk_out
在spiclk_internal
边沿进行切换,这不是异步复位触发器的方式应该表现。你可能想要的是
As written, the process would cause
spiclk_out
to toggle onspiclk_internal
edges even whenreset
is active, which is not how flip-flops with asynchronous resets should behave.What you probably want is