data/full_repos/permissive/427163843/Pong_game_v1.1.srcs/sources_1/imports/test folder/Pong_Top.v
1: b'%Error: Cannot find file containing module: folder,data/full_repos/permissive/427163843\n        ... Looked in:\n             data/full_repos/permissive/427163843/Pong_game_v1.1.srcs/sources_1/imports/test/folder,data/full_repos/permissive/427163843\n             data/full_repos/permissive/427163843/Pong_game_v1.1.srcs/sources_1/imports/test/folder,data/full_repos/permissive/427163843.v\n             data/full_repos/permissive/427163843/Pong_game_v1.1.srcs/sources_1/imports/test/folder,data/full_repos/permissive/427163843.sv\n             folder,data/full_repos/permissive/427163843\n             folder,data/full_repos/permissive/427163843.v\n             folder,data/full_repos/permissive/427163843.sv\n             obj_dir/folder,data/full_repos/permissive/427163843\n             obj_dir/folder,data/full_repos/permissive/427163843.v\n             obj_dir/folder,data/full_repos/permissive/427163843.sv\n%Error: Cannot find file containing module: data/full_repos/permissive/427163843/Pong_game_v1.1.srcs/sources_1/imports/test\n%Error: Cannot find file containing module: folder/Pong_Top.v\n%Error: Exiting due to 3 error(s)\n'
module Pong_Top
  #(parameter c_TOTAL_COLS=800,
    parameter c_TOTAL_ROWS=525,
    parameter c_ACTIVE_COLS=640,
    parameter c_ACTIVE_ROWS=480)
  (input            clk,
   input            i_HSync,
   input            i_VSync,
   input            RxD,
   input            enter_i,

   output reg       o_HSync,
   output reg       o_VSync,
   output [3:0] o_Red_Video,
   output [3:0] o_Grn_Video,
   output [3:0] o_Blu_Video);
 

  parameter c_GAME_WIDTH  = 40;
  parameter c_GAME_HEIGHT = 30;
  parameter c_SCORE_LIMIT = 9;
  parameter c_PADDLE_HEIGHT = 6;
  parameter c_PADDLE_COL_P1 = 0;
  parameter c_PADDLE_COL_Bot = c_GAME_WIDTH-1;
 

  parameter IDLE    = 3'b000;
  parameter RUNNING = 3'b001;
  parameter P1_WINS = 3'b010;
  parameter Bot = 3'b011;
  parameter CLEANUP = 3'b100;
 
  reg [2:0] r_SM_Main = IDLE;
 
  wire       w_HSync, w_VSync;
  wire [9:0] w_Col_Count, w_Row_Count;
   
  wire       w_Draw_Paddle_P1, w_Draw_Paddle_Bot;
  wire [5:0] w_Paddle_Y_P1, w_Paddle_Y_Bot;
  wire       w_Draw_Ball, w_Draw_Any;
  wire [5:0] w_Ball_X, w_Ball_Y;
  wire divided_clk;
 
  reg [3:0] r_P1_Score = 0;
  reg [3:0] r_Bot_Score = 0;
 



  wire [5:0] w_Col_Count_Div, w_Row_Count_Div;

  clock_divider clock_wrapper(
    .clk(clk),.divided_clk(divided_clk));
 
  Sync_To_Count #(.TOTAL_COLS(c_TOTAL_COLS),
                  .TOTAL_ROWS(c_TOTAL_ROWS)) Sync_To_Count_Inst
    (.clk(divided_clk),
     .i_HSync(i_HSync),
     .i_VSync(i_VSync),
     .o_HSync(w_HSync),
     .o_VSync(w_VSync),
     .o_Col_Count(w_Col_Count),
     .o_Row_Count(w_Row_Count));
 
  always @(posedge divided_clk)
  begin
    o_HSync <= w_HSync;
    o_VSync <= w_VSync;
  end
 

  assign w_Col_Count_Div = w_Col_Count[9:4];
  assign w_Row_Count_Div = w_Row_Count[9:4];
 
 

  Pong_Paddle_Ctrl #(.c_PLAYER_PADDLE_X(c_PADDLE_COL_P1),
                     .c_GAME_HEIGHT(c_GAME_HEIGHT)) P1_Inst
    (.clk(clk),
     .RxD(RxD),
     .enter_o(enter_i),
     .i_Col_Count_Div(w_Col_Count_Div),
     .i_Row_Count_Div(w_Row_Count_Div),
     .o_Draw_Paddle(w_Draw_Paddle_P1),
     .o_Paddle_Y(w_Paddle_Y_P1));


  Pong_Bot #(.c_PLAYER_PADDLE_X(c_PADDLE_COL_Bot),
            .c_GAME_HEIGHT(c_GAME_HEIGHT)) Bot_Inst
  (
    .Ball_X(w_Ball_X),
    .Ball_Y(w_Ball_Y),
    .clk(divided_clk),
    .i_Col_Count_Div(w_Col_Count_Div),
    .i_Row_Count_Div(w_Row_Count_Div),
    .o_Draw_Paddle(w_Draw_Paddle_Bot),
    .o_Paddle_Y(w_Paddle_Y_Bot)
  );
 

  Pong_Ball_Ctrl Pong_Ball_Ctrl_Inst
    (.clk(divided_clk),
     .i_Paddle_Y_1(w_Paddle_Y_P1),
     .i_Paddle_Y_2(w_Paddle_Y_Bot),
     .i_Game_Active(w_Game_Active),
     .i_Col_Count_Div(w_Col_Count_Div),
     .i_Row_Count_Div(w_Row_Count_Div),
     .o_Draw_Ball(w_Draw_Ball),
     .o_Ball_X(w_Ball_X),
     .o_Ball_Y(w_Ball_Y));
 
 

  always @(posedge divided_clk)
  begin
    case (r_SM_Main)
 

    IDLE :
    begin
      if (enter_i == 1'b1)
        r_SM_Main <= RUNNING;
    end
 


    RUNNING :
    begin

      if (w_Ball_X == 0 && 
          (w_Ball_Y < w_Paddle_Y_P1 || 
           w_Ball_Y > w_Paddle_Y_P1 + c_PADDLE_HEIGHT))
        r_SM_Main <= Bot;
 

      else if (w_Ball_X == c_GAME_WIDTH-1 && 
               (w_Ball_Y < w_Paddle_Y_Bot ||
                w_Ball_Y > w_Paddle_Y_Bot  + c_PADDLE_HEIGHT))
        r_SM_Main <= P1_WINS;
    end
 
    P1_WINS :
    begin
      if (r_P1_Score == c_SCORE_LIMIT-1)
        r_P1_Score <= 0;
      else
      begin
        r_P1_Score <= r_P1_Score + 1;
        r_SM_Main <= CLEANUP;
      end
    end
 
    Bot :
    begin
      if (r_Bot_Score == c_SCORE_LIMIT-1)
        r_Bot_Score <= 0;
      else
      begin
        r_Bot_Score <= r_Bot_Score + 1;
        r_SM_Main <= CLEANUP;
      end
    end
 
    CLEANUP :
      r_SM_Main <= IDLE;
 
    endcase
  end
 

  assign w_Game_Active = (r_SM_Main == RUNNING) ? 1'b1 : 1'b0;
 
  assign w_Draw_Any = w_Draw_Ball | w_Draw_Paddle_P1 | w_Draw_Paddle_Bot;
 

  assign o_Red_Video = w_Draw_Any ? 4'b1111 : 4'b0000;
  assign o_Grn_Video = w_Draw_Any ? 4'b1111 : 4'b0000;
  assign o_Blu_Video = w_Draw_Any ? 4'b1111 : 4'b0000;
 
endmodule
module Pong_Top
  #(parameter c_TOTAL_COLS=800,
    parameter c_TOTAL_ROWS=525,
    parameter c_ACTIVE_COLS=640,
    parameter c_ACTIVE_ROWS=480)
  (input            clk,
   input            i_HSync,
   input            i_VSync,
   input            RxD,
   input            enter_i,

   output reg       o_HSync,
   output reg       o_VSync,
   output [3:0] o_Red_Video,
   output [3:0] o_Grn_Video,
   output [3:0] o_Blu_Video);

 

  parameter c_GAME_WIDTH  = 40;
  parameter c_GAME_HEIGHT = 30;
  parameter c_SCORE_LIMIT = 9;
  parameter c_PADDLE_HEIGHT = 6;
  parameter c_PADDLE_COL_P1 = 0;
  parameter c_PADDLE_COL_Bot = c_GAME_WIDTH-1;
 

  parameter IDLE    = 3'b000;
  parameter RUNNING = 3'b001;
  parameter P1_WINS = 3'b010;
  parameter Bot = 3'b011;
  parameter CLEANUP = 3'b100;
 
  reg [2:0] r_SM_Main = IDLE;
 
  wire       w_HSync, w_VSync;
  wire [9:0] w_Col_Count, w_Row_Count;
   
  wire       w_Draw_Paddle_P1, w_Draw_Paddle_Bot;
  wire [5:0] w_Paddle_Y_P1, w_Paddle_Y_Bot;
  wire       w_Draw_Ball, w_Draw_Any;
  wire [5:0] w_Ball_X, w_Ball_Y;
  wire divided_clk;
 
  reg [3:0] r_P1_Score = 0;
  reg [3:0] r_Bot_Score = 0;
 



  wire [5:0] w_Col_Count_Div, w_Row_Count_Div;

  clock_divider clock_wrapper(
    .clk(clk),.divided_clk(divided_clk));
 
  Sync_To_Count #(.TOTAL_COLS(c_TOTAL_COLS),
                  .TOTAL_ROWS(c_TOTAL_ROWS)) Sync_To_Count_Inst
    (.clk(divided_clk),
     .i_HSync(i_HSync),
     .i_VSync(i_VSync),
     .o_HSync(w_HSync),
     .o_VSync(w_VSync),
     .o_Col_Count(w_Col_Count),
     .o_Row_Count(w_Row_Count));
 
  always @(posedge divided_clk)
  begin
    o_HSync <= w_HSync;
    o_VSync <= w_VSync;
  end
 

  assign w_Col_Count_Div = w_Col_Count[9:4];
  assign w_Row_Count_Div = w_Row_Count[9:4];
 
 

  Pong_Paddle_Ctrl #(.c_PLAYER_PADDLE_X(c_PADDLE_COL_P1),
                     .c_GAME_HEIGHT(c_GAME_HEIGHT)) P1_Inst
    (.clk(clk),
     .RxD(RxD),
     .enter_o(enter_i),
     .i_Col_Count_Div(w_Col_Count_Div),
     .i_Row_Count_Div(w_Row_Count_Div),
     .o_Draw_Paddle(w_Draw_Paddle_P1),
     .o_Paddle_Y(w_Paddle_Y_P1));


  Pong_Bot #(.c_PLAYER_PADDLE_X(c_PADDLE_COL_Bot),
            .c_GAME_HEIGHT(c_GAME_HEIGHT)) Bot_Inst
  (
    .Ball_X(w_Ball_X),
    .Ball_Y(w_Ball_Y),
    .clk(divided_clk),
    .i_Col_Count_Div(w_Col_Count_Div),
    .i_Row_Count_Div(w_Row_Count_Div),
    .o_Draw_Paddle(w_Draw_Paddle_Bot),
    .o_Paddle_Y(w_Paddle_Y_Bot)
  );
 

  Pong_Ball_Ctrl Pong_Ball_Ctrl_Inst
    (.clk(divided_clk),
     .i_Paddle_Y_1(w_Paddle_Y_P1),
     .i_Paddle_Y_2(w_Paddle_Y_Bot),
     .i_Game_Active(w_Game_Active),
     .i_Col_Count_Div(w_Col_Count_Div),
     .i_Row_Count_Div(w_Row_Count_Div),
     .o_Draw_Ball(w_Draw_Ball),
     .o_Ball_X(w_Ball_X),
     .o_Ball_Y(w_Ball_Y));
 
 

  always @(posedge divided_clk)
  begin
    case (r_SM_Main)
 

    IDLE :
    begin
      if (enter_i == 1'b1)
        r_SM_Main <= RUNNING;
    end
 


    RUNNING :
    begin

      if (w_Ball_X == 0 && 
          (w_Ball_Y < w_Paddle_Y_P1 || 
           w_Ball_Y > w_Paddle_Y_P1 + c_PADDLE_HEIGHT))
        r_SM_Main <= Bot;
 

      else if (w_Ball_X == c_GAME_WIDTH-1 && 
               (w_Ball_Y < w_Paddle_Y_Bot ||
                w_Ball_Y > w_Paddle_Y_Bot  + c_PADDLE_HEIGHT))
        r_SM_Main <= P1_WINS;
    end
 
    P1_WINS :
    begin
      if (r_P1_Score == c_SCORE_LIMIT-1)
        r_P1_Score <= 0;
      else
      begin
        r_P1_Score <= r_P1_Score + 1;
        r_SM_Main <= CLEANUP;
      end
    end
 
    Bot :
    begin
      if (r_Bot_Score == c_SCORE_LIMIT-1)
        r_Bot_Score <= 0;
      else
      begin
        r_Bot_Score <= r_Bot_Score + 1;
        r_SM_Main <= CLEANUP;
      end
    end
 
    CLEANUP :
      r_SM_Main <= IDLE;
 
    endcase
  end
 

  assign w_Game_Active = (r_SM_Main == RUNNING) ? 1'b1 : 1'b0;
 
  assign w_Draw_Any = w_Draw_Ball | w_Draw_Paddle_P1 | w_Draw_Paddle_Bot;
 

  assign o_Red_Video = w_Draw_Any ? 4'b1111 : 4'b0000;
  assign o_Grn_Video = w_Draw_Any ? 4'b1111 : 4'b0000;
  assign o_Blu_Video = w_Draw_Any ? 4'b1111 : 4'b0000;
 
endmodule