-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwinning_checker.v.bak
66 lines (58 loc) · 2.98 KB
/
winning_checker.v.bak
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
module winning_checker(check_done, winning , main_vector, state);
output winning [4:0];
output check_done;
input [1:0] main_vector [8:0];
input [2:0] state;
always @ (main_vector)
begin
if(state == 3'b011)
if(main_vector[0] == main_vector[1] == main_vector[2] == 2'b10)
winning = 5'b10000;
else
if(main_vector[3] == main_vector[4] == main_vector[5] == 2'b10)
winning = 5'b10001;
else
if(main_vector[6] == main_vector[7] == main_vector[8] == 2'b10)
winning = 5'b10010;
else
if(main_vector[0] == main_vector[3] == main_vector[6] == 2'b10)
winning = 5'b10011;
else
if(main_vector[1] == main_vector[4] == main_vector[7] == 2'b10)
winning = 5'b10100;
else
if(main_vector[2] == main_vector[5] == main_vector[8] == 2'b10)
winning = 5'b10101;
else
if(main_vector[0] == main_vector[4] == main_vector[8] == 2'b10)
winning = 5'b10110;
else
if(main_vector[2] == main_vector[4] == main_vector[6] == 2'b10)
winning = 5'b10111;
else
if(main_vector[0] == main_vector[1] == main_vector[2] == 2'b01)
winning = 5'b11000;
else
if(main_vector[3] == main_vector[4] == main_vector[5] == 2'b01)
winning = 5'b11001;
else
if(main_vector[6] == main_vector[7] == main_vector[8] == 2'b01)
winning = 5'b11010;
else
if(main_vector[0] == main_vector[3] == main_vector[6] == 2'b01)
winning = 5'b11011;
else
if(main_vector[1] == main_vector[4] == main_vector[7] == 2'b01)
winning = 5'b11100;
else
if(main_vector[2] == main_vector[5] == main_vector[8] == 2'b01)
winning = 5'b11101;
else
if(main_vector[0] == main_vector[4] == main_vector[8] == 2'b01)
winning = 5'b11110;
else
if(main_vector[2] == main_vector[4] == main_vector[6] == 2'b01)
winning = 5'b11111;
check_done = 1;
end
endmodule