data/full_repos/permissive/521337848/Hardware/IO/keyDevice.v
1: b'%Warning-MULTITOP: data/full_repos/permissive/521337848/Hardware/IO/keyDevice.v:70: Multiple top level modules\n                                                                                  : ... Suggest see manual; fix the duplicates, or use --top-module to select top.\n                   ... Use "/* verilator lint_off MULTITOP */" and lint_on around source to disable this message.\n                                                                                  : ... Top module \'keyDevice\'\nmodule keyDevice(\n       ^~~~~~~~~\n                                                                                  : ... Top module \'timerInDevice\'\nmodule timerInDevice(\n       ^~~~~~~~~~~~~\n                                                                                  : ... Top module \'keyrstmodule\'\nmodule keyrstmodule(\n       ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/521337848/Hardware/IO/keyDevice.v:176: Cannot find file containing module: \'keyrst\'\nkeyrst k1(.mode(0),\n^~~~~~\n        ... Looked in:\n             data/full_repos/permissive/521337848/Hardware/IO,data/full_repos/permissive/521337848/keyrst\n             data/full_repos/permissive/521337848/Hardware/IO,data/full_repos/permissive/521337848/keyrst.v\n             data/full_repos/permissive/521337848/Hardware/IO,data/full_repos/permissive/521337848/keyrst.sv\n             keyrst\n             keyrst.v\n             keyrst.sv\n             obj_dir/keyrst\n             obj_dir/keyrst.v\n             obj_dir/keyrst.sv\n%Error: data/full_repos/permissive/521337848/Hardware/IO/keyDevice.v:26: Cannot find file containing module: \'keyrst\'\nkeyrst k1(.mode(0),\n^~~~~~\n%Error: data/full_repos/permissive/521337848/Hardware/IO/keyDevice.v:33: Cannot find file containing module: \'keyrst\'\nkeyrst k2(.mode(0),\n^~~~~~\n%Error: data/full_repos/permissive/521337848/Hardware/IO/keyDevice.v:40: Cannot find file containing module: \'keyrst\'\nkeyrst k3(.mode(0),\n^~~~~~\n%Error: data/full_repos/permissive/521337848/Hardware/IO/keyDevice.v:47: Cannot find file containing module: \'keyrst\'\nkeyrst k4(.mode(0),\n^~~~~~\n%Error: Exiting due to 5 error(s), 1 warning(s)\n'
module keyMan(
	input clk,
	
	input rst,
	
	input[4:0] in,
	input[7:0] tim,
	
	output reg irq,
	
	output reg[31:0] out
);

reg iirq;

reg[4:0] f_key;
reg[4:0] n_key;

reg[21:0] f_tim;
reg[21:0] n_tim;

reg[31:0] f_out;

always@(posedge clk or posedge rst)begin
	if(rst) begin
		f_out <= 0;
		f_key <= 0;
		f_tim <= 0;
	end else
	begin
		f_out <= out;
		f_key <= n_key;
		f_tim <= n_tim;
	end
end

	
always@(*)begin
	
	out = f_out;
	n_key = f_key;
	n_tim = f_tim;
	
	iirq =0;
	
	if(f_tim != 0) begin
		n_tim = f_tim - 1;
	end
	
	if(in == 0 && f_tim == 0) begin
		n_key = 0;
	end
		
	if(in != 0) begin
	
		if(f_key == in) n_tim = {4'd15,18'b0};
		
		if(f_key != in && f_tim == 0) begin
			n_key = in;
			n_tim = {4'd15,18'b0};
			iirq = 1;
			out = {8'd1,8'd0,8'd0,3'b0,in};
		end
			
		
	end
	
end

always@(posedge clk)
	irq <= iirq;
	
endmodule
module keyMan(
	input clk,
	
	input rst,
	
	input[4:0] in,
	input[7:0] tim,
	
	output reg irq,
	
	output reg[31:0] out
);


reg iirq;

reg[4:0] f_key;
reg[4:0] n_key;

reg[21:0] f_tim;
reg[21:0] n_tim;

reg[31:0] f_out;

always@(posedge clk or posedge rst)begin
	if(rst) begin
		f_out <= 0;
		f_key <= 0;
		f_tim <= 0;
	end else
	begin
		f_out <= out;
		f_key <= n_key;
		f_tim <= n_tim;
	end
end

	
always@(*)begin
	
	out = f_out;
	n_key = f_key;
	n_tim = f_tim;
	
	iirq =0;
	
	if(f_tim != 0) begin
		n_tim = f_tim - 1;
	end
	
	if(in == 0 && f_tim == 0) begin
		n_key = 0;
	end
		
	if(in != 0) begin
	
		if(f_key == in) n_tim = {4'd15,18'b0};
		
		if(f_key != in && f_tim == 0) begin
			n_key = in;
			n_tim = {4'd15,18'b0};
			iirq = 1;
			out = {8'd1,8'd0,8'd0,3'b0,in};
		end
			
		
	end
	
end

always@(posedge clk)
	irq <= iirq;
	
endmodule