data/full_repos/permissive/104660645/sequence_detector/src/hdl/top_level.v
 line:66: before: "="
1: b"%Error: data/full_repos/permissive/104660645/sequence_detector/src/hdl/top_level.v:104: Cannot find file containing module: 'detector_secuencia'\n detector_secuencia det_inst (\n ^~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/104660645/sequence_detector/src/hdl,data/full_repos/permissive/104660645/detector_secuencia\n             data/full_repos/permissive/104660645/sequence_detector/src/hdl,data/full_repos/permissive/104660645/detector_secuencia.v\n             data/full_repos/permissive/104660645/sequence_detector/src/hdl,data/full_repos/permissive/104660645/detector_secuencia.sv\n             detector_secuencia\n             detector_secuencia.v\n             detector_secuencia.sv\n             obj_dir/detector_secuencia\n             obj_dir/detector_secuencia.v\n             obj_dir/detector_secuencia.sv\n%Error: data/full_repos/permissive/104660645/sequence_detector/src/hdl/top_level.v:114: Cannot find file containing module: 'unsigned_to_bcd'\n unsigned_to_bcd u32_to_bcd_inst (\n ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/104660645/sequence_detector/src/hdl/top_level.v:123: Cannot find file containing module: 'clk_divider'\n clk_divider #(\n ^~~~~~~~~~~\n%Error: data/full_repos/permissive/104660645/sequence_detector/src/hdl/top_level.v:132: Cannot find file containing module: 'ss_mux'\n ss_mux ss_mux_inst (\n ^~~~~~\n%Error: data/full_repos/permissive/104660645/sequence_detector/src/hdl/top_level.v:141: Cannot find file containing module: 'pb_debouncer'\n pb_debouncer #(\n ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/104660645/sequence_detector/src/hdl/top_level.v:152: Cannot find file containing module: 'pb_debouncer'\n pb_debouncer #(\n ^~~~~~~~~~~~\n%Error: Exiting due to 6 error(s)\n"
module top_level
(
	input clk_100M,
	input reset_n,
	input [1:0] button,
	output [7:0] ss_select,
	output [7:0] ss_value,
	output detected,
	output [2:0] leds
);

	reg [1:0] reset_sr;
	wire reset = reset_sr[1];
	always @(posedge clk_100M)
		reset_sr <= {reset_sr[0], ~reset_n};


	wire clk_ss;


	wire [31:0] bcd;


	wire det_out;


	wire [1:0] button_posedge;


	reg det_tick;
	reg det_in;
	always @(*) begin
		case (button_posedge)
		'b01: begin
			det_in = 1'b0;
			det_tick = 1'b1;
		end
		'b10: begin
			det_in = 1'b1;
			det_tick = 1'b1;
		end
		default: begin
			det_in = 1'b0;
			det_tick = 1'b0;
		end
		endcase
	end


	localparam C_WAIT = 'b001;
	localparam C_ADD1 = 'b010;
	localparam C_HOLD = 'b100;
	reg [2:0] counter_state, counter_state_next;
	reg [31:0] counter, counter_next = 'd0;

	always @(*) begin
		counter_next = counter;
		counter_state_next = counter_state;

		case (counter_state)
		C_WAIT:
			if (det_out == 1'b1)
				counter_state_next = C_ADD1;
		C_ADD1: begin
			counter_next = counter + 'd1;
			counter_state_next = C_HOLD;
		end
		C_HOLD:
			if (det_out == 1'b0)
				counter_state_next = C_WAIT;
		default:
			counter_state_next = C_WAIT;
		endcase
	end

	always @(posedge clk_100M) begin
		if (reset) begin
			counter <= 'd0;
			counter_state <= C_WAIT;
		end else begin
			counter <= counter_next;
			counter_state <= counter_state_next;
		end
	end


	assign detected = det_out;


	detector_secuencia det_inst (
		.clk(clk_100M),
		.reset(reset),
		.in(det_in),
		.tick(det_tick),
		.current_state(leds),
		.out(det_out)
	);


	unsigned_to_bcd u32_to_bcd_inst (
		.clk(clk_100M),
		.trigger(1'b1),
		.in(counter),
		.idle(),
		.bcd(bcd)
	);


	clk_divider #(
		.O_CLK_FREQ(480)
	) clk_div_ss_display (
		.clk_in(clk_100M),
		.reset(1'b0),
		.clk_out(clk_ss)
	);


	ss_mux ss_mux_inst (
		.clk(clk_ss),
		.bcd(bcd),
		.dots(8'h00),
		.ss_value(ss_value),
		.ss_select(ss_select)
	);


	pb_debouncer #(
		.COUNTER_WIDTH(20)
	) pb_deb0 (
		.clk(clk_100M),
		.rst(reset),
		.pb(button[0]),
		.pb_state(),
		.pb_negedge(),
		.pb_posedge(button_posedge[0])
	);

	pb_debouncer #(
		.COUNTER_WIDTH(20)
	) pb_deb1 (
		.clk(clk_100M),
		.rst(reset),
		.pb(button[1]),
		.pb_state(),
		.pb_negedge(),
		.pb_posedge(button_posedge[1])
	);

endmodule
module top_level
(
	input clk_100M,
	input reset_n,
	input [1:0] button,
	output [7:0] ss_select,
	output [7:0] ss_value,
	output detected,
	output [2:0] leds
);


	reg [1:0] reset_sr;
	wire reset = reset_sr[1];
	always @(posedge clk_100M)
		reset_sr <= {reset_sr[0], ~reset_n};


	wire clk_ss;


	wire [31:0] bcd;


	wire det_out;


	wire [1:0] button_posedge;


	reg det_tick;
	reg det_in;
	always @(*) begin
		case (button_posedge)
		'b01: begin
			det_in = 1'b0;
			det_tick = 1'b1;
		end
		'b10: begin
			det_in = 1'b1;
			det_tick = 1'b1;
		end
		default: begin
			det_in = 1'b0;
			det_tick = 1'b0;
		end
		endcase
	end


	localparam C_WAIT = 'b001;
	localparam C_ADD1 = 'b010;
	localparam C_HOLD = 'b100;
	reg [2:0] counter_state, counter_state_next;
	reg [31:0] counter, counter_next = 'd0;

	always @(*) begin
		counter_next = counter;
		counter_state_next = counter_state;

		case (counter_state)
		C_WAIT:
			if (det_out == 1'b1)
				counter_state_next = C_ADD1;
		C_ADD1: begin
			counter_next = counter + 'd1;
			counter_state_next = C_HOLD;
		end
		C_HOLD:
			if (det_out == 1'b0)
				counter_state_next = C_WAIT;
		default:
			counter_state_next = C_WAIT;
		endcase
	end

	always @(posedge clk_100M) begin
		if (reset) begin
			counter <= 'd0;
			counter_state <= C_WAIT;
		end else begin
			counter <= counter_next;
			counter_state <= counter_state_next;
		end
	end


	assign detected = det_out;


	detector_secuencia det_inst (
		.clk(clk_100M),
		.reset(reset),
		.in(det_in),
		.tick(det_tick),
		.current_state(leds),
		.out(det_out)
	);


	unsigned_to_bcd u32_to_bcd_inst (
		.clk(clk_100M),
		.trigger(1'b1),
		.in(counter),
		.idle(),
		.bcd(bcd)
	);


	clk_divider #(
		.O_CLK_FREQ(480)
	) clk_div_ss_display (
		.clk_in(clk_100M),
		.reset(1'b0),
		.clk_out(clk_ss)
	);


	ss_mux ss_mux_inst (
		.clk(clk_ss),
		.bcd(bcd),
		.dots(8'h00),
		.ss_value(ss_value),
		.ss_select(ss_select)
	);


	pb_debouncer #(
		.COUNTER_WIDTH(20)
	) pb_deb0 (
		.clk(clk_100M),
		.rst(reset),
		.pb(button[0]),
		.pb_state(),
		.pb_negedge(),
		.pb_posedge(button_posedge[0])
	);

	pb_debouncer #(
		.COUNTER_WIDTH(20)
	) pb_deb1 (
		.clk(clk_100M),
		.rst(reset),
		.pb(button[1]),
		.pb_state(),
		.pb_negedge(),
		.pb_posedge(button_posedge[1])
	);

endmodule