Input 在verilog中用作另一个模块输入的模块输出

Input 在verilog中用作另一个模块输入的模块输出,input,module,output,verilog,Input,Module,Output,Verilog,在模块a内部时,我试图使用模块B的输出作为另一个模块C的输入。本质上,这是一个“go”开关,在满足某些条件后在模块B中翻转,然后这应该是模块C激活的触发器。是否可以像这样链接输出和输入 我一直在四处阅读,发现特别有用——然而,我不太理解网络的概念,或者它们是否会有帮助。将模块B的输出连接到用作模块C输入的reg会起作用吗?谢谢 编辑: 我正在寻找类似的东西(涉及3个不同的模块),在模块a中实例化模块B和模块C。我想将B的输出连接到C的输入。您可以进行这些连接 例如: module my_modu

在模块a内部时,我试图使用模块B的输出作为另一个模块C的输入。本质上,这是一个“go”开关,在满足某些条件后在模块B中翻转,然后这应该是模块C激活的触发器。是否可以像这样链接输出和输入

我一直在四处阅读,发现特别有用——然而,我不太理解网络的概念,或者它们是否会有帮助。将模块B的输出连接到用作模块C输入的reg会起作用吗?谢谢

编辑:


我正在寻找类似的东西(涉及3个不同的模块),在模块a中实例化模块B和模块C。我想将B的输出连接到C的输入。

您可以进行这些连接 例如:

module my_moduleA (inA, outA)
input inA;
output reg outA; //If you want to assign something to out inside an always block, it has to be output reg, otherwise you will have to use assign out from an always block.

//Put your logic here

endmodule

module my_moduleB (inB, outB)
input inB;
output reg outB; //If you want to assign something to out inside an always block, it has to be output reg, otherwise you will have to use assign out from an always block.

//Put your logic here

//Instantiation of module A
my_moduleA instance(  //Here is the connection made between module A and B
.inA (inB),  
.outA (outB));
endmodule

这就是连接的方式,如果要在内部信号上进行连接,则可以使用导线类型进行连接 例如:

module my_moduleA (inA, outA)
input inA;
output reg outA; //If you want to assign something to out inside an always block, it has to be output reg, otherwise you will have to use assign out from an always block.

//Put your logic here

endmodule

module my_moduleB (inB, outB)
input inB;
output reg outB; //If you want to assign something to out inside an always block, it has to be output reg, otherwise you will have to use assign out from an always block.

//Put your logic here

//Instantiation of module A
my_moduleA instance(  //Here is the connection made between module A and B
.inA (inB),  
.outA (outB));
endmodule

这就是连接的方式,如果您想在内部信号上进行这些连接,则可以使用wire type(导线类型)

您的三个模块示例(),使用wire outB_to_inC将输出连接到输入:

//A.v
module A(inA, outA);
input wire inA;
output wire outA;

wire outB_to_inC;

B B_inst(.inB(inA), .outB(outB_to_inC));

C C_inst(.inC(outB_to_inC), .outC(outA));

endmodule

/////

//B.v
module B (inB, outB);
input wire inB;
output wire outB;

//... more code here

endmodule

/////

//C.v
module C (inC, outC);
input wire inC;
output wire outC;

//... more code here

endmodule


您的三个模块示例(),使用wire outB_to_inC将输出连接到输入:

//A.v
module A(inA, outA);
input wire inA;
output wire outA;

wire outB_to_inC;

B B_inst(.inB(inA), .outB(outB_to_inC));

C C_inst(.inC(outB_to_inC), .outC(outA));

endmodule

/////

//B.v
module B (inB, outB);
input wire inB;
output wire outB;

//... more code here

endmodule

/////

//C.v
module C (inC, outC);
input wire inC;
output wire outC;

//... more code here

endmodule


我刚刚编辑了我的文章,并作了进一步澄清。你的回答是否适用于我正在寻找的东西?是的,确实如此,在这种情况下,我建议你使用模块A中的电线进行连接。假设我制作了一个全加器模块。现在,要将其转换为4位全加器,我如何使用FA1实例中的
cout
作为
cin
转换为FA2I,我刚刚编辑了我的文章,并作了进一步说明。你的回答是否适用于我正在寻找的东西?是的,确实如此,在这种情况下,我建议你使用模块A中的电线进行连接。假设我制作了一个全加器模块。现在,要将其更改为4位全加器,如何将FA1实例中的
cout
作为
cin
使用到FA2中