2015-04-06 697 views
0

我查看了我的代碼,發現沒有錯。這裏是具體的錯誤,任何幫助讚賞:錯誤:HDLCompilers:26 - 「myGates.v」行33期待'endmodule',找到'輸入'文件分析<「myGates.prj」>失敗。我在Verilog中收到了期待的'endmodule'錯誤

module myGates(
    input sw0, 
    input sw1, 
    input sw2, 
    input sw3, 
    output ld0, 
    output ld1, 
    output ld2, 
    output ld3, 
    output ld7 
    ); 

    input sw0, sw1, sw2, sw3; 
    output ld0, ld1, ld2, ld3, ld7; 
    wire w1, w2; 

    assign ld0 = sw0; 
    assign ld1 = sw1; 
    assign ld2 = sw2; 
    assign ld3 = sw3; 

    and u1 (w1, sw0, sw1); 
    and u2 (w2, sw2, sw3); 
    and u3 (ld7, w1, w2); 
endmodule 

回答

2

您正在混合ANSI和非ANSI標題樣式。你必須選擇一個

ANSI:

module myGates(// direction, type, range, and name here 
    input sw0, sw1, sw2, sw3, 
    output ld0, ld1, ld2, ld3, 
    output ld7 
); 

    wire w1, w2; // internal wire/reg 

    // your code ... 
endmodule 

非ANSI:IEEE標準1364-1995和預IEEE委託項目,因爲IEEE標準1364-2001(推薦)支持。由於IEEE標準1364-2001支持向後可比性。

module myGates(// name only here 
    sw0, sw1, sw2, sw3, 
    ld0, ld1, ld2, ld3, 
    ld7 
); 

    input sw0, sw1, sw2, sw3; // direction & range here 
    output ld0, ld1, ld2, ld3; 
    output ld7; 
    // <- if 'reg' type, then type & range here 

    wire w1, w2; // internal wire/reg 

    // your code ... 
endmodule 
相關問題