Partha Mukherjee said:
Will you please elucidate the answer regarding the tristate output of query number 1 (i.e transferring of data from/to Spartan-3 FPGA board to/from keyboard)?
Tri-state is general approach. It does not depend what are you going to interface: keyboard or something else. The main idea is as followa: you have pin, which can be used as
input and as an
output. This pin is called
bi-directional. Let's call this pin
data. Now you will need additional internal signal, which will be used to control current direction of data pin. We will call this signal
enable.
When
enable is equal '1', data will flow from FPGA to out (so, pin
data will work as output). When signal
enable is equal '0', we will force output buffer to high-impedance state (
'Z' for VHDL) and signal from external connection will force logic value on pin
data. We can read this value. VHDL code is pretty simple for this.
Sequential example:
Code:
PROCESS(enable, a)
BEGIN
IF (en='1') THEN
data <= a;
ELSE
data <= 'Z';
END IF;
END PROCESS;
Concurrent example:
Code:
data <= a WHEN enable='1' ELSE ‘Z’;
You have to control signal
enable and read/write data in according to protocol (keyboard protocol in your case).
Good luck!