【问题标题】:fpga assigning an inout pin to an input pin in verilogfpga在verilog中将输入引脚分配给输入引脚
【发布时间】:2017-05-09 17:05:52
【问题描述】:

我正在尝试使用 verilog 连接 Altera FPGA 上的两个引脚。

具体来说,我将inout 引脚连接到input 引脚。我得到了错误。

引脚“”有多个驱动程序

此链接上解释了该错误。

Altera description

这是解决方案:

module multi_driver(inout o, input a, b, en);

   // Input a directly drives the bidir pin w/o a tri-state condition
   assign o = a;

   // If en = 1 below, there will be an electrical conflict in the design.
   // To avoid this possibility, the Quartus II software issues an error
   assign o = (en) ? b : 1'bz;

endmodule

有人能解释一下assign o = (en) ? b : 1'bz; 的确切作用吗?

【问题讨论】:

标签: verilog fpga intel-fpga


【解决方案1】:

assign o = (en) ? b : 1'bz; 是 Verilog 的三态锁存器模板。当en 为高时,o 端口将被输出,其值为b。当en 为低端口时,o 将为1'bz(即高阻抗状态)。高阻抗状态意味着它将从模块外部强制形成任何形状(即它是输入)。

İ如果您尝试强制另一个信号assign o = a; 而不管en 信号,它会警告您该信号有多个驱动程序。只有当管脚处于高阻状态时,才能连接模块外的信号。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    相关资源
    最近更新 更多