International Islamic University, Islamabad: FPGA Based Design LAB
International Islamic University, Islamabad: FPGA Based Design LAB
International Islamic University, Islamabad: FPGA Based Design LAB
Islamabad
FPGA Based Design LAB
Name of Student:
Roll No.:
Date of Experiment:
Marks obtained:
Remarks:
Instructor’s Signature:
2. Resources Required
• A Computer
• Xilinx ISE
• Spartan 2 or Spartan 3E board
• PS2 Keyboard
3. Introduction
The PS/2 connector is a 6-pin mini-DIN connector used for connecting some keyboards and mice
to a PC compatible computer system. Its name comes from the IBM Personal System/2 series of
personal computers, with which it was introduced in 1987. The PS/2 mouse connector generally
replaced the older DE-9 RS-232 "serial mouse" connector, while the PS/2 keyboard connector
replaced the larger 5-pin/180° DIN connector used in the IBM PC/AT design. The PS/2 designs
on keyboard and mouse interfaces are electrically similar and employ the same communication
protocol.
PS/2 XC3S500E-Pins
PS2_CLk P174
PS2_DATA P175
Top Module
module top_keyboard(out,kbrd_clk,kbrd_data,rst);
input kbrd_clk,kbrd_data,rst;
output [3:0]out;
deserialize des(.in(kbrd_data),.clk(kbrd_clk),.out(data),.rst(rst));
decoder dec(.out(out),.in(data));
endmodule
Deserialize Module
module deserialize(in,clk,out,ready,rst);
input in,clk,rst;
output [7:0] out;
output ready;
reg start_bit,r0,r1,r2,r3,r4,r5,r6,r7,parity,stop;
reg [3:0]counter;
reg ready;
reg [7:0] out;
always@(posedge clk)
begin
if(ready)
out <= {r7,r6,r5,r4,r3,r2,r1,r0};
else
out <= out;
end
endmodule
endmodule