Create a new VoloApp:
vim modules/MyApp/MyApp_app.yaml
python tools/generate_volo_app.py --config modules/MyApp/MyApp_app.yaml --output modules/MyApp/volo_main/
vim modules/MyApp/volo_main/MyApp_volo_main.vhd
uv run python scripts/build_mcc_package.py modules/MyApp
Test PulseStar: uv run python tests/run.py pulsestar_volo
VHDL-2008 development for Moku FPGA devices with AI-powered workflow
This project demonstrates a modern VHDL development approach combining:
- Serena MCP - AI agent knowledge management system
- CocotB - Python-based hardware verification
- GHDL - Open-source VHDL simulator
- Standardized architecture - Consistent module organization
MokuConfig is THE central deployment model for this project:
π models/moku/platform_config.py - Single source of truth for deployment specifications
π Works for BOTH CocotB simulation AND hardware deployment
π― Type-safe Pydantic validation prevents configuration errors
See: CLAUDE.md for quick examples, Serena memory mokuconfig_core_abstraction for complete reference
Essential files to read:
CLAUDE.md- Project overview and quick referenceAGENTS.md- Build commands and agent guidelines.cursor/rules.mdc- Points to Serena memories (source of truth)
Check Serena onboarding status:
# Use Serena MCP tool to check available memories
mcp__serena__check_onboarding_performedAvailable Serena memories (read as needed):
mokuconfig_core_abstraction.mdβ - THE core deployment model (LOAD FIRST!)project_overview.md- High-level project contextcodebase_structure.md- Directory organizationcoding_standards.md- VHDL rules and tiered systemdesign_patterns.md- Common implementation patternsghdl_patterns_and_solutions.md- Build and compilation tipscocotb_testing_guide.md- Testing framework (current standard)tech_stack.md- Tools and platform informationmokuconfig_and_benchbench_framework.md- Infrastructure modelstask_completion_checklist.md- Workflow checklist
ποΈ Moku Instrument API Library (NEW - 16 complete instrument references):
instrument_oscilloscope.md- Time-domain waveform captureinstrument_waveform_generator.md- Standard signal generationinstrument_spectrum_analyzer.md- Frequency-domain analysisinstrument_data_logger.md- Time-series recording and streaminginstrument_lock_in_amplifier.md- Phase-sensitive detectioninstrument_pid_controller.md- Closed-loop control systemsinstrument_frequency_response_analyzer.md- Bode plots and transfer functionsinstrument_logic_analyzer.md- Digital signal captureinstrument_laser_lock_box.md- PDH laser locking (dual PID)instrument_phasemeter.md- Phase and frequency measurementinstrument_digital_filter_box.md- Real-time IIR filteringinstrument_fir_filter_builder.md- Custom FIR filter designinstrument_arbitrary_waveform_generator.md- Custom waveform LUTsinstrument_time_frequency_analyzer.md- Interval timing and Allan deviationinstrument_neural_network.md- ML inference on FPGAinstrument_cloud_compile.md- Custom VHDL deployment
Each instrument memory includes:
- Python API methods with examples
- MCC routing patterns for cross-slot integration
- Multi-instrument scenarios (WaveformGen + Oscilloscope, etc.)
- VHDL CustomWrapper integration patterns
- CocotB local testing vs hardware validation workflows
Read the documentation:
CLAUDE.md- Project overview and quick startAGENTS.md- Build commands and development workflowtests/README.md- CocotB testing guide
Build and test:
# Run CocotB tests (preferred)
cd tests/
make TEST_MODULE=clk_divider_core
# Build all modules
cd modules/
make clean && make compileUnified VHDL deployment framework: Design β Test Locally β Push to Hardware β
The Moku Platform Simulator provides a seamless abstraction for deploying VHDL modules to both simulation (CocotB) and real Moku hardware. Same configuration, different backends!
First successful deployment: simple_counter module deployed to Moku:Go
Workflow validated: VHDL β CloudCompile β Synthesis β MokuBench β Real Hardware
# Same MokuConfig works for BOTH simulation and hardware!
from models.moku import MokuConfig, SlotConfig, MokuConnection, MOKU_GO_PLATFORM
config = MokuConfig(
platform=MOKU_GO_PLATFORM,
slots={
1: SlotConfig(instrument='CloudCompile', bitstream='simple_counter.tar.gz'),
2: SlotConfig(instrument='Oscilloscope')
},
routing=[MokuConnection(source='Slot1OutA', destination='Slot2InA')]
)
# SimBench: Test locally with CocotB
sim_backend = SimulationBackend(config, dut)
await sim_backend.setup()
sim_data = await sim_backend.run(duration_ms=100)
# MokuBench: Deploy to real hardware (requires BenchBench for physical setup)
hw_backend = HardwareBackend(config, bench)
await hw_backend.setup()
hw_data = await hw_backend.run(duration_ms=100)Test connection:
uv run python tests/mokubench_connection_test.py --ip 192.168.13.159Deploy simple_counter:
uv run python tests/mokubench_deployment_test.py --ip 192.168.13.159Key Features:
- β
Validated Pydantic models (
MokuConfig+BenchBench) - β CloudCompile bitstream deployment
- β Multi-instrument orchestration (Oscilloscope, WaveformGenerator, CloudCompile)
- β MCC signal routing configuration
- β Control register management (MCC_READY convention)
- β Real-time data collection from hardware
- β Physical wiring validation (prevents hardware mistakes)
Documentation:
docs/MOKUBENCH_WORKFLOW.md- Complete deployment workflow.serena/memories/mokuconfig_core_abstraction.md- Core deployment model.serena/memories/mokuconfig_and_benchbench_framework.md- Infrastructure reference
Status: Phase 1 (SimBench) β | Phase 3 (MokuBench) β
β Successfully deployed to Moku hardware!
The modules/SimpleWaveGen/ directory contains a complete reference implementation:
- Waveform generation (sine, square, triangle)
- Platform integration with Moku CustomWrapper
- Direct instantiation pattern
- CocotB tests (in development)
Download the working bitstream: static/SimpleWaveGen-001-b.tar (2.0MB)
volo_vhdl/
βββ .serena/ # Serena MCP memories (SOURCE OF TRUTH)
β βββ memories/ # Knowledge base for AI agents
βββ .cursor/ # Cursor AI configuration
β βββ rules.mdc # Points to Serena memories
βββ CLAUDE.md # Claude Code guidance
βββ AGENTS.md # Agent guidelines and build commands
βββ README.md # This file
βββ modules/ # VHDL modules (main development area)
β βββ volo_common/ # Shared utilities and packages
β βββ EMFI-Seq/ # Active module example
β βββ SimpleWaveGen/ # Reference implementation (deployed)
β βββ Makefile # Central build system
β βββ Makefile.deps # Module dependencies
β βββ Makefile.shared # Shared build rules
βββ tests/ # CocotB testing framework (PREFERRED)
β βββ Makefile # Test build system
β βββ conftest.py # Shared test utilities
β βββ test_*.py # Test modules
β βββ README.md # Testing guide
βββ static/ # Deployment artifacts (bitstreams)
βββ archive/ # Legacy documentation (for reference)
Every VHDL module follows this standardized structure:
modules/<module_name>/
βββ common/ # Shared utilities (Tier 1: strict RTL)
βββ datadef/ # Data structures, LUTs (Tier 2: relaxed)
βββ core/ # Pure algorithmic logic (Tier 1: strict RTL)
βββ top/ # Platform integration (Tier 1: strict RTL)
βββ tb/ # GHDL testbenches (DEPRECATED - use CocotB)
βββ Makefile # Module build rules
βββ README.md # Module documentation
Common (common/*.vhd):
- Configuration constants
- Platform interface packages
- Validation functions
Datadef (datadef/*.vhd):
- LUT definitions
- Complex data structures
- Records (with Verilog conversion strategy)
Core (core/*.vhd):
- Pure logic implementation
- FSMs using
std_logic_vector(no enums) - Standard control signals:
clk,reset,enable,clk_en
Top (top/*.vhd):
- Platform integration (Moku CustomWrapper)
- REQUIRED: Direct instantiation (
entity WORK.module_name) - Register mapping
Location: tests/ directory
Run tests:
cd tests/
make TEST_MODULE=clk_divider_core # Run specific module
make list-tests # List available tests
make clean # Clean artifactsExample test: tests/test_clk_divider_core.py (7 tests passing)
Reference: See tests/README.md and Serena memory cocotb_testing_guide.md
Status: Being phased out - DO NOT create new GHDL testbenches
Migration: All new tests use CocotB framework
Archive: Old GHDL patterns preserved in ghdl_patterns_and_solutions.md Serena memory
cd tests/
make TEST_MODULE=clk_divider_core # Run specific module tests
WAVES=1 make TEST_MODULE=clk_divider_core # Enable waveformscd modules/
make clean && make compile # Build all modules
make list-modules # List available modules
make compile-single-module MODULE_NAME=SimpleWaveGen# Always use VHDL-2008 standard
ghdl -a --std=08 --work=work <file.vhd> # Analyze
ghdl -e --std=08 --work=work <entity> # Elaborate
ghdl -r --std=08 --work=work <entity> # RunThe project uses Serena MCP (Model Context Protocol) for knowledge management:
Why Serena?
- Single source of truth - All knowledge in
.serena/memories/ - Agent-friendly - Structured, searchable memories
- Version controlled - Knowledge evolves with code
- Cross-session - Knowledge persists across AI agent sessions
Available memories:
mokuconfig_core_abstraction.mdβ - THE core deployment modelcoding_standards.md- VHDL rules, tiered system, portabilitydesign_patterns.md- FSMs, control signals, register interfacesghdl_patterns_and_solutions.md- Compilation, debugging, testbenchescocotb_testing_guide.md- Testing framework patternscodebase_structure.md- Directory organizationtech_stack.md- Tools, platform, dependenciesmokuconfig_and_benchbench_framework.md- Infrastructure modelsinstrument_*.md- 16 Moku instrument API references (NEW!)
How to use:
# AI agents: Use Serena MCP tools
mcp__serena__list_memories
mcp__serena__read_memory memory_file_name="coding_standards"
# Humans: Read directly
cat .serena/memories/coding_standards.mdThree-tier rule system:
Tier 1 (Strict RTL) - common/, core/, top/:
- Only
std_logic,std_logic_vector,unsigned,signed - No enumeration types (use
std_logic_vectorwith constants) - No records in port declarations
- MANDATORY: Direct instantiation in top layer
Tier 2 (Relaxed Data) - datadef/:
- Records allowed for data organization
- LUTs and complex constants
- Must document Verilog conversion strategy
Tier 3 (Full VHDL-2008) - tb/ (deprecated):
- All VHDL-2008 features allowed
- Use CocotB instead for new tests
All top-level files must use direct instantiation:
-- β
REQUIRED
U1: entity WORK.module_name
port map (
clk => clk,
rst => rst,
data_in => data_in,
data_out => data_out
);
-- β FORBIDDEN in top layer
component module_name is ... end component;
U1: module_name port map (...);ctrl_*- Control signals (enable, reset)cfg_*- Configuration parametersstat_*- Status and monitoring
modules/volo_common/:
volo_common_pkg.vhd- General utilitiesMoku_Voltage_pkg.vhd- Voltage conversion (16-bit ADC/DAC)Moku_Pct_pkg.vhd- Type-safe percentage-to-voltage conversionclk_divider_core.vhd- Clock divider with enable control
Use std_logic_vector encoding (no enums):
constant IDLE_STATE : std_logic_vector(1 downto 0) := "00";
constant ACTIVE_STATE : std_logic_vector(1 downto 0) := "01";
constant DONE_STATE : std_logic_vector(1 downto 0) := "10";
signal current_state : std_logic_vector(1 downto 0);- Reset (
resetorn_reset) - Forces safe state - Clock Enable (
clk_en) - Freezes sequential logic - Functional Enable (
enable) - Gates functional work
.cursor/rules.mdc- Points to Serena memoriesCLAUDE.md- Claude Code quick referenceAGENTS.md- Build commands and guidelines- Serena memories - Complete knowledge base
README.md- This file (project overview)CLAUDE.md- Quick start and key patternstests/README.md- CocotB testing guidemodules/README.md- Module system documentation
archive/ai-workflow-legacy-2025-10-22/- Legacy AI workflowarchive/ghdl_testbench_docs_*/- Old GHDL testbench patterns
Current modules:
- β
modules/volo_common/- Shared utilities (stable) - β
modules/SimpleWaveGen/- Reference implementation (deployed) - π§
modules/EMFI-Seq/- EMFI sequencer (in development)
Testing migration:
- β
CocotB framework established (
tests/) - β
Example tests passing (
test_clk_divider_core.py) - π§ Migrating remaining GHDL testbenches to CocotB
- Renamed:
MokuPlatformConfigβMokuConfig(THE core abstraction) - Documentation: Featured prominently in CLAUDE.md, AGENTS.md, README.md
- Serena memories: New
mokuconfig_core_abstraction.md(CRITICAL priority) - Serena memories: Renamed
bench_config_frameworkβmokuconfig_and_benchbench_framework - Priority loading: Load
mokuconfig_core_abstractionfirst in every context window - Backward compatibility: Alias maintains old imports during transition
- Architecture refactor: Split monolithic
BenchConfiginto validated Pydantic models - New models:
BenchBench(physical bench) +MokuConfig(deployment config) - Directory rename:
tests/bench_framework/βtests/moku_platform_simulator/ - Physical wiring validation: Device catalog prevents hardware mistakes (direction checking)
- Type safety: Full Pydantic validation with clear error messages
- Documentation update: All memories, READMEs, and guides synced to new architecture
- Helper scripts: Verification and bulk update tools for future migrations
- Phase 3 complete: Unified Moku Platform Simulator deployed to real hardware
- First successful deployment:
simple_countermodule deployed to Moku:Go via CloudCompile - Complete workflow validated: VHDL β CloudCompile β Synthesis β MokuBench β Real Hardware
- Implemented
HardwareBackendwith full Moku API integration (MultiInstrument, CloudCompile, Oscilloscope) - Created
SimulationBackendwith CocotB integration (6 tests passing) - Unified configuration abstraction works seamlessly for both simulation and hardware
- Added initial Pydantic data models for type-safe configuration validation
- CloudCompile package builder with local GHDL verification
- MCC_READY convention for safe bitstream loading
- Connection test and deployment test scripts
- Comprehensive documentation in
.serena/memories/bench_config_framework.md - Tagged as
mokubench-phase3
- Added 16 complete Moku instrument API reference memories (
.serena/memories/instrument_*.md) - Comprehensive Python API documentation for all built-in Moku instruments
- MCC routing patterns and cross-slot integration examples
- VHDL CustomWrapper integration patterns for each instrument
- Multi-instrument scenario examples (WaveformGen + Oscilloscope, etc.)
- CocotB testing vs hardware validation workflows
- Instruments: Oscilloscope, Waveform Generator, Spectrum Analyzer, Data Logger, Lock-In Amplifier, PID Controller, Frequency Response Analyzer, Logic Analyzer, Laser Lock Box, Phasemeter, Digital Filter Box, FIR Filter Builder, Arbitrary Waveform Generator, Time & Frequency Analyzer, Neural Network, Cloud Compile
- Migrated all knowledge to Serena MCP memories
- Archived legacy
ai-workflow/directory - Removed obsolete modules and documentation
- Added
Moku_Pct_pkg.vhdwith CocotB tests - Standardized on CocotB testing framework
- Successfully deployed SimpleWaveGen to Moku hardware
- Platform interface package pattern established
- Direct instantiation pattern enforced
- GHDL testbench patterns documented
- Initial VHDL-2008 project structure
- Tiered rule system for Verilog portability
- Standardized module architecture
- Moku voltage conversion utilities
Before starting work:
- Check Serena memories for existing patterns
- Read
CLAUDE.mdandAGENTS.md - Follow standardized module structure
- Use CocotB for all new tests
- Use direct instantiation in top layer
- Update Serena memories with new learnings
This project is part of Johnny's evolving VHDL development workflow for Moku FPGA devices.
Key Principle: All valuable knowledge lives in Serena memories (.serena/memories/). When in doubt, check there first!