data/full_repos/permissive/194450802/draw_fpv.v
1: b"%Error: data/full_repos/permissive/194450802/draw_fpv.v:182: Cannot find file containing module: 'draw_vertical_line'\n    draw_vertical_line dvl0 (.clock(clock),\n    ^~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/194450802,data/full_repos/permissive/194450802/draw_vertical_line\n             data/full_repos/permissive/194450802,data/full_repos/permissive/194450802/draw_vertical_line.v\n             data/full_repos/permissive/194450802,data/full_repos/permissive/194450802/draw_vertical_line.sv\n             draw_vertical_line\n             draw_vertical_line.v\n             draw_vertical_line.sv\n             obj_dir/draw_vertical_line\n             obj_dir/draw_vertical_line.v\n             obj_dir/draw_vertical_line.sv\n%Error: data/full_repos/permissive/194450802/draw_fpv.v:202: Cannot find file containing module: 'raytracer'\n    raytracer rt1 (.clock(clock),\n    ^~~~~~~~~\n%Error: Exiting due to 2 error(s)\n"
module draw_fpv_datapath(clock, reset,
                         draw_line_start, draw_line_done, raytracer_start, raytracer_done,
                         reset_x, increment_x, x_at_max, rt_grid_access,
                         player_pos_x, player_pos_y, player_angle,
                         grid_x, grid_y, grid_out,
                         vga_x, vga_y, vga_colour, vga_write);


    input clock;
    input reset;


    input [13:0] player_pos_x;
    input [12:0] player_pos_y;
    input [7:0] player_angle;


    output reg [5:0] grid_x;
    output reg [4:0] grid_y;
    input [2:0] grid_out;


    output [7:0] vga_x;
    output [6:0] vga_y;
    output [17:0] vga_colour;
    output vga_write;


    input draw_line_start;
    output draw_line_done;
    input raytracer_start;
    output raytracer_done;
    input reset_x;
    input increment_x;
    output x_at_max;
    input rt_grid_access;


    reg [7:0] x;


    reg [17:0] colour;
    draw_vertical_line dvl0 (.clock(clock),
                             .reset(reset),
                             .start(draw_line_start),
                             .done(draw_line_done),
                             .x(x),
                             .min_y(7'd0),
                             .max_y(7'd119),
                             .colour(colour),
                             .vga_x(vga_x),
                             .vga_y(vga_y),
                             .vga_colour(vga_colour),
                             .vga_write(vga_write));


    wire [7:0] angle;
    wire [5:0] rt_grid_x;
    wire [4:0] rt_grid_y;
    wire [5:0] rt_result_x;
    wire [4:0] rt_result_y;
    wire vertical;
    raytracer rt1 (.clock(clock),
                   .reset(reset),
                   .start(raytracer_start),
                   .done(raytracer_done),
                   .x(player_pos_x),
                   .y(player_pos_y),
                   .angle(angle),
                   .result_x(rt_result_x),
                   .result_y(rt_result_y),
                   .result_dir(vertical),
                   .grid_x(rt_grid_x),
                   .grid_y(rt_grid_y),
                   .grid_out(grid_out));


    wire [8:0] angle_base;
    wire [8:0] angle_base_signed = {1'b0, x} - 9'd80;
    assign angle_base = angle_base_signed[8] ? (angle_base_signed + 9'd256) : angle_base_signed;
    assign angle = angle_base[7:0] + player_angle;


    always @(posedge clock) begin
        if (reset | reset_x)
            x <= 8'b0;
        else if (increment_x)
            x <= x + 1;
    end
    assign x_at_max = x == 8'd119;


    always @(*) begin
        if (rt_grid_access) begin
            grid_x = rt_grid_x;
            grid_y = rt_grid_y;
        end
        else begin
            grid_x = rt_result_x;
            grid_y = rt_result_y;
        end
    end


    always @(*) begin
        if (vertical)
            colour = { {6{grid_out[2]}} , {6{grid_out[1]}} , {6{grid_out[0]}} };
        else
            colour = { {2{grid_out[2]}},4'b0 , {2{grid_out[1]}},4'b0 , {2{grid_out[0]}},4'b0 };
    end
endmodule
module draw_fpv_datapath(clock, reset,
                         draw_line_start, draw_line_done, raytracer_start, raytracer_done,
                         reset_x, increment_x, x_at_max, rt_grid_access,
                         player_pos_x, player_pos_y, player_angle,
                         grid_x, grid_y, grid_out,
                         vga_x, vga_y, vga_colour, vga_write);



    input clock;
    input reset;


    input [13:0] player_pos_x;
    input [12:0] player_pos_y;
    input [7:0] player_angle;


    output reg [5:0] grid_x;
    output reg [4:0] grid_y;
    input [2:0] grid_out;


    output [7:0] vga_x;
    output [6:0] vga_y;
    output [17:0] vga_colour;
    output vga_write;


    input draw_line_start;
    output draw_line_done;
    input raytracer_start;
    output raytracer_done;
    input reset_x;
    input increment_x;
    output x_at_max;
    input rt_grid_access;


    reg [7:0] x;


    reg [17:0] colour;
    draw_vertical_line dvl0 (.clock(clock),
                             .reset(reset),
                             .start(draw_line_start),
                             .done(draw_line_done),
                             .x(x),
                             .min_y(7'd0),
                             .max_y(7'd119),
                             .colour(colour),
                             .vga_x(vga_x),
                             .vga_y(vga_y),
                             .vga_colour(vga_colour),
                             .vga_write(vga_write));


    wire [7:0] angle;
    wire [5:0] rt_grid_x;
    wire [4:0] rt_grid_y;
    wire [5:0] rt_result_x;
    wire [4:0] rt_result_y;
    wire vertical;
    raytracer rt1 (.clock(clock),
                   .reset(reset),
                   .start(raytracer_start),
                   .done(raytracer_done),
                   .x(player_pos_x),
                   .y(player_pos_y),
                   .angle(angle),
                   .result_x(rt_result_x),
                   .result_y(rt_result_y),
                   .result_dir(vertical),
                   .grid_x(rt_grid_x),
                   .grid_y(rt_grid_y),
                   .grid_out(grid_out));


    wire [8:0] angle_base;
    wire [8:0] angle_base_signed = {1'b0, x} - 9'd80;
    assign angle_base = angle_base_signed[8] ? (angle_base_signed + 9'd256) : angle_base_signed;
    assign angle = angle_base[7:0] + player_angle;


    always @(posedge clock) begin
        if (reset | reset_x)
            x <= 8'b0;
        else if (increment_x)
            x <= x + 1;
    end
    assign x_at_max = x == 8'd119;


    always @(*) begin
        if (rt_grid_access) begin
            grid_x = rt_grid_x;
            grid_y = rt_grid_y;
        end
        else begin
            grid_x = rt_result_x;
            grid_y = rt_result_y;
        end
    end


    always @(*) begin
        if (vertical)
            colour = { {6{grid_out[2]}} , {6{grid_out[1]}} , {6{grid_out[0]}} };
        else
            colour = { {2{grid_out[2]}},4'b0 , {2{grid_out[1]}},4'b0 , {2{grid_out[0]}},4'b0 };
    end
endmodule