data/full_repos/permissive/117026779/src/Keyboard.v
1: b"%Error: data/full_repos/permissive/117026779/src/Keyboard.v:256: Cannot find file containing module: 'Syncronizer'\nSyncronizer #(.WIDTH(1)) sync_clk (\n^~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/117026779/src,data/full_repos/permissive/117026779/Syncronizer\n             data/full_repos/permissive/117026779/src,data/full_repos/permissive/117026779/Syncronizer.v\n             data/full_repos/permissive/117026779/src,data/full_repos/permissive/117026779/Syncronizer.sv\n             Syncronizer\n             Syncronizer.v\n             Syncronizer.sv\n             obj_dir/Syncronizer\n             obj_dir/Syncronizer.v\n             obj_dir/Syncronizer.sv\n%Error: data/full_repos/permissive/117026779/src/Keyboard.v:264: Cannot find file containing module: 'Syncronizer'\nSyncronizer #(.WIDTH(1)) sync_data (\n^~~~~~~~~~~\n%Error: data/full_repos/permissive/117026779/src/Keyboard.v:272: Cannot find file containing module: 'SHIFTREGISTER'\nSHIFTREGISTER #(.WIDTH(11)) scan_code_register (\n^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/117026779/src/Keyboard.v:292: Cannot find file containing module: 'COUNTER'\nCOUNTER #(.WIDTH(4)) counter_ps2_clks (\n^~~~~~~\n%Error: data/full_repos/permissive/117026779/src/Keyboard.v:302: Cannot find file containing module: 'XNOR'\nXNOR #(.WIDTH(8)) parity_checker (\n^~~~\n%Error: data/full_repos/permissive/117026779/src/Keyboard.v:307: Cannot find file containing module: 'XNOR'\nXNOR #(.WIDTH(2)) parity_matcher (\n^~~~\n%Error: data/full_repos/permissive/117026779/src/Keyboard.v:312: Cannot find file containing module: 'AND'\nAND #(.WIDTH(2)) new_signal (\n^~~\n%Error: data/full_repos/permissive/117026779/src/Keyboard.v:317: Cannot find file containing module: 'TRIBUFFER'\nTRIBUFFER #(.WIDTH(8)) scan_code_buffer (\n^~~~~~~~~\n%Error: data/full_repos/permissive/117026779/src/Keyboard.v:97: Cannot find file containing module: 'FIFO'\nFIFO #(\n^~~~\n%Error: data/full_repos/permissive/117026779/src/Keyboard.v:503: Cannot find file containing module: 'VGA_Terminal'\nVGA_Terminal vga_term(\n^~~~~~~~~~~~\n%Error: Exiting due to 10 error(s)\n"
module Keyboard(

    input wire clk,
    input wire rst,

    input wire ps2_clk,
    input wire ps2_data,

    input wire cs,

    input wire clr,

    output wire [`SCAN_CODE_DATA_LENGTH-1:0] data,

    output wire ready
);

wire new_code;
wire ps2_clk_sync;
wire ps2_data_sync;
wire count_finished;
wire internal_clear;
wire [3:0] count_output;
wire [`SCAN_CODE_LENGTH-1:0] scan_code;
wire calculated_parity;
wire is_valid_scan_code;
wire scancode_based_clear;


assign internal_clear = (rst | clr);

assign count_finished = (count_output == `SCAN_CODE_LENGTH);

assign ready = new_code;

Syncronizer #(.WIDTH(1)) sync_clk (
	.clk(clk),
	.rst(rst),
	.en(!ready),
	.in(ps2_clk),
	.sync_out(ps2_clk_sync)
);

Syncronizer #(.WIDTH(1)) sync_data (
	.clk(clk),
	.rst(rst),
	.en(!ready),
	.in(ps2_data),
	.sync_out(ps2_data_sync)
);

SHIFTREGISTER #(.WIDTH(`SCAN_CODE_LENGTH)) scan_code_register (
	.rst(internal_clear),
	.clk(!ps2_clk_sync),
	.en(!ready),
	.in(ps2_data_sync),
	.Q({
        scan_code[0],
        scan_code[1],
        scan_code[2],
        scan_code[3],
        scan_code[4],
        scan_code[5],
        scan_code[6],
        scan_code[7],
        scan_code[8],
        scan_code[9],
        scan_code[10]
    })
);

COUNTER #(.WIDTH(4)) counter_ps2_clks (
	.rst(internal_clear),
	.clk(!ps2_clk_sync),
	.load(1'b0),
	.increment(1'b1),
	.enable(!count_finished),
	.D(4'b0),
	.Q(count_output)
);

XNOR #(.WIDTH(8)) parity_checker (
	.in(scan_code[8:1]),
	.out(calculated_parity)
);

XNOR #(.WIDTH(2)) parity_matcher (
	.in({ scan_code[9], calculated_parity} ),
	.out(is_valid_scan_code)
);

AND #(.WIDTH(2)) new_signal (
    .in({ is_valid_scan_code, count_finished }),
    .out(new_code)
);

TRIBUFFER #(.WIDTH(8)) scan_code_buffer (
	.oe(cs),
	.in(scan_code[8:1]),
	.out(data)
);

endmodule
module Keyboard(

    input wire clk,
    input wire rst,

    input wire ps2_clk,
    input wire ps2_data,

    input wire cs,

    input wire clr,

    output wire [`SCAN_CODE_DATA_LENGTH-1:0] data,

    output wire ready
);


wire new_code;
wire ps2_clk_sync;
wire ps2_data_sync;
wire count_finished;
wire internal_clear;
wire [3:0] count_output;
wire [`SCAN_CODE_LENGTH-1:0] scan_code;
wire calculated_parity;
wire is_valid_scan_code;
wire scancode_based_clear;


assign internal_clear = (rst | clr);

assign count_finished = (count_output == `SCAN_CODE_LENGTH);

assign ready = new_code;

Syncronizer #(.WIDTH(1)) sync_clk (
	.clk(clk),
	.rst(rst),
	.en(!ready),
	.in(ps2_clk),
	.sync_out(ps2_clk_sync)
);

Syncronizer #(.WIDTH(1)) sync_data (
	.clk(clk),
	.rst(rst),
	.en(!ready),
	.in(ps2_data),
	.sync_out(ps2_data_sync)
);

SHIFTREGISTER #(.WIDTH(`SCAN_CODE_LENGTH)) scan_code_register (
	.rst(internal_clear),
	.clk(!ps2_clk_sync),
	.en(!ready),
	.in(ps2_data_sync),
	.Q({
        scan_code[0],
        scan_code[1],
        scan_code[2],
        scan_code[3],
        scan_code[4],
        scan_code[5],
        scan_code[6],
        scan_code[7],
        scan_code[8],
        scan_code[9],
        scan_code[10]
    })
);

COUNTER #(.WIDTH(4)) counter_ps2_clks (
	.rst(internal_clear),
	.clk(!ps2_clk_sync),
	.load(1'b0),
	.increment(1'b1),
	.enable(!count_finished),
	.D(4'b0),
	.Q(count_output)
);

XNOR #(.WIDTH(8)) parity_checker (
	.in(scan_code[8:1]),
	.out(calculated_parity)
);

XNOR #(.WIDTH(2)) parity_matcher (
	.in({ scan_code[9], calculated_parity} ),
	.out(is_valid_scan_code)
);

AND #(.WIDTH(2)) new_signal (
    .in({ is_valid_scan_code, count_finished }),
    .out(new_code)
);

TRIBUFFER #(.WIDTH(8)) scan_code_buffer (
	.oe(cs),
	.in(scan_code[8:1]),
	.out(data)
);

endmodule