Line/Port Manipulation Without Pre-selection
|Top Previous Next|
I/O line manipulation without pre-selection is good when you need to deal with several I/O lines at once. For this, use io.lineset, io.lineget, and io.invert methods. These methods require the line number to be supplied directly, as a parameter. Therefore, pre-selection with the io.num property is not necessary. Moreover, executing these methods leaves the io.num value intact.
Here is an example of a serialized clock/data output. The clock line is PL_IO_NUM_0 and the data line is PL_IO_NUM_1. Notice how this is implemented — clock line is preselected once, then set LOW and HIGH using the io.state property. Meanwhile, the data line is updated using the io.lineset method. The variable x supposedly carries a bit of data to be output (where x gets is data is not shown).
Note that I/O line and port names are platform-specific and are defined by pl_io_num and pl_io_port_num enums respectively. The declarations for these enums can be found in your device's platform documentation (for example, EM1000's is here).
On many devices, a number of I/O lines may be shared with inputs/outputs of special function blocks (serial ports, etc.). When a special function block is enabled, I/O lines it uses cannot (should not) be manipulated though the io object.