Forum Discussion
Altera_Forum
Honored Contributor
16 years agoI am not clear what you want to say (assigning ports to it??).
A bidirectional bus is under control of two(or more devices). At any sample time, the designer has to know who should write to the bus(drive it) and who should read it. Any other drive should be cut-off including your own fpga drive if you want to read the bus inside the fpga(as input). The simple fpga method is connect the bidir pin to two internal nodes(A,B). read A anytime you want. write to port when you want to output else cut-off(so you don't read back your own drive). So you need a 3rd control signal to enable/disable the tristate buffer. A <= bidir; -- read port bidir <= B when enable = '1' else 'Z';; --write to port