Tools & Adapters API Reference ⚙️¶
This section documents the foundational execution tools, LLM clients, and HDL simulator adapters in dv-agentic-system.
Tool Interface & Models¶
The base interfaces and validation schemas for tools and system data types.
interface
¶
Abstract base classes defining the simulator and coverage tool contracts.
CoverageTool
¶
Bases: ABC
Interface for coverage analysis tools.
Source code in src/dv_agentic/tools/interface.py
get_coverage(job_id)
abstractmethod
¶
Retrieve coverage results for a specific job.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The ID of the simulation job. |
required |
SimulatorTool
¶
Bases: ABC
Interface for simulation tools (VCS, Questa, cocotb, etc.).
Source code in src/dv_agentic/tools/interface.py
compile(file_list, top)
abstractmethod
¶
Compile the source files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_list
|
list[str]
|
List of source file paths. |
required |
top
|
str
|
Name of the top-level module. |
required |
run(test, seed, debug)
abstractmethod
¶
Run a specific test.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test
|
str
|
Name of the test to run. |
required |
seed
|
int
|
Random seed for simulation. |
required |
debug
|
bool
|
Whether to enable debug mode (e.g., waveform dumping). |
required |
Source code in src/dv_agentic/tools/interface.py
models
¶
Data models for simulation results and coverage tracking.
CompileResult
dataclass
¶
CoverageDB
dataclass
¶
SimResult
dataclass
¶
Result of a simulation run.
Source code in src/dv_agentic/tools/models.py
SimTask
dataclass
¶
Input specification for a single SimControllerAgent run.
Attributes:
| Name | Type | Description |
|---|---|---|
task_id |
str
|
Unique identifier for this task (used for branch naming and commit messages). |
test |
str
|
UVM test name or cocotb test module to run. |
seed |
int
|
Random seed for the simulation. |
file_list |
list[str]
|
Source files to compile. May be empty if the project already has a compiled snapshot. |
top |
str
|
Top-level module name passed to the simulator. |
debug |
bool
|
Whether to enable debug mode (waveform dumping, full verbosity). |
Source code in src/dv_agentic/tools/models.py
LLM Clients¶
These clients interact with LLM backends (either via cloud APIs or local model pipelines) to complete system agent queries.
Base LLM Client Interface¶
interface
¶
BaseLLMClient
¶
Bases: ABC
Abstract base class for LLM clients.
Source code in src/dv_agentic/tools/llm/interface.py
complete(system, messages, max_tokens=1000)
abstractmethod
async
¶
Complete the given conversation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
str
|
The system prompt. |
required |
messages
|
list[dict[str, str]]
|
A list of message dictionaries (e.g., {"role": "user", "content": "..."}). |
required |
max_tokens
|
int
|
The maximum number of tokens to generate. |
1000
|
Returns:
| Type | Description |
|---|---|
str
|
The generated response string. |
Source code in src/dv_agentic/tools/llm/interface.py
Web API LLM Client¶
api
¶
External LLM client for the LLM Messages API.
Uses only Python stdlib (urllib) — no third-party SDK required. Set LLM_API_KEY in the environment or pass it explicitly.
LLMAPIClient
¶
Bases: BaseLLMClient
Calls the LLM /v1/messages endpoint over raw HTTP.
All network I/O runs in a thread-pool executor so the async caller is never blocked.
Source code in src/dv_agentic/tools/llm/api.py
__init__(api_key=None, model='claude-3-5-sonnet-latest', api_url=DEFAULT_URL, timeout=120)
¶
Initialise the client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
LLM API key. Falls back to |
None
|
model
|
str
|
Model identifier to send in every request. |
'claude-3-5-sonnet-latest'
|
api_url
|
str
|
Full URL of the messages endpoint (override for testing). |
DEFAULT_URL
|
timeout
|
int
|
Socket timeout in seconds for each HTTP call. |
120
|
Source code in src/dv_agentic/tools/llm/api.py
complete(system, messages, max_tokens=1000)
async
¶
Send a request to the LLM API and return the assistant reply.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
str
|
System prompt string. |
required |
messages
|
list[dict[str, str]]
|
Conversation turns in |
required |
max_tokens
|
int
|
Maximum tokens to generate. |
1000
|
Returns:
| Type | Description |
|---|---|
str
|
The text content of the first content block in the response. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
On non-2xx HTTP response. |
Source code in src/dv_agentic/tools/llm/api.py
Local LLM Client¶
local
¶
Internal LLM client for the local/internal endpoint (OpenAI-compatible).
Reads LOCAL_LLM_BASE_URL and LOCAL_LLM_API_KEY from the environment,
or accept them explicitly. The endpoint is assumed to follow the
OpenAI Chat Completions API shape (POST /v1/chat/completions).
LocalLLMClient
¶
Bases: BaseLLMClient
Calls an internal LLM endpoint that speaks OpenAI Chat Completions.
All network I/O runs in a thread-pool executor so the async caller is never blocked.
Source code in src/dv_agentic/tools/llm/local.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
__init__(base_url=None, api_key=None, model='default', timeout=120)
¶
Initialise the client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str | None
|
Base URL of the local LLM service, e.g.
|
None
|
api_key
|
str | None
|
Bearer token for the internal service.
Falls back to |
None
|
model
|
str
|
Model name to send in the request body. |
'default'
|
timeout
|
int
|
Socket timeout in seconds. |
120
|
Source code in src/dv_agentic/tools/llm/local.py
complete(system, messages, max_tokens=1000)
async
¶
Send a chat-completion request to the local LLM endpoint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
str
|
System prompt string (prepended as a |
required |
messages
|
list[dict[str, str]]
|
Conversation turns in |
required |
max_tokens
|
int
|
Maximum tokens to generate. |
1000
|
Returns:
| Type | Description |
|---|---|
str
|
The assistant's reply text. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
On non-2xx HTTP response or connection failure. |
Source code in src/dv_agentic/tools/llm/local.py
Simulator Adapters¶
These classes adapt Cocotb, pyuvm, and various logic simulators (like GHDL, Icarus, Verilator, Xcelium, and IMC) to be controlled programmatically by our agents.
Cocotb Base Adapter¶
cocotb_base
¶
Base class for cocotb.runner based simulator adapters.
CocotbBaseAdapter
¶
Bases: SimulatorTool
Base class for simulators using cocotb.runner infrastructure.
Source code in src/dv_agentic/tools/adapters/cocotb_base.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
__init__(simulator, hdl_toplevel='top', hdl_toplevel_lang=None)
¶
Initialize the cocotb base adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
simulator
|
str
|
Name of the simulator (e.g., "icarus", "verilator", "ghdl"). |
required |
hdl_toplevel
|
str
|
Name of the HDL top-level module. |
'top'
|
hdl_toplevel_lang
|
str | None
|
Language of the top-level module ("verilog" or "vhdl"). |
None
|
Source code in src/dv_agentic/tools/adapters/cocotb_base.py
compile(file_list, top)
¶
Compile HDL source files using the cocotb runner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_list
|
list[str]
|
List of paths to Verilog/SystemVerilog or VHDL source files. |
required |
top
|
str
|
Name of the HDL top-level module to build. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
CompileResult
|
class: |
Source code in src/dv_agentic/tools/adapters/cocotb_base.py
run(test, seed, debug)
¶
Run a cocotb simulation test case.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test
|
str
|
Test case identifier, either "module" or "module.testcase". |
required |
seed
|
int
|
Random seed for the simulation. |
required |
debug
|
bool
|
If True, enable waveform dumping (if supported by the simulator). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
SimResult
|
class: |
Source code in src/dv_agentic/tools/adapters/cocotb_base.py
pyuvm Adapter¶
pyuvm
¶
Adapter for pyuvm functional coverage (External/Open-source environment).
PyuvmCoverageAdapter
¶
Bases: CoverageTool
Coverage adapter for pyuvm (External environment).
Parses text-based coverage reports or logs generated by pyuvm testbenches using tools like cocotb-coverage or custom UVMCoverage subscribers.
Source code in src/dv_agentic/tools/adapters/pyuvm.py
__init__(default_report_path='coverage.txt')
¶
Initialize the pyuvm coverage adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
default_report_path
|
str
|
Default file to parse if no job-specific report is found. |
'coverage.txt'
|
Source code in src/dv_agentic/tools/adapters/pyuvm.py
get_coverage(job_id)
¶
Retrieve coverage results for a specific pyuvm job.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The ID of the simulation job. Looks for a log or report
file named |
required |
Source code in src/dv_agentic/tools/adapters/pyuvm.py
Simulator Specifics¶
ghdl_cocotb
¶
Adapter for GHDL + cocotb + pyuvm (External/Open-source environment).
GHDLCocotbAdapter
¶
Bases: CocotbBaseAdapter
Adapter for GHDL + cocotb + pyuvm (External Environment).
Source code in src/dv_agentic/tools/adapters/ghdl_cocotb.py
__init__(hdl_toplevel='top', hdl_toplevel_lang='vhdl')
¶Initialize GHDL cocotb adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hdl_toplevel
|
str
|
Name of the HDL top-level module. |
'top'
|
hdl_toplevel_lang
|
str
|
Language of the top-level module (usually |
'vhdl'
|
Source code in src/dv_agentic/tools/adapters/ghdl_cocotb.py
icarus
¶
Adapter for Icarus Verilog simulator (External/Open-source environment).
IcarusAdapter
¶
Bases: CocotbBaseAdapter
Adapter for Icarus Verilog simulator (External Environment).
Source code in src/dv_agentic/tools/adapters/icarus.py
__init__(hdl_toplevel='top')
¶Initialize Icarus adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hdl_toplevel
|
str
|
Name of the HDL top-level module. |
'top'
|
verilator
¶
Adapter for Verilator simulator (External/Open-source environment).
VerilatorAdapter
¶
Bases: CocotbBaseAdapter
Adapter for Verilator simulator (External Environment).
Source code in src/dv_agentic/tools/adapters/verilator.py
__init__(hdl_toplevel='top')
¶Initialize Verilator adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hdl_toplevel
|
str
|
Name of the HDL top-level module. |
'top'
|
Source code in src/dv_agentic/tools/adapters/verilator.py
xcelium
¶
Adapter for Cadence Xcelium simulator (Internal environment).
XceliumAdapter
¶
Bases: SimulatorTool
Adapter for Cadence Xcelium simulator (Internal Environment).
Source code in src/dv_agentic/tools/adapters/xcelium.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
__init__(xrun_path='xrun', collect_coverage=True, cov_work_dir='cov_work')
¶Initialize Xcelium adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xrun_path
|
str
|
Path to the xrun binary. |
'xrun'
|
collect_coverage
|
bool
|
Whether to instrument the simulation for coverage.
Set to |
True
|
cov_work_dir
|
str
|
Root directory for per-job coverage DBs.
Each run writes to |
'cov_work'
|
Source code in src/dv_agentic/tools/adapters/xcelium.py
compile(file_list, top)
¶Compile the source files using xrun -compile.
Source code in src/dv_agentic/tools/adapters/xcelium.py
run(test, seed, debug)
¶Run a simulation using xrun -run.
Source code in src/dv_agentic/tools/adapters/xcelium.py
imc
¶
Adapter for Cadence IMC 24.06 + Verisium 25.12 coverage tools (Internal environment).
Workflow¶
XceliumAdapter.run()writes a per-job coverage DB to{cov_work_dir}/{job_id}/(one directory per simulation run).IMCAdapter.get_coverage(job_id)loads that directory and returns aCoverageDBsummary.IMCAdapter.merge(job_ids)merges multiple runs into a single aggregated DB, then optionally invokes Verisiumvsiffor enterprise-level aggregation reports.
Assumed tool versions¶
- IMC : 24.06.a001
- Verisium : 25.12.081
- OS : RHEL 8.4
IMCAdapter
¶
Bases: CoverageTool
Coverage adapter for IMC 24.06 + Verisium 25.12 (Internal environment).
Paired with XceliumAdapter — both must share the same cov_work_dir
so that job IDs resolve to the same filesystem paths.
Source code in src/dv_agentic/tools/adapters/imc.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
__init__(imc_path='imc', vsif_path='vsif', cov_work_dir='cov_work')
¶Initialize the IMC coverage adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
imc_path
|
str
|
Path to the |
'imc'
|
vsif_path
|
str
|
Path to the |
'vsif'
|
cov_work_dir
|
str
|
Root directory where |
'cov_work'
|
Source code in src/dv_agentic/tools/adapters/imc.py
get_coverage(job_id)
¶Load a single run's coverage DB and return a summary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
Simulation job identifier produced by |
required |
Source code in src/dv_agentic/tools/adapters/imc.py
merge(job_ids, merged_dir='cov_merged', use_verisium=False)
¶Merge coverage from multiple simulation runs into one aggregated DB.
Runs imc -load <dir1> <dir2> ... -merge <merged_dir> -exit to
aggregate per-job coverage DBs, then optionally invokes Verisium
vsif for cross-session enterprise-level reporting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_ids
|
list[str]
|
Job IDs whose coverage DBs will be merged. |
required |
merged_dir
|
str
|
Destination directory for the aggregated DB. |
'cov_merged'
|
use_verisium
|
bool
|
If |
False
|