In addition to walking and falling, Lemmings can sometimes be told to do useful things, like dig (it starts digging when dig=1). A Lemming can dig if it is currently walking on ground (ground=1 and not falling), and will continue digging until it reaches the other side (ground=0). At that point, since there is no ground, it will fall (aaah!), then continue walking in its original direction once it hits ground again. As with falling, being bumped while digging has no effect, and being told to dig when falling or when there is no ground is ignored.
(In other words, a walking Lemming can fall, dig, or switch directions. If more than one of these conditions are satisfied, fall has higher precedence than dig, which has higher precedence than switching directions.)
Extend your finite state machine to model this behaviour.
前言
六个输入,包括一个时钟clk,一个高电平有效的异步置位信号areset,一个左遇障碍的输入信号bump_left,一个右遇障碍的输入信号bump_right,一个控制地面高度的输入信号ground,一个挖掘行为的控制信号 dig;四个输出,包括一个左行输出信号walk_left,一个右行输出信号walk_right,一个降落喊声信号aaah&