PS/2 keyboard controller

The PS/2 controller handles the low-level details of communicating with a PS/2 keyboard. The PS/2 controller is implemented in ps2_keyboard.v, ps2_serial.v, ps2_serial_buf.v, and keyboard_ram.v.

ps2_command and ps2_response implement the standard I/O protocol. There are no command parameters. The response parameters are ps2_pressed and ps2_ascii[7:0]. The response parameters represent a keyboard event, describing which key was acted on (ps2_ascii) and whether the action was a key press or key release (ps2_pressed). If ps2_pressed is 1, the event was a key press. If ps2_pressed is 0, the event was a key release. ps2_ascii contains the ASCII value for the key that was pressed or released.

ase100 simulates the PS/2 keyboard controller accurately enough to test your device driver and to run assembly-language programs. ase100 sees keyboard events when the mouse is in the VGA window.

Lab 7 task

Write a device driver for the PS/2 controller that a program can call to read a keyboard event from the keyboard controller. Remember that the keyboard sends press events and release events. Then, write a test program that reads a password from the keyboard and compares it to the correct password. The correct password should be stored in an array, with the length of the array specified by another variable. If the password is correct, light up the green LEDS. If the password is wrong, light up the red LEDs.

Optional: If one of your teammates has written a driver for the LCD, try displaying the characters you read from the keyboard on the LCD.

Useful trivia: the wiring in most computer keyboards prevents them from detecting new key presses if 2-3 keys are already held down.