Changes between Initial Version and Version 1 of cores/w3_userio


Ignore:
Timestamp:
Aug 11, 2012, 11:30:11 PM (12 years ago)
Author:
murphpo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • cores/w3_userio

    v1 v1  
     1 = WARP v3 User I/O Controller (w3_userio) =
     2
     3This core provides software access to the various user I/O resources on the WARP v3 board. These resources include the 12 user LEDs, 2 hex displays, 3 push buttons, and 4-position DIP switch. For details on the user I/O devices, refer to the [wiki:/HardwareUsersGuides/WARPv3/UserIO WARP v3 User Guide].
     4
     5The w3_userio core is packaged as a pcore with both custom HDL and a C driver.
     6
     7== Hardware ==
     8The w3_userio HDL implements a PLBv46 slave interface with multiple registers accessible from user code. Refer to the driver documentation below for details on setting these registers.
     9
     10=== User Outputs ===
     11User outputs (LEDs, hex displays) can be controlled either from software or via hardware ports. The w3_userio core implements a 2-to-1 mux for each output bit:
     12[[Image(wiki:cores/w3_userio/files:w3_userio_ctrlSrcMux.png, nolink)]] [[BR]]
     13
     14There is one bit in a {{{usr_}}} port for each LED and hex display segment. The table below lists the w3_userio {{{usr_}}} input ports. User logic should drive the ports corresponding to outputs configured for hardware control. When an output is configured for software control the corresponding {{{usr_}}} port bit is ignored.
     15
     16||= Port Name =||= Width =||= Description =||
     17|| usr_hexdisp_left || 7 || Left hex display ||
     18|| usr_hexdisp_left_dp || 1 || Left hex display decimal point ||
     19|| usr_hexdisp_right || 0 || Right hex display ||
     20|| usr_hexdisp_right_dp || 0 || Right hex display decimal point ||
     21|| usr_leds_red || 4 || Red LEDs ||
     22|| usr_leds_green || 4 || Green LEDs ||
     23|| usr_rfa_led_red || 1 || Red LED near RF A ||
     24|| usr_rfa_led_green || 1 || Green LED near RF A ||
     25|| usr_rfb_led_red || 1 || Red LED near RF B ||
     26|| usr_rfb_led_green || 1 || Green LED near RF B ||
     27
     28By default only the RF LEDs are configured for hardware control. The control source of each output can be changed at anytime from user code.
     29
     30=== Hex Display Mapping ===
     31The w3_userio core implements logic to map 4-bit values to the nearest 7-segment pattern for the corresponding hexadecimal digit. When enabled only the 4 LSB of the user-supplied value is used to update each hex display. When this logic is disabled the full 7-bit value is driven directly to the seven LED segments on the corresponding hex display. The mapping mode of each display can changed at any time from user code. Refer to the driver documentation below for details.
     32
     33The 4-bit to 7-segment mapping logic is only available when the corresponding hex display is configured for software control. When configured for hardware control the 7-bit {{{usr_}}} port is tied directly to the corresponding hex display outputs.
     34
     35=== User Inputs ===
     36User inputs are debounced in HDL, with the debounced values captured in software-accessible registers. The debounced values are also driven to {{{usr_}}} ports for use by custom logic. The table below lists the ports for each input device.
     37
     38||= Port Name =||= Width =||= Description =||
     39|| usr_dipsw || 4 || DIP switch ||
     40|| usr_pb_u || 1 || Up push button ||
     41|| usr_pb_m || 0 || Middle push button ||
     42|| usr_pb_d || 0 || Down push button ||
     43
     44=== FPGA DNA ===
     45
     46The Virtex-6 FPGA implements a "DNA" feature, which provides a 56-bit value unique to every chip. This value is set at the factory and cannot be changed. User logic must instantiate the DNA_PORT primitive to access the DNA value. The w3_userio core implements logic to read the DNA value and capture it in a software-accessible register. This logic is implemented when the {{{INCLUDE_DNA_READ_LOGIC}}} parameter is set to 1.
     47
     48When the DNA_PORT logic is included, the user design must provide a clock signal at the w3_userio {{{DNA_Port_Clk}}} port. This signal must be slower than 100MHz. If the DNA_PORT logic is omitted (i.e. {{{INCLUDE_DNA_READ_LOGIC = 0}}}) the {{{DNA_Port_Clk}}} port is ignored.
     49
     50=== Instantiating the Core ===
     51The MHS snippet below shows the w3_userio instantiation used in the WARP v3 reference projects. The memory address is intentionally invalid; you must run "Generate Addresses" after adding the core.
     52
     53Note that in this example four {{{usr_}}} ports are used to provide hardware control of the RF LEDs. The signals connected to these ports ({{{RFx_statLED_*}}}) are driven by the radio_controller to indicate Tx/Rx status of each RF interface.
     54
     55{{{
     56#!sh
     57
     58#Top level ports
     59...
     60# User I/O pins
     61 PORT USERIO_hexdisp_left_pin = USERIO_hexdisp_left_pin, DIR = O, VEC = [0:6]
     62 PORT USERIO_hexdisp_right_pin = USERIO_hexdisp_right_pin, DIR = O, VEC = [0:6]
     63 PORT USERIO_hexdisp_left_dp_pin = USERIO_hexdisp_left_dp_pin, DIR = O
     64 PORT USERIO_hexdisp_right_dp_pin = USERIO_hexdisp_right_dp_pin, DIR = O
     65 PORT USERIO_leds_red_pin = USERIO_leds_red_pin, DIR = O, VEC = [0:3]
     66 PORT USERIO_leds_green_pin = USERIO_leds_green_pin, DIR = O, VEC = [0:3]
     67 PORT USERIO_rfa_led_red_pin = USERIO_rfa_led_red_pin, DIR = O
     68 PORT USERIO_rfa_led_green_pin = USERIO_rfa_led_green_pin, DIR = O
     69 PORT USERIO_rfb_led_red_pin = USERIO_rfb_led_red_pin, DIR = O
     70 PORT USERIO_rfb_led_green_pin = USERIO_rfb_led_green_pin, DIR = O
     71 PORT USERIO_dipsw_pin = USERIO_dipsw_pin, DIR = I, VEC = [0:3]
     72 PORT USERIO_pb_u_pin = USERIO_pb_u_pin, DIR = I
     73 PORT USERIO_pb_m_pin = USERIO_pb_m_pin, DIR = I
     74 PORT USERIO_pb_d_pin = USERIO_pb_d_pin, DIR = I
     75...
     76BEGIN w3_userio
     77 PARAMETER INSTANCE = w3_userio_0
     78 PARAMETER HW_VER = 1.00.a
     79 PARAMETER C_BASEADDR = 0xFFFFFFFF
     80 PARAMETER C_HIGHADDR = 0x00000000
     81 BUS_INTERFACE SPLB = plb_primary
     82 PORT hexdisp_left = USERIO_hexdisp_left_pin
     83 PORT hexdisp_right = USERIO_hexdisp_right_pin
     84 PORT hexdisp_left_dp = USERIO_hexdisp_left_dp_pin
     85 PORT hexdisp_right_dp = USERIO_hexdisp_right_dp_pin
     86 PORT leds_red = USERIO_leds_red_pin
     87 PORT leds_green = USERIO_leds_green_pin
     88 PORT rfa_led_red = USERIO_rfa_led_red_pin
     89 PORT rfa_led_green = USERIO_rfa_led_green_pin
     90 PORT rfb_led_red = USERIO_rfb_led_red_pin
     91 PORT rfb_led_green = USERIO_rfb_led_green_pin
     92 PORT dipsw = USERIO_dipsw_pin
     93 PORT pb_u = USERIO_pb_u_pin
     94 PORT pb_m = USERIO_pb_m_pin
     95 PORT pb_d = USERIO_pb_d_pin
     96 PORT usr_rfa_led_red = RFA_statLED_Rx
     97 PORT usr_rfa_led_green = RFA_statLED_Tx
     98 PORT usr_rfb_led_red = RFB_statLED_Rx
     99 PORT usr_rfb_led_green = RFB_statLED_Tx
     100 PORT DNA_Port_Clk = clk_40MHz
     101END
     102...
     103}}}
     104
     105== Driver ==
     106
     107The w3_userio pcore includes a C driver to access user I/O devices from user code. Refer to the [//svn/WARP/PlatformSupport/CustomPeripherals/pcores/w3_userio_v1_00_a/doc/html/api/modules.html w3_userio API documentation] for full details.
     108
     109All driver functions require the base memory address of the w3_userio pcore. This address is set in your XPS project. The EDK tools copy this address into a macro in the {{{xparameters.h}}} file when you generate a BSP. The auto-generated macro should be named {{{XPAR_W3_USERIO_0_BASEADDR}}} (assuming your pcore instance is named {{{w3_userio_0}}}, as in the example above).
     110
     111The example below illustrates using the w3_userio driver from user code. Note that the core requires no initialization for normal operation.
     112{{{
     113#!C
     114//Define our own macro, in case EDK changes its naming scheme in the future
     115// Assumes pcore instance is named w3_userio_0; confirm in xparameters.h
     116#define USERIO_BASEADDR XPAR_W3_USERIO_0_BASEADDR
     117
     118//Default state on reset:
     119//Select software control of all outputs except RF LEDs
     120//Set both hex dipslays to map 4-bit to 7-segment values
     121userio_write_control(USERIO_BASEADDR, (W3_USERIO_CTRLSRC_LEDS_RF | W3_USERIO_HEXDISP_L_MAPMODE | W3_USERIO_HEXDISP_R_MAPMODE));
     122
     123//Select software control of all outputs
     124//Set both hex dipslays to map 4-bit to 7-segment values
     125userio_write_control(USERIO_BASEADDR, (W3_USERIO_HEXDISP_L_MAPMODE | W3_USERIO_HEXDISP_R_MAPMODE));
     126
     127//Select hardware control of RF LEDs
     128//Disable mapping for hex display values
     129userio_write_control(USERIO_BASEADDR, W3_USERIO_CTRLSRC_LEDS_RF);
     130
     131//Enable hardware control of green user LEDs, preserve other control settings
     132userio_write_control(USERIO_BASEADDR, (userio_read_control(USERIO_BASEADDR) | W3_USERIO_CTRLSRC_LEDS_GREEN));
     133}}}
     134
     135
     136== Source ==
     137
     138The full hardware and software source code is available in the repository: [source:/PlatformSupport/CustomPeripherals/pcores/w3_userio_v1_00_a]. The VHDL, Verilog and C source code are made available under the [wiki:/license WARP license].