惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
小众软件
小众软件
Last Week in AI
Last Week in AI
月光博客
月光博客
博客园 - 聂微东
Recent Announcements
Recent Announcements
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
博客园 - Franky
云风的 BLOG
云风的 BLOG
量子位
N
Netflix TechBlog - Medium
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
博客园 - 司徒正美
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享

博客园 - yf.x

超声波测距#倒车雷达#DE10-Lite 按键计数器#DE10-Lite 按键消抖#DE10-Lite 流水呼吸灯v2#DE10-Lite 流水呼吸灯-v1#DE10-Lite 呼吸灯-#DE10-Lite 流水灯#DE10-Lite#Verilog HDLBits_review 2015fsm 补码FSM-HDLbits 串行数据流输出其中的数据位-HDLbits 串行数据接收判断-HDLbits 输出PS2数据流-HDLbits PS2数据流检测状态机-HDLbits 独热码状态机-HDLbits 旅鼠4-HDLbits 旅鼠游戏3-HDLbits 旅鼠游戏--HDLbits 水库水位控制问题-HDLbits 康威生命游戏-hdlbits
旅鼠游戏2-HDLbits
yf.x · 2025-12-16 · via 博客园 - yf.x

还是那个老鼠左右走动的游戏,这次除了撞墙左右翻转之外,还加上了地面消失就掉落的功能,地面恢复后,继续掉落之前的状态。(越来越像超级玛丽了)

image

module top_module(
input clk,
input areset, // Freshly brainwashed Lemmings walk left.
input bump_left,
input bump_right,
input ground,
output walk_left,
output walk_right,
output aaah );
parameter LEFT=0,RIGHT=1,FALL_L=2,FALL_R=3;
reg [1:0]state,next_state;
always @(posedge clk,posedge areset)
if(areset)
state<=LEFT;
else
state<=next_state;

always @(*)
case(state)
LEFT:
next_state=!ground?FALL_L:(bump_left?RIGHT:LEFT);
RIGHT:
next_state=!ground?FALL_R:(bump_right?LEFT:RIGHT);
FALL_L:next_state=!ground?FALL_L:LEFT;
FALL_R:next_state=!ground?FALL_R:RIGHT;

endcase

assign walk_left=(state==LEFT)?1'b1:1'b0;
assign walk_right=(state==RIGHT)?1'b1:1'b0;
assign aaah=(state==FALL_L | state==FALL_R)?1'b1:1'b0;

image

endmodule