代码之家  ›  专栏  ›  技术社区  ›  el pass

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

  •  0
  • el pass  · 技术社区  · 8 年前

    我是verilog的新手,但我不明白为什么对信号(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 回复  |  直到 8 年前
        1
  •  2
  •   Greg dave_59    8 年前

    A. wire 是nettype,并且不能在 always 块或 initial 阻碍。
    改变 subcounter_of_counter 从…起 金属丝 reg 规则 是逻辑类型的关键字,并不明确表示它将合成到寄存器。