模块端口-声明输入/输出/输出

时间:2020-06-27 19:48:29

标签: verilog

如果我想在模块内使用以下代码,这些变量的方向应该是什么?

always @(posedge clock)

begin

a <= b;
b <= a;

end

我尝试使用inout,但inout不适用于reg。

1 个答案:

答案 0 :(得分:-1)

方向是根据需要分配信号的位置选择的。 clock通常是在顶级分配的,因此它的值需要 in 到您的模块中:inputab已在模块内部分配,因此您希望它们的值不在模块output的范围内。

module mine( input wire clock,
             output reg a,b);