Simplest Hardware Terminal PS/2 to COM

This terminal reads keyboards codes and write them to the serial port.


 Spartan-3 development board with attached PS2 and COM cables. Last keyboard's scancode is displayed by the 7-segment indicators.

Virtual terminal screen on PC display.


Let's say you're about to develop a new super CPU or to test an already existed one. The important thing you need is communication. Try this simple RTL design, that connects PS/2 with COM, so you can communicate with your Hardware with a Keyboard and a PC.

How it works 

You need some FPGA board  with PS/2 and COM connectors. Attach a PS/2 keyboard to your board and connect your board with a computer with COM port.

Each keyboard event generates a sequence of bits that are read by apple_keyboard module. Apple because firstly I intended to use apple keyboard. In-ports of main module {PS2_clk, PS2_data} have to be connected with physical inputs  of PS/2 connector. Signal will be propagated to the RS232 module, where with the help of shift-register, it will be sent with appropriate speed through the rs232 serial interface. Design implementation is so simple, that it's self described.

 You can apply following bindings for a Spartan 3 FPGA board (using some *.ucf file if you're Xilinx ISE guy):

NET "HEX<7>"  LOC = "P16"; #dp
NET "HEX<6>"  LOC = "N16"; #g
NET "HEX<5>"  LOC = "F13"; #f
NET "HEX<4>"  LOC = "R16"; #e
NET "HEX<3>"  LOC = "P15"; #d
NET "HEX<2>"  LOC = "N15"; #c
NET "HEX<1>"  LOC = "G13"; #b
NET "HEX<0>"  LOC = "E14"; #a

#active indicator (from left to right) should be 'low', other 'hi'
NET "INDICATOR<3>"  LOC = "E13";
NET "INDICATOR<2>"  LOC = "F14";
NET "INDICATOR<1>"  LOC = "G14";
NET "INDICATOR<0>"  LOC = "D14";

#buttons (from left to right)
NET "BTN<0>"  LOC = "M13";
NET "BTN<1>"  LOC = "M14";
NET "BTN<2>"  LOC = "L13";

#clock 50 MhZ
NET "clk"  LOC = "T9";

NET "PS2_data" LOC = "M15";
NET "PS2_clk" LOC = "M16";

NET "txd"  LOC = "R13";

Source code

RTL design sourcecode and Makefiles (tested with Xilinx ISE 9.1 for Linux). Language: VHDL ps2_to_com_terminal_make.tar.bz2

Simple terminal program to test connection.
Language:Python rs232_python.tar.bz2

Building instructions

I prefer to use Makefiles. Please just unpack design source code tar xjvf ps2_to_com_terminal_make.tar.bz2 and follow to the ./terminal.with.make/syn/src There you will find a lot of files, feel free to insert your own paths into them.