always [url=home.php?mod=space&uid=72445]@[/url] (posedge clk or negedge rst ) begin if (!rst) state<=State_idle; else state<=next_state; end //第二段状态机 always @ (posedge clk or negedge rst ) begin if (!rst) begin next_state<=0; isNew<=0; end else begin case (state) /********上电复位后的空状态****************************/ State_idle: begin if (isStart) next_state<=State_new; else next_state<=State_new; end /**************产生一个新的方块******************************/ State_new: begin isNew<=1'b1; next_state<=State_hold; end /***********保持状态等待信号*********************************/ State_hold: begin isNew<=1'b0; isCount<=1'b1; isMove_D<=0; isMove_R<=0; isMove_L<=0; if(Count_Finish) begin next_state<=State_down; isClear<=1'b1; end else if (ps2_data_in==8'h74) next_state<=State_move_R; else if (ps2_data_in==8'h6B) next_state<=State_move_L; else if (ps2_data_in==8'h72) next_state<=State_down; end /**************判断方块能否下降一格*************************/ State_down: begin isClear<=1'b0; if (Move_D_EN) begin isMove_D<=1'b1; next_state<=State_hold; end else next_state<=State_remove_1; end /********************************************/ State_move_L: begin if (Move_L_EN) isMove_L<=1'b1; next_state<=State_hold; end /***********更新方块的坐标信息****************************/ State_move_R: begin if (Move_R_EN) isMove_R<=1'b1; next_state<=State_hold; end /***********方块不能下降后更新背景矩阵的信息*********************************/ State_remove_1: begin isremove<=1'b1; next_state<=State_remove_2; end /***********判断是否可以清除*********************************/ State_remove_2: begin isremove<=1'b0; Check_Sig<=1'b1; if(Check_Finish) next_state<=State_isdie; end /***********判断是否死亡*********************************/ State_isdie: begin if (BackGround[3]>16'h8001) next_state<=State_stop; else next_state<=State_new; end State_stop: begin next_state<=State_idle; end endcase end end 目前不知道为何很多功能无法实现,求大神路过能留个qq,小弟想大神取些经~~谢谢 l
收藏1 举报
charrijon 发表于 2016-10-4 21:32 第一次看到有人拿FPGA做这么没有意思的事情
本版积分规则 发表回复 回帖并转播 回帖后跳转到最后一页
人才类勋章
等级类勋章
发帖类勋章
时间类勋章
3
6
0
扫码关注 21ic 官方微信
扫码关注嵌入式微处理器
扫码关注电源系统设计
扫码关注21ic项目外包
扫码浏览21ic手机版
本站介绍 | 申请友情链接 | 欢迎投稿 | 隐私声明 | 广告业务 | 网站地图 | 联系我们 | 诚聘英才
京公网安备 11010802024343号