data/full_repos/permissive/159247586/HDMI/ttt.v
1: b"%Error: data/full_repos/permissive/159247586/HDMI/ttt.v:83: Cannot find file containing module: 'user'\n  user #(CLOCKS_PER_BAUD[23:0])\n  ^~~~\n        ... Looked in:\n             data/full_repos/permissive/159247586/HDMI,data/full_repos/permissive/159247586/user\n             data/full_repos/permissive/159247586/HDMI,data/full_repos/permissive/159247586/user.v\n             data/full_repos/permissive/159247586/HDMI,data/full_repos/permissive/159247586/user.sv\n             user\n             user.v\n             user.sv\n             obj_dir/user\n             obj_dir/user.v\n             obj_dir/user.sv\n%Error: data/full_repos/permissive/159247586/HDMI/ttt.v:88: Cannot find file containing module: 'xmove'\n  xmove g1(board, x_move);\n  ^~~~~\n%Error: data/full_repos/permissive/159247586/HDMI/ttt.v:91: Cannot find file containing module: 'result'\n  result r1(board, result);\n  ^~~~~~\n%Error: data/full_repos/permissive/159247586/HDMI/ttt.v:94: Cannot find file containing module: 'movemask'\n  movemask m1(user_move, 0, user_move_mask, bad_user_move);\n  ^~~~~~~~\n%Error: data/full_repos/permissive/159247586/HDMI/ttt.v:97: Cannot find file containing module: 'movemask'\n  movemask m2(x_move, 1, x_move_mask, bad_x_move);\n  ^~~~~~~~\n%Error: Exiting due to 5 error(s)\n"
module ttt(i_clk, o_setup, o_uart_tx, i_uart_rx, o_board);
  input wire i_clk;
  output wire [31:0] o_setup;
  output wire o_uart_tx;
  input  wire i_uart_rx;
  output wire [17:0] o_board;
`else

module ttt(i_clk, o_uart_tx, i_uart_rx, o_board);
  input wire i_clk;
  output wire o_uart_tx;
  input  wire i_uart_rx;
  output wire [17:0] o_board;
`endif

  parameter CLOCK_RATE_HZ = 1000000;
  parameter BAUD_RATE = 115_200;
  parameter CLOCKS_PER_BAUD = CLOCK_RATE_HZ/BAUD_RATE;
`ifdef VERILATOR
  assign o_setup = CLOCKS_PER_BAUD;
`endif

  reg [17:0] board;
  initial board= 18'd0;



  assign o_board = board;

  localparam INITIALISE_STATE = 5'h0;
  localparam ASK_USER_MOVE    = 5'h1;
  localparam GET_USER_MOVE    = 5'h2;	
  localparam MAKE_USER_MOVE   = 5'h3;	
  localparam CHECK_USER_MOVE  = 5'h4;	
  localparam MAKE_X_MOVE      = 5'h5;	
  localparam CHECK_X_MOVE     = 5'h6;	
  localparam WAIT_FOR_USER    = 5'h1a;
  localparam WAIT_FOR_USER2   = 5'h1b;
  localparam WIN_STATE        = 5'h1c;	
  localparam LOSE_STATE       = 5'h1d;	
  localparam DRAW_STATE       = 5'h1e;	
  localparam ERROR_STATE      = 5'h1f;	

  reg [4:0] state;
  initial state= INITIALISE_STATE;

  reg [17:0] oldboard;



  reg [1:0] result;
  localparam NONE = 0;			
  localparam XWIN = 1;			
  localparam OWIN = 2;
  localparam DRAW = 3;

  reg result_stb;
  initial result_stb=0;

  reg need_userinput;
  initial need_userinput=0;

  wire user_busy;
  wire [3:0] user_move;
  wire usermove_stb;


  wire [17:0] user_move_mask;
  wire bad_user_move;

  wire [3:0] x_move;
  wire [17:0] x_move_mask;
  wire bad_x_move;


  user #(CLOCKS_PER_BAUD[23:0])
       u1(i_clk, o_uart_tx, i_uart_rx, board, result, result_stb,
          need_userinput, user_busy, user_move, usermove_stb);


  xmove g1(board, x_move);


  result r1(board, result);


  movemask m1(user_move, 0, user_move_mask, bad_user_move);


  movemask m2(x_move, 1, x_move_mask, bad_x_move);


  always @(posedge i_clk)
    case (state)
      INITIALISE_STATE: begin
   	board <= 18'd0;
	result_stb <= 0;
	state <= ASK_USER_MOVE;
      end

      ASK_USER_MOVE: begin
	need_userinput <= 1;
	state <= GET_USER_MOVE;
      end

      GET_USER_MOVE: begin
	if (!user_busy && usermove_stb) begin
	  need_userinput <= 0;
	  state <= MAKE_USER_MOVE;
	end
      end

      MAKE_USER_MOVE: begin
	if (bad_user_move)
	  state <= ASK_USER_MOVE;
	else begin
	  oldboard <= board;
	  board <= board | user_move_mask;
	  state <= CHECK_USER_MOVE;
	end
      end






      CHECK_USER_MOVE: begin
	if (board == oldboard)
	  state <= ASK_USER_MOVE;
	else if (result == DRAW)
	  state <= DRAW_STATE;
	else if (result == OWIN)
	  state <= LOSE_STATE;
	else
	  state <= MAKE_X_MOVE;
      end

      MAKE_X_MOVE: begin
	if (bad_x_move)
	  state <= ERROR_STATE;
	else begin
	  board <= board | x_move_mask;
	  state <= CHECK_X_MOVE;
	end
      end

      CHECK_X_MOVE: begin
	if (result == DRAW)
          state <= DRAW_STATE;
	else if (result == XWIN)
	  state <= WIN_STATE;
	else
	  state <= ASK_USER_MOVE;
      end

      WIN_STATE: begin
	result_stb <= 1;
	state <= WAIT_FOR_USER;
      end

      LOSE_STATE:
	state <= INITIALISE_STATE;

      DRAW_STATE: begin
	result_stb <= 1;
	state <= WAIT_FOR_USER;
      end

      WAIT_FOR_USER: begin
	result_stb <= 0;
	state <= WAIT_FOR_USER2;
      end

      WAIT_FOR_USER2:
	if (!user_busy)
	  state <= INITIALISE_STATE;

      ERROR_STATE:
        state <= INITIALISE_STATE;

      default:
        state <= INITIALISE_STATE;
    endcase
endmodule
module ttt(i_clk, o_setup, o_uart_tx, i_uart_rx, o_board);

  input wire i_clk;
  output wire [31:0] o_setup;
  output wire o_uart_tx;
  input  wire i_uart_rx;
  output wire [17:0] o_board;
`else

module ttt(i_clk, o_uart_tx, i_uart_rx, o_board);
  input wire i_clk;
  output wire o_uart_tx;
  input  wire i_uart_rx;
  output wire [17:0] o_board;
`endif

  parameter CLOCK_RATE_HZ = 1000000;
  parameter BAUD_RATE = 115_200;
  parameter CLOCKS_PER_BAUD = CLOCK_RATE_HZ/BAUD_RATE;
`ifdef VERILATOR
  assign o_setup = CLOCKS_PER_BAUD;
`endif

  reg [17:0] board;
  initial board= 18'd0;



  assign o_board = board;

  localparam INITIALISE_STATE = 5'h0;
  localparam ASK_USER_MOVE    = 5'h1;
  localparam GET_USER_MOVE    = 5'h2;	
  localparam MAKE_USER_MOVE   = 5'h3;	
  localparam CHECK_USER_MOVE  = 5'h4;	
  localparam MAKE_X_MOVE      = 5'h5;	
  localparam CHECK_X_MOVE     = 5'h6;	
  localparam WAIT_FOR_USER    = 5'h1a;
  localparam WAIT_FOR_USER2   = 5'h1b;
  localparam WIN_STATE        = 5'h1c;	
  localparam LOSE_STATE       = 5'h1d;	
  localparam DRAW_STATE       = 5'h1e;	
  localparam ERROR_STATE      = 5'h1f;	

  reg [4:0] state;
  initial state= INITIALISE_STATE;

  reg [17:0] oldboard;



  reg [1:0] result;
  localparam NONE = 0;			
  localparam XWIN = 1;			
  localparam OWIN = 2;
  localparam DRAW = 3;

  reg result_stb;
  initial result_stb=0;

  reg need_userinput;
  initial need_userinput=0;

  wire user_busy;
  wire [3:0] user_move;
  wire usermove_stb;


  wire [17:0] user_move_mask;
  wire bad_user_move;

  wire [3:0] x_move;
  wire [17:0] x_move_mask;
  wire bad_x_move;


  user #(CLOCKS_PER_BAUD[23:0])
       u1(i_clk, o_uart_tx, i_uart_rx, board, result, result_stb,
          need_userinput, user_busy, user_move, usermove_stb);


  xmove g1(board, x_move);


  result r1(board, result);


  movemask m1(user_move, 0, user_move_mask, bad_user_move);


  movemask m2(x_move, 1, x_move_mask, bad_x_move);


  always @(posedge i_clk)
    case (state)
      INITIALISE_STATE: begin
   	board <= 18'd0;
	result_stb <= 0;
	state <= ASK_USER_MOVE;
      end

      ASK_USER_MOVE: begin
	need_userinput <= 1;
	state <= GET_USER_MOVE;
      end

      GET_USER_MOVE: begin
	if (!user_busy && usermove_stb) begin
	  need_userinput <= 0;
	  state <= MAKE_USER_MOVE;
	end
      end

      MAKE_USER_MOVE: begin
	if (bad_user_move)
	  state <= ASK_USER_MOVE;
	else begin
	  oldboard <= board;
	  board <= board | user_move_mask;
	  state <= CHECK_USER_MOVE;
	end
      end






      CHECK_USER_MOVE: begin
	if (board == oldboard)
	  state <= ASK_USER_MOVE;
	else if (result == DRAW)
	  state <= DRAW_STATE;
	else if (result == OWIN)
	  state <= LOSE_STATE;
	else
	  state <= MAKE_X_MOVE;
      end

      MAKE_X_MOVE: begin
	if (bad_x_move)
	  state <= ERROR_STATE;
	else begin
	  board <= board | x_move_mask;
	  state <= CHECK_X_MOVE;
	end
      end

      CHECK_X_MOVE: begin
	if (result == DRAW)
          state <= DRAW_STATE;
	else if (result == XWIN)
	  state <= WIN_STATE;
	else
	  state <= ASK_USER_MOVE;
      end

      WIN_STATE: begin
	result_stb <= 1;
	state <= WAIT_FOR_USER;
      end

      LOSE_STATE:
	state <= INITIALISE_STATE;

      DRAW_STATE: begin
	result_stb <= 1;
	state <= WAIT_FOR_USER;
      end

      WAIT_FOR_USER: begin
	result_stb <= 0;
	state <= WAIT_FOR_USER2;
      end

      WAIT_FOR_USER2:
	if (!user_busy)
	  state <= INITIALISE_STATE;

      ERROR_STATE:
        state <= INITIALISE_STATE;

      default:
        state <= INITIALISE_STATE;
    endcase
endmodule