Verilog编译

2019-07-16 02:00发布

在Quartus里面编译出错,提示Error (10171): Verilog HDL syntax error at LED.v(100) near end of file ;  expecting "endmodule"
但是我没有漏掉endmodule
除了这个错误以外
Error: Quartus II 64-Bit Analysis & Synthesis was unsuccessful. 1 error, 0 warnings
        Error: Peak virtual memory: 331 megabytes

        Error: Processing ended: Mon Nov 05 21:26:35 2012

        Error: Elapsed time: 00:00:00

        Error: Total CPU time (on all processors): 00:00:00

Error: Quartus II Full Compilation was unsuccessful. 3 errors, 0 warnings



还有这个,请问是什么问题?


另附程序

module Press
                (
                input clk,
                input RST,
                input KEY,
                input EN,
                output REF
                );
        always @ (posedge clk or negedge RST)
                begin
                        if (!RST)
                                REF <= 0;
                        else if (EN)
                                        if (KEY==0)
                                        REF <= 1;
                end
endmodule


module Calm
                (
                input REF,
                input clk,
                output VALUE,
                output EN
                );

        parameter T10MS = 15'd20_000;       
        reg [14:0]Count;

        always @ (posedge clk or negedge RST)
                begin
                        if (!RST || Count==T10MS)
                                Count <= 0;
                        else
                                Count <= Count + 1'b1;
                end

        always @ (posedge clk or negedge RST)
                begin
                        if (!RST)
                                VALUE <= 0;
                        else if (REF==1)
                                VALUE <= 0;
                end
endmodule
       
       
module LED
                (
                input RST,
                input clk,
                input KEY,
                output [3:0]LED_OUT
                );
                 
wire REF,VALUE,EN;
reg STATE;

        module Press
                (
                .clk(clk),
                 .RST(RST),
                 .KEY(KEY),
                 .EN(EN),
                 .REF(REF)
                 );
                 
        module Calm
                (
                .REF(REF),
                .clk(clk),
                .VALUE(VALUE),
                .EN(EN)
                );
                 
        always @ (posedge clk or negedge RST)
                begin
                        if (!RST)
                                begin
                                STATE <= 0;
                                LED_OUT <= 4'b0000;
                                end
                        else if (VALUE==1)
                                STATE <= ~STATE;
                end       

        always @ (posedge clk or negedge RST)
                begin
                        if (!RST)
                                begin
                                LED_OUT <= 4'b0000;
                                end
                        else if (STATE==1)
                                LED_OUT = 4'b1111;
                                else
                                LED_OUT = 4'b0000;
                end                       
endmodule

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
5条回答
hxq160
2019-07-16 06:15
子模块调用有问题,
     module Press
                (
                .clk(clk),
                 .RST(RST),
                 .KEY(KEY),
                 .EN(EN),
                 .REF(REF)
                 );
                 
        module Calm
                (
                .REF(REF),
                .clk(clk),
                .VALUE(VALUE),
                .EN(EN)
                );
改成
Press press1(.clk(clk), .RST(RST), .KEY(KEY), .EN(EN), .REF(REF) );
Calm calm1(.REF(REF),  .clk(clk), .VALUE(VALUE), .EN(EN) );

一周热门 更多>