How themperek/cocotb-vivado works
cocotb-vivado lets engineers run Python/cocotb testbenches against Vivado XSim designs. The main workflow is to pass plain HDL and optional Vivado-managed sources to the runner, prepare and parse Vivado simulation inputs, build or reuse an XSim snapshot, then run tests through the XSI-backed cocotb interface. Separate branches cover Vivado source formats and the simulator compatibility layer. Some internal calls are omitted where excerpts show imports but not dispatch details.
Main entry points: sources.py Vivado source types · runner.py Build and test runner · simulator.py Simulator API shim · manager.py Simulation manager
Components 15
Build and Vivado inputs
- Build and test runner
src/cocotb_vivado/runner.py - Vivado source types
src/cocotb_vivado/vivado/sources.py - Simulation directory parser
src/cocotb_vivado/vivado/sim_dir.py - XSim snapshot
Cocotb compatibility
- Simulator API shim
src/cocotb_vivado/stub/simulator.py - Simulation manager
src/cocotb_vivado/stub/manager.py - Port and callback handles
src/cocotb_vivado/stub/handles.py - GPI constants
src/cocotb_vivado/_gpi_enums.py - XSI interface
src/cocotb_vivado/xsi.py
Vivado support
- Vivado command helpers
src/cocotb_vivado/vivado/_tcl.py - Part discovery
src/cocotb_vivado/vivado/part.py - Vivado source API
src/cocotb_vivado/vivado/__init__.py
Other components
- Test author
- Vivado XSim tools
- cocotb runtime
Connections 20
- Test author → Build and test runner: builds and tests
README.md - Build and test runner → Vivado source types: prepares sources
README.md - Vivado source types → Vivado XSim tools: runs Vivado
README.md - Vivado source types → Simulation directory parser: parses generated files
README.md - Build and test runner → XSim snapshot: builds or reuses
README.md - Vivado XSim tools → XSim snapshot: produces
README.md - Build and test runner → Vivado XSim tools: compiles and elaborates
README.md - Build and test runner → cocotb runtime: runs tests with
README.md - cocotb runtime → Simulator API shim: uses simulator API
- Simulator API shim → Simulation manager: dispatches callbacks
src/cocotb_vivado/stub/simulator.py - Simulator API shim → Port and callback handles: exposes handle types
src/cocotb_vivado/stub/simulator.py - Simulator API shim → GPI constants: uses constants
src/cocotb_vivado/stub/simulator.py - Simulation manager → XSI interface: drives simulation
src/cocotb_vivado/stub/manager.py - Simulation manager → Port and callback handles: uses callbacks and ports
src/cocotb_vivado/stub/manager.py - Port and callback handles → GPI constants: uses type constants
src/cocotb_vivado/stub/handles.py - XSI interface → Vivado XSim tools: loads XSI library
src/cocotb_vivado/xsi.py - Vivado source API → Vivado source types: exports source classes
src/cocotb_vivado/vivado/__init__.py - Vivado source types → Vivado command helpers: invokes tool helpers
src/cocotb_vivado/vivado/sources.py - Vivado source types → Part discovery: resolves part
src/cocotb_vivado/vivado/sources.py - Part discovery → Vivado command helpers: uses discovery command
src/cocotb_vivado/vivado/part.py