2016-10-03 11 views
0

Я пытаюсь сделать сумматор в Verilog, и до сих пор мне не удалось это сделать, и мне было интересно, может ли кто-нибудь помочь. Вот мой код:Создание полного сумматора в Verilog

module fulladder.v(
input a, 
input b, 
input c, 
output sum, 
output carry 
); 
wire (w1, w2, w3, w4); 
xor(sum, a, w2); 
xor(w2, b, c); 
and (w3, b, c); 
and (w4, b, c); 
and (w5, c, a); 
or (carry, w3, w4, w5); 
endmodule 

Когда я запускаю его с fulladder.v после модуля я получаю ошибку синтаксиса, но когда я использую fulladder (без .в) Я получаю много ошибок:

***** START RUN ***** 
ERROR:HDLCompiler:806 - "fulladder.v" Line 8: Syntax error near "w1". 
ERROR:HDLCompiler:1059 - "fulladder.v" Line 8: w1 is an unknown type 
WARNING:HDLCompiler:329 - "fulladder.v" Line 10: Target <w2> of concurrent assignment or output port connection should be a net type. 
WARNING:HDLCompiler:329 - "fulladder.v" Line 11: Target <w3> of concurrent assignment or output port connection should be a net type. 
WARNING:HDLCompiler:329 - "fulladder.v" Line 12: Target <w4> of concurrent assignment or output port connection should be a net type. 
ERROR:HDLCompiler:598 - "fulladder.v" Line 1: Module <fulladder> ignored due to previous errors. 
***** OUTPUT ***** 
***** RESULT ***** 
FAIL 

Кто-нибудь знает, что случилось? Я очень благодарен за любую помощь!

Благодаря

ответ

1

Правильный синтаксис

wire w1, w2, w3, w4; 

Кроме того, вы никогда не использовать w1, и вы используете w5 но не объявить.

Смежные вопросы