FPGA控制PS2键盘verilog设计Quartus9.1工程源码+设计说明文件,可以做为你的学习设计参考。
1. 这个实例通过开发板上面的PS/2接口接收键盘输入的数据,在LCD上面显示出来;
2. 工程在project文件夹里面,打开工程;
3. 源文件在rtl文件夹里面;
module top(clk_in,
data,
lcd_e,
lcd_rs,
lcd_rw,
led,
ps2ck,
ps2dk);
input clk_in;
output [7:0] data;
output lcd_e;
output lcd_rs;
output lcd_rw;
output [7:0] led;
inout ps2ck;
inout ps2dk;
wire XLXN_4;
wire XLXN_5;
wire XLXN_6;
reg clk;
assign rst = 1'b1;
always@(posedge clk_in)
clk <= ~clk;
div_256 XLXI_1 (.mclk(clk),
.reset(rst),
.clk(XLXN_6));
div16 XLXI_2 (.clk(clk),
.rst(rst),
.clk_16(XLXN_5));
lcd XLXI_3 (.clk(XLXN_5),
.data_in(led[7:0]),
.rst(XLXN_4),
.data(data[7:0]),
.lcd_e(lcd_e),
.lcd_rs(lcd_rs),
.lcd_rw(lcd_rw));
ps2_keyboard_interface XLXI_4 (.clk(XLXN_6),
.reset(rst),
.rx_read(),
.tx_data(),
.tx_write(),
.rx_ascii(led[7:0]),
.rx_data_ready(),
.rx_extended(),
.rx_released(XLXN_4),
.rx_scan_code(),
.rx_shift_key_on(),
.tx_error_no_keyboard_ack(),
.tx_write_ack_o(),
.ps2_clk(ps2ck),
.ps2_data(ps2dk));
endmodule