We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 22211

XAPP058 - How can the "micro.c file" be modified to return a device's IDCODE?


Keywords: XAPP058

Xilinx Application Note XAPP058 provides source code for an embedded SVF file player. The source code provided is intended to play an SVF file and return a success or failure based on the TDO checks embedded in the SVF file. When an SVF file is created to "Get Device ID," the IDCODE for the device is embedded in the SVF file. Running the SVF file to "Get Device ID" will get the IDCODE from the device and check this value against the value stored in the SVF file. The function will not actually return the IDCODE from the device, but will return an error if the IDCODE from the device does not match the IDCODE in the SVF file. Can the "micro.c" file be modified to return the IDCODE for a device?



The simplest solution is to allow the XAPP058 solution and SVF do the work to check for a specific IDCODE.

The SVF file format allows for checking of the IDCODE value for a specific device when the SVF is generated from the iMPACT software with the Get Device ID operation. The XAPP058 code can execute the Get Device ID SVF file to check for the IDCODE of the specified device. If the IDCODE from the device in the JTAG chain matches, then the XAPP058 source code execution results in success. A failing result from the XAPP058 source code indicates that the IDCODE did not match. This style of operation allows for IDCODE checking from the "micro.c" function without the need for the user to parse the actual binary pattern for a valid IDCODE.

If there is a need to check for one of many possible IDCODE values, then multiple, separate Get Device ID SVF files can be created and executed via the XAPP058 solution. A successful result from one of the Get Device ID SVF files indicates a match for the IDCODE checked by that SVF file.


If a binary pattern must be returned for detailed evaluation of an embedded IDCODE, then the "micro.c" code from XAPP058 will need to be modified.

To retrieve the IDCODE from devices in a JTAG chain, you need to take into consideration the operation of IEEE STD 1149.1 devices. It is necessary to understand the procedure for invoking a device to emit an IDCODE along with the supported Instructions and Data Register lengths of all devices in the JTAG chain. See the IEEE STD 1149.1 for details. In brief, a reset of the JTAG Test Access Port (TAP) via the Test-Logic-Reset state enables devices with IDCODEs to emit their IDCODE when the JTAG TAP of the devices is moved to the Shift-DR state. To implement this procedure, you must add code to XAPP058 to first move the JTAG TAP to the Test-Logic-Reset state, then move the JTAG TAP to the Shift-DR state, and, finally, shift the data register bits out of the JTAG devices to be captured for later evaluation.

NOTE: The code specified below is pseudo code to implement this feature on the XAPP058 XSVF player source code, v5.01, and has not been fully implemented or tested by Xilinx.

// Assumes the following XAPP058 data structure exists and is initialized
// SXsvfInfo xsvfInfo;
// xsvfInitialize( &xsvfInfo );

// Here is the function to get the IDCODEs (and BYPASS) bits from all devices:
// You must know how many IDCODE (and BYPASS) bits are to be shifted from the chain.
// The total number is given to the function as the lNumBits parameter.
// Upon exit from the function, the IDCODE (and BYPASS) bits will be
// in the xsvfInfo.lvTdoCaptured array
int xsvfGetIDCODEs( long lNumBits )
// Reset all JTAG TAPs to Test-Logic-Reset
// According to 1149.1, this makes the IDCODE (or BYPASS) the active instr.
xsvfGotoTapState( &(xsvfInfo.ucTapState), XTAPSTATE_RESET );

// Go to the Shift-DR state to prepare to shift out IDCODE (or BYPASS) bits
xsvfGotoTapState( &(xsvfInfo.ucTapState), XTAPSTATE_SHIFTDR );

// Shift and save IDCODE and BYPASS bits in the xsvfInfo.lvTdoCaptured array
// xsvfInfo.lvTdi is used for TDI input, but the TDI input value is a don?t care
xsvfShiftOnly( lNumBits, &(xsvfInfo.lvTdi), &(xsvfInfo.lvTdoCaptured), 1 );

// End with TAPs in Test-Logic-Reset
xsvfGotoTapState( &(xsvfInfo.ucTapState), XTAPSTATE_RESET );
AR# 22211
日期 10/01/2008
状态 Active
Type ??????