|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
各位大侠谁帮我看看这段程序哪有问题啊?提示的错误是下面的always块那的上升沿有问题,但是我看好多参考书上也是这么写的啊!谢谢啦!
module menu(clk,clear,stop,MSH,MSL,SH,SL,MH,ML);
input clk,clear,stop;
output[3:0] MSH,MSL,SH,SL,MH,ML;
reg[3:0] MSH,MSL,SH,SL,MH,ML;
reg count1,count2;
always @(posedge clk)
begin
if(clear)
begin
MSL<=0;
MSH<=0;
count1<=0;
end
else if(!stop)
begin
if(MSL==9)
begin
MSL<=0;
if(MSH==9)
begin
MSH<=0;
count1<=0;
end
else
begin
MSH<=MSH+1;
count1<=0;
end
end
else
begin
MSL<=MSL+1;
count1<=0;
end
end
end
always @(posedge clear or posedge count1)
begin
if(clear)
begin
SL<=0;
SH<=0;
count2<=0;
end
if(SL==9)
begin
SL<=0;
if(SH==5)
begin
SH<=0;
count2<=1;
end
else
begin
SH<=SH+1;
count2<=0;
end
end
else
begin
SL<=SL+1;
count2<=0;
end
end
always @(posedge clear or posedge count2)
begin
if(clear)
begin
ML<=0;
MH<=0;
end
if(ML==9)
begin
ML<=0;
if(MH==5)
MH<=0;
else
MH<=MH+1;
end
else
ML<=ML+1;
end
endmodule |
|