Custom User I/O Control Core

A custom core for user I/O control is available in the repository and during the base system builder process. The core allows the user to control the LEDs, read the push buttons and DIP switches and output patterns to the 7-segment displays. The core also implements the mapping of 4-bit hexadecimal characters to 7-bit patterns used to drive the 7-segment displays. This mapping is enabled per display at runtime by user designs.

Register Bank

The core has 5 registers that enable the I/O functionality. Register 0 and 1 are the output and input registers for the dedicated I/O, namely the LEDs, the push buttons and the DIP switch.


As we know, there are four peripherals controlled by the UserIO controller.

Dedicated LEDs:

The following function call directly writes to the LED outputs. The value should be 8-bits wide and the baseaddress is the base address of the UserIO core. The least significant bit corresponds to LED0.

WarpV4_UserIO_Leds(baseaddress, value)

Push Buttons:

The push button values can be read using the following function.


where baseaddress is the base address of the UserIO core. As noted previously, the bottom push button is used as the reset button in all XPS designs, hence the function returns a four bit value. The returned vector is arranged as follows: [Up, Left, Right, Center].

Dip Switch:

The dip switches can be read using the following function:


where baseaddress is the base address of the UserIO core. The returned value is four bits wide.

Hex Displays:

There are two primary methods to control the hex displays: raw mode and number mode. The number mode allows the user to write the number desired to a register which is then appropriately converted to appear on the hex display. In raw mode, the user controls each bit individually. The three displays can be configured separately.

To configure the hex display for number mode choose one of the following functions:


Once configured for number mode, the display will show the number written by the following function:

WarpV4_UserIO_WriteNumber_[LeftHex|MiddleHex|RightHex](baseaddress, number, decimal)

where number is the number desired at the display and decimal is to toggle the decimal point. If decimal is 1 then the decimal point in on.

In addition, the number written can be read out by:


where the return value is the four bit value corresponding to the last number written. Additionally, as 0x0 corresponds to a number zero being displayed instead of turning the displays off, the following functions toggle the visibility of the numbers:


Toggling the visibility will not alter the values to be shown. Note: these function only works in Number Mode.

The second mode for the hex displays is raw mode where each segment in the display can be controlled independently. To enable raw mode the following functions are used:


To interact with the data for the hex displays in raw mode, the following functions must be used:

WarpV4_UserIO_WriteRaw_[LeftHex|MiddleHex|RightHex](baseaddress, value)

The value for the WriteRaw function must be 8 bits wide and arranged as follows [A B C D E F G DP]. The ReadRaw function returns a 8-bit number in the same order.


The 8 LEDs that are not directly connected to the FPGA but controlled through an IO Expander can be written to using the following function call:

WarpV4_UserIO_Write_ExtraLeds(baseaddress, value)

where value is 8-bits wide with each bit corresponding to each LED to be written.

Last modified 10 years ago Last modified on Oct 18, 2009, 11:24:56 PM