| name | pyucis |
| description | Python API and tools for working with UCIS (Unified Coverage Interoperability Standard) coverage databases. Use when working with hardware verification coverage data, converting coverage formats, merging coverage databases, generating coverage reports, or analyzing functional and code coverage metrics. |
| license | Apache-2.0 |
| metadata | {"author":"fvutils","version":"1.0","repository":"https://github.com/fvutils/pyucis"} |
| compatibility | Requires Python 3.x. Network access optional for remote database operations. |
PyUCIS - Coverage Database Manipulation
PyUCIS provides a comprehensive Python API and command-line tools for working with UCIS (Unified Coverage Interoperability Standard) coverage databases. This skill enables agents to effectively manage, analyze, and report on hardware verification coverage data.
When to Use This Skill
Use PyUCIS when you need to:
- Convert coverage databases between formats (XML, YAML, UCIS binary)
- Merge multiple coverage databases from different test runs
- Generate coverage reports in various formats (text, JSON, LCOV, Cobertura, JaCoCo, Clover)
- Analyze functional coverage (covergroups, coverpoints, bins)
- Query code coverage metrics (line, branch, toggle, assertion)
- Compare coverage between test runs
- Identify coverage gaps and hotspots
- Export coverage data for CI/CD pipelines
Installation
pip install pyucis
pip install pyucis[dev]
Command Line Usage
Database Conversion
Convert coverage data between different formats:
pyucis convert --input-format xml --output-format yaml coverage.xml -o coverage.yaml
pyucis convert --input-format yaml --output-format xml coverage.yaml -o coverage.xml
pyucis convert coverage.xml -o coverage.yaml
Database Merging
Merge multiple coverage databases:
pyucis merge test1.xml test2.xml test3.xml -o merged.xml
pyucis merge --input-format xml --output-format yaml test*.xml -o merged.yaml
pyucis merge -l libucis.so db1.xml db2.xml -o merged.xml
Coverage Reporting
Generate various types of reports:
pyucis report coverage.xml -o report.txt
pyucis report --output-format txt coverage.xml -o report.txt
Coverage Queries
Query specific coverage information:
pyucis show summary coverage.xml
pyucis show gaps coverage.xml --threshold 80
pyucis show covergroups coverage.xml --include-bins
pyucis show bins coverage.xml --covergroup my_cg --min-hits 0
pyucis show tests coverage.xml
pyucis show hierarchy coverage.xml --max-depth 3
pyucis show metrics coverage.xml
pyucis show compare baseline.xml current.xml
pyucis show hotspots coverage.xml --threshold 80 --limit 10
pyucis show code-coverage coverage.xml --output-format lcov -o coverage.info
pyucis show code-coverage coverage.xml --output-format cobertura -o coverage.xml
pyucis show code-coverage coverage.xml --output-format jacoco
pyucis show assertions coverage.xml
pyucis show toggle coverage.xml
Python API
Basic Database Operations
from ucis import UCIS
db = UCIS("coverage.xml")
for scope in db.scopes():
print(f"Scope: {scope.name}, Type: {scope.type}")
for item in scope.coveritems():
print(f" Item: {item.name}, Hits: {item.count}")
new_db = UCIS()
new_db.create_scope("top", scope_type=UCIS.SCOPE_INSTANCE)
new_db.write("output.xml", format="xml")
Working with Covergroups
from ucis import UCIS
db = UCIS("coverage.xml")
for scope in db.scopes():
if scope.type == UCIS.SCOPE_COVERGROUP:
print(f"Covergroup: {scope.name}")
for cp_scope in scope.scopes():
if cp_scope.type == UCIS.SCOPE_COVERPOINT:
print(f" Coverpoint: {cp_scope.name}")
for bin_item in cp_scope.coveritems():
print(f" Bin: {bin_item.name}, Count: {bin_item.count}")
Coverage Metrics
from ucis import UCIS
db = UCIS("coverage.xml")
total_bins = 0
covered_bins = 0
for scope in db.scopes():
for item in scope.coveritems():
total_bins += 1
if item.count > 0:
covered_bins += 1
coverage_pct = (covered_bins / total_bins * 100) if total_bins > 0 else 0
print(f"Overall Coverage: {coverage_pct:.2f}%")
MCP Server Integration
PyUCIS includes a Model Context Protocol (MCP) server that enables AI agents to interact with coverage databases:
pyucis-mcp-server
pyucis-mcp-server --port 8080
The MCP server provides 17+ specialized tools for coverage analysis. See MCP_SERVER.md for detailed documentation.
Coverage Data Model
Scope Types
- INSTANCE: Design instance in hierarchy
- COVERGROUP: Functional coverage group
- COVERPOINT: Individual coverage point
- CROSS: Cross coverage between coverpoints
- FUNCTION: Function coverage
- BLOCK: Code block coverage
- BRANCH: Branch coverage
- TOGGLE: Signal toggle coverage
- FSM: FSM state/transition coverage
Coverage Item Types
- BIN: Coverpoint bin with hit count
- LINE: Source line coverage
- BRANCH: Branch coverage point
- TOGGLE: Signal toggle (0->1, 1->0)
- ASSERTION: Assertion coverage
- STATEMENT: Statement coverage
Supported File Formats
Input Formats
- XML: UCIS XML format (default)
- YAML: UCIS YAML format
- UCDB: Binary UCIS database (requires libucis)
Export Formats
- XML: Standard UCIS XML
- YAML: UCIS YAML
- JSON: Structured JSON output
- LCOV: LCOV format for code coverage
- Cobertura: Cobertura XML format
- JaCoCo: JaCoCo XML format
- Clover: Clover XML format
Common Workflows
CI/CD Integration
pyucis merge test_run_*.xml -o merged_coverage.xml
pyucis show code-coverage merged_coverage.xml --output-format lcov -o coverage.info
pyucis show metrics merged_coverage.xml --output-format json | jq '.coverage_percent'
Coverage Analysis
pyucis show gaps coverage.xml --threshold 0
pyucis show hotspots coverage.xml --threshold 90 --limit 20
pyucis show compare yesterday.xml today.xml
Format Conversion
pyucis convert legacy.xml -o modern.yaml
pyucis show code-coverage coverage.xml --output-format cobertura -o cobertura.xml
Error Handling
Common errors and solutions:
- File not found: Ensure the coverage database path is correct
- Format errors: Specify
--input-format explicitly if auto-detection fails
- Merge conflicts: Use
--libucis option if merging complex databases
- Memory issues: Process large databases in chunks or use YAML format
Advanced Features
Custom Filtering
Use plusargs to pass tool-specific options:
pyucis report coverage.xml +filter=uncovered +detail=high
Programmatic Database Creation
from ucis import UCIS, CoverGroup, CoverPoint, Bin
db = UCIS()
top = db.create_scope("top", UCIS.SCOPE_INSTANCE)
cg = CoverGroup("my_covergroup")
top.add_child(cg)
cp = CoverPoint("my_coverpoint")
cg.add_child(cp)
cp.add_bin("low", 100)
cp.add_bin("mid", 50)
cp.add_bin("high", 0)
db.write("new_coverage.xml")
Best Practices
- Use YAML for readability: YAML format is easier to inspect and version control
- Merge regularly: Combine coverage from parallel runs to get complete picture
- Set coverage goals: Use
--threshold options to enforce coverage requirements
- Export for tools: Convert to LCOV/Cobertura for integration with CI/CD dashboards
- Track trends: Use
show compare to monitor coverage progress over time
Resources
Getting Help
To see available command options:
pyucis --help
pyucis convert --help
pyucis merge --help
pyucis report --help
pyucis show --help
pyucis show summary --help
For listing supported formats:
pyucis list-db-formats
pyucis list-rpt-formats