Verilog 导致非法左值的部分选择

Verilog 导致非法左值的部分选择,verilog,xilinx,Verilog,Xilinx,下面我有一个Verilog项目,它实现了一个LSFR。目前,Xilinx ISE 14.6中的代码无法正确编译。它的错误是: ERROR:HDLCompilers:108 - "top.v" line 70 Part-select of scalar wire array 'q' is illegal ERROR:HDLCompilers:107 - "top.v" line 70 Illegal right hand side of nonblocking assignment ERROR:H

下面我有一个Verilog项目,它实现了一个LSFR。目前,Xilinx ISE 14.6中的代码无法正确编译。它的错误是:

ERROR:HDLCompilers:108 - "top.v" line 70 Part-select of scalar wire array 'q' is illegal
ERROR:HDLCompilers:107 - "top.v" line 70 Illegal right hand side of nonblocking assignment
ERROR:HDLCompilers:108 - "top.v" line 74 Part-select of scalar wire array 'q' is illegal
ERROR:HDLCompilers:107 - "top.v" line 74 Illegal right hand side of nonblocking assignment
这在我的代码中指向这一点:

always @ (display) begin
    if(display == 1'b0) begin
        LSB <= q[3:0]; 
        switch <= LSB; 
    end
    else begin
        MSB <= q[7:4];
        switch <= MSB;
    end
end
始终@(显示)开始
如果(显示==1'b0)开始
LSB尝试更改:

wire q[7:0];
wire q_[7:0]; 
致:


这为我清除了编译错误。

您应该考虑将
始终@(显示)
替换为
始终@*
,因为这是一个不完整的灵敏度列表,您的RTL模拟和门级(合成后)结果可能不匹配。
wire q[7:0];
wire q_[7:0]; 
wire [7:0] q;
wire [7:0] q_;