【VHDL】求指导我写的这个游戏程序错在哪了该怎么改

suitangshihua 2017-11-05 02:47:19

state:process (count51,count52,count3,clktmp_1s,clk_kb,btn0)
begin
cnt5=6 then
cnt5<=0;
else --将输入的数字依次显示于不同数码管
cnt5<=cnt5+1;
end if;
if clk_kb'event and clk_kb='1' then --每输入一个数字计一次数
if
if cnt6=7 then
cnt6<=0;
else
cnt6<=cnt6+1;
end if;
end if;

if rst='1' or reset='1' then
reset <= '0';
case tmp_dz is --显示欢迎界面爱心字符
when 0=>row<="01111111";col<="01100110";
when 1=>row<="10111111";col<="10011001";
when 2=>row<="11011111";col<="10010001";
when 3=>row<="11101111";col<="10000001";
when 4=>row<="11110111";col<="01000010";
when 5=>row<="11111011";col<="00100100";
when 6=>row<="11111101";col<="00011000";
when 7=>row<="11111110";col<="00010000";
when others=>row<="11111111";col<="00000000";
end case;

tmpg1<="0000000";
tmpg2<="0000000";
tmpg3<="0000000";
tmpg4<="0000000";
tmpg5<="0000000";
tmpg6<="0000000";
tmpg7<="0000000";

elsif(clktmp_1s'event and clktmp_1s = '1') then
if btn0='1' then --按(btn0)开始键后进入状态1
current_state<=s1;
case current_state is
when s1=>

case n1 is
when 9 =>qout1<="1001";tmpg1<="1111011";
when 8 =>qout1<="1000";tmpg1<="1111111";
when 7 =>qout1<="0111";tmpg1<="1110000";
when 6 =>qout1<="0110";tmpg1<="1011111";
when 5 =>qout1<="0101";tmpg1<="1011011";
when 4 =>qout1<="0100";tmpg1<="0110011";
when 3 =>qout1<="0011";tmpg1<="1111001";
when 2 =>qout1<="0010";tmpg1<="1101101";
when 1 =>qout1<="0001";tmpg1<="0110000";
when 0 =>qout1<="0000";tmpg1<="1111110";
when others=>qout1<="0000";tmpg1<="1111110";
end case;
case n2 is
when 9 =>qout2<="1001";tmpg2<="1111011";
when 8 =>qout2<="1000";tmpg2<="1111111";
when 7 =>qout2<="0111";tmpg2<="1110000";
when 6 =>qout2<="0110";tmpg2<="1011111";
when 5 =>qout2<="0101";tmpg2<="1011011";
when 4 =>qout2<="0100";tmpg2<="0110011";
when 3 =>qout2<="0011";tmpg2<="1111001";
when 2 =>qout2<="0010";tmpg2<="1101101";
when 1 =>qout2<="0001";tmpg2<="0110000";
when 0 =>qout2<="0000";tmpg2<="1111110";
when others=>qout2<="0000";tmpg2<="1111110";
end case;
case n3 is
when 9 =>qout3<="1001";tmpg3<="1111011";
when 8 =>qout3<="1000";tmpg3<="1111111";
when 7 =>qout3<="0111";tmpg3<="1110000";

中间太长省略,全都是case语句为主的七个状态(S1~S7)


when s7=>

tmpbeep<='1';
tmpg1<="0000000";
tmpg2<="0000000";
tmpg3<="0000000";
tmpg4<="0000000";
tmpg5<="0000000";
tmpg6<="0000000";
tmpg7<="0000000";

case tmp_dz is
when 0=>row<="01111111";col<="00111100";
when 1=>row<="10111111";col<="01000010";
when 2=>row<="11011111";col<="10100101";
when 3=>row<="11101111";col<="10000001";
when 4=>row<="11110111";col<="10100101";
when 5=>row<="11111011";col<="10011001";
when 6=>row<="11111101";col<="01000010";
when 7=>row<="11111110";col<="00111100";
when others=>row<="11111111";col<="00000000";
end case;
end case;
end if;
end if;
end process state;

shumaguan:process(clk_smg) --0到6计数器
begin
if(clk_smg'event and clk_smg='1')then
if tmpc = 6 then tmpc<=0;
else
tmpc<=tmpc+1;
end if;
end if;
end process shumaguan;

process(tmpc) --数码管选通轮流显示
begin
case tmpc is
when 0 =>cat<="11111110";g<=tmpg1;
when 1 =>cat<="11111101";g<=tmpg2;
when 2 =>cat<="11111011";g<=tmpg3;
when 3 =>cat<="11110111";g<=tmpg4;
when 4 =>cat<="11101111";g<=tmpg5;
when 5 =>cat<="11011111";g<=tmpg6;
when 6 =>cat<="01111111";g<=tmpg7;
end case;
end process;
end a;

最后这一章是我的程序逻辑设计的框图
代码在quartus里综合成功了,27个warning。但是下载到板子(EMP1270144c5)上后却不按要求显示初始“爱心欢迎界面”,而是显示S1的内容,并且点阵内容显示不完整(只显示第一行的)、数码管虽然显示了随机数但是每秒就更换一次随机数。
按rst键会出现开始的“爱心欢迎界面”,但一松手就没了。第二至第七状态始终无法出现,附第一状态到第二状态的自动跳变截图。

求指导!谢谢谢谢谢谢!!!
...全文
375 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复

6,120

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 硬件设计
社区管理员
  • 硬件设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧