【问题标题】:Getting an error while using two bus wire as input and other two as output in verilog在verilog中使用两条总线作为输入,另外两条作为输出时出错
【发布时间】:2014-04-06 07:08:12
【问题描述】:

我正在尝试定义我的 4 线 JD 和 JC 阵列,其中两根用作输入,两根用作输出。但是,如代码所示,我收到一条错误消息,指出声明是非法的。

错误提示:

错误:HDLCompilers:27 - “top.v”第 38 行非法重新声明 'JC' 错误:HDLCompilers:27 - “top.v”第 41 行非法重新声明 'JD'

解决这个问题的最佳方法是什么?

代码示例

module top
(
    input wire mclk,             //50 MHz by default
    input wire rcclk,            //
    output  wire [7:0] seg,
    output wire dp,
    output wire [3:0] an,
    output wire [7:0] Led,
    input wire [7:0] sw,
    input wire [3:0] btn,

    //I/O pins
    input wire [3:0] JA,
    input wire [3:0] JB,
    //input wire [3:0] JC,

    input wire [3:2] JC,   //<< this is where I get the error
    output wire [1:0] JC,  //<< this is where I get the error

    input wire [3:2] JD,   //<< this is where I get the error
    output wire [1:0] JD   //<< this is where I get the error

);

【问题讨论】:

    标签: input io output verilog bus


    【解决方案1】:

    您始终可以将JCJD 定义为双向引脚(inout):

    inout [1:0] JC,
    inout [1:0] JD
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-10
      • 2021-11-05
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 2021-09-28
      相关资源
      最近更新 更多