Skip to main content

Sigmantic AI CLI - Intelligent RTL code generation with Claude and workspace management

Project description

Sigmantic AI CLI

An intelligent CLI tool for RTL (Register Transfer Level) code generation that follows an agentic workflow with workspace-based project management inspired by the Claude Agent SDK:

  1. Workspace Management: Every session starts with workspace creation/attachment
  2. Planning Phase: Structured todo planning with RTL specifications
  3. Verification First: Generates comprehensive testbenches before RTL code
  4. Iterative RTL Generation: Creates and refines RTL code using Verilator feedback
  5. Self-Explanation: Documents and explains the generated code functionality

Features

  • ๐Ÿ—๏ธ Workspace-Based Projects: Claude Agent SDK-inspired project structure
  • ๐Ÿค– Agentic Workflow: AI-driven planning and execution
  • ๐Ÿงช Verification-First Approach: Testbenches generated before implementation
  • ๐Ÿ”„ Iterative Refinement: Uses Verilator feedback to improve code quality
  • ๐Ÿ“ Self-Documenting: Explains generated code and design decisions
  • ๐ŸŽฏ RTL-Focused: Specialized for hardware description languages (Verilog/SystemVerilog)
  • ๐Ÿ› ๏ธ Tool Integration: Built-in Verilator integration for compilation and verification
  • ๐Ÿ“Š Rich CLI Interface: Beautiful terminal interface with progress tracking
  • ๐Ÿ” File System Context: Uses workspace structure for agent context management

Quick Start

  1. Setup:

    ./setup.sh
    
  2. Configure:

    cp env.example .env
    # Edit .env and add your Anthropic API key to key.cfg
    
  3. Create your first RTL project:

    sigmantic "Create a 32-bit ALU with add, subtract, and, or operations"
    # The system will prompt you to create or attach to a workspace
    

Workspace Management

Workspace Structure

Each RTL project workspace follows the Claude Agent SDK pattern:

my_rtl_project/
โ”œโ”€โ”€ CLAUDE.md                    # Project context for Claude
โ”œโ”€โ”€ .claude/                     # Agent configuration
โ”‚   โ”œโ”€โ”€ settings.json           # Project settings
โ”‚   โ”œโ”€โ”€ agents/                 # Specialized RTL agents
โ”‚   โ”‚   โ”œโ”€โ”€ rtl_designer.md     # RTL design specialist
โ”‚   โ”‚   โ””โ”€โ”€ verification_specialist.md
โ”‚   โ””โ”€โ”€ commands/               # Custom slash commands
โ”‚       โ”œโ”€โ”€ simulate.md         # /simulate command
โ”‚       โ””โ”€โ”€ lint.md            # /lint command
โ”œโ”€โ”€ rtl/                        # Generated RTL modules
โ”œโ”€โ”€ testbenches/                # Verification testbenches  
โ”œโ”€โ”€ docs/                       # Design documentation
โ””โ”€โ”€ sim/                        # Simulation results

Workspace Commands

# List available workspaces
sigmantic --list-workspaces

# Show current workspace info
sigmantic --workspace-info

# Generate RTL in a specific workspace
sigmantic "Create a FIFO" --workspace /path/to/workspace

Installation

Option 1: Install from PyPI (Recommended)

pip install sigmantic

Option 2: Install from Source

git clone https://github.com/sigmantic-ai/sigmantic-cli.git
cd sigmantic-cli
pip install -e .

Option 3: Quick Setup Script

git clone https://github.com/sigmantic-ai/sigmantic-cli.git
cd sigmantic-cli
./install.sh

Configuration

After installation, configure your API key:

# Create config directory
mkdir -p ~/.sigmantic

# Add your Anthropic API key
echo "ANTHROPIC_API_KEY=your_api_key_here" > ~/.sigmantic/key.cfg

Verify Installation

sigmantic --help
sigmantic --list-workspaces

Usage

Basic Usage

python3 rtl_agent.py "Your RTL design description"

Options

  • --non-interactive, -n: Run without interactive prompts
  • --workspace, -w: Specify workspace directory (default: ./workspace)
  • --help: Show help message

Examples

# Simple counter
python3 rtl_agent.py "Create an 8-bit up counter with enable and reset"

# ALU design
python3 rtl_agent.py "Design a 16-bit ALU supporting add, subtract, AND, OR"

# FIFO buffer
python3 rtl_agent.py "Implement a synchronous FIFO with 32-bit width and 16 entries"

# State machine
python3 rtl_agent.py "Create a traffic light controller state machine"

Interactive Examples

python3 examples.py

Workflow Details

1. Planning Phase

  • Analyzes user requirements
  • Creates structured task breakdown
  • Defines RTL specification (inputs, outputs, parameters)
  • Plans verification strategy

2. Verification Phase

  • Generates comprehensive testbench
  • Creates test cases for all scenarios
  • Defines coverage goals
  • Explains verification strategy

3. RTL Generation Phase

  • Generates initial RTL code
  • Compiles with Verilator
  • Iteratively fixes compilation errors
  • Runs verification tests
  • Optimizes based on feedback

4. Explanation Phase

  • Documents design decisions
  • Explains code functionality
  • Creates comprehensive documentation
  • Highlights key learning points

Architecture

SigmanticAICLi/
โ”œโ”€โ”€ rtl_agent.py           # Main CLI interface
โ”œโ”€โ”€ models.py              # Data models and types
โ”œโ”€โ”€ verilator_utils.py     # Verilator integration
โ”œโ”€โ”€ agents/                # Individual agent modules
โ”‚   โ”œโ”€โ”€ planning_agent.py      # Task planning and specification
โ”‚   โ”œโ”€โ”€ verification_agent.py  # Testbench generation
โ”‚   โ”œโ”€โ”€ rtl_generation_agent.py # RTL code generation
โ”‚   โ””โ”€โ”€ explanation_agent.py   # Code explanation
โ”œโ”€โ”€ templates/             # RTL and testbench templates
โ”œโ”€โ”€ workspace/             # Generated files (created at runtime)
โ”œโ”€โ”€ examples.py            # Example usage scenarios
โ”œโ”€โ”€ test_installation.py   # Installation verification
โ””โ”€โ”€ setup.sh              # Automated setup script

Output Files

For each RTL generation, the tool creates:

  • {module_name}.v - Generated RTL code
  • {module_name}_tb.v - Verification testbench
  • {module_name}_documentation.md - Comprehensive documentation
  • Verilator compilation and simulation results

Configuration

Environment variables (set in .env):

  • OPENAI_API_KEY - Your OpenAI API key (required)
  • VERILATOR_PATH - Path to Verilator executable (optional)
  • WORKSPACE_DIR - Workspace directory for generated files

Testing

Run the installation test:

python3 test_installation.py

This verifies:

  • All dependencies are installed
  • Imports work correctly
  • CLI help functionality
  • Environment setup

Examples and Use Cases

Digital Design Education

  • Generate examples for learning RTL concepts
  • Create testbenches for verification practice
  • Understand design patterns and best practices

Rapid Prototyping

  • Quickly generate RTL modules for system integration
  • Create verification infrastructure
  • Iterate on designs with AI feedback

Design Documentation

  • Generate comprehensive design documentation
  • Explain complex RTL designs
  • Create educational materials

Limitations

  • Requires OpenAI API access (costs apply)
  • Generated code may need manual review for production use
  • Verilator integration is optional but recommended
  • Complex designs may require multiple iterations

Contributing

This is a demonstration project showcasing agentic AI workflows for RTL design. Feel free to extend and modify for your specific needs.

License

MIT License - See LICENSE file for details

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

sigmantic-0.2.0.tar.gz (53.2 kB view details)

Uploaded Source

Built Distribution

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

sigmantic-0.2.0-py3-none-any.whl (47.9 kB view details)

Uploaded Python 3

File details

Details for the file sigmantic-0.2.0.tar.gz.

File metadata

  • Download URL: sigmantic-0.2.0.tar.gz
  • Upload date:
  • Size: 53.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for sigmantic-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c86da7ba26b4b08a61f1e7dd57981525c98d7e7d95c4f23147da22d916e954de
MD5 90319258f58a9e937248ff37b1e2cbbc
BLAKE2b-256 f773f90c10a62a8e1f2e5661f26df77f9b0fb646edcf1ae913407d047458e213

See more details on using hashes here.

File details

Details for the file sigmantic-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sigmantic-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 47.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for sigmantic-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 559dade6fa0499652ec869f983380ed88793157d8c2518362c410bef02776f00
MD5 06ac73513be39b5d29c9a7d462205781
BLAKE2b-256 f3e79be8e3426e31ce2bd22bbd3b4e63e38d8e8edd9f688c019af22aded1c60e

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