我是SystemVerilog的新手,我使用SystemVerilog。我试着设计一个简单的FSM来练习,但是我一直遇到这样的错误:
错误:赋值语句l-值中的语法
module primoex (input logic clk, reset, x,
output logic y);
enum reg [1:0] {S0, S1, S2} stati;
reg [1:0] stato, statoprox;
always_ff@(posedge clk, posedge reset)
if(reset) stato = S0;
else stato <= statoprox;
always_comb
case (stato)
S0: statoprox = x? S1 : S0;
S1: statoprox = x? S2 : S0;
S2: statoprox = x? S2 : S0;
default= S0;
endcase
assign y = S1 & ~S0;
endmodule发布于 2021-02-08 20:08:58
在case语句中,使用default关键字代替其他大小写项值;不能为其赋值。您仍然需要使用要分配的信号名。
更改:
default= S0;至:
default statoprox = S0;此代码在多个模拟器上在操场上编译。你可以注册一个免费帐户。
它没有在Icarus上编译,但是您可能有不同的版本。我看到与您报告的编译错误不同。请记住,Icarus并不支持所有SystemVerilog特性。
https://stackoverflow.com/questions/66108561
复制相似问题