All Projects → cocotb → Cocotb

cocotb / Cocotb

Licence: other
cocotb, a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Cocotb

Awesome Open Hardware Verification
A List of Free and Open Source Hardware Verification Tools and Frameworks
Stars: ✭ 103 (-86.08%)
Mutual labels:  verilog, vhdl, verification
math
Useful m-scripts for DSP (CIC, FIR, FFT, Fast convolution, Partial Filters etc.)
Stars: ✭ 15 (-97.97%)
Mutual labels:  vhdl, verilog
ruby-vpi
Ruby interface to IEEE 1364-2005 Verilog VPI
Stars: ✭ 15 (-97.97%)
Mutual labels:  verification, verilog
Spinalhdl
Scala based HDL
Stars: ✭ 696 (-5.95%)
Mutual labels:  verilog, vhdl
pcievhost
PCIe (1.0a to 2.0) Virtual host model for verilog
Stars: ✭ 22 (-97.03%)
Mutual labels:  verification, verilog
cocotb-bus
Pre-packaged testbenching tools and reusable bus interfaces for cocotb
Stars: ✭ 20 (-97.3%)
Mutual labels:  vhdl, verilog
hwt
VHDL/Verilog/SystemC code generator, simulator API written in python/c++
Stars: ✭ 145 (-80.41%)
Mutual labels:  vhdl, verilog
vericert
A formally verified high-level synthesis tool based on CompCert and written in Coq.
Stars: ✭ 63 (-91.49%)
Mutual labels:  verification, verilog
intfftk
Fully pipelined Integer Scaled / Unscaled Radix-2 Forward/Inverse Fast Fourier Transform (FFT) IP-core for newest Xilinx FPGAs (Source language - VHDL / Verilog). GNU GPL 3.0.
Stars: ✭ 43 (-94.19%)
Mutual labels:  vhdl, verilog
Edalize
An abstraction library for interfacing EDA tools
Stars: ✭ 270 (-63.51%)
Mutual labels:  verilog, vhdl
Riscv
RISC-V CPU Core (RV32IM)
Stars: ✭ 272 (-63.24%)
Mutual labels:  verilog, verification
symbolator
HDL symbol generator
Stars: ✭ 123 (-83.38%)
Mutual labels:  vhdl, verilog
formal hw verification
Trying to verify Verilog/VHDL designs with formal methods and tools
Stars: ✭ 32 (-95.68%)
Mutual labels:  vhdl, verilog
fphdl
VHDL-2008 Support Library
Stars: ✭ 36 (-95.14%)
Mutual labels:  vhdl, verification
vim-hdl
Vim plugin to aid VHDL development (for LSP, see https://github.com/suoto/hdl_checker)
Stars: ✭ 59 (-92.03%)
Mutual labels:  vhdl, verilog
getting-started
List of ideas for getting started with TimVideos projects
Stars: ✭ 50 (-93.24%)
Mutual labels:  vhdl, verilog
Awesome Hdl
Hardware Description Languages
Stars: ✭ 385 (-47.97%)
Mutual labels:  verilog, vhdl
SpinalCrypto
SpinalHDL - Cryptography libraries
Stars: ✭ 36 (-95.14%)
Mutual labels:  vhdl, verilog
vboard
Virtual development board for HDL design
Stars: ✭ 32 (-95.68%)
Mutual labels:  vhdl, verilog
docker
Scripts to build and use docker images including GHDL
Stars: ✭ 27 (-96.35%)
Mutual labels:  vhdl, verilog

cocotb is a coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python.

Documentation Status Build Status PyPI Gitpod Ready-to-Code codecov

Installation

The current stable version of cocotb requires:

After installing these dependencies, the latest stable version of cocotb can be installed with pip.

pip install cocotb

For more details on installation, including prerequisites, see the documentation.

For details on how to install the development version of cocotb, see the preliminary documentation of the future release.

!!! Bus and Testbenching Components !!! The reusable bus interfaces and testbenching components have recently been moved to the cocotb-bus package. You can easily install these at the same time as cocotb by adding the bus extra install: pip install cocotb[bus].

Usage

As a first trivial introduction to cocotb, the following example "tests" a flip-flop.

First, we need a hardware design which we can test. For this example, create a file dff.sv with SystemVerilog code for a simple D flip-flop. You could also use any other language a cocotb-supported simulator understands, e.g. VHDL.

// dff.sv

`timescale 1us/1ns

module dff (
    output logic q,
    input logic clk, d
);

always @(posedge clk) begin
    q <= d;
end

endmodule

An example of a simple randomized cocotb testbench:

# test_dff.py

import random
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import FallingEdge

@cocotb.test()
async def test_dff_simple(dut):
    """ Test that d propagates to q """

    clock = Clock(dut.clk, 10, units="us")  # Create a 10us period clock on port clk
    cocotb.fork(clock.start())  # Start the clock

    for i in range(10):
        val = random.randint(0, 1)
        dut.d <= val  # Assign the random value val to the input port d
        await FallingEdge(dut.clk)
        assert dut.q.value == val, "output q was incorrect on the {}th cycle".format(i)

A simple Makefile:

# Makefile

TOPLEVEL_LANG = verilog
VERILOG_SOURCES = $(shell pwd)/dff.sv
TOPLEVEL = dff
MODULE = test_dff

include $(shell cocotb-config --makefiles)/Makefile.sim

In order to run the test with Icarus Verilog, execute:

make SIM=icarus

asciicast

For more information please see the cocotb documentation and our wiki.

Tutorials, examples and related projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].