在 VHDL 进程中使用敏感度列表实现可靠的 RTL 设计
在生产级 VHDL 中,进程通常由敏感度列表驱动,而非 虽然 编写仿真代码时,我总依赖 带敏感度列表的进程语法如下: 注意:进程内读取的每个信号都必须出现在列表中。VHDL 编译器不会标记缺失信号,但遗漏会导致综合后行为改变。 VHDL‑2008 引入关键字 在配套视频教程中,我们演示了如何构建一个使用敏感度列表的进程。 本课生成的最终 VHDL 代码片段: 在 ModelSim 中运行该测试平台得到: 控制台输出表明 实践中,敏感度列表是可综合 RTL 的事实标准。它们意图明确,让综合工具生成正确硬件,避免 继续下一教程 这里。wait 语句。敏感度列表枚举了所有应在发生变化时唤醒进程的信号。wait on 和 wait until 便于仿真,但很少用于可综合的 RTL。在综合中,wait 语句常被忽略,导致不可预测的硬件行为。相反,敏感度列表直接映射到组合逻辑或时序同步块,综合工具能可靠地实现它们。基础 VHDL 教程 – 进程敏感度
wait 语句控制时序。但对于将综合成硅片的设计,我完全避免使用 wait,改用敏感度列表。process( signal1, signal2, ... ) is
begin
-- 主要逻辑
end process;
all 自动包含所有读取信号,如 process(all)。但大多数商业综合工具仍不支持该特性。练习
entity T09_SensitivityListTb is end entity;
architecture sim of T09_SensitivityListTb is
signal CountUp : integer := 0;
signal CountDown : integer := 10;
begin
process is
begin
CountUp <= CountUp + 1;
CountDown <= CountDown - 1;
wait for 10 ns;
end process;
-- 使用 Wait On 触发的进程
process is
begin
if CountUp = CountDown then
report "Process A: Jackpot!";
end if;
wait on CountUp, CountDown;
end process;
-- 等效的敏感度列表进程
process(CountUp, CountDown) is
begin
if CountUp = CountDown then
report "Process B: Jackpot!";
end if;
end process;
end architecture;
VSIM 2> run
# ** Note: Process A: Jackpot!
# Time: 40 ns Iteration: 1 Instance: /t09_sensitivitylisttb
# ** Note: Process B: Jackpot!
# Time: 40 ns Iteration: 1 Instance: /t09_sensitivitylisttb
分析
wait on 进程与敏感度列表进程在完全相同条件下触发。这种等价性成立是因为敏感度列表隐式表现为放在进程末尾的 wait on。wait 语句可能引入的歧义。
关键要点
wait on 结尾的进程。wait 语句;可综合 RTL 应使用敏感度列表。
VHDL