Skip to main content

AI-assisted verification gap analysis for safety-critical FPGA/RTL designs

Project description

RTLGuard

Generate test cases for your RTL designs in seconds.

RTLGuard is a command-line tool that reads your VHDL or SystemVerilog source files, checks for FPGA best-practice violations, generates concrete AI-powered test cases, and produces a ready-to-simulate SystemVerilog testbench.


Installation

Requires Python 3.10 or later.

pip install rtlguard

Set your API key before running:

# macOS / Linux
export ANTHROPIC_API_KEY=sk-ant-...

# Windows (Command Prompt)
set ANTHROPIC_API_KEY=sk-ant-...

# Windows (PowerShell)
$env:ANTHROPIC_API_KEY="sk-ant-..."

Usage

rtlguard analyze FILE [FILE ...] [options]

Basic example

rtlguard analyze counter.sv

With a design spec for additional context

rtlguard analyze counter.sv --spec requirements.txt

Multiple files

rtlguard analyze ctrl.vhd datapath.sv alu.vhd

Custom output directory

rtlguard analyze my_module.vhd -o results/

Options

Flag Default Description
FILE VHDL (.vhd, .vhdl) or SystemVerilog (.sv, .v) source file(s)
--spec FILE Optional design spec or requirements document for AI context
-o DIR, --output-dir DIR ./rtlguard_out Directory to write output files
-v, --verbose off Print parser warnings and validation issues
-h, --help Show help and exit

What it does

Step 1 — FPGA best-practice check

RTLGuard checks your source code for common FPGA design issues before generating test cases:

Severity Examples
Critical Combinational feedback loops, multiple drivers, undriven outputs
High Inferred latches, blocking assignments in sequential logic, inconsistent resets
Medium Missing reset handler, incomplete sensitivity lists, magic numbers
Low Naming inconsistencies, missing comments

Results are saved to <output-dir>/<module>_fpga_check.txt.

If violations are found, RTLGuard asks whether to proceed or fix the file first. If you choose to fix, edit the file in your editor, save, and press Enter — RTLGuard re-checks only the original violations, not the full design from scratch.

Step 2 — Test case generation

RTLGuard uses AI to generate concrete, module-specific test cases covering:

  • Reset and power-on behaviour
  • Normal operating modes
  • Boundary and edge cases (overflow, underflow, max values)
  • Any requirements from the spec (if provided)

Results are saved to <output-dir>/<module>_test_cases.txt.

Step 3 — Review and edit test cases (optional)

Before the testbench is generated, RTLGuard asks if you want to edit the test cases file. This lets you add, remove, or modify test cases to match your exact requirements.

If you choose to edit:

  1. Open <module>_test_cases.txt in any editor and make your changes — add new test cases, delete ones you don't need, or add notes.
  2. Save the file and press Enter in the terminal.
  3. RTLGuard re-parses your edits using AI: it removes duplicates, discards incomplete entries, renumbers IDs, and fixes formatting.
  4. The cleaned test cases are printed in the terminal for review.
  5. Confirm to proceed with the cleaned version, or decline to use your raw edits as-is.

Step 4 — SystemVerilog testbench

RTLGuard always generates a complete, ready-to-simulate SystemVerilog testbench:

  • Correct DUT instantiation
  • Clock generation
  • Reset sequence
  • Each test case as a labelled block with $display and automated pass/fail checks

The testbench is saved to <output-dir>/<module>_tb.sv.


Example output

  counter.sv
  Checking FPGA best practices ... ✓  Saved to rtlguard_out/counter_fpga_check.txt
  Generating test cases ... ✓  Saved to rtlguard_out/counter_test_cases.txt

  Edit test cases before generating testbench? [y/n]: y

  Edit rtlguard_out/counter_test_cases.txt and press Enter when ready ...
  Reparsing test cases ... ✓

  ------------------------------------------------------------
  [TC-001] Reset asserted holds output at zero  (CRITICAL)
    Verify output is zeroed when reset is asserted.
    Stimulus:
      rstn = 0
      clk = posedge
    Expected:
      out == 4'b0000

  [TC-002] Counter increments after reset de-asserted  (CRITICAL)
    Verify counter begins counting from zero after reset is released.
    Stimulus:
      rstn = 1
      clk = posedge
    Expected:
      out == 4'b0001
  ------------------------------------------------------------

  Proceed with these test cases? [y/n]: y
  Generating testbench ... ✓  Saved to rtlguard_out/counter_tb.sv

counter_test_cases.txt

[TC-001] Reset asserted holds output at zero  (CRITICAL)
  Verify output is zeroed when reset is asserted.
  Stimulus:
    rstn = 0
    clk = posedge
  Expected:
    out == 4'b0000

[TC-002] Counter increments after reset de-asserted  (CRITICAL)
  Verify counter begins counting from zero after reset is released.
  Stimulus:
    rstn = 0
    clk = posedge
    rstn = 1
    clk = posedge
  Expected:
    out == 4'b0001

Requirements

Requirement Version
Python ≥ 3.10
anthropic ≥ 0.40.0 (installed automatically)

Source

github.com/kingsleyamiah/rtl-guard-ai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rtlguard-0.4.0.tar.gz (78.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rtlguard-0.4.0-py3-none-any.whl (104.3 kB view details)

Uploaded Python 3

File details

Details for the file rtlguard-0.4.0.tar.gz.

File metadata

  • Download URL: rtlguard-0.4.0.tar.gz
  • Upload date:
  • Size: 78.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.4

File hashes

Hashes for rtlguard-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e064be51edfae3eef895e66dde7f5f463348bc4c13183c4ab4d04a6dd3459458
MD5 450c5e5c9704b8c48549d2b8b8760d71
BLAKE2b-256 da8b866f2c90c775051b243c092ff50b154e534fc6d009537e811ba9d9d9c1b8

See more details on using hashes here.

File details

Details for the file rtlguard-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: rtlguard-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 104.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.4

File hashes

Hashes for rtlguard-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84d991501fd3237df7f859dfcacd0ce19cb55e25434d98bfda66704231fee723
MD5 23e1e05950e38ae134439239f6e29256
BLAKE2b-256 d662f9ef5cdf0c51038fc4ea97e871998478053715f769b2cf7593224fab58a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page