Verilog语言写的一个小程序出错,在ISE软件中,大概实现一个跑马灯

ERROR:HDLCompiler:806-"D:/StudyProgram/ISE/14.7/Design_Test/Test_2.3/digt_Module.v"Li... ERROR:HDLCompiler:806 - "D:/StudyProgram/ISE/14.7/Design_Test/Test_2.3/digt_Module.v" Line 30: Syntax error near "=".
ERROR:HDLCompiler:806 - "D:/StudyProgram/ISE/14.7/Design_Test/Test_2.3/digt_Module.v" Line 33: Syntax error near "always".
ERROR:HDLCompiler:806 - "D:/StudyProgram/ISE/14.7/Design_Test/Test_2.3/digt_Module.v" Line 45: Syntax error near "always".
ERROR:HDLCompiler:806 - "D:/StudyProgram/ISE/14.7/Design_Test/Test_2.3/digt_Module.v" Line 59: Syntax error near "always".
ERROR:HDLCompiler:806 - "D:/StudyProgram/ISE/14.7/Design_Test/Test_2.3/digt_Module.v" Line 73: Syntax error near "always".
ERROR:HDLCompiler:806 - "D:/StudyProgram/ISE/14.7/Design_Test/Test_2.3/digt_Module.v" Line 87: Syntax error near "always".
ERROR:HDLCompiler:1059 - "D:/StudyProgram/ISE/14.7/Design_Test/Test_2.3/digt_Module.v" Line 30: i is an unknown type
ERROR:HDLCompiler:598 - "D:/StudyProgram/ISE/14.7/Design_Test/Test_2.3/digt_Module.v" Line 21: Module <digt_Module> ignored due to previous errors.
这是错误~~~~~~~~
下面是主要代码::::
module digt_Module(
switch,clk,led1,led2,led3,led4,key
);
input switch,clk,key;
output led1,led2,led3,led4;

reg led1,led2,led3,led4;
reg[31:0] count;//计数器
reg[2:0] i;
i=1;
always@(key)
begin
always@(posedge clk)
begin
if((switch == 0)|(count == 10000000))
begin
count <= 0;
i<=i+1;
end
else
count <= count + 1;
end

always@(posedge clk)
begin
if(switch == 0)
led1 <= 0;
else
if(count == 10000000&&i==1)
begin
led1 <= ~led1;
led4 <= 0;
end
else
led1 <= led1;
end

always@(posedge clk)
begin
if(switch == 0)
led2 <= 0;
else
if(count == 10000000&&i==2)
begin
led2 <= ~led2;
led1 <= 0;
end
else
led2 <= led2;
end

always@(posedge clk)
begin
if(switch == 0)
led3 <= 0;
else
if(count == 10000000&&i==3)
begin
led3 <= ~led3;
led2 <= 0;
end
else
led3 <= led3;
end

always@(posedge clk)
begin
if(switch == 0)
led4 <= 0;
else
if(count == 10000000&&i==4)
begin
led4<= ~led4;
led3 <= 0;
i <= 1;
end
else
led4 <= led4;
end
end
endmodule
展开
 我来答
  • 你的回答被采纳后将获得:
  • 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
kyo4749
2014-10-09 · TA获得超过433个赞
知道小有建树答主
回答量:294
采纳率:100%
帮助的人:188万
展开全部
always 里面还套always?
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式