错误:[VRFC 10-1145]非网络端口d_x不能在Verilog中出现模式错误

发布于 2025-02-02 06:24:36 字数 1996 浏览 5 评论 0原文

我正在编写一条代码,以通过NOC的North Last Routing在NOC中找到一条路径。我尚未将任何输入声明为INOUT,但仍显示下面给出的错误。从字面上看我编写的所有代码,此错误正在弹出。问题在哪里?

我在这里提供我的代码和测试台。

代码:

timescale 1ns / 1ps



module mesh  (
input  [15:0] a,
input  [1:0] c_x,
input  [1:0] c_y ,
output [3:0] port
    ); 
 
  reg d_x=0,d_y=0,s_x=0,s_y=0;
    
 always @ (a or c_x or c_y)//when cx or cy changes, this loop happens 
 begin
  d_x=a[1:0];// x coordinate of destination address
  d_y=a[3:2];//y coordinate of destination address
 s_x=a[5:4];// x coordinate of source addres
  s_y=a[7:6];// y coordinate of source addres
 
comp u1(
    .a(a),
    .c_x(c_x),
    .c_y(c_y),
    .port(port)
);
  
     
       end                   
endmodule

TestBench:

`timescale 1ns / 1ps


module north_tb(
reg  [15:0] a,
reg [1:0] c_x,
reg [1:0] c_y ,
wire [3:0] port
 
    );
    
 mesh u1(
 .a(a),
 .c_x(c_x),
 .c_y(c_y),
 .port(port)
 );
    
  initial 
  begin  
    a[15:0] = 16'b100110101001010;//
    c_x=2'b01;
    c_y =2'b00;
    #5
    c_x=2'b01;
    c_y =2'b01;
    #5
    c_x=2'b01;
    c_y =2'b10;
    #5
    c_x=2'b10;
    c_y =2'b10;
    #5
          
    
 
                  
  
  $finish;                  
                    
                    
                    


end
endmodule

以下是错误消息:

ERROR: [VRFC 10-1145] non-net port d_x cannot be of mode inout [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:4]
ERROR: [VRFC 10-1145] non-net port d_y cannot be of mode inout [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:5]
ERROR: [VRFC 10-1145] non-net port c_x cannot be of mode inout [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:6]
ERROR: [VRFC 10-1145] non-net port c_y cannot be of mode inout [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:7]
ERROR: [VRFC 10-1040] module comp_tb ignored due to previous errors [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:3]

I am writing a code for finding a path by north last routing in NOC. I have not declared any of the inputs as inout but still the error given below is shown. This error is popping up for literally all of the codes I write. Where is the problem?

I am providing my code and testbench here.

code:

timescale 1ns / 1ps



module mesh  (
input  [15:0] a,
input  [1:0] c_x,
input  [1:0] c_y ,
output [3:0] port
    ); 
 
  reg d_x=0,d_y=0,s_x=0,s_y=0;
    
 always @ (a or c_x or c_y)//when cx or cy changes, this loop happens 
 begin
  d_x=a[1:0];// x coordinate of destination address
  d_y=a[3:2];//y coordinate of destination address
 s_x=a[5:4];// x coordinate of source addres
  s_y=a[7:6];// y coordinate of source addres
 
comp u1(
    .a(a),
    .c_x(c_x),
    .c_y(c_y),
    .port(port)
);
  
     
       end                   
endmodule

testbench:

`timescale 1ns / 1ps


module north_tb(
reg  [15:0] a,
reg [1:0] c_x,
reg [1:0] c_y ,
wire [3:0] port
 
    );
    
 mesh u1(
 .a(a),
 .c_x(c_x),
 .c_y(c_y),
 .port(port)
 );
    
  initial 
  begin  
    a[15:0] = 16'b100110101001010;//
    c_x=2'b01;
    c_y =2'b00;
    #5
    c_x=2'b01;
    c_y =2'b01;
    #5
    c_x=2'b01;
    c_y =2'b10;
    #5
    c_x=2'b10;
    c_y =2'b10;
    #5
          
    
 
                  
  
  $finish;                  
                    
                    
                    


end
endmodule

following is the error message:

ERROR: [VRFC 10-1145] non-net port d_x cannot be of mode inout [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:4]
ERROR: [VRFC 10-1145] non-net port d_y cannot be of mode inout [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:5]
ERROR: [VRFC 10-1145] non-net port c_x cannot be of mode inout [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:6]
ERROR: [VRFC 10-1145] non-net port c_y cannot be of mode inout [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:7]
ERROR: [VRFC 10-1040] module comp_tb ignored due to previous errors [D:/Vivado/northlast/northlast.srcs/sim_1/new/comp_tb.v:3]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

昇り龍 2025-02-09 06:24:36

TestBench的通常没有端口。
模拟器不喜欢发布的TestBench使用端口访问测试设计的方式(DUT)。

测试台访问DUT的方法是使用在测试台中本地声明的信号。

这样:

// testbench module does not have ports
module north_tb();    

  // use local signals to access the DUT
  reg  [15:0] a  ;
  reg [1:0] c_x  ;
  reg [1:0] c_y  ;
  wire [3:0] port;  
    
 mesh u1(
 .a(a),
 .c_x(c_x),
 .c_y(c_y),
 .port(port)
 );
  initial 
  begin  
    a[15:0] = 16'b100110101001010;//
    c_x=2'b01;
    c_y =2'b00;
    #5
    c_x=2'b01;
    c_y =2'b01;
    #5
    c_x=2'b01;
    c_y =2'b10;
    #5
    c_x=2'b10;
    c_y =2'b10;
    #5

  $finish;                  
end
endmodule

该帖子在网格模块中存在问题。它实例化了一个称为Comp的模块,该模块在帖子中未提供。我认为这不是触发帖子的问题。

我认为问题是试图在测试台模块上拥有端口,并期望它们充当本地信号。

可以是,您编写的所有代码都在测试板上都有端口吗?

在网格模块中,此陈述是有害的,原因有两个。

 always @ (a or c_x or c_y)//when cx or cy changes, this loop happens 

建议是用

always @ (*)

Testbench's generally do not have ports.
The simulator does not like the way the posted testbench is using ports for access to design under test (DUT).

The way for the testbench to access the DUT is by using signals declared locally in the testbench.

Like this:

// testbench module does not have ports
module north_tb();    

  // use local signals to access the DUT
  reg  [15:0] a  ;
  reg [1:0] c_x  ;
  reg [1:0] c_y  ;
  wire [3:0] port;  
    
 mesh u1(
 .a(a),
 .c_x(c_x),
 .c_y(c_y),
 .port(port)
 );
  initial 
  begin  
    a[15:0] = 16'b100110101001010;//
    c_x=2'b01;
    c_y =2'b00;
    #5
    c_x=2'b01;
    c_y =2'b01;
    #5
    c_x=2'b01;
    c_y =2'b10;
    #5
    c_x=2'b10;
    c_y =2'b10;
    #5

  $finish;                  
end
endmodule

The post has a problem in the mesh module. It instantiates a module called comp which is not provided in the post. I don't think this is the problem that triggered post though.

I think the problem is trying to have ports on the testbench module, and expecting them to function as local signals.

Could in be that all the code you write have ports on the testbenches?

In the mesh module this statement is bad for a couple of reasons.

 always @ (a or c_x or c_y)//when cx or cy changes, this loop happens 

A recommendation is to replace it with

always @ (*)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文