在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
只能在过程代码中使用,即在process
、function
或procedure
中使用。