update to 01/03

This commit is contained in:
2021-01-03 19:42:17 +08:00
parent 4a39dfe368
commit cb82fcdf4e
67 changed files with 864068 additions and 281 deletions
@@ -42,7 +42,8 @@ module game_logic_classic(
output reg gameover_classic,
output wire [ 15: 0 ] led_classic,
output reg [ 7: 0 ] score_classic //[7:4] is player2 ,[3:0] is player1
output reg [ 7: 0 ] score_classic, //[7:4] is player2 ,[3:0] is player1
output reg [ 1: 0 ] winner
);
reg [ 3: 0 ] score1;
reg [ 3: 0 ] score2;
@@ -51,7 +52,7 @@ initial begin
gameover_classic <= 0;
score_classic <= 0;
winner <= 0;
score1 <= 0;
score2 <= 0;
score_classic <= 0;
@@ -108,6 +109,7 @@ always @( posedge clk ) begin
score1 <= 0;
score2 <= 0;
score_classic <= 0;
winner <= 2'b00;
end
else begin
score_classic[ 7: 4 ] <= score2[ 3: 0 ];
@@ -122,6 +124,12 @@ always @( posedge clk ) begin
score_classic[ 3: 0 ] <= score1[ 3: 0 ];
if ( HP1_value == 0 || HP2_value == 0 || score1 >= 8 || score2 >= 8 ) begin
gameover_classic <= 1;
if ( HP2_value == 0 || score1 >= 8 ) begin
winner <= 2'b10;
end
else begin
winner <= 2'b11;
end
end
end