-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameLogic_tb.v
114 lines (85 loc) · 2.3 KB
/
gameLogic_tb.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
`timescale 1ns/1ps
module gameLogic_tb;
reg[2:0] player1; //action
reg[2:0] player2; //action
reg clock,reset;
wire [2:0] player1_position; //position starts from 0
wire[2:0] player2_position; //position starts from 5
wire[1:0] player1_health, player2_health; //health starts from 3
wire winner1;
wire winner2;
wire playerLED1;
wire playerLED2;
gameLogic uut(playerLED1,playerLED2,player1,player2,clock,reset,player1_position,player2_position,player1_health,player2_health,winner1,winner2);
initial begin
clock = 0;
repeat(50)
#50 clock = ~ clock;
end
initial begin
//$dumpfile("gameLogic_tb.vcd");
//$dumpvars(0,uut);
/*
* Wait = 3'b000
*
* Punch = 3'b001
* Kick = 3'b010
*
* Move_Left = 3'b011
* Move_Right = 3'b100
* Jump = 3'b101
*
*/
// reset = 1;
// #100
// reset = 0;
// #200;
reset = 1;
#10;
reset = 0;
#10;
player1 = 3'b100; //Move Right
player2 = 3'b011; //Move Left
#200;
//! TEST
// player1 = 3'b000;
// player2 = 3'b000;
player1 = 3'b100; //Move Right
player2 = 3'b011; //Move Left
#200;
player1 = 3'b001; //Punch
player2 = 3'b101; //Jump
#200;
player1 = 3'b001; //Punch
player2 = 3'b010; //Kick
#200;
player1 = 3'b001; //Punch
player2 = 3'b001; //Punch
#200;
player1 = 3'b100; //Move Right
player2 = 3'b000; //Wait
#200;
player1 = 3'b101; //Jump
player2 = 3'b000; //Wait
#200;
player1 = 3'b001; //Punch
player2 = 3'b010; //Kick
#200;
player1 = 3'b010; //Kick
player2 = 3'b101; //Jump
#200;
player1 = 3'b011; //Left
player2 = 3'b010; //Kick
#200;
player1 = 3'b010; //Kick
player2 = 3'b011; //Left
#200;
player1 = 3'b010; //Kick
player2 = 3'b000; //Left
#200;
//! a test case for when player 2 dies and 1 wins
//! Clock 31
// player1 = 3'b010; //Kick
// player2 = 3'b001; //Punch
end
endmodule