Lib(X)SVF – A library for implementing SVF and XSVF JTAG players

Lib(X)SVF is a library focused on implementing players for the Serial Vector Format (SVF) and the eXtended Serial Vector Format (XSVF). These formats are used for describing the actions and data required to test and program devices via the Joint Test Action Group (JTAG) interface. JTAG is commonly used for on-chip debugging and programming of CPUs, FPGAs (Field Programmable Gate Arrays), and CPLDs (Complex Programmable Logic Devices), as well as for boundary-scan testing.

SVF and XSVF Overview:

SVF was originally developed as a standard way to represent the data and instructions needed to test logic devices via JTAG. It describes the sequences to control the JTAG state machine, manipulate the JTAG taps, and perform operations like setting or retrieving values.

XSVF expanded upon SVF to provide additional capabilities for programming complex devices such as FPGAs. XSVF supports higher-level instructions, which makes it more suitable for certain programming environments and complex devices.

Features and Applications of Lib(X)SVF:

  • Compatibility: Lib(X)SVF allows software to interpret SVF and XSVF files, which can be used across different platforms, making it a versatile tool for JTAG operations.
  • Functionality: By using this library, developers can create applications that program or test logic devices via JTAG without having to write the complex low-level code to process SVF or XSVF instructions.
  • Device Support: It facilitates the process of updating firmware or device configurations for a wide range of JTAG-compatible devices.
  • Automation: With Lib(X)SVF, developers can automate testing and programming tasks in production or development environments, integrating these processes into larger automated workflows.

Pros of Using Lib(X)SVF:

  • Standardization: Provides a unified approach to handling JTAG programming across various devices by supporting the standard SVF and XSVF formats.
  • Ease of Integration: Software developers can integrate JTAG functionality into their systems without deep knowledge of the underlying specifics of JTAG test and programming operations.
  • Simplification: Reduces the complexity of developing custom software for device programming, as the library handles the parsing and execution of SVF/XSVF commands.

Cons of Using Lib(X)SVF:

  • Resource Requirements: Depending on the system's resources, the overhead introduced by a library may be significant for resource-constrained environments.
  • Abstraction Limitation: While abstraction makes development easier, it might also limit some aspects of direct control or optimization that could be achieved with a lower-level approach.
  • Library Dependence: Relying on a third-party library introduces dependencies, and applications may be affected by any bugs or limitations within the library itself.

In essence, Lib(X)SVF is a facilitator for developers who require a practical and efficient way to implement SVF and XSVF functionality for device testing and programming in JTAG environments. It significantly simplifies the development process by abstracting the intricacies of SVF/XSVF execution, leveraging these standardized formats for broader application with varying hardware.

JTAG (IEEE 1149.1, aka „Boundary Scan“[1] [2]) is a standard IC testing, debugging and programming port.

SVF (Serial Vector Format[3] [4]) is a file format for storing the patterns that should be sent to the JTAG interface, as well as the expected response. It is used as an exchange format between programms that generate the JTAG input/output patterns and devices that can physically talk to a JTAG interface.

XSVF (Xilinx Serial Vector Format[5]) is a binary variant of the SVF file format, optimized but not limited to programming Xilinx FPGA and CPLD devices.

Often one wants to use an embedded host processor or microcontroller to access the JTAG interface on an embedded device instead of using an external JTAG probe. This library can be used to implement such a solution. In addition to playing SVF and XSVF files this library is also capable of scanning the devices in the JTAG chain.

The libraries API can be used in a simple synchronous mode (perfect for register mapped GPIOs) or in a bit more complex asynchronous mode (for high speed interfaces with some roundtrip time).

Lib(X)SVF is free software licensed under the ISC license[6] (a GPL compatible licence that is similar in terms to the MIT license or the 2-clause BSD license).

[1] http://en.wikipedia.org/wiki/JTAG
[2] http://www.fpga4fun.com/JTAG.html
[3] http://en.wikipedia.org/wiki/Serial_Vector_Format
[4] http://www.asset-intertech.com/support/svf.pdf
[5] http://www.xilinx.com/bvdocs/appnotes/xapp503.pdf
[6] http://en.wikipedia.org/wiki/ISC_license

Documentation (README file):
http://svn.clifford.at/libxsvf/trunk/README

Example program (simple synchronous interface):
http://svn.clifford.at/libxsvf/trunk/xsvftool-gpio.c

Example program (asynchronous interface to the FTDI FT232H/FT2232H/FT4232H USB chips):
http://svn.clifford.at/libxsvf/trunk/xsvftool-ft232h.c

Example program (interface to the Xilinx Platform Cable USB):
http://svn.clifford.at/libxsvf/trunk/xsvftool-xpcu.src/

Link to the sources (subversion repository):
http://svn.clifford.at/libxsvf/trunk/

Projects using Lib(X)SVF

The following is a small excerpt of projects using Lib(X)SVF:

Please drop me a line if you are using Lib(X)SVF for something interesting and agree to be listed here with your project.

In papers and reports, please refer to Lib(X)SVF as follows: Clifford Wolf. Lib(X)SVF: A library for implementing SVF and XSVF JTAG players. http://www.clifford.at/libxsvf/, e.g. using the following BibTeX code:

@MISC{LibXSVF,
        author = {Clifford Wolf},
        title = {Lib(X)SVF: A library for implementing SVF and XSVF JTAG players},
        howpublished = "\url{http://www.clifford.at/libxsvf/}"
}

I can inform you that Lib(X)SVF would be most commonly employed in situations where JTAG functionality is required, but it isn't practical or efficient to build a custom solution from scratch. Here are a few projects where a library like Lib(X)SVF could be advantageous:

  1. Firmware Update Tools: Companies producing embedded devices, like routers or smart appliances, could use Lib(X)SVF to create software that updates firmware on their devices. Lib(X)SVF would handle the JTAG communication, and the company would provide the device-specific firmware.
  2. Development and Debugging Tools: Manufacturers of development boards, such as those used for FPGA or microcontroller prototyping, could integrate Lib(X)SVF into their IDEs or debugging tools. This would allow developers to upload their code to the hardware seamlessly or perform hardware troubleshooting via JTAG.
  3. Manufacturing Test Equipment: In a manufacturing scenario, testing equipment might use Lib(X)SVF to perform boundary-scan testing or device initialization. This ensures that each device off the production line meets the necessary specifications and is correctly programmed.
  4. Educational Platforms: To teach students about hardware programming and JTAG interfaces, educational toolkits could use Lib(X)SVF to facilitate the interaction with hardware without delving into the low-level details of JTAG operation too early in the learning process.
  5. Automated Testing Frameworks: Companies developing complex electronic products may use automated testing frameworks that include Lib(X)SVF to conduct automated testing sequences on each product via the JTAG interface, verifying functionality and performance.

While direct references to specific projects using Lib(X)SVF are beyond the scope of available information, the above examples represent plausible uses for the library. Given its versatile nature, it is conceivable that any project requiring JTAG-based SVF or XSVF file execution could benefit from such a library, especially when ease of use, standardization, and efficiency are priorities.