2013-10-11 572 views
0

在模塊內部時A我嘗試使用模塊B的輸出作爲另一個模塊C的輸入。實質上,這是一個「去」開關,它被翻轉在滿足特定條件的模塊B中,然後這應該是模塊C激活的觸發器。是否有可能像這樣鏈接輸出和輸入?用作verilog中另一個模塊的輸入的模塊的輸出

我一直在閱讀,發現this image特別有用 - 但是,我不太理解網絡的概念,或者如果他們會有所幫助。將模塊B的輸出連接到用作模塊C工作輸入的寄存器?謝謝。

編輯:

我正在尋找類似的東西在那裏我實例化一個模塊B和模塊A.我想B的輸出連接到C的輸入內的模塊C this(涉及3個不同的模塊) 。

回答

2

可以使這些連接 例如:

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 

這是如何連接的,如果你想在內部信號的連接,那麼你可以使用線式

+0

我剛剛編輯我的帖子,更多的澄清。你的迴應是否適用於我所尋找的? –

+0

是的,只是在這種情況下,我建議您使用模塊A中的電線進行連接。 – DOS

4

你三個模塊實例(image),使用電線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 

相關問題