How xilinx/xilinxvirtualcable works
Project Type and Purpose
• This is an open-source, C-based network-server tool (Xilinx Virtual Cable, XVC) that implements a TCP/IP service to emulate a JTAG cable.
• It allows EDA tools (e.g., Vivado Logic Analyzer) or custom TCP clients to perform JTAG operations (shift, getinfo) and, in version 1.1, memory reads/writes (mrd, mwr) over a network.
• The project supplies multiple platform-specific server implementations:
• dpc/ – XVC 1.1 via the Debug Packet Controller interface
• jtag/zynq7000 – XVC 1.0 on Zynq-7000 SoCs
• jtag/zynqMP – XVC 1.0 on Zynq UltraScale+ SoCs (with a Linux kernel driver)
• mem/versal – XVC 1.1 on Versal SoCs (memory-mapped RD/WR)
File-Structure Analysis
• Top level
• README.md – high-level description, protocol details
• dpc/ – source, headers, Makefile, license for XVC 1.1 via DPC
• jtag/ – two subdirs for Zynq7000 (XAPP1251 reference design) and ZynqMP
• mem/ – Versal XVC 1.1 memory server
• Each platform folder contains:
• src/ or driver/ and user/ subfolders
• C source for a TCP server (xvcserver.c), hardware access modules (hsdp_lib.c, xvc_mem.c, xvc_driver.c)
• Build scripts (Makefile) and configuration headers
• Key patterns
• Protocol-handler layer (parse TCP messages, respond per XVC 1.0/1.1)
• Platform-abstraction layer (DPC library, kernel driver or memory access routines)
• Hardware interface layer (JTAG pins, debug packet controller, SoC memory bus)
README Insights
• Describes XVC 1.0 vs. 1.1 messages and command set
• Emphasizes single-connection, request/response model over TCP
• Points to platform examples and reference designs (e.g., XAPP1251 for Zynq-7000)
Diagramming the Architecture
a. Main Components
1. External Client (Vivado, custom TCP client)
2. TCP/IP Stack (BSD sockets in C)
3. XVC Server Process
• Protocol Handler (parses getinfo, settck, shift, mrd, mwr)
• Command Dispatcher (routes commands to HAL)
4. Platform-Specific HAL Modules
• DPC Library (hsdp.c/h)
• JTAG Kernel Driver Interface (xvc_driver + ioctl)
• Memory-Mapped Access (xvc_mem)
5. Hardware Interfaces
• Debug Packet Controller IP
• SoC JTAG pins (via EMIO/PL)
• SoC memory bus for mrd/mwr
6. Physical FPGA/SoC Device
b. Relationships and Data Flows
• Client → TCP Socket → XVC Server → Protocol Handler
• Protocol Handler ──> Dispatcher → Platform HAL → Hardware
• Hardware response → HAL → Protocol Handler → TCP Socket → Client
c. Architectural Patterns
• Layered architecture: Network → Protocol → HAL → Hardware
• Strategy pattern for selecting platform HAL at build/run time
• Single-threaded, synchronous request/response model (no concurrent clients)
d. Key Technologies
• C programming, Makefiles
• BSD sockets API for TCP/IP
• Linux kernel driver (for ZynqMP) via char device and ioctl
• ULEB128 encoding for mrd/mwr parameters
• Build tools: GNU Make, cross-compile toolchains