{"id":33258583,"url":"https://github.com/themperek/cocotb-vivado","last_synced_at":"2026-04-06T02:01:51.395Z","repository":{"id":217555069,"uuid":"744198784","full_name":"themperek/cocotb-vivado","owner":"themperek","description":"Limited python / cocotb interface to Xilinx/AMD Vivado simulator.","archived":false,"fork":false,"pushed_at":"2025-09-28T15:07:56.000Z","size":56,"stargazers_count":74,"open_issues_count":4,"forks_count":12,"subscribers_count":9,"default_branch":"main","last_synced_at":"2026-02-15T18:11:47.316Z","etag":null,"topics":["cocotb","python","simulation","verification","vivado","xilinx"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/themperek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-16T20:14:51.000Z","updated_at":"2026-02-03T03:18:59.000Z","dependencies_parsed_at":"2024-01-21T15:24:46.733Z","dependency_job_id":"ca40e59d-16a1-4fa8-9547-f73833d75860","html_url":"https://github.com/themperek/cocotb-vivado","commit_stats":null,"previous_names":["themperek/cocotb-xsi","themperek/cocotb-vivado"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/themperek/cocotb-vivado","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themperek%2Fcocotb-vivado","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themperek%2Fcocotb-vivado/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themperek%2Fcocotb-vivado/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themperek%2Fcocotb-vivado/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/themperek","download_url":"https://codeload.github.com/themperek/cocotb-vivado/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themperek%2Fcocotb-vivado/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31456664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocotb","python","simulation","verification","vivado","xilinx"],"created_at":"2025-11-17T03:00:41.008Z","updated_at":"2026-04-06T02:01:51.385Z","avatar_url":"https://github.com/themperek.png","language":"Python","funding_links":[],"categories":["Hardware Verification"],"sub_categories":["Tools"],"readme":"# cocotb-vivado\n[![PyPI version](https://badge.fury.io/py/cocotb-vivado.svg)](https://pypi.org/project/cocotb-vivado/)\n\nA limited Python/[cocotb](https://github.com/cocotb/cocotb/) interface to the [Xilinx Vivado Simulator](https://docs.xilinx.com/v/u/en-US/dh0010-vivado-simulation-hub) simulator. \nBased on [cocotb-stub-sim](https://github.com/fvutils/cocotb-stub-sim).\n\n---\n\n## 🚧 Project Status\n**Proof of Concept** – expect limitations (see below).  \n\n- Only top-level ports are accessible (simulator limitation).  \n- Edge-triggers `Edge`, `RisingEdge`, `FallingEdge` only work on clocks generated in the testbench/python with cocotb.clock.Clock() driver.\" (simulator limitation, see below).\n- Setting signal values is immediate (`setimmediatevalue` behavior).  \n- Only **Verilog top-levels** are supported (VHDL support planned).  \n- Direct access to the **XSI interface** is available.  \n\n---\n\n## Installation\n\n```bash\npip install cocotb-vivado==0.0.3 (for VIVADO \u003c= 2022.2)\npip install cocotb-vivado (for VIVADO \u003e= 2023.1)\n```\n\n## Quickstart\n\n```python\nimport subprocess\n\nimport cocotb_vivado\nimport cocotb\nfrom cocotb.triggers import Timer\n\n@cocotb.test()\nasync def simple_test(dut):\n    dut.clk.value = 0\n    await Timer(10, units=\"ns\")\n    dut.clk.value = 1\n    await Timer(10, units=\"ns\")\n    assert dut.out.value == 1\n\ndef test_simple():\n    subprocess.run([\"xvlog\", \"tb.v\"])\n    subprocess.run([\"xelab\", \"work.tb\", \"-dll\"])\n\n    cocotb_vivado.run(module=\"test_simple\", xsim_design=\"xsim.dir/work.tb/xsimk.so\", top_level_lang=\"verilog\")\n```\n\nSee `testes/test_simple.py` for full example.\n\n## Usage\n\nSee the `tests` folder for examples.\n\n```bash\nsource ../Vivado/202X.X/settings64.sh\nexport LD_LIBRARY_PATH=$XILINX_VIVADO/lib/lnx64.o\npytest -s\n```\n\nExtra feature: One does not need to recompile the project when running/changing tests .\n\n## Direct `XSI` interface\n\nYou can use `XSI` interface directly see `tests/test_xsi.py` for an example.\n\n## Overcoming `XSI` limitations\n\n`XSI` interface natively supports only `Timer` trigger.\n\nTo allow for using edge triggers under this limitation, cocotb-vivado  provides its custom trigger mechanism. When `cocotb_vivado` is imported, a global ClockScheduler singleton is created. This scheduler replaces cocotb’s standard implementations of `Clock`, `Edge`, `RisingEdge`, and `FallingEdge`.\n\nThe monkey‑patched Clock objects register themselves with the scheduler, which drives the associated signals and observes every resulting transition. On each clock‑driven edge, the scheduler evaluates all pending edge triggers and resumes any coroutines waiting on them. This polling‑on‑edge model gives deterministic behavior for multiple clocks while keeping the standard cocotb coroutine interface unchanged.\n\n## cocotb extensions\n\nIn order to use cocotb extension like [cocotbext-axi](https://github.com/alexforencich/cocotbext-axi) one needs to use `Clock` driver for clocking their DUT.\n\n## Full Vivado design simulation\n\nIn order order to simulate full design you need create design, `export_simulation` files compile, elaborate and run. See `tests/fw.tcl` and `tests/test_fw.tcl` for an example.\n\n## Dump waveforms\n\nYou can dump `vcd` file with verilog syntax in your testbench:\n\n```verilog\ninitial begin\n    $dumpfile(\"test.vcd\");\n    $dumpvars(0);\nend\n```\n\n### Acknowledgment\n\nWe'd like to thank our employer, [Dectris](https://dectris.com/) for supporting this work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemperek%2Fcocotb-vivado","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthemperek%2Fcocotb-vivado","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemperek%2Fcocotb-vivado/lists"}