简体   繁体   English

不允许同时分配给非网络“_”

[英]Concurrent assignment to a non-net '_' is not permitted

I'm getting the error:我收到错误:

concurrent assignment to a non-net 'A' is not permitted
concurrent assignment to a non-net 'B' is not permitted 
Static elaboration of top level Verilog design unit(s) in library work failed.

What am I doing wrong?我究竟做错了什么?

module ex1( input reg [1:0] a,
input reg [1:0]b,
output wire c,
);
assign c=(a>b)?(a=1'b1):(c=1'b0);     
endmodule 

  module testbench(
    );
    reg[1:0]a=2'b11;
    reg [1:0]b=2'b00;
    wire c;
    always#10
    begin
    a=a-2'b01;
    b=b-2'b01;
    end
    initial
    #150 $finish;
    ex1 testbench2 (.a(a),
    .b(b),.c(c));
    endmodule

I get 3 syntax errors in your ex1 module.我在您的ex1模块中收到 3 个语法错误。

The trailing comma in a port list is illegal.端口列表中的尾随逗号是非法的。 Change:改变:

output wire c,

to:至:

output wire c

It is illegal to assign a value to an input port inside a module.给模块内部的输入端口赋值是非法的。 This is illegal: a=1'b1 .这是非法的: a=1'b1 Assuming it was a typo to use a there, and you really meant to type c , you should change:假设在此处使用a是一个错字,并且您真的打算输入c ,您应该更改:

assign c=(a>b)?(a=1'b1):(c=1'b0);     

to:至:

assign c = (a>b) ? 1'b1 : 1'b0;     

You typically never want to make an assignment inside a conditional operator like your code does.您通常不想像您的代码那样在条件运算符中进行赋值。

One simulator also complains about declaring an input port as a reg type.一个模拟器还抱怨将input端口声明为reg类型。 You should omit reg for a and b .您应该为ab省略reg Here is the recoded module:这是重新编码的模块:

module ex1 (
    input [1:0] a,
    input [1:0] b,
    output wire c
);
    assign c = (a>b) ? 1'b1 : 1'b0;     
endmodule 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在verilog中的模块调用中不允许并发分配给非网络端口 - concurrent assignment to a non-net port is not permitted in module call in verilog 什么是“并发分配给非网络<port_name>不允许” Verilog 模拟错误? - What is "concurrent assignment to a non-net <port_name> is not permitted" Verilog simulation error? 错误“不允许对非注册结果进行程序性分配” - Error “procedural assignment to a non-register result is not permitted” 调试错误“不允许向非寄存器k进行过程分配” - Debugging error “procedural assignment to a non-register k is not permitted” 使用for循环时出错[不允许将过程分配给非寄存器i] - Error using for loop [procedural assignment to a non-register i is not permitted] 不允许对非寄存器 trig_i_a 进行 Synth 8-2576 程序分配 - Synth 8-2576 procedural assignment to a non-register trig_i_a is not permitted “并发分配或输出端口连接的目标应该是网络类型” - "Target of concurrent assignment or output port connection should be a net type" 错误:[Synth 8-2576]程序分配给非寄存器操作数是不允许的 - Error: [Synth 8-2576] procedural assignment to a non-register operand is not permitted Verilog中的并发分配错误 - Concurrent assignment error in verilog 不允许对非寄存器 shifty 进行程序分配,左侧应该是 reg/integer/time/genvar——这是我得到的错误 - Procedural assignment to a non-register shiftedy is not permitted, left-hand side should be reg/integer/time/genvar -- this is the error I am getting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM