在Quartus里面编译出错,提示Error (10171): Verilog HDL syntax error at LED.v(100) near end of file ; expec
ting "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
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) );
这个问题对新手来说是很常见的,在行为建模时,你的REF要定义成reg类型,必须事先申明的。默认的是wire类型。
谢谢了
一周热门 更多>