【问题标题】:verilog, why is this illegal reference to netverilog,为什么这是对网络的非法引用
【发布时间】:2016-11-12 23:09:59
【问题描述】:

我是 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

【问题讨论】:

    标签: verilog hdl digital digital-logic


    【解决方案1】:

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

    【讨论】:

    猜你喜欢
    • 2013-02-17
    • 1970-01-01
    • 1970-01-01
    • 2012-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-12
    相关资源
    最近更新 更多