data/full_repos/permissive/138243369/f3_gpu.v
1: b'%Error: data/full_repos/permissive/138243369/f3_gpu.v:1: Cannot find include file: constant.v\n`include "constant.v"\n         ^~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/138243369,data/full_repos/permissive/138243369/constant.v\n             data/full_repos/permissive/138243369,data/full_repos/permissive/138243369/constant.v.v\n             data/full_repos/permissive/138243369,data/full_repos/permissive/138243369/constant.v.sv\n             constant.v\n             constant.v.v\n             constant.v.sv\n             obj_dir/constant.v\n             obj_dir/constant.v.v\n             obj_dir/constant.v.sv\n%Error: data/full_repos/permissive/138243369/f3_gpu.v:176: Define or directive not defined: \'`MAX_IMAGE_SIZE\'\n                            cursor_y <= `MAX_IMAGE_SIZE;\n                                        ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/138243369/f3_gpu.v:176: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n                            cursor_y <= `MAX_IMAGE_SIZE;\n                                                       ^\n%Error: data/full_repos/permissive/138243369/f3_gpu.v:184: Define or directive not defined: \'`MAX_IMAGE_SIZE\'\n                        if (cursor_x == `MAX_IMAGE_SIZE)\n                                        ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/138243369/f3_gpu.v:184: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n                        if (cursor_x == `MAX_IMAGE_SIZE)\n                                                       ^\n%Error: data/full_repos/permissive/138243369/f3_gpu.v:194: Define or directive not defined: \'`MAX_IMAGE_SIZE\'\n                            cursor_x <= `MAX_IMAGE_SIZE;\n                                        ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/138243369/f3_gpu.v:194: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n                            cursor_x <= `MAX_IMAGE_SIZE;\n                                                       ^\n%Error: data/full_repos/permissive/138243369/f3_gpu.v:202: Define or directive not defined: \'`MAX_IMAGE_SIZE\'\n                        if (cursor_y == `MAX_IMAGE_SIZE) \n                                        ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/138243369/f3_gpu.v:202: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n                        if (cursor_y == `MAX_IMAGE_SIZE) \n                                                       ^\n%Error: Exiting due to 9 error(s)\n'
module f3_gpu(
input wire [3:0] instruction,
input wire [21:0] display_addr,
input wire [2:0] pixel_data,
input wire [3:0] mapper_pixel_x,
input wire [3:0] mapper_pixel_y,
input wire [3:0] offset_x,
input wire [3:0] offset_y,
input wire scramble,
input wire offset_all_zero,
input wire sysclk,
output reg [21:0] mapper_display_addr,
output reg [3:0] offset_pos_x,
output reg [3:0] offset_pos_y,
output reg [7:0] pixel_addr,
output reg [2:0] display_data,
output reg [3:0] ram_write_pos,
output reg ram_write_horizontal,
output reg ram_write_increase,
output reg ram_write,
output reg ram_reset);

reg [10:0] display_x, display_y;
reg [3:0] pixel_x, pixel_y, pixel_offset_x, pixel_offset_y, cursor_x, cursor_y;
reg [24:0] flash_counter;
reg [1:0] win_check_delay;
reg flash_negative, instruction_done, is_cursor, scramble_reset, scramble_win, writing_RAM;

initial begin

	instruction_done = 0;

	cursor_x = 0;
	cursor_y = 0;

	flash_counter = 0;
	flash_negative = 0;

	ram_reset = 0;

	scramble_reset = 1;

   scramble_win = 0;

	win_check_delay = 2'b0;
end

always @(posedge sysclk) begin

	flash_counter <= flash_counter + 1'b1;

	if (flash_counter == 25'b0) begin
		flash_negative <= ~flash_negative;
	end

	if (writing_RAM) begin

		ram_write <= 0;

		scramble_reset <= 0;

		if (win_check_delay == 2'b0) begin

			writing_RAM <= 0;


			if (offset_all_zero) begin


				scramble_win <= 1;
			end
		end
		else begin

			win_check_delay <= win_check_delay + 2'b1;
		end
	end

	if (scramble_win) begin

		  if (instruction == 5) begin

            ram_reset <= 1;

				scramble_win <= 0;
		  end
	end
	else begin

        ram_reset <= (instruction == 5);

        if (instruction_done) begin

            if (instruction == 0) begin

                instruction_done <= 0;
            end
        end
        else begin

            if (scramble) begin


                case (instruction)


                    1: begin

                        ram_write_pos <= cursor_x;
                        ram_write_horizontal <= 0;
                        ram_write_increase <= 1;

                        ram_write <= 1;

								writing_RAM <= 1;

								win_check_delay <= 2'b1;

                        instruction_done <= 1;
                    end

                    2: begin

                        ram_write_pos <= cursor_y;
                        ram_write_horizontal <= 1;
                        ram_write_increase <= 0;

                        ram_write <= 1;

								writing_RAM <= 1;

								win_check_delay <= 2'b1;

                        instruction_done <= 1;
                    end

                    3: begin

                        ram_write_pos <= cursor_y;
                        ram_write_horizontal <= 1;
                        ram_write_increase <= 1;

                        ram_write <= 1;

								writing_RAM <= 1;

								win_check_delay <= 2'b1;

                        instruction_done <= 1;
                    end

                    4: begin

                        ram_write_pos <= cursor_x;
                        ram_write_horizontal <= 0;
                        ram_write_increase <= 0;

                        ram_write <= 1;

								writing_RAM <= 1;

								win_check_delay <= 2'b1;

                        instruction_done <= 1;
                    end
                endcase
            end
            else begin

                case (instruction)


                    1: begin
                        if (cursor_y == 0)
                            cursor_y <= `MAX_IMAGE_SIZE;
                        else
                            cursor_y <= cursor_y - 1'b1;

                        instruction_done <= 1;
                    end

                    2: begin
                        if (cursor_x == `MAX_IMAGE_SIZE)
                            cursor_x <= 0;
                        else
                            cursor_x <= cursor_x + 1'b1;

                        instruction_done <= 1;
                    end

                    3: begin
                        if (cursor_x == 0)
                            cursor_x <= `MAX_IMAGE_SIZE;
                        else
                            cursor_x <= cursor_x - 1'b1;

                        instruction_done <= 1;
                    end

                    4: begin
                        if (cursor_y == `MAX_IMAGE_SIZE) 
                            cursor_y <= 0;
                        else
                            cursor_y <= cursor_y + 1'b1;

                        instruction_done <= 1;
                    end
                endcase
            end
        end
	end
end

always @(*) begin

	display_x = display_addr[21:11];
	display_y = display_addr[10:0];

	if ((display_x < 231) || (display_x > 711) || (display_y < 36) || (display_y > 516)) begin

		display_data = 3'b000;
	end
	else begin

		mapper_display_addr = display_addr;

		is_cursor = flash_negative && (mapper_pixel_x == cursor_x) && (mapper_pixel_y == cursor_y);

		offset_pos_x = mapper_pixel_x;
		offset_pos_y = mapper_pixel_y;

		pixel_x = mapper_pixel_x + offset_y;
		pixel_y = mapper_pixel_y + offset_x;

		pixel_addr = {pixel_y, pixel_x};


      if (scramble_win) begin

          if (flash_negative)
              display_data = ~pixel_data;
          else
              display_data = pixel_data;
      end
      else begin

          if (is_cursor)
              display_data = ~pixel_data;
          else
              display_data = pixel_data;
      end
	end
end

endmodule
module f3_gpu(
input wire [3:0] instruction,
input wire [21:0] display_addr,
input wire [2:0] pixel_data,
input wire [3:0] mapper_pixel_x,
input wire [3:0] mapper_pixel_y,
input wire [3:0] offset_x,
input wire [3:0] offset_y,
input wire scramble,
input wire offset_all_zero,
input wire sysclk,
output reg [21:0] mapper_display_addr,
output reg [3:0] offset_pos_x,
output reg [3:0] offset_pos_y,
output reg [7:0] pixel_addr,
output reg [2:0] display_data,
output reg [3:0] ram_write_pos,
output reg ram_write_horizontal,
output reg ram_write_increase,
output reg ram_write,
output reg ram_reset);


reg [10:0] display_x, display_y;
reg [3:0] pixel_x, pixel_y, pixel_offset_x, pixel_offset_y, cursor_x, cursor_y;
reg [24:0] flash_counter;
reg [1:0] win_check_delay;
reg flash_negative, instruction_done, is_cursor, scramble_reset, scramble_win, writing_RAM;

initial begin

	instruction_done = 0;

	cursor_x = 0;
	cursor_y = 0;

	flash_counter = 0;
	flash_negative = 0;

	ram_reset = 0;

	scramble_reset = 1;

   scramble_win = 0;

	win_check_delay = 2'b0;
end

always @(posedge sysclk) begin

	flash_counter <= flash_counter + 1'b1;

	if (flash_counter == 25'b0) begin
		flash_negative <= ~flash_negative;
	end

	if (writing_RAM) begin

		ram_write <= 0;

		scramble_reset <= 0;

		if (win_check_delay == 2'b0) begin

			writing_RAM <= 0;


			if (offset_all_zero) begin


				scramble_win <= 1;
			end
		end
		else begin

			win_check_delay <= win_check_delay + 2'b1;
		end
	end

	if (scramble_win) begin

		  if (instruction == 5) begin

            ram_reset <= 1;

				scramble_win <= 0;
		  end
	end
	else begin

        ram_reset <= (instruction == 5);

        if (instruction_done) begin

            if (instruction == 0) begin

                instruction_done <= 0;
            end
        end
        else begin

            if (scramble) begin


                case (instruction)


                    1: begin

                        ram_write_pos <= cursor_x;
                        ram_write_horizontal <= 0;
                        ram_write_increase <= 1;

                        ram_write <= 1;

								writing_RAM <= 1;

								win_check_delay <= 2'b1;

                        instruction_done <= 1;
                    end

                    2: begin

                        ram_write_pos <= cursor_y;
                        ram_write_horizontal <= 1;
                        ram_write_increase <= 0;

                        ram_write <= 1;

								writing_RAM <= 1;

								win_check_delay <= 2'b1;

                        instruction_done <= 1;
                    end

                    3: begin

                        ram_write_pos <= cursor_y;
                        ram_write_horizontal <= 1;
                        ram_write_increase <= 1;

                        ram_write <= 1;

								writing_RAM <= 1;

								win_check_delay <= 2'b1;

                        instruction_done <= 1;
                    end

                    4: begin

                        ram_write_pos <= cursor_x;
                        ram_write_horizontal <= 0;
                        ram_write_increase <= 0;

                        ram_write <= 1;

								writing_RAM <= 1;

								win_check_delay <= 2'b1;

                        instruction_done <= 1;
                    end
                endcase
            end
            else begin

                case (instruction)


                    1: begin
                        if (cursor_y == 0)
                            cursor_y <= `MAX_IMAGE_SIZE;
                        else
                            cursor_y <= cursor_y - 1'b1;

                        instruction_done <= 1;
                    end

                    2: begin
                        if (cursor_x == `MAX_IMAGE_SIZE)
                            cursor_x <= 0;
                        else
                            cursor_x <= cursor_x + 1'b1;

                        instruction_done <= 1;
                    end

                    3: begin
                        if (cursor_x == 0)
                            cursor_x <= `MAX_IMAGE_SIZE;
                        else
                            cursor_x <= cursor_x - 1'b1;

                        instruction_done <= 1;
                    end

                    4: begin
                        if (cursor_y == `MAX_IMAGE_SIZE) 
                            cursor_y <= 0;
                        else
                            cursor_y <= cursor_y + 1'b1;

                        instruction_done <= 1;
                    end
                endcase
            end
        end
	end
end

always @(*) begin

	display_x = display_addr[21:11];
	display_y = display_addr[10:0];

	if ((display_x < 231) || (display_x > 711) || (display_y < 36) || (display_y > 516)) begin

		display_data = 3'b000;
	end
	else begin

		mapper_display_addr = display_addr;

		is_cursor = flash_negative && (mapper_pixel_x == cursor_x) && (mapper_pixel_y == cursor_y);

		offset_pos_x = mapper_pixel_x;
		offset_pos_y = mapper_pixel_y;

		pixel_x = mapper_pixel_x + offset_y;
		pixel_y = mapper_pixel_y + offset_x;

		pixel_addr = {pixel_y, pixel_x};


      if (scramble_win) begin

          if (flash_negative)
              display_data = ~pixel_data;
          else
              display_data = pixel_data;
      end
      else begin

          if (is_cursor)
              display_data = ~pixel_data;
          else
              display_data = pixel_data;
      end
	end
end

endmodule