On an FPGA, is it possible to mimic the behaviour of something like an Arduino, whereby the code running on the chip is able to designate a pin as an input or output?
Let's say the FPGA is configured as a processor. Further, lets say that we have three registers designated for controlling IO pins much like the Arduino equivalents:
Each port is controlled by three registers... The DDR register, determines whether the pin is an INPUT or OUTPUT. The PORT register controls whether the pin is HIGH or LOW, and the PIN register reads the state of INPUT pins set to input with pinMode().
How can you get the FPGA to use a register (like DDR) to change the direction of the pin, based on what the running program updates the register to? (By running program, I mean the program running on the processor the FPGA has been configured as).
I'm not sure if this is possible given how during pin assignment for synthesis you have to specify the pin direction. But hopefully I'm wrong? Could this be done somehow by using 'bidirectional' pin mode?