verilog,为什么这是非法引用网

时间:2016-11-12 23:10:00

标签: verilog hdl digital digital-logic

我是verilog的新手,但我不明白为什么这是非法引用net for signal(subcounter_of_counter)。我的意思是它的组合逻辑

提前感谢:)

wire [n-1:0] subcounter_of_counter;
reg [n-1:0] mask,free;     
always @(*) begin //command or id or mask or free or subcounter_of_counter
        if (command==increment) begin
            for (int i = 0; i < n; i=i+1)begin
                if (i<id) begin
                    subcounter_of_counter[i]=1'b0;
                end else if (i==id) begin
                    subcounter_of_counter[i]=1'b1;
                end else begin
                    if( (|mask[id+1:i]) || (|free[id+1:i]) ) begin
                        subcounter_of_counter[i]=1'b0;
                    end else begin
                        subcounter_of_counter[i]=1'b1;
                    end
                end
            end
        end
        end

1 个答案:

答案 0 :(得分:2)

wire是网络类型,无法在always块或initial块中分配网络类型。
subcounter_of_counterwire更改为reg以解决您的问题。 reg是逻辑类型的关键字,并不明确表示它将合成到寄存器。