为什么 iverilog 会为 always_ff 生成语法错误?
Why does iverilog generate a syntax error for always_ff?
我最近开始使用 System Verilog,我对一个语法错误感到有点傻眼。给定以下模块:
test.sv :
module test(
input logic clk,
output logic out );
always_ff @(posedge clk) begin
out = 1'b1;
end
endmodule
使用 iverilog -g2012 test.sv
编译时,会为第 5 行 (always_ff) 生成一个简单的 syntax-error
。我不知道为什么会这样,因为我的语法似乎是正确的。
语法对于 SystemVerilog 是正确的,但并非所有 iverilog
版本都支持它。来自 Release Notes of Icarus Verilog 11
The following SystemVerilog language features are now supported:
the always_comb, always_ff, and always_latch constructs
如果你没有使用这个版本,你应该升级。
您的代码可以在 edaplayground 上的其他模拟器上编译。
或者,您不需要使用 always_ff
。您仍然可以使用 always
:
always @(posedge clk) begin
out <= 1'b1;
end
我将您的分配更改为非阻塞 (<=
),建议用于顺序逻辑。
我最近开始使用 System Verilog,我对一个语法错误感到有点傻眼。给定以下模块:
test.sv :
module test(
input logic clk,
output logic out );
always_ff @(posedge clk) begin
out = 1'b1;
end
endmodule
使用 iverilog -g2012 test.sv
编译时,会为第 5 行 (always_ff) 生成一个简单的 syntax-error
。我不知道为什么会这样,因为我的语法似乎是正确的。
语法对于 SystemVerilog 是正确的,但并非所有 iverilog
版本都支持它。来自 Release Notes of Icarus Verilog 11
The following SystemVerilog language features are now supported:
the always_comb, always_ff, and always_latch constructs
如果你没有使用这个版本,你应该升级。
您的代码可以在 edaplayground 上的其他模拟器上编译。
或者,您不需要使用 always_ff
。您仍然可以使用 always
:
always @(posedge clk) begin
out <= 1'b1;
end
我将您的分配更改为非阻塞 (<=
),建议用于顺序逻辑。