2017-10-20 74 views
0

我想做一個4位輸入模3模塊。我不斷收到錯誤「實例化不允許在連續區域,除了檢查器實例」。我不確定我做錯了什麼。verilog:實例化是不允許在連續區域,除了檢查實例

module divisible_3(
    input [3:0] a, 
    output div3); 

wire xnor30; 
wire xnor21; 
wire and32; 
wire xnor10; 
wire xnor_and; 
wire andxnor_and; 

begin 
always @ (*) 

two_input_xnor xnor1 (a[3], a[0], xnor30); 
two_input_xnor xnor2 (a[2], a[1], xnor21); 

two_input_and and1 (a[3], a[2], and32); 
two_input_xnor xnor3 (a[1], a[0], xnor10); 

two_input_and and2 (xnor30, xnor21, xnor_and); 
two_input_and and3 (and32, xnor10, andxnor_and); 

two_input_or or1 (xnor_and, andxnor_and, div3); 

end 

endmodule 
+1

[multiplier 4-bit verilog using half and full adders]可能的副本(https://stackoverflow.com/questions/20842388/multiplier-4-bit-with-verilog-using-just-half-and -full-adders) – Qiu

回答

1

我不知道你在這裏做什麼,但是你不能在always塊中實例化模塊。它只是沒有任何意義。此外,該開始語句在您放置它的地方沒有功能。它屬於always塊的開始部分。 無論你想要做什麼,只要在always塊外面實例化所有的模塊,就可以了。

+0

謝謝!我知道我做錯了什麼。顯然有不止一個.. –

+0

很高興聽到,你已經想通了:) – urban