vhdl - 无法推断寄存器...在...,因为它在时钟边沿之外不保存其值

标签 vhdl fpga intel-fpga

这肯定是刚接触 VHDL 的人最常见的问题,但我不明白我在这里做错了什么!这似乎符合我在正确的状态机设计中看到的所有习惯用法。我正在 Altera Quartus 9.2 中进行编译,无论其值(value)如何。实际错误是:

“无法推断 [文件] [行] 处的“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;

感谢您的宝贵时间。

最佳答案

正如所写,即使reset处于事件状态,该过程也会导致spiclk_outspiclk_internal边缘上切换,这不是触发器的工作方式异步重置应该表现良好。

你可能想要的是

SPICLK: process(spiclk_internal, reset)
    if reset = '1' then
        spiclk_out <= '0';
    elsif spiclk_internal'event and spiclk_internal='1' then
        spiclk_out <= not spiclk_out;
    end if;
end process SPICLK;

关于vhdl - 无法推断寄存器...在...,因为它在时钟边沿之外不保存其值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5986966/

相关文章:

linux-kernel - Linux 驱动程序 DMA 传输到以 PC 为主的 PCIe 卡

VHDL block 和 protected 输入 - 此代码的作用是什么?

vhdl - 具有行为架构的桶形移位器的 VHDL 代码结构

architecture - VHDL : How to clock Register File, 数据存储器和 PC 中的 MIPS 架构

vhdl - 如何使用脚本在 Digilent Xilinx FPGA 板上的 PROM 中闪存比特流文件?

FPGA时序问题

verilog - 使用串联和大小写时,移位器输出始终为 0

linux - QuartusII 14.1.0 Debian Linux 崩溃

c - 如何在 Nios 2 中打印一个整数?

variable-assignment - 如何从 VHDL 中的内部架构写入两个输出端口?