VHDL:if语句内部用于生成



在VHDL中的for generate语句中写入if语句有效吗?

例如

architecture Behavioral of top_level is
begin
label: for ii in 0 to (width - 1) generate
if ii = 0 then
... do this
end if;
end generate;
end Behavioral;

这会产生语法错误warning: syntax error near if,所以我想知道if语句是否不能嵌套在VHDL中的for-generate语句中。

如果是,还有其他方法吗?

您需要使用if..generate进行条件生成。if..then只能在过程代码中使用,即在processfunctionprocedure中使用。

最新更新