data/full_repos/permissive/505898990/verilog/rtl/examples/distance_display_mine_orginal.v
1: b"%Error: data/full_repos/permissive/505898990/verilog/rtl/examples/distance_display_mine_orginal.v:435: syntax error, unexpected ';', expecting ')' or ','\n    output reg [7:0] o_segments = 0;\n                                   ^\n%Error: Exiting due to 1 error(s)\n"
module distance_measurement(
	  input wire        i_clk,
    input wire        i_reset,
    input wire        i_sensor_echo,
    output reg        o_sensor_trigger,
    output reg [8:0]  o_distance,
    output reg        o_rdy
);

    localparam CYCLES_TILL_100_MS = 100_000;
    localparam CYCLES_TILL_DISABLE_TRIGGER = 10;
    localparam MAX_DISTANCE_CYCLES = 23_200;
    localparam MIN_DISTANCE_CYCLES = 116;

    reg [16:0]  r_measurment_counter_uS;
    reg         r_echo_received;

    always @(posedge i_clk) begin

        if (i_reset) begin
            r_measurment_counter_uS <= {17{1'b0}};
            r_echo_received <= 1'b0;
            o_distance <= {9{1'b0}};
            o_sensor_trigger <= 1'b0;
            o_rdy <= 1'b0;


        end else begin


            if (r_measurment_counter_uS == CYCLES_TILL_100_MS - 1) begin

                r_measurment_counter_uS <= {17{1'b0}};
                r_echo_received <= 1'b0;
                o_distance <= {9{1'b0}};
                o_rdy <= 1'b0;

                o_sensor_trigger <= 1'b1;


            end else begin
                r_measurment_counter_uS <= r_measurment_counter_uS + 1'b1;
            end


            if (r_measurment_counter_uS == CYCLES_TILL_DISABLE_TRIGGER - 1) begin
            o_sensor_trigger <= 1'b0;
            end


            if (i_sensor_echo && !r_echo_received) begin
                r_echo_received <= 1'b1;


                if ((r_measurment_counter_uS > MAX_DISTANCE_CYCLES - 1) || (r_measurment_counter_uS < MIN_DISTANCE_CYCLES - 1)) begin
                    o_distance <= {9{1'b0}};
                    o_rdy <= 1'b1;
                    

                end else 
                o_distance <= (r_measurment_counter_uS - 10) / 58;
                o_rdy <= 1'b1;

            end

        end

    end
 
endmodule
module distance_measurement(
	  input wire        i_clk,
    input wire        i_reset,
    input wire        i_sensor_echo,
    output reg        o_sensor_trigger,
    output reg [8:0]  o_distance,
    output reg        o_rdy
);


    localparam CYCLES_TILL_100_MS = 100_000;
    localparam CYCLES_TILL_DISABLE_TRIGGER = 10;
    localparam MAX_DISTANCE_CYCLES = 23_200;
    localparam MIN_DISTANCE_CYCLES = 116;

    reg [16:0]  r_measurment_counter_uS;
    reg         r_echo_received;

    always @(posedge i_clk) begin

        if (i_reset) begin
            r_measurment_counter_uS <= {17{1'b0}};
            r_echo_received <= 1'b0;
            o_distance <= {9{1'b0}};
            o_sensor_trigger <= 1'b0;
            o_rdy <= 1'b0;


        end else begin


            if (r_measurment_counter_uS == CYCLES_TILL_100_MS - 1) begin

                r_measurment_counter_uS <= {17{1'b0}};
                r_echo_received <= 1'b0;
                o_distance <= {9{1'b0}};
                o_rdy <= 1'b0;

                o_sensor_trigger <= 1'b1;


            end else begin
                r_measurment_counter_uS <= r_measurment_counter_uS + 1'b1;
            end


            if (r_measurment_counter_uS == CYCLES_TILL_DISABLE_TRIGGER - 1) begin
            o_sensor_trigger <= 1'b0;
            end


            if (i_sensor_echo && !r_echo_received) begin
                r_echo_received <= 1'b1;


                if ((r_measurment_counter_uS > MAX_DISTANCE_CYCLES - 1) || (r_measurment_counter_uS < MIN_DISTANCE_CYCLES - 1)) begin
                    o_distance <= {9{1'b0}};
                    o_rdy <= 1'b1;
                    

                end else 
                o_distance <= (r_measurment_counter_uS - 10) / 58;
                o_rdy <= 1'b1;

            end

        end

    end
 
endmodule