data/full_repos/permissive/187705377/Camera Reduced/edge_search.sv
 line:20: before: "{"
1: b'%Error: Cannot find file containing module: Reduced,data/full_repos/permissive/187705377\n        ... Looked in:\n             data/full_repos/permissive/187705377/Camera/Reduced,data/full_repos/permissive/187705377\n             data/full_repos/permissive/187705377/Camera/Reduced,data/full_repos/permissive/187705377.v\n             data/full_repos/permissive/187705377/Camera/Reduced,data/full_repos/permissive/187705377.sv\n             Reduced,data/full_repos/permissive/187705377\n             Reduced,data/full_repos/permissive/187705377.v\n             Reduced,data/full_repos/permissive/187705377.sv\n             obj_dir/Reduced,data/full_repos/permissive/187705377\n             obj_dir/Reduced,data/full_repos/permissive/187705377.v\n             obj_dir/Reduced,data/full_repos/permissive/187705377.sv\n%Error: Cannot find file containing module: data/full_repos/permissive/187705377/Camera\n%Error: Cannot find file containing module: Reduced/edge_search.sv\n%Error: Exiting due to 3 error(s)\n'
module edge_search(
    input logic [9:0] search_x0,
    input logic [9:0] search_y0,
    input logic [9:0] search_x1,
    input logic [9:0] search_y1,
    input logic start,
    input logic clk,
    input logic reset,
    input logic [1:0] search_direction,
    output logic done,
    output logic found,


    output logic [9:0] x,
    output logic [9:0] y,
    input logic pixel,
    input logic ready
    );

    enum {IDLE, LOAD, REQ_PIXEL, WAIT_FOR_PX, EVAL_PIXEL, FINISHED} ps, ns;
    enum {UP, DOWN, LEFT, RIGHT} direction;


    logic [10:0] x_count, y_count;
    logic outside_of_search_frame;
    
    assign outside_of_search_frame = (x_count > search_x1) || (x_count < search_x0)
                                  || (y_count > search_y1) || (y_count < search_y0);



    always_comb begin
        case(search_direction)
            2'b00 : direction = UP;
            2'b01 : direction = DOWN;
            2'b10 : direction = LEFT;
            2'b11 : direction = RIGHT;
        endcase
    end


    always_comb begin
        case(ps)
            IDLE: begin
                    if(start)   ns = LOAD;
                    else        ns = IDLE;
                end
            LOAD:               ns = REQ_PIXEL;
            REQ_PIXEL:          ns = WAIT_FOR_PX;
            WAIT_FOR_PX: begin
                    if(ready)   ns = EVAL_PIXEL;
                    else        ns = REQ_PIXEL;
                end
            EVAL_PIXEL: begin

                    if(pixel || outside_of_search_frame) ns = FINISHED;
                    else        ns = REQ_PIXEL;
                end
            FINISHED: begin
							 ns = IDLE;
                  
                end
        endcase
    end

    always_ff @(posedge clk) begin
        if(reset) begin
            ps <= IDLE;
			   done    <= '0;
			   found   <= '0;
			   x       <= '0;
            y       <= '0;
		  end
        else begin
            ps <= ns;
            case(ps)
                IDLE: begin
                    done    <= '0;
                    found   <= '0;
                    x       <= '0;
                    y       <= '0;
                end
                LOAD: begin




						  done    = 1'b0;
                    case (direction)
                        UP : begin
                            x_count <= search_x0;
                            y_count <= search_y1;
                        end
                        DOWN : begin
                            x_count <= search_x0;
                            y_count <= search_y0;                            
                        end
                        RIGHT : begin
                            x_count <= search_x0;
                            y_count <= search_y0; 
                        end
                        LEFT : begin
                            x_count <= search_x1;
                            y_count <= search_y0; 
                        end
                    endcase

                end
                REQ_PIXEL: begin
                    x <= x_count;
                    y <= y_count;
                end
                EVAL_PIXEL: begin                    

                    case (direction)
                        UP :

                            if(x_count == search_x1) begin
                                y_count <= y_count - 1;
                                x_count <= search_x0;
                            end else
                                x_count <= x_count + 1;

                        DOWN:

                            if(x_count == search_x1) begin
                                y_count <= y_count + 1;
                                x_count <= search_x0;
                            end else
                                x_count <= x_count + 1;
                        
                        RIGHT:

                            if(y_count == search_y1) begin
                                y_count <= search_y0;
                                x_count <= x_count + 1;
                            end else
                                y_count <= y_count + 1;
                        
                        LEFT:

                            if(y_count == search_y1) begin
                                y_count <= search_y0;
                                x_count <= x_count - 1;
                            end else
                                y_count <= y_count + 1;
                        
                    endcase
                end
                FINISHED: begin
                    done    <= 1'b1;
                    found   <= !outside_of_search_frame;
                end
            endcase
        end
    end
endmodule
module edge_search(
    input logic [9:0] search_x0,
    input logic [9:0] search_y0,
    input logic [9:0] search_x1,
    input logic [9:0] search_y1,
    input logic start,
    input logic clk,
    input logic reset,
    input logic [1:0] search_direction,
    output logic done,
    output logic found,


    output logic [9:0] x,
    output logic [9:0] y,
    input logic pixel,
    input logic ready
    );


    enum {IDLE, LOAD, REQ_PIXEL, WAIT_FOR_PX, EVAL_PIXEL, FINISHED} ps, ns;
    enum {UP, DOWN, LEFT, RIGHT} direction;


    logic [10:0] x_count, y_count;
    logic outside_of_search_frame;
    
    assign outside_of_search_frame = (x_count > search_x1) || (x_count < search_x0)
                                  || (y_count > search_y1) || (y_count < search_y0);



    always_comb begin
        case(search_direction)
            2'b00 : direction = UP;
            2'b01 : direction = DOWN;
            2'b10 : direction = LEFT;
            2'b11 : direction = RIGHT;
        endcase
    end


    always_comb begin
        case(ps)
            IDLE: begin
                    if(start)   ns = LOAD;
                    else        ns = IDLE;
                end
            LOAD:               ns = REQ_PIXEL;
            REQ_PIXEL:          ns = WAIT_FOR_PX;
            WAIT_FOR_PX: begin
                    if(ready)   ns = EVAL_PIXEL;
                    else        ns = REQ_PIXEL;
                end
            EVAL_PIXEL: begin

                    if(pixel || outside_of_search_frame) ns = FINISHED;
                    else        ns = REQ_PIXEL;
                end
            FINISHED: begin
							 ns = IDLE;
                  
                end
        endcase
    end

    always_ff @(posedge clk) begin
        if(reset) begin
            ps <= IDLE;
			   done    <= '0;
			   found   <= '0;
			   x       <= '0;
            y       <= '0;
		  end
        else begin
            ps <= ns;
            case(ps)
                IDLE: begin
                    done    <= '0;
                    found   <= '0;
                    x       <= '0;
                    y       <= '0;
                end
                LOAD: begin




						  done    = 1'b0;
                    case (direction)
                        UP : begin
                            x_count <= search_x0;
                            y_count <= search_y1;
                        end
                        DOWN : begin
                            x_count <= search_x0;
                            y_count <= search_y0;                            
                        end
                        RIGHT : begin
                            x_count <= search_x0;
                            y_count <= search_y0; 
                        end
                        LEFT : begin
                            x_count <= search_x1;
                            y_count <= search_y0; 
                        end
                    endcase

                end
                REQ_PIXEL: begin
                    x <= x_count;
                    y <= y_count;
                end
                EVAL_PIXEL: begin                    

                    case (direction)
                        UP :

                            if(x_count == search_x1) begin
                                y_count <= y_count - 1;
                                x_count <= search_x0;
                            end else
                                x_count <= x_count + 1;

                        DOWN:

                            if(x_count == search_x1) begin
                                y_count <= y_count + 1;
                                x_count <= search_x0;
                            end else
                                x_count <= x_count + 1;
                        
                        RIGHT:

                            if(y_count == search_y1) begin
                                y_count <= search_y0;
                                x_count <= x_count + 1;
                            end else
                                y_count <= y_count + 1;
                        
                        LEFT:

                            if(y_count == search_y1) begin
                                y_count <= search_y0;
                                x_count <= x_count - 1;
                            end else
                                y_count <= y_count + 1;
                        
                    endcase
                end
                FINISHED: begin
                    done    <= 1'b1;
                    found   <= !outside_of_search_frame;
                end
            endcase
        end
    end
endmodule