集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 3592|回复: 1

inout使用中出现Illegal output or inout port connection (port 'a_in').

[复制链接]
wodexiaobobo 发表于 2011-9-25 14:12:56 | 显示全部楼层 |阅读模式
在练习verilog时碰到这样一个问题
# ** Error: (vsim-3053) testTOP.v(19): Illegal output or inout port connection (port 'a_in').
#         Region: /testTOP_v/test6
# ** Error: (vsim-3053) testTOP.v(19): Illegal output or inout port connection (port 'b_in').
#         Region: /testTOP_v/test6
# ** Error: (vsim-3053) testTOP.v(19): Illegal output or inout port connection (port 'c_in').
#         Region: /testTOP_v/test6
# ** Error: (vsim-3053) testTOP.v(19): Illegal output or inout port connection (port 'd_in').
#         Region: /testTOP_v/test6
# Error loading design

我的verilog模块源代码为:
`timescale 1ns / 100ps

module test6(a_out,b_out,c_out,d_out,a_in,b_in,c_in,d_in);

        output        [7:0]a_out,b_out,c_out,d_out;
        inout                [7:0]a_in,b_in,c_in,d_in;
        reg                [7:0]a_out,b_out,c_out,d_out;
        reg                [7:0]at,bt,ct,dt;
       
        always@(a_in or b_in or c_in or d_in)
        begin
                {at,bt,ct,dt}={a_in,b_in,c_in,d_in};
                sort(at,ct);
                sort(bt,dt);
                sort(at,bt);
                sort(ct,dt);
                sort(bt,ct);
                {a_out,b_out,c_out,d_out}={at,bt,ct,dt};
        end
       
task sort;
        inout[7:0]x,y;
        reg[7:0]  temp;
        if(x>y)
        begin
                temp=x;
                x=y;
                y=temp;
        end
endtask

endmodule


我的test bench是:
`timescale 1ns / 1ps
`include "test6.v"

module testTOP_v;

        // Outputs
        wire [7:0] a_out;
        wire [7:0] b_out;
        wire [7:0] c_out;
        wire [7:0] d_out;

        // Bidirs
        reg [7:0] a_in;
        reg [7:0] b_in;
        reg [7:0] c_in;
        reg [7:0] d_in;

        test6 test6 (.a_out(a_out),        .b_out(b_out), .c_out(c_out), .d_out(d_out),
                                  .a_in(a_in), .b_in(b_in), .c_in(c_in), .d_in(d_in));

        initial
        begin
                a_in=0;
                b_in=0;
                c_in=0;
                d_in=0;
                repeat(50)
                begin
                        #100
                        a_in={$random}%25;
                        b_in={$random}%25;
                        c_in={$random}%25;
                        d_in={$random}%25;

                end
                        #3000 $stop;
                end
      
endmodule
ananaizheni 发表于 2011-9-25 21:11:45 | 显示全部楼层
我也碰到同样问题。
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|集成电路技术分享 ( 京ICP备20003123号-1 )

GMT+8, 2024-5-10 13:16 , Processed in 0.105961 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表