请大家帮我看下这个跑马灯的代码,怎么都得不到结果。verilog。
module horse_light (clk,reset,led);input clk,reset;
output reg led;
reg count;
reg state;
parameter s0=0;
parameter s1=1;
parameter s2=2;
parameter s3=3;
parameter s4=4;
parameter s5=5;
parameter s6=6;
parameter s7=7;
always @ (posedge clk)
if(reset)
begin
state<=s0;
count<=10'b0;
end
else
case(state)
s0:if(count==10'b1111_1111_11)
begin
state<=s1;
count<=10'b0;
end
else
begin
led<=8'b0000_0001;
count<=count+1;
end
s1:if(count==10'b1111_1111_11)
begin
state<=s2;
count<=10'b0;
end
else
begin
led<=8'b0000_0010;
count<=count+1;
end
s2:if(count==10'b1111_1111_11)
begin
state<=s3;
count<=10'b0;
end
else
begin
led<=8'b0000_0100;
count<=count+1;
end
s3:if(count==10'b1111_1111_11)
begin
state<=s4;
count<=10'b0;
end
else
begin
led<=8'b0000_1000;
count<=count+1;
end
s4:if(count==10'b1111_1111_11)
begin
state<=s5;
count<=10'b0;
end
else
begin
led<=8'b0001_0000;
count<=count+1;
end
s5:if(count==10'b1111_1111_11)
begin
state<=s6;
count<=10'b0;
end
else
begin
led<=8'b0010_0000;
count<=count+1;
end
s6:if(count==10'b1111_1111_11)
begin
state<=s7;
count<=10'b0;
end
else
begin
led<=8'b0100_0000;
count<=count+1;
end
s7:if(count==10'b1111_1111_11)
begin
state<=s0;
count<=10'b0;
end
else
begin
led<=8'b1000_0000;
count<=count+1;
end
default:state<=s0;
endcase
endmodule http://cache.amobbs.com/bbs_upload782111/files_21/ourdev_501319.JPG
(原文件名:1.JPG)
这是仿真的图 调通了。。。。
原来是我没有在每个case后面加个begin end。 回复【2楼】yvhksovo
哥们 能把那个有用的代码发一下出来嘛 急啊 拜求 弄个跑马灯。。。这么麻烦哦 回复【2楼】yvhksovo
-----------------------------------------------------------------------
可以给我一份代码吗?谢谢了,这是我邮箱……joavedinzz@sina.cn
页:
[1]