-
Notifications
You must be signed in to change notification settings - Fork 6
/
DinoFSM.v
41 lines (35 loc) · 1.09 KB
/
DinoFSM.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module DinoFSM(
/*input wire clk,*/
input wire rst,
input wire animationClk,
input wire [1:0] gameState,
input wire Airborne,
input wire onGround,
input wire isDuck,
output wire [3:0] DinoMovementSelect);
reg [3:0] select;
always @(*) begin
if (rst) begin
select <= 4'b0000;
end
else begin
case (gameState)
2'b00: select <= 4'b0011;
2'b01: select <= 4'b0010;
2'b10: begin
if (Airborne) begin
select <= 4'b0011;
end
else if (onGround) begin
if (animationClk)
select <= (isDuck)? 4'b0101:4'b0001;
else
select <= (isDuck)? 4'b0000:4'b0100;
end
end
default: select <= 4'b0011;
endcase
end
end // always @ (posedge clk or posedge rst)
assign DinoMovementSelect = select;
endmodule // DinoFSM