completeIET Prize 2026 • First Class 91%

VAIDAR: AI-Enabled Hardware-in-the-Loop FPGA Verification

Automated Python Hardware-in-the-Loop (HIL) verification framework for AMD Xilinx Artix-7 FPGAs, achieving 968.9 tests/sec over deterministic binary UART with Google Gemini API edge-case generation and fault diagnosis.

  • FPGA
  • Verilog
  • Python
  • HIL Testing
  • Vivado
  • UART
  • Gemini API
VAIDAR: AI-Enabled Hardware-in-the-Loop FPGA Verification

Project Overview

VAIDAR (Verification & Artificial Intelligence for Digital Architecture Runtime) is an automated Hardware-in-the-Loop (HIL) FPGA verification framework built for my Final Year BEng Individual Project (“SOFTWARE-TO-SILICON: An AI-Enabled Python Framework for Hardware-in-the-Loop FPGA Verification”) at the University of Brighton.

The project achieved First Class 91% (A+), contributed to receiving The IET Prize 2026, and is the subject of an upcoming peer-reviewed journal article in FPGA Horizons Journal (January 2027 issue, co-authored with Dr. Bahawodin Baha).

Letter Component Engineering Role in the System
V Verification Automated HIL testbench and Python mathematical golden reference model (0xFFFF wraparound + NZCV flags)
AI Artificial Intelligence Google Gemini API integration for constrained CSV edge-case generation and single-sentence failure diagnosis
D Digital Synthesised Verilog RTL control FSM and 100 MHz mid-bit oversampling UART receiver
A Architecture Custom 16-bit, 18-instruction ALU with 4 internal registers on AMD Xilinx Artix-7 silicon
R Runtime Multi-threaded Python execution engine and CustomTkinter GUI achieving 968.9 tests/sec over binary UART

Verifying FPGA logic before deployment forces engineers into a trade-off: Software-in-the-Loop (SIL) simulation is flexible but misses real physical I/O timing, electrical latency, and metastability, while manual bench testing using board slide switches and LEDs gives real silicon behaviour at an unscalable pace. According to the 2026 Siemens EDA and Wilson Research Group Functional Verification Study, functional verification consumes an average of 51% of FPGA project time, and 98% of participating FPGA projects still experience non-trivial bugs escaping into production.

VAIDAR addresses this gap on a low-cost Digilent Nexys A7 board by pairing a deterministic binary UART protocol with a Python golden-model test engine, a watchdog folder queue for hands-free CSV batch execution, and optional LLM assistance for generating boundary test cases and explaining failing logs.


System Architecture & Physical Testbed

The architecture splits responsibilities cleanly between the host PC (Python orchestration, CustomTkinter GUI, watchdog directory observer, golden reference model, and Gemini API integration) and the AMD Xilinx Artix-7 (XC7A100T) FPGA fabric running at 100 MHz.

Automated HIL Validation Framework Block Diagram Figure 1: End-to-end VAIDAR HIL architecture connecting the Python middleware and CSV test queue over USB-to-UART to the Verilog controller and 16-bit ALU on physical FPGA silicon.

Communication uses a fixed-length binary UART packet protocol requiring only two digital pins (RX and TX):

  • Downstream (PC to FPGA, 5 bytes): Byte 0 = 8-bit opcode, Bytes 1-2 = 16-bit Operand A (big-endian), Bytes 3-4 = 16-bit Operand B (big-endian).
  • Upstream (FPGA to PC, 3 bytes): Byte 0 = packed hardware status flags (N, Z, C, V), Bytes 1-2 = 16-bit result.

Using an external Silicon Labs CP2102 USB-to-UART bridge demonstrates that the testbench does not rely on an on-chip USB controller and can connect directly to bare-metal digital I/O pins. The verified 100,000-test benchmark ran at 230,400 baud (434 FPGA clock cycles per bit, sampled at midpoint cycle 217 for noise rejection), while the parameterisable Verilog and PySerial driver also support higher configured rates such as 921,600 baud (shown in the desktop GUI screenshot above).

Physical Testbed Hardware Setup Figure 2: Physical bench validation setups pairing Digilent Nexys A7 Artix-7 boards with host ThinkPad workstations via onboard USB-UART (left) and an external CP2102 USB-to-UART bridge wired to RX/TX pins (right).


Verified Benchmarks & Bottleneck Analysis

Physical benchmarking on the Digilent Nexys A7 compared a manual switch-and-LED baseline against automated batches from 10 up to 100,000 test vectors (at 230,400 baud, 5-byte TX / 3-byte RX, zero visual delay):

Benchmark Metric Manual Bench Baseline (Switches & LEDs) VAIDAR Automated HIL (230,400 Baud)
Measured Throughput 0.022 tests/sec (~45 sec/test) 968.9 tests/sec (~44,040x faster)
100,000-Vector Run Unviable (~1,243 hours) 103.21 seconds (100,000 / 100,000 PASS)
1,000,000-Vector Extrapolation ~12,433 hours (~1.4 years) ~17.2 minutes
Verification Fidelity Physical FPGA silicon Physical FPGA silicon + Python golden model
Fault Diagnosis Manual LED / logic inspection Automated timeout & Gemini single-sentence triage

Link & Latency Bottleneck Profiling: At 230,400 baud with standard 10-bit UART framing (1 start bit, 8 data bits, 1 stop bit), transferring 8 bytes round-trip takes a theoretical minimum of ~0.347 ms (~2,880 tests/sec). Reaching 968.9 tests/sec saturates roughly 34% of the physical wire capacity. Because the 100 MHz FPGA executes ALU operations in under a microsecond, silicon execution time is negligible; the limiting factor is host-side Python overhead and the operating system’s ~1 ms USB serial polling interval.


Hardware Architecture: 16-Bit Verilog ALU & Control FSM

To test the framework against non-trivial stateful logic, the Device-Under-Test (DUT) is a custom 16-bit Verilog ALU supporting 18 instructions (ADD, SUB, MUL, DIV, MOD, SQRT, POW, AND, OR, XOR, NOT, SHL, SHR, STO, RCL, INC, DEC, NEG), a 4-entry internal register file (STO/RCL), hardware divide-by-zero exception handling (0xEEEE with overflow flag), a seven-segment display controller, and status LEDs:

16-Bit ALU Hardware Block Diagram Figure 3: Internal FPGA block diagram showing uart_receiver, top_16bit_alu (Main Control FSM and 16-bit ALU), uart_transmitter, status LEDs, and multiplexed seven-segment display driver.

Excerpt from hardware/src/sources_1/new/top_16bit_alu.v showing the 5-byte receive state machine and arithmetic execution:

case (current_state)
    STATE_IDLE:      if (rx_done_flag) begin opcode_reg      <= rx_byte_data; current_state <= STATE_WAIT_A_HI; end
    STATE_WAIT_A_HI: if (rx_done_flag) begin operand_a[15:8] <= rx_byte_data; current_state <= STATE_WAIT_A_LO; end
    STATE_WAIT_A_LO: if (rx_done_flag) begin operand_a[7:0]  <= rx_byte_data; current_state <= STATE_WAIT_B_HI; end
    STATE_WAIT_B_HI: if (rx_done_flag) begin operand_b[15:8] <= rx_byte_data; current_state <= STATE_WAIT_B_LO; end
    STATE_WAIT_B_LO: if (rx_done_flag) begin operand_b[7:0]  <= rx_byte_data; current_state <= STATE_CALCULATE; end

    STATE_CALCULATE: begin
        alu_flags <= 4'b0000;
        case (opcode_reg)
            8'h01: begin // ADD
                alu_result    <= add_val[15:0];
                alu_flags[1]  <= add_val[16];
                alu_flags[0]  <= ~(operand_a[15] ^ operand_b[15]) & (operand_a[15] ^ add_val[15]);
                current_state <= STATE_TX_FLAGS;
            end
            8'h04, 8'h05, 8'h06: begin // DIV, MOD, SQRT
                if ((opcode_reg == 8'h04 || opcode_reg == 8'h05) && operand_b == 0) begin
                    alu_result <= 16'hEEEE; alu_flags[0] <= 1; current_state <= STATE_TX_FLAGS;
                end else if (wait_timer < 32) begin
                    wait_timer <= wait_timer + 1;
                    current_state <= STATE_CALCULATE;
                end else begin
                    if (opcode_reg == 8'h04) alu_result <= operand_a / operand_b;
                    else if (opcode_reg == 8'h05) alu_result <= operand_a % operand_b;
                    else alu_result <= hardware_sqrt(operand_a);
                    wait_timer <= 0;
                    current_state <= STATE_TX_FLAGS;
                end
            end
        endcase
    end
endcase

Software Architecture & Gemini API Integration

The desktop application uses a decoupled, multi-threaded CustomTkinter architecture: the main thread handles UI rendering and controls while background threads run serial I/O, watchdog directory monitoring, and API requests over thread-safe message queues so the UI never freezes during high-throughput runs.

The Google Gemini API is integrated for two targeted engineering workflows (with optional Anthropic, OpenAI, and offline mock providers in the repository):

  1. Constrained Edge-Case CSV Generation: Given the rigid 18-opcode instruction schema and a natural-language prompt (for example, division boundary cases or overflow conditions), Gemini outputs raw Operation,Operand A,Operand B CSV vectors that are validated and queued straight onto physical silicon.
  2. Automated Log Diagnosis: When a hardware run fails (status flag mismatch, result mismatch, or serial communication timeout), the failure summary is sent to Gemini for a concise single-sentence root-cause diagnosis, validated against intentionally injected Verilog faults (a combinational mapping error and a missing soft-reset condition).

VAIDAR AI Test Generation and Log Analysis Workflow Figure 4: Dual AI assistant workflows in VAIDAR for prompt-driven CSV test generation (top) and post-run failure log analysis (bottom).

Excerpt from profiles/alu_16bit.py handling the deterministic 5-byte command packing and 3-byte hardware response unpacking:

def pack_command(self, row: dict) -> bytes:
    cmd_str = row.get('Operation', '').lower().strip()
    opcode = self.OPCODES.get(cmd_str, 0xFF)
    op_a = int(row.get('Operand A', 0))
    op_b = int(row.get('Operand B', 0))

    return bytes([
        opcode,
        (op_a >> 8) & 0xFF, op_a & 0xFF,
        (op_b >> 8) & 0xFF, op_b & 0xFF,
    ])

def unpack_response(self, raw_bytes: bytes):
    if len(raw_bytes) < 3:
        return None

    flags_byte, res_hi, res_lo = raw_bytes[0], raw_bytes[1], raw_bytes[2]
    return {
        'result': (res_hi << 8) | res_lo,
        'N': (flags_byte >> 3) & 1,
        'Z': (flags_byte >> 2) & 1,
        'C': (flags_byte >> 1) & 1,
        'V': flags_byte & 1,
    }

Publications, Deliverables & Attribution

  • GitHub Repository: HarryRogers073/vaidar
  • Publication: FPGA Horizons Journal (January 2027 issue) - upcoming peer-reviewed journal article on Python HIL FPGA verification, co-authored with Dr. Bahawodin Baha.
  • Academic Context: BEng (Hons) Final Year Individual Project, University of Brighton (First Class 91%, The IET Prize 2026)
  • Academic Exhibition Poster: Download High-Resolution Vector PDF
  • Target Silicon: Digilent Nexys A7 FPGA (AMD Xilinx Artix-7 XC7A100T)
  • EDA Tooling: AMD Xilinx Vivado Design Suite (v2025.1.1)
  • Attribution & Provenance:
    • Custom Code & RTL: The Python HIL test engine, golden reference model, CustomTkinter desktop GUI, 16-bit Verilog ALU, control FSM, and seven-segment display controller were written by Harry Rogers.
    • Adapted Hardware: The physical UART receiver (uart_receiver.v) was adapted from Russell Merrick’s open-source Nandland UART receiver with custom framing and mid-bit sampling logic.
    • Open-Source Libraries: Built with pyserial, customtkinter, watchdog, python-dotenv, and the Google Gemini (google-genai / google-generativeai), Anthropic, and OpenAI SDKs.