data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v
None: at end of input
1: b'%Error: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:45: Cannot find file containing module: \'regfile_37\'\n  regfile_37 regfile (\n  ^~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog,data/full_repos/permissive/209997170/regfile_37\n             data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog,data/full_repos/permissive/209997170/regfile_37.v\n             data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog,data/full_repos/permissive/209997170/regfile_37.sv\n             regfile_37\n             regfile_37.v\n             regfile_37.sv\n             obj_dir/regfile_37\n             obj_dir/regfile_37.v\n             obj_dir/regfile_37.sv\n%Error: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:73: Cannot find file containing module: \'map_38\'\n  map_38 map (\n  ^~~~~~\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:130: Operator SUB expects 8 bits on the RHS, but RHS\'s CONST \'2\'h2\' generates 2 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 2\'h2;\n                                                                                         ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:137: Operator ADD expects 8 bits on the RHS, but RHS\'s CONST \'2\'h2\' generates 2 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] + 2\'h2;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:142: Operator SUB expects 8 bits on the RHS, but RHS\'s CONST \'6\'h20\' generates 6 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 6\'h20;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:143: Operator SUB expects 8 bits on the RHS, but RHS\'s CONST \'5\'h10\' generates 5 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] - 5\'h10;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:148: Operator ADD expects 8 bits on the RHS, but RHS\'s CONST \'5\'h10\' generates 5 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 5\'h10;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:149: Operator ADD expects 8 bits on the RHS, but RHS\'s CONST \'6\'h20\' generates 6 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] + 6\'h20;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:164: Operator SUB expects 8 bits on the RHS, but RHS\'s CONST \'5\'h10\' generates 5 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 5\'h10;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:165: Operator ASSIGN expects 8 bits on the Assign RHS, but Assign RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[0+7-:8] = 1\'h0;\n                                                 ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:170: Operator ADD expects 8 bits on the RHS, but RHS\'s CONST \'6\'h20\' generates 6 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 6\'h20;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:171: Operator ASSIGN expects 8 bits on the Assign RHS, but Assign RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[0+7-:8] = 1\'h0;\n                                                 ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:179: Operator ASSIGN expects 8 bits on the Assign RHS, but Assign RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[0+7-:8] = 1\'h0;\n                                                 ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:184: Operator ADD expects 8 bits on the RHS, but RHS\'s CONST \'2\'h2\' generates 2 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 2\'h2;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:185: Operator ASSIGN expects 8 bits on the Assign RHS, but Assign RHS\'s CONST \'1\'h0\' generates 1 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[0+7-:8] = 1\'h0;\n                                                 ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:190: Operator SUB expects 8 bits on the RHS, but RHS\'s CONST \'5\'h10\' generates 5 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 5\'h10;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:191: Operator SUB expects 8 bits on the RHS, but RHS\'s CONST \'5\'h10\' generates 5 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] - 5\'h10;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:194: Operator ADD expects 8 bits on the RHS, but RHS\'s CONST \'5\'h10\' generates 5 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 5\'h10;\n                                                                                         ^\n%Warning-WIDTH: data/full_repos/permissive/209997170/bloxorz/work/planAhead/bloxorz/bloxorz.srcs/sources_1/imports/verilog/game_24.v:195: Operator ADD expects 8 bits on the RHS, but RHS\'s CONST \'5\'h10\' generates 5 bits.\n                                                                                                                                        : ... In instance game_24\n            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] + 5\'h10;\n                                                                                         ^\n%Error: Exiting due to 2 error(s), 17 warning(s)\n'
module game_24 (
    input clk,
    input rst,
    input button_up,
    input button_down,
    input button_left,
    input button_right,
    input button_stage_left,
    input button_stage_right,
    output reg [255:0] map_out,
    output reg [15:0] player_position_out,
    output reg [7:0] win_position_out,
    output reg win_bool_out,
    output reg loss_bool_out,
    output reg portrait_orientation_out,
    output reg horizontal_orientation_out,
    output reg vertical_orientation_out,
    output reg [1:0] map_index
  );
  
  
  
  wire [256-1:0] M_regfile_map_out;
  wire [16-1:0] M_regfile_player_position_out;
  wire [8-1:0] M_regfile_win_position_out;
  wire [1-1:0] M_regfile_win_bool_out;
  wire [1-1:0] M_regfile_loss_bool_out;
  wire [1-1:0] M_regfile_portrait_orientation_out;
  wire [1-1:0] M_regfile_horizontal_orientation_out;
  wire [1-1:0] M_regfile_vertical_orientation_out;
  reg [256-1:0] M_regfile_map_in;
  reg [16-1:0] M_regfile_player_position_in;
  reg [8-1:0] M_regfile_win_position_in;
  reg [1-1:0] M_regfile_win_bool_in;
  reg [1-1:0] M_regfile_loss_bool_in;
  reg [1-1:0] M_regfile_portrait_orientation_in;
  reg [1-1:0] M_regfile_horizontal_orientation_in;
  reg [1-1:0] M_regfile_vertical_orientation_in;
  regfile_37 regfile (
    .clk(clk),
    .rst(rst),
    .map_in(M_regfile_map_in),
    .player_position_in(M_regfile_player_position_in),
    .win_position_in(M_regfile_win_position_in),
    .win_bool_in(M_regfile_win_bool_in),
    .loss_bool_in(M_regfile_loss_bool_in),
    .portrait_orientation_in(M_regfile_portrait_orientation_in),
    .horizontal_orientation_in(M_regfile_horizontal_orientation_in),
    .vertical_orientation_in(M_regfile_vertical_orientation_in),
    .map_out(M_regfile_map_out),
    .player_position_out(M_regfile_player_position_out),
    .win_position_out(M_regfile_win_position_out),
    .win_bool_out(M_regfile_win_bool_out),
    .loss_bool_out(M_regfile_loss_bool_out),
    .portrait_orientation_out(M_regfile_portrait_orientation_out),
    .horizontal_orientation_out(M_regfile_horizontal_orientation_out),
    .vertical_orientation_out(M_regfile_vertical_orientation_out)
  );
  wire [256-1:0] M_map_map_out;
  wire [16-1:0] M_map_player_position_out;
  wire [8-1:0] M_map_win_position_out;
  wire [2-1:0] M_map_map_index;
  reg [1-1:0] M_map_button_stage_left;
  reg [1-1:0] M_map_button_stage_right;
  reg [1-1:0] M_map_win_bool_in;
  reg [1-1:0] M_map_loss_bool_in;
  map_38 map (
    .clk(clk),
    .rst(rst),
    .button_stage_left(M_map_button_stage_left),
    .button_stage_right(M_map_button_stage_right),
    .win_bool_in(M_map_win_bool_in),
    .loss_bool_in(M_map_loss_bool_in),
    .map_out(M_map_map_out),
    .player_position_out(M_map_player_position_out),
    .win_position_out(M_map_win_position_out),
    .map_index(M_map_map_index)
  );
  localparam START_movement_fsm = 1'd0;
  localparam NOTSTART_movement_fsm = 1'd1;
  
  reg M_movement_fsm_d, M_movement_fsm_q = START_movement_fsm;
  
  always @* begin
    M_movement_fsm_d = M_movement_fsm_q;
    
    map_out = M_regfile_map_out;
    player_position_out = M_regfile_player_position_out;
    win_position_out = M_regfile_win_position_out;
    win_bool_out = M_regfile_win_bool_out;
    loss_bool_out = M_regfile_loss_bool_out;
    portrait_orientation_out = M_regfile_portrait_orientation_out;
    horizontal_orientation_out = M_regfile_horizontal_orientation_out;
    vertical_orientation_out = M_regfile_vertical_orientation_out;
    map_index = M_map_map_index;
    M_map_button_stage_left = button_stage_left;
    M_map_button_stage_right = button_stage_right;
    M_map_win_bool_in = M_regfile_win_bool_out;
    M_map_loss_bool_in = M_regfile_loss_bool_out;
    M_regfile_map_in = M_map_map_out;
    M_regfile_player_position_in = M_regfile_player_position_out;
    M_regfile_win_position_in = M_map_win_position_out;
    M_regfile_win_bool_in = M_regfile_win_bool_out;
    M_regfile_loss_bool_in = M_regfile_loss_bool_out;
    M_regfile_portrait_orientation_in = M_regfile_portrait_orientation_out;
    M_regfile_horizontal_orientation_in = M_regfile_horizontal_orientation_out;
    M_regfile_vertical_orientation_in = M_regfile_vertical_orientation_out;
    
    case (M_movement_fsm_q)
      START_movement_fsm: begin
        M_regfile_map_in = M_map_map_out;
        M_regfile_player_position_in = M_map_player_position_out;
        M_regfile_win_position_in = M_map_win_position_out;
        M_regfile_win_bool_in = 1'h0;
        M_regfile_loss_bool_in = 1'h0;
        M_regfile_portrait_orientation_in = 1'h1;
        M_regfile_horizontal_orientation_in = 1'h0;
        M_regfile_vertical_orientation_in = 1'h0;
        M_movement_fsm_d = NOTSTART_movement_fsm;
      end
      NOTSTART_movement_fsm: begin
        if (M_regfile_portrait_orientation_out == 1'h1) begin
          if (button_left == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 2'h2;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] - 1'h1;
            M_regfile_horizontal_orientation_in = 1'h1;
            M_regfile_portrait_orientation_in = 1'h0;
          end
          if (button_right == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 1'h1;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] + 2'h2;
            M_regfile_horizontal_orientation_in = 1'h1;
            M_regfile_portrait_orientation_in = 1'h0;
          end
          if (button_up == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 6'h20;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] - 5'h10;
            M_regfile_vertical_orientation_in = 1'h1;
            M_regfile_portrait_orientation_in = 1'h0;
          end
          if (button_down == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 5'h10;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] + 6'h20;
            M_regfile_vertical_orientation_in = 1'h1;
            M_regfile_portrait_orientation_in = 1'h0;
          end
        end
        if (M_regfile_vertical_orientation_out == 1'h1) begin
          if (button_left == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 1'h1;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] - 1'h1;
          end
          if (button_right == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 1'h1;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] + 1'h1;
          end
          if (button_up == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 5'h10;
            M_regfile_player_position_in[0+7-:8] = 1'h0;
            M_regfile_vertical_orientation_in = 1'h0;
            M_regfile_portrait_orientation_in = 1'h1;
          end
          if (button_down == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 6'h20;
            M_regfile_player_position_in[0+7-:8] = 1'h0;
            M_regfile_vertical_orientation_in = 1'h0;
            M_regfile_portrait_orientation_in = 1'h1;
          end
        end
        if (M_regfile_horizontal_orientation_out == 1'h1) begin
          if (button_left == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 1'h1;
            M_regfile_player_position_in[0+7-:8] = 1'h0;
            M_regfile_horizontal_orientation_in = 1'h0;
            M_regfile_portrait_orientation_in = 1'h1;
          end
          if (button_right == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 2'h2;
            M_regfile_player_position_in[0+7-:8] = 1'h0;
            M_regfile_horizontal_orientation_in = 1'h0;
            M_regfile_portrait_orientation_in = 1'h1;
          end
          if (button_up == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 5'h10;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] - 5'h10;
          end
          if (button_down == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 5'h10;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] + 5'h10;
          end
        end
        if (M_regfile_player_position_out[8+7-:8] == M_regfile_win_position_out && M_regfile_portrait_orientation_out) begin
          M_regfile_win_bool_in = 1'h1;
          M_movement_fsm_d = START_movement_fsm;
        end
        if (M_regfile_map_out[(8'hff - M_regfile_player_position_out[8+7-:8])*1+0-:1] == 1'h0) begin
          M_regfile_loss_bool_in = 1'h1;
          M_movement_fsm_d = START_movement_fsm;
        end
        if (M_regfile_map_out[(8'hff - M_regfile_player_position_out[0+7-:8])*1+0-:1] == 1'h0 && ~M_regfile_portrait_orientation_out) begin
          M_regfile_loss_bool_in = 1'h1;
          M_movement_fsm_d = START_movement_fsm;
        end
      end
    endcase
  end
  
  always @(posedge clk) begin
    if (rst == 1'b1) begin
      M_movement_fsm_q <= 1'h0;
    end else begin
      M_movement_fsm_q <= M_movement_fsm_d;
    end
  end
  
endmodule
module game_24 (
    input clk,
    input rst,
    input button_up,
    input button_down,
    input button_left,
    input button_right,
    input button_stage_left,
    input button_stage_right,
    output reg [255:0] map_out,
    output reg [15:0] player_position_out,
    output reg [7:0] win_position_out,
    output reg win_bool_out,
    output reg loss_bool_out,
    output reg portrait_orientation_out,
    output reg horizontal_orientation_out,
    output reg vertical_orientation_out,
    output reg [1:0] map_index
  );

  
  
  
  wire [256-1:0] M_regfile_map_out;
  wire [16-1:0] M_regfile_player_position_out;
  wire [8-1:0] M_regfile_win_position_out;
  wire [1-1:0] M_regfile_win_bool_out;
  wire [1-1:0] M_regfile_loss_bool_out;
  wire [1-1:0] M_regfile_portrait_orientation_out;
  wire [1-1:0] M_regfile_horizontal_orientation_out;
  wire [1-1:0] M_regfile_vertical_orientation_out;
  reg [256-1:0] M_regfile_map_in;
  reg [16-1:0] M_regfile_player_position_in;
  reg [8-1:0] M_regfile_win_position_in;
  reg [1-1:0] M_regfile_win_bool_in;
  reg [1-1:0] M_regfile_loss_bool_in;
  reg [1-1:0] M_regfile_portrait_orientation_in;
  reg [1-1:0] M_regfile_horizontal_orientation_in;
  reg [1-1:0] M_regfile_vertical_orientation_in;
  regfile_37 regfile (
    .clk(clk),
    .rst(rst),
    .map_in(M_regfile_map_in),
    .player_position_in(M_regfile_player_position_in),
    .win_position_in(M_regfile_win_position_in),
    .win_bool_in(M_regfile_win_bool_in),
    .loss_bool_in(M_regfile_loss_bool_in),
    .portrait_orientation_in(M_regfile_portrait_orientation_in),
    .horizontal_orientation_in(M_regfile_horizontal_orientation_in),
    .vertical_orientation_in(M_regfile_vertical_orientation_in),
    .map_out(M_regfile_map_out),
    .player_position_out(M_regfile_player_position_out),
    .win_position_out(M_regfile_win_position_out),
    .win_bool_out(M_regfile_win_bool_out),
    .loss_bool_out(M_regfile_loss_bool_out),
    .portrait_orientation_out(M_regfile_portrait_orientation_out),
    .horizontal_orientation_out(M_regfile_horizontal_orientation_out),
    .vertical_orientation_out(M_regfile_vertical_orientation_out)
  );
  wire [256-1:0] M_map_map_out;
  wire [16-1:0] M_map_player_position_out;
  wire [8-1:0] M_map_win_position_out;
  wire [2-1:0] M_map_map_index;
  reg [1-1:0] M_map_button_stage_left;
  reg [1-1:0] M_map_button_stage_right;
  reg [1-1:0] M_map_win_bool_in;
  reg [1-1:0] M_map_loss_bool_in;
  map_38 map (
    .clk(clk),
    .rst(rst),
    .button_stage_left(M_map_button_stage_left),
    .button_stage_right(M_map_button_stage_right),
    .win_bool_in(M_map_win_bool_in),
    .loss_bool_in(M_map_loss_bool_in),
    .map_out(M_map_map_out),
    .player_position_out(M_map_player_position_out),
    .win_position_out(M_map_win_position_out),
    .map_index(M_map_map_index)
  );
  localparam START_movement_fsm = 1'd0;
  localparam NOTSTART_movement_fsm = 1'd1;
  
  reg M_movement_fsm_d, M_movement_fsm_q = START_movement_fsm;
  
  always @* begin
    M_movement_fsm_d = M_movement_fsm_q;
    
    map_out = M_regfile_map_out;
    player_position_out = M_regfile_player_position_out;
    win_position_out = M_regfile_win_position_out;
    win_bool_out = M_regfile_win_bool_out;
    loss_bool_out = M_regfile_loss_bool_out;
    portrait_orientation_out = M_regfile_portrait_orientation_out;
    horizontal_orientation_out = M_regfile_horizontal_orientation_out;
    vertical_orientation_out = M_regfile_vertical_orientation_out;
    map_index = M_map_map_index;
    M_map_button_stage_left = button_stage_left;
    M_map_button_stage_right = button_stage_right;
    M_map_win_bool_in = M_regfile_win_bool_out;
    M_map_loss_bool_in = M_regfile_loss_bool_out;
    M_regfile_map_in = M_map_map_out;
    M_regfile_player_position_in = M_regfile_player_position_out;
    M_regfile_win_position_in = M_map_win_position_out;
    M_regfile_win_bool_in = M_regfile_win_bool_out;
    M_regfile_loss_bool_in = M_regfile_loss_bool_out;
    M_regfile_portrait_orientation_in = M_regfile_portrait_orientation_out;
    M_regfile_horizontal_orientation_in = M_regfile_horizontal_orientation_out;
    M_regfile_vertical_orientation_in = M_regfile_vertical_orientation_out;
    
    case (M_movement_fsm_q)
      START_movement_fsm: begin
        M_regfile_map_in = M_map_map_out;
        M_regfile_player_position_in = M_map_player_position_out;
        M_regfile_win_position_in = M_map_win_position_out;
        M_regfile_win_bool_in = 1'h0;
        M_regfile_loss_bool_in = 1'h0;
        M_regfile_portrait_orientation_in = 1'h1;
        M_regfile_horizontal_orientation_in = 1'h0;
        M_regfile_vertical_orientation_in = 1'h0;
        M_movement_fsm_d = NOTSTART_movement_fsm;
      end
      NOTSTART_movement_fsm: begin
        if (M_regfile_portrait_orientation_out == 1'h1) begin
          if (button_left == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 2'h2;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] - 1'h1;
            M_regfile_horizontal_orientation_in = 1'h1;
            M_regfile_portrait_orientation_in = 1'h0;
          end
          if (button_right == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 1'h1;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] + 2'h2;
            M_regfile_horizontal_orientation_in = 1'h1;
            M_regfile_portrait_orientation_in = 1'h0;
          end
          if (button_up == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 6'h20;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] - 5'h10;
            M_regfile_vertical_orientation_in = 1'h1;
            M_regfile_portrait_orientation_in = 1'h0;
          end
          if (button_down == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 5'h10;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[8+7-:8] + 6'h20;
            M_regfile_vertical_orientation_in = 1'h1;
            M_regfile_portrait_orientation_in = 1'h0;
          end
        end
        if (M_regfile_vertical_orientation_out == 1'h1) begin
          if (button_left == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 1'h1;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] - 1'h1;
          end
          if (button_right == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 1'h1;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] + 1'h1;
          end
          if (button_up == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 5'h10;
            M_regfile_player_position_in[0+7-:8] = 1'h0;
            M_regfile_vertical_orientation_in = 1'h0;
            M_regfile_portrait_orientation_in = 1'h1;
          end
          if (button_down == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 6'h20;
            M_regfile_player_position_in[0+7-:8] = 1'h0;
            M_regfile_vertical_orientation_in = 1'h0;
            M_regfile_portrait_orientation_in = 1'h1;
          end
        end
        if (M_regfile_horizontal_orientation_out == 1'h1) begin
          if (button_left == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 1'h1;
            M_regfile_player_position_in[0+7-:8] = 1'h0;
            M_regfile_horizontal_orientation_in = 1'h0;
            M_regfile_portrait_orientation_in = 1'h1;
          end
          if (button_right == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 2'h2;
            M_regfile_player_position_in[0+7-:8] = 1'h0;
            M_regfile_horizontal_orientation_in = 1'h0;
            M_regfile_portrait_orientation_in = 1'h1;
          end
          if (button_up == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] - 5'h10;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] - 5'h10;
          end
          if (button_down == 1'h1) begin
            M_regfile_player_position_in[8+7-:8] = M_regfile_player_position_out[8+7-:8] + 5'h10;
            M_regfile_player_position_in[0+7-:8] = M_regfile_player_position_out[0+7-:8] + 5'h10;
          end
        end
        if (M_regfile_player_position_out[8+7-:8] == M_regfile_win_position_out && M_regfile_portrait_orientation_out) begin
          M_regfile_win_bool_in = 1'h1;
          M_movement_fsm_d = START_movement_fsm;
        end
        if (M_regfile_map_out[(8'hff - M_regfile_player_position_out[8+7-:8])*1+0-:1] == 1'h0) begin
          M_regfile_loss_bool_in = 1'h1;
          M_movement_fsm_d = START_movement_fsm;
        end
        if (M_regfile_map_out[(8'hff - M_regfile_player_position_out[0+7-:8])*1+0-:1] == 1'h0 && ~M_regfile_portrait_orientation_out) begin
          M_regfile_loss_bool_in = 1'h1;
          M_movement_fsm_d = START_movement_fsm;
        end
      end
    endcase
  end
  
  always @(posedge clk) begin
    if (rst == 1'b1) begin
      M_movement_fsm_q <= 1'h0;
    end else begin
      M_movement_fsm_q <= M_movement_fsm_d;
    end
  end
  
endmodule