何为cocotb cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches cocotb是一套基于python的用于构建仿真及测试用例的lib库,它的框架为: 可以看到,在cocotb的框架里,我们的待测试逻辑运行在仿真器中(VCS、Verilator等),而我们的测试框架及测试用例均以 想想单纯的一个图像处理的仿真用纯Systemverilog的方式进行验证在进行测试数据生成及最后结果对比要多少脚本…… cocotb安装 按照cocotb手册给出的安装流程,在CentOS里安装步骤为 pip install cocotb #pip may belong to a different Python installation # to what you expect. 在仿真完成后,能够自动汇总测试结果: 写在最后 之所以探索下cocotb,主要原因是虽然SpinalHDL测试框架和cocotb差不多,但目前SpinalHDL尚未集成对VCS仿真器的集成
pytest方式调用python库cocotb-test的cocotb-test.simulator.run方法,该方法定义了使用何种仿真器的方法;makefile方式是调用python库cocotb中的 扩展知识:python库介绍,感兴趣的可以去了解cocotb的使用,功能强大并且高效,cocotb是一个基于CO routine的CO simulation TestBench环境,使用Python验证 cocotb介绍:https://docs.cocotb.org/en/stable/ cocotb git:https://github.com/cocotb/cocotb cocotb-test:https --ns INFO cocotb.gpi .. alex/.local/lib/python3.9/site-packages/cocotb 0.00ns INFO cocotb
本文介绍了cocotb的安装、python tb文件的写法、用xrun仿真cocotb的脚本等,我们来看看体验如何。 一、准备 centos7 python3.6+ yum install python3-devel pip3 install --upgrade cocotb 二、写RTL // top.sv module from cocotb.triggers import Timer, FallingEdge async def gen_clk(dut): for cycle in range(100): () async def tb(dut): await cocotb.start(gen_clk(dut)) await cocotb.start(gen_rst(dut)) 19行:用@cocotb.test()装饰器指定了tb的顶层主函数。
使用cocotb+verilator运行时报错 error: ‘class Vtop’ has no member named ‘nextTimeSlot’ 157 | top->eventsPending 确保安装了依赖,unsetenv命令是csh命令行工具用的,unset是bash用的 参考: Cocotb error with Verilator · cocotb/cocotb · Discussion #3602 Quickstart Guide — cocotb 1.9.2 documentation
cocotb-bus cocotb-test cocotbext-axi cocotbext-eth cocotbext-pcie pytest scapy Recommended additional tests in parallel with pytest -n auto) pytest-sugar (makes pytest output a bit nicer) $ pip3 install cocotb $ pip3 install cocotb-bus $ pip3 install cocotb-test $ pip3 install cocotbext-axi $ pip3 install cocotbext-eth $ cd /path/to/corundum-master $ tox py39 installed: apipkg==1.5,attrs==21.2.0,cocotb==1.5.2,cocotb-bus ==0.1.1,cocotb-test==0.2.0,cocotbext-axi==0.1.12,cocotbext-eth==0.1.14,cocotbext-pcie==0.1.10,execnet
公众号:OpenFPGA Alex Forencich主要项目 包含网络和PCIe相关,其中cocotbext-xxx是仿真测试模型(cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python.cocotb是一套基于python的用于构建仿真及测试用例的lib库)。 但是后者的仿真理论(包括使用cocotbext-pcie和 cocotbext- axi 的完整 cocotb 测试平台 。)更加充实,适合研究总线接口。
SURF 使用 CocoTB 和 GHDL 进行验证,使流程变得简单。 它利用了 CocoTB、OSVVM、UVVM 和 VUnit 进行验证。 以上这些只是一些常用的库,可以结合之前推荐的开源库一起使用: 这些开源库可以帮助开发解决方案,而无需从头开始。
我们的设计已通过基于cocotb的框架进行了验证和仿真。 仿真环境基于cocotb [11],它允许使用几个现成的Python包(例如Scapy)来生成测试用例。另外,可以将测试中的设计与虚拟网络接口[12]连接起来。 我们为AXI4-stream总线开发了cocotb驱动程序和监视器,从而使我们能够快速评估不同的Deparser配置。Xilinx Vivado 2019.1用于合成和布局布线。 . https://github.com/cocotb/cocotb [12] Chris Higgs and Stuart Hodgeson. 2020. Tutorial: Ping — cocotb 1.4.0 documentation. https://docs.cocotb.org/en/stable/ping_tun_tap.html [13]
写在最后 如果选用基于cocotb来进行代码仿真,也可采用这种形式来生成自动化测试报告。
项目包括使用cocotbext-axi 的完整 cocotb 测试平台。 模块介绍 arbiter 模块 通用参数化仲裁器。支持优先级和循环仲裁。支持阻塞直到请求释放或确认。