output [3:0] scankey; input pressed; reg int_enable, pending; reg [3:0] scankey, pkey;
In practice, scan more slowly and use extra register on asynchronous input pressed. Also, have more than one input wire (use a close to square array).
Could use a separate microcontroller to scan keyboard.
This keyboard scanner generates an interrupt on each key press.
Standard PC keyboard generates an output byte on press and release and implements a short FIFO.