data/full_repos/permissive/202448421/rtl/laser_keyboard.v
1: b"%Error: data/full_repos/permissive/202448421/rtl/laser_keyboard.v:278: Cannot find file containing module: 'ps2_keyboard'\nps2_keyboard KEYBOARD(\n^~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/202448421/rtl,data/full_repos/permissive/202448421/ps2_keyboard\n             data/full_repos/permissive/202448421/rtl,data/full_repos/permissive/202448421/ps2_keyboard.v\n             data/full_repos/permissive/202448421/rtl,data/full_repos/permissive/202448421/ps2_keyboard.sv\n             ps2_keyboard\n             ps2_keyboard.v\n             ps2_keyboard.sv\n             obj_dir/ps2_keyboard\n             obj_dir/ps2_keyboard.v\n             obj_dir/ps2_keyboard.sv\n%Error: Exiting due to 1 error(s)\n"
module LASER_KEYBOARD
(
	input				KB_CLK,
	input				DLY_CLK,
	input				RESET_N,

	input				PS2_KBCLK,
	input				PS2_KBDAT,

	input	[7:0]		KEY_ADDR,
	output				KEY_PRESSED,
	output	[5:0]		KEY_DATA,

	output				RESET_KEY_N
);




wire	[7:0]		SCAN;
wire				PRESS;
wire				PRESS_N;
wire				EXTENDED;

reg		[63:0]		KEY;
reg		[9:0]		KEY_EX;
reg		[11:0]		KEY_Fxx;







reg		KEY_RESET;
reg		[11:0]		RESET_KEY_COUNT;



wire	[63:0]	KEY_C		=	KEY;
wire	[9:0]	KEY_EX_C	=	KEY_EX;


wire KEY_CTRL_ULRD_BRK = (KEY_EX[8:3]==6'b111111);

wire KEY_DATA_BIT5 = (KEY_ADDR[7:0]|{KEY_C[61], KEY_C[53], KEY_C[45],           KEY_C[37]&KEY_EX_C[5]&KEY_EX_C[8], KEY_C[29], KEY_C[21],           KEY_C[13],                   KEY_C[ 5]})==8'hff;
wire KEY_DATA_BIT4 = (KEY_ADDR[7:0]|{KEY_C[60], KEY_C[52], KEY_C[44],           KEY_C[36]&KEY_EX_C[7], KEY_C[28], KEY_C[20],           KEY_C[12],                   KEY_C[ 4]})==8'hff;
wire KEY_DATA_BIT3 = (KEY_ADDR[7:0]|{KEY_C[59], KEY_C[51], KEY_C[43],           KEY_C[35]&KEY_EX_C[6], KEY_C[27], KEY_C[19],           KEY_C[11],                   KEY_C[ 3]})==8'hff;
wire KEY_DATA_BIT2 = (KEY_ADDR[7:0]|{KEY_C[58], KEY_C[50], KEY_C[42]&KEY_EX_C[3], KEY_C[34],           KEY_C[26], KEY_C[18]&KEY_EX_C[0], KEY_C[10]&KEY_CTRL_ULRD_BRK, KEY_C[ 2]})==8'hff;
wire KEY_DATA_BIT1 = (KEY_ADDR[7:0]|{KEY_C[57], KEY_C[49], KEY_C[41],           KEY_C[33]&KEY_EX_C[4], KEY_C[25], KEY_C[17],           KEY_C[ 9],                   KEY_C[ 1]})==8'hff;
wire KEY_DATA_BIT0 = (KEY_ADDR[7:0]|{KEY_C[56], KEY_C[48], KEY_C[40],           KEY_C[32],             KEY_C[24], KEY_C[16],           KEY_C[ 8],                   KEY_C[ 0]})==8'hff;



assign KEY_DATA = { KEY_DATA_BIT5, KEY_DATA_BIT4, KEY_DATA_BIT3, KEY_DATA_BIT2, KEY_DATA_BIT1, KEY_DATA_BIT0 };




assign	KEY_PRESSED = (KEY[63:0] == 64'hFFFFFFFFFFFFFFFF) ? 1'b0:1'b1;


always @(posedge DLY_CLK or negedge RESET_N)
begin
	if(~RESET_N)
	begin
		RESET_KEY_COUNT		<=	12'hFFF;
	end
	else
	begin
		if(KEY_RESET)
		begin
			RESET_KEY_COUNT		<=	12'h000;
		end
		else
		begin
			if(RESET_KEY_COUNT[11]==1'b0)
			begin
				RESET_KEY_COUNT	<=	RESET_KEY_COUNT+1;
			end
		end
	end
end

always @(posedge KB_CLK or negedge RESET_N)
begin
	if(~RESET_N)
	begin
		KEY					<=	64'hFFFFFFFFFFFFFFFF;
		KEY_EX				<=	10'h3FF;
		KEY_Fxx				<=	12'h000;

		KEY_RESET			<=	1'b0;
	end
	else
	begin


		case(SCAN)
		8'h07:
		begin
				KEY_Fxx[11]	<= PRESS;
				if(PRESS && (KEY[10]==PRESS_N))
				begin
					KEY_RESET			<=	1'b1;
				end
				else
				begin
					KEY_RESET			<=	1'b0;
				end
		end
		8'h78:	KEY_Fxx[10] <= PRESS;
		8'h09:	KEY_Fxx[ 9] <= PRESS;
		8'h01:	KEY_Fxx[ 8] <= PRESS;
		8'h0A:	KEY_Fxx[ 7] <= PRESS;
		8'h83:	KEY_Fxx[ 6] <= PRESS;
		8'h0B:	KEY_Fxx[ 5] <= PRESS;
		8'h03:	KEY_Fxx[ 4] <= PRESS;
		8'h0C:	KEY_Fxx[ 3] <= PRESS;
		8'h04:	KEY_Fxx[ 2] <= PRESS;
		8'h06:	KEY_Fxx[ 1] <= PRESS;
		8'h05:	KEY_Fxx[ 0] <= PRESS;
		8'h16:	KEY[28] <= PRESS_N;
		8'h1E:	KEY[25] <= PRESS_N;
		8'h26:	KEY[27] <= PRESS_N;
		8'h25:	KEY[29] <= PRESS_N;
		8'h2E:	KEY[24] <= PRESS_N;
		8'h36:	KEY[40] <= PRESS_N;
		8'h3D:	KEY[45] <= PRESS_N;

		8'h3E:	KEY[43] <= PRESS_N;
		8'h46:	KEY[41] <= PRESS_N;
		8'h45:	KEY[44] <= PRESS_N;
		8'h4E:	KEY[42] <= PRESS_N;

		8'h66:	KEY_EX[8] <= PRESS_N;


		8'h49:	KEY[33] <= PRESS_N;
		8'h4b:	KEY[57] <= PRESS_N;
		8'h44:	KEY[49] <= PRESS_N;

		8'h5A:	KEY[50] <= PRESS_N;


		8'h52:	KEY[58] <= PRESS_N;
		8'h1D:	KEY[ 1] <= PRESS_N;
		8'h24:	KEY[ 3] <= PRESS_N;
		8'h2D:	KEY[ 5] <= PRESS_N;
		8'h2C:	KEY[ 0] <= PRESS_N;
		8'h35:	KEY[48] <= PRESS_N;
		8'h3C:	KEY[53] <= PRESS_N;
		8'h43:	KEY[51] <= PRESS_N;
		8'h1B:	KEY[ 9] <= PRESS_N;
		8'h23:	KEY[11] <= PRESS_N;
		8'h2B:	KEY[13] <= PRESS_N;
		8'h34:	KEY[ 8] <= PRESS_N;
		8'h33:	KEY[56] <= PRESS_N;
		8'h3B:	KEY[61] <= PRESS_N;
		8'h42:	KEY[59] <= PRESS_N;
		8'h22:	KEY[17] <= PRESS_N;
		8'h21:	KEY[19] <= PRESS_N;
		8'h2a:	KEY[21] <= PRESS_N;
		8'h32:	KEY[16] <= PRESS_N;
		8'h31:	KEY[32] <= PRESS_N;
		8'h3a:	KEY[37] <= PRESS_N;
		8'h41:	KEY[35] <= PRESS_N;
		8'h15:	KEY[ 4] <= PRESS_N;
		8'h1C:	KEY[12] <= PRESS_N;
		8'h1A:	KEY[20] <= PRESS_N;
		8'h29:	KEY[36] <= PRESS_N;

		8'h4C:	KEY[60] <= PRESS_N;
		8'h4D:	KEY[52] <= PRESS_N;
		8'h14:	KEY[10] <= PRESS_N;
		8'h12:	KEY[18] <= PRESS_N;
		8'h59:	KEY_EX[0] <= PRESS_N;
		8'h11:
		begin
			if(~EXTENDED)
					KEY_EX[1] <= PRESS_N;
			else
					KEY_EX[2] <= PRESS_N;
		end
		8'h76:	KEY_EX[3] <= PRESS_N;
		8'h75:	KEY_EX[4] <= PRESS_N;
		8'h6B:	KEY_EX[5] <= PRESS_N;
		8'h74:	KEY_EX[6] <= PRESS_N;
		8'h72:	KEY_EX[7] <= PRESS_N;
		endcase
	end
end


ps2_keyboard KEYBOARD(
		.RESET_N(RESET_N),
		.CLK(KB_CLK),
		.PS2_CLK(PS2_KBCLK),
		.PS2_DATA(PS2_KBDAT),
		.RX_SCAN(SCAN),
		.RX_PRESSED(PRESS),
		.RX_EXTENDED(EXTENDED)
);

assign PRESS_N = ~PRESS;


assign RESET_KEY_N = RESET_KEY_COUNT[11];

endmodule
module LASER_KEYBOARD
(
	input				KB_CLK,
	input				DLY_CLK,
	input				RESET_N,

	input				PS2_KBCLK,
	input				PS2_KBDAT,

	input	[7:0]		KEY_ADDR,
	output				KEY_PRESSED,
	output	[5:0]		KEY_DATA,

	output				RESET_KEY_N
);





wire	[7:0]		SCAN;
wire				PRESS;
wire				PRESS_N;
wire				EXTENDED;

reg		[63:0]		KEY;
reg		[9:0]		KEY_EX;
reg		[11:0]		KEY_Fxx;







reg		KEY_RESET;
reg		[11:0]		RESET_KEY_COUNT;



wire	[63:0]	KEY_C		=	KEY;
wire	[9:0]	KEY_EX_C	=	KEY_EX;


wire KEY_CTRL_ULRD_BRK = (KEY_EX[8:3]==6'b111111);

wire KEY_DATA_BIT5 = (KEY_ADDR[7:0]|{KEY_C[61], KEY_C[53], KEY_C[45],           KEY_C[37]&KEY_EX_C[5]&KEY_EX_C[8], KEY_C[29], KEY_C[21],           KEY_C[13],                   KEY_C[ 5]})==8'hff;
wire KEY_DATA_BIT4 = (KEY_ADDR[7:0]|{KEY_C[60], KEY_C[52], KEY_C[44],           KEY_C[36]&KEY_EX_C[7], KEY_C[28], KEY_C[20],           KEY_C[12],                   KEY_C[ 4]})==8'hff;
wire KEY_DATA_BIT3 = (KEY_ADDR[7:0]|{KEY_C[59], KEY_C[51], KEY_C[43],           KEY_C[35]&KEY_EX_C[6], KEY_C[27], KEY_C[19],           KEY_C[11],                   KEY_C[ 3]})==8'hff;
wire KEY_DATA_BIT2 = (KEY_ADDR[7:0]|{KEY_C[58], KEY_C[50], KEY_C[42]&KEY_EX_C[3], KEY_C[34],           KEY_C[26], KEY_C[18]&KEY_EX_C[0], KEY_C[10]&KEY_CTRL_ULRD_BRK, KEY_C[ 2]})==8'hff;
wire KEY_DATA_BIT1 = (KEY_ADDR[7:0]|{KEY_C[57], KEY_C[49], KEY_C[41],           KEY_C[33]&KEY_EX_C[4], KEY_C[25], KEY_C[17],           KEY_C[ 9],                   KEY_C[ 1]})==8'hff;
wire KEY_DATA_BIT0 = (KEY_ADDR[7:0]|{KEY_C[56], KEY_C[48], KEY_C[40],           KEY_C[32],             KEY_C[24], KEY_C[16],           KEY_C[ 8],                   KEY_C[ 0]})==8'hff;



assign KEY_DATA = { KEY_DATA_BIT5, KEY_DATA_BIT4, KEY_DATA_BIT3, KEY_DATA_BIT2, KEY_DATA_BIT1, KEY_DATA_BIT0 };




assign	KEY_PRESSED = (KEY[63:0] == 64'hFFFFFFFFFFFFFFFF) ? 1'b0:1'b1;


always @(posedge DLY_CLK or negedge RESET_N)
begin
	if(~RESET_N)
	begin
		RESET_KEY_COUNT		<=	12'hFFF;
	end
	else
	begin
		if(KEY_RESET)
		begin
			RESET_KEY_COUNT		<=	12'h000;
		end
		else
		begin
			if(RESET_KEY_COUNT[11]==1'b0)
			begin
				RESET_KEY_COUNT	<=	RESET_KEY_COUNT+1;
			end
		end
	end
end

always @(posedge KB_CLK or negedge RESET_N)
begin
	if(~RESET_N)
	begin
		KEY					<=	64'hFFFFFFFFFFFFFFFF;
		KEY_EX				<=	10'h3FF;
		KEY_Fxx				<=	12'h000;

		KEY_RESET			<=	1'b0;
	end
	else
	begin


		case(SCAN)
		8'h07:
		begin
				KEY_Fxx[11]	<= PRESS;
				if(PRESS && (KEY[10]==PRESS_N))
				begin
					KEY_RESET			<=	1'b1;
				end
				else
				begin
					KEY_RESET			<=	1'b0;
				end
		end
		8'h78:	KEY_Fxx[10] <= PRESS;
		8'h09:	KEY_Fxx[ 9] <= PRESS;
		8'h01:	KEY_Fxx[ 8] <= PRESS;
		8'h0A:	KEY_Fxx[ 7] <= PRESS;
		8'h83:	KEY_Fxx[ 6] <= PRESS;
		8'h0B:	KEY_Fxx[ 5] <= PRESS;
		8'h03:	KEY_Fxx[ 4] <= PRESS;
		8'h0C:	KEY_Fxx[ 3] <= PRESS;
		8'h04:	KEY_Fxx[ 2] <= PRESS;
		8'h06:	KEY_Fxx[ 1] <= PRESS;
		8'h05:	KEY_Fxx[ 0] <= PRESS;
		8'h16:	KEY[28] <= PRESS_N;
		8'h1E:	KEY[25] <= PRESS_N;
		8'h26:	KEY[27] <= PRESS_N;
		8'h25:	KEY[29] <= PRESS_N;
		8'h2E:	KEY[24] <= PRESS_N;
		8'h36:	KEY[40] <= PRESS_N;
		8'h3D:	KEY[45] <= PRESS_N;

		8'h3E:	KEY[43] <= PRESS_N;
		8'h46:	KEY[41] <= PRESS_N;
		8'h45:	KEY[44] <= PRESS_N;
		8'h4E:	KEY[42] <= PRESS_N;

		8'h66:	KEY_EX[8] <= PRESS_N;


		8'h49:	KEY[33] <= PRESS_N;
		8'h4b:	KEY[57] <= PRESS_N;
		8'h44:	KEY[49] <= PRESS_N;

		8'h5A:	KEY[50] <= PRESS_N;


		8'h52:	KEY[58] <= PRESS_N;
		8'h1D:	KEY[ 1] <= PRESS_N;
		8'h24:	KEY[ 3] <= PRESS_N;
		8'h2D:	KEY[ 5] <= PRESS_N;
		8'h2C:	KEY[ 0] <= PRESS_N;
		8'h35:	KEY[48] <= PRESS_N;
		8'h3C:	KEY[53] <= PRESS_N;
		8'h43:	KEY[51] <= PRESS_N;
		8'h1B:	KEY[ 9] <= PRESS_N;
		8'h23:	KEY[11] <= PRESS_N;
		8'h2B:	KEY[13] <= PRESS_N;
		8'h34:	KEY[ 8] <= PRESS_N;
		8'h33:	KEY[56] <= PRESS_N;
		8'h3B:	KEY[61] <= PRESS_N;
		8'h42:	KEY[59] <= PRESS_N;
		8'h22:	KEY[17] <= PRESS_N;
		8'h21:	KEY[19] <= PRESS_N;
		8'h2a:	KEY[21] <= PRESS_N;
		8'h32:	KEY[16] <= PRESS_N;
		8'h31:	KEY[32] <= PRESS_N;
		8'h3a:	KEY[37] <= PRESS_N;
		8'h41:	KEY[35] <= PRESS_N;
		8'h15:	KEY[ 4] <= PRESS_N;
		8'h1C:	KEY[12] <= PRESS_N;
		8'h1A:	KEY[20] <= PRESS_N;
		8'h29:	KEY[36] <= PRESS_N;

		8'h4C:	KEY[60] <= PRESS_N;
		8'h4D:	KEY[52] <= PRESS_N;
		8'h14:	KEY[10] <= PRESS_N;
		8'h12:	KEY[18] <= PRESS_N;
		8'h59:	KEY_EX[0] <= PRESS_N;
		8'h11:
		begin
			if(~EXTENDED)
					KEY_EX[1] <= PRESS_N;
			else
					KEY_EX[2] <= PRESS_N;
		end
		8'h76:	KEY_EX[3] <= PRESS_N;
		8'h75:	KEY_EX[4] <= PRESS_N;
		8'h6B:	KEY_EX[5] <= PRESS_N;
		8'h74:	KEY_EX[6] <= PRESS_N;
		8'h72:	KEY_EX[7] <= PRESS_N;
		endcase
	end
end


ps2_keyboard KEYBOARD(
		.RESET_N(RESET_N),
		.CLK(KB_CLK),
		.PS2_CLK(PS2_KBCLK),
		.PS2_DATA(PS2_KBDAT),
		.RX_SCAN(SCAN),
		.RX_PRESSED(PRESS),
		.RX_EXTENDED(EXTENDED)
);

assign PRESS_N = ~PRESS;


assign RESET_KEY_N = RESET_KEY_COUNT[11];

endmodule