# divanshu-walia/c_rtl_coverage architecture

> Architecture diagram of the GitHub repository divanshu-walia/c_rtl_coverage, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/divanshu-walia/c_rtl_coverage
- Repository: https://github.com/divanshu-walia/c_rtl_coverage

## Overview

This is an HLS testbench-generation and coverage-evaluation project. Users select benchmarks and strategies; the pipeline generates or reuses C testbenches, synthesizes the benchmark with Bambu, measures C coverage, replays captured calls in Verilator, and records coverage results for plotting. Separate workflows refine LLM testbenches iteratively and run/analyze independent trials, including reachability-ceiling and remeasurement utilities. The graph reflects documented workflows and visible module references; several implementation details and benchmark sources are not present in the supplied tree or excerpts.

Main entry points: [`pipeline/run_pipeline.py`](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_pipeline.py) (Coverage pipeline), [`pipeline/agentic_loop.py`](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/agentic_loop.py) (Agentic refinement), [`pipeline/generate_tb.py`](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/generate_tb.py) (Generation CLI), [`pipeline/run_replicates.py`](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_replicates.py) (Repeated trials)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Testbench generation"]
  node_generation_entry["Generation CLI<br/>[generate_tb.py]"]
  node_strategy_templates["Manual and random<br/>[generate_tb.py]"]
  node_llm_generation["LLM generation<br/>[generate_tb.py]"]
  node_llm_client["Claude client<br/>[llm_client.py]"]
  node_testbenches["Generated testbenches"]
end

subgraph group_measurement["Coverage measurement"]
  node_pipeline["Coverage pipeline<br/>[run_pipeline.py]"]
  node_c_measure["C coverage run<br/>[run_pipeline.py]"]
  node_call_capture["Call capture<br/>[call_capture.py]"]
  node_rtl_replay["RTL replay<br/>[run_pipeline.py]"]
  node_coverage_parser["Coverage parser"]
end

subgraph group_experiments["Experiment workflows"]
  node_agentic_loop["Agentic refinement<br/>[agentic_loop.py]"]
  node_replicates["Repeated trials<br/>[run_replicates.py]"]
  node_ceiling["Reachability ceiling<br/>[run_ceiling.py]"]
  node_remeasure["Trial remeasurement"]
end

subgraph group_results["Results and analysis"]
  node_results_csv[("Coverage results<br/>[run_pipeline.py]")]
  node_plot_results["Coverage plots<br/>[plot_results.py]"]
  node_replicate_analysis["Replicate analysis"]
  node_model_comparison["Model comparison<br/>[compare_models.py]"]
end

node_user(("Engineer"))
node_anthropic{{"Anthropic API"}}
node_bambu{{"Bambu HLS"}}
node_verilator{{"Verilator"}}

node_user -->|"selects strategy"| node_generation_entry
node_generation_entry -->|"builds manual/random"| node_strategy_templates
node_generation_entry -->|"requests LLM"| node_llm_generation
node_llm_generation -->|"calls"| node_llm_client
node_llm_client -->|"requests completion"| node_anthropic
node_strategy_templates -->|"writes"| node_testbenches
node_llm_generation -->|"writes"| node_testbenches
node_user -->|"runs benchmarks"| node_pipeline
node_pipeline -->|"uses"| node_testbenches
node_pipeline -->|"synthesizes with"| node_bambu
node_pipeline -->|"runs C coverage"| node_c_measure
node_pipeline -->|"captures calls"| node_call_capture
node_pipeline -->|"replays stimulus"| node_rtl_replay
node_rtl_replay -->|"simulates RTL"| node_verilator
node_pipeline -->|"parses reports"| node_coverage_parser
node_coverage_parser -->|"provides metrics"| node_results_csv
node_pipeline -->|"records results"| node_results_csv
node_user -->|"requests plots"| node_plot_results
node_plot_results -->|"reads"| node_results_csv
node_user -->|"starts refinement"| node_agentic_loop
node_agentic_loop -->|"requests refinements"| node_llm_client
node_agentic_loop -->|"measures iterations"| node_pipeline
node_user -->|"starts trials"| node_replicates
node_replicates -->|"runs measurements"| node_pipeline
node_replicates -->|"can seed refinement"| node_agentic_loop
node_user -->|"requests stress test"| node_ceiling
node_user -->|"requests remeasurement"| node_remeasure
node_user -->|"analyzes trials"| node_replicate_analysis
node_replicate_analysis -->|"uses coverage helpers"| node_coverage_parser
node_user -.->|"compares models"| node_model_comparison

click node_generation_entry "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/generate_tb.py"
click node_strategy_templates "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/generate_tb.py"
click node_llm_generation "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/generate_tb.py"
click node_llm_client "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/llm_client.py"
click node_testbenches "https://github.com/divanshu-walia/c_rtl_coverage/tree/main/testbenches"
click node_pipeline "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_pipeline.py"
click node_c_measure "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_pipeline.py"
click node_call_capture "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/call_capture.py"
click node_rtl_replay "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_pipeline.py"
click node_coverage_parser "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/extract_coverage.py"
click node_results_csv "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_pipeline.py"
click node_plot_results "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/plot_results.py"
click node_agentic_loop "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/agentic_loop.py"
click node_replicates "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_replicates.py"
click node_ceiling "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_ceiling.py"
click node_remeasure "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/remeasure_experiment.py"
click node_replicate_analysis "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/analyze_replicates.py"
click node_model_comparison "https://github.com/divanshu-walia/c_rtl_coverage/blob/main/model_comparison/compare_models.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_generation_entry,node_strategy_templates,node_llm_generation,node_llm_client,node_testbenches toneBlue
class node_pipeline,node_c_measure,node_call_capture,node_rtl_replay,node_coverage_parser toneAmber
class node_agentic_loop,node_replicates,node_ceiling,node_remeasure,node_anthropic toneMint
class node_results_csv,node_plot_results,node_replicate_analysis,node_model_comparison toneRose
class node_user,node_bambu,node_verilator toneIndigo
```

## Components

### Testbench generation

- [Generation CLI](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/generate_tb.py): `pipeline/generate_tb.py`
- [Manual and random](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/generate_tb.py): `pipeline/generate_tb.py`
- [LLM generation](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/generate_tb.py): `pipeline/generate_tb.py`
- [Claude client](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/llm_client.py): `pipeline/llm_client.py`
- [Generated testbenches](https://github.com/divanshu-walia/c_rtl_coverage/tree/main/testbenches): `testbenches`

### Coverage measurement

- [Coverage pipeline](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_pipeline.py): `pipeline/run_pipeline.py`
- [C coverage run](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_pipeline.py): `pipeline/run_pipeline.py`
- [Call capture](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/call_capture.py): `pipeline/call_capture.py`
- [RTL replay](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_pipeline.py): `pipeline/run_pipeline.py`
- [Coverage parser](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/extract_coverage.py): `pipeline/extract_coverage.py`

### Experiment workflows

- [Agentic refinement](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/agentic_loop.py): `pipeline/agentic_loop.py`
- [Repeated trials](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_replicates.py): `pipeline/run_replicates.py`
- [Reachability ceiling](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_ceiling.py): `pipeline/run_ceiling.py`
- [Trial remeasurement](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/remeasure_experiment.py): `pipeline/remeasure_experiment.py`

### Results and analysis

- [Coverage results](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/run_pipeline.py): `pipeline/run_pipeline.py`
- [Coverage plots](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/plot_results.py): `pipeline/plot_results.py`
- [Replicate analysis](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/pipeline/analyze_replicates.py): `pipeline/analyze_replicates.py`
- [Model comparison](https://github.com/divanshu-walia/c_rtl_coverage/blob/main/model_comparison/compare_models.py): `model_comparison/compare_models.py`

### Other components

- **Engineer**
- **Anthropic API**
- **Bambu HLS**
- **Verilator**

## Connections

- Engineer → Generation CLI: selects strategy (evidence: `README.md`)
- Generation CLI → Manual and random: builds manual/random (evidence: `pipeline/generate_tb.py`)
- Generation CLI → LLM generation: requests LLM (evidence: `pipeline/generate_tb.py`)
- LLM generation → Claude client: calls (evidence: `pipeline/generate_tb.py`)
- Claude client → Anthropic API: requests completion (evidence: `pipeline/llm_client.py`)
- Manual and random → Generated testbenches: writes (evidence: `README.md`)
- LLM generation → Generated testbenches: writes (evidence: `README.md`)
- Engineer → Coverage pipeline: runs benchmarks (evidence: `README.md`)
- Coverage pipeline → Generated testbenches: uses (evidence: `pipeline/run_pipeline.py`)
- Coverage pipeline → Bambu HLS: synthesizes with (evidence: `pipeline/run_pipeline.py`)
- Coverage pipeline → C coverage run: runs C coverage (evidence: `README.md`)
- Coverage pipeline → Call capture: captures calls (evidence: `README.md`)
- Coverage pipeline → RTL replay: replays stimulus (evidence: `README.md`)
- RTL replay → Verilator: simulates RTL (evidence: `README.md`)
- Coverage pipeline → Coverage parser: parses reports (evidence: `pipeline/run_pipeline.py`)
- Coverage parser → Coverage results: provides metrics (evidence: `README.md`)
- Coverage pipeline → Coverage results: records results (evidence: `README.md`)
- Engineer → Coverage plots: requests plots (evidence: `README.md`)
- Coverage plots → Coverage results: reads (evidence: `README.md`)
- Engineer → Agentic refinement: starts refinement (evidence: `README.md`)
- Agentic refinement → Claude client: requests refinements (evidence: `pipeline/agentic_loop.py`)
- Agentic refinement → Coverage pipeline: measures iterations (evidence: `pipeline/agentic_loop.py`)
- Engineer → Repeated trials: starts trials (evidence: `README.md`)
- Repeated trials → Coverage pipeline: runs measurements (evidence: `pipeline/run_replicates.py`)
- Repeated trials → Agentic refinement: can seed refinement (evidence: `README.md`)
- Engineer → Reachability ceiling: requests stress test (evidence: `README.md`)
- Engineer → Trial remeasurement: requests remeasurement (evidence: `README.md`)
- Engineer → Replicate analysis: analyzes trials (evidence: `README.md`)
- Replicate analysis → Coverage parser: uses coverage helpers (evidence: `pipeline/analyze_replicates.py`)
- Engineer → Model comparison: compares models
