Installation

Using cocotb requires installation of prerequisites and installation of cocotb itself. In this document, we are assuming that you already have a supported simulator available in PATH.

Installation of Prerequisites

Cocotb has the following requirements:

  • Python 3.5+

  • Python-dev packages

  • GCC 4.8.1+ or Clang 3.3+ and associated development packages

  • GNU Make

  • A Verilog or VHDL simulator, depending on your RTL source code

Changed in version 1.4: Dropped Python 2 support

Note

In order to use a 32-bit simulator you need to use a 32-bit version of Python.

The installation instructions vary depending on your operating system:

Conda is an open-source package and environment management system that we recommend for Windows.

Download and install Miniconda from https://conda.io/. From an Anaconda Prompt, use the following line to install a compiler (GCC or Clang) and GNU Make:

conda install -c msys2 m2-base m2-make m2w64-toolchain libpython

In a terminal, run

sudo apt-get install make gcc g++ python3 python3-dev python3-pip

In a terminal, run

sudo yum install make gcc gcc-c++ libstdc++-devel python3 python3-devel python3-pip

We recommmend using the Homebrew package manager. After installing it, run the following line in a terminal:

brew install python icarus-verilog gtkwave

Installation of cocotb

The latest release of cocotb can be installed by running

pip install --global-option build_ext --global-option --compiler=mingw32 cocotb

The latest release of cocotb can be installed by running

pip install cocotb

The latest release of cocotb can be installed by running

pip install cocotb

The latest release of cocotb can be installed by running

pip install cocotb

Warning

pip may belong to a different Python installation to what you expect. Use pip -V to check. If this prints “(python 2.7)”, use pip3 or python3 -m pip in place of pip in the command shown.

If you want to install the development version of cocotb, instructions are here.

After installation, you should be able to execute cocotb-config. If it is not found, you need to append its location to the PATH environment variable. This may happen when you use the --user option to pip, in which case the location is documented here.

For more installation options, please see our Wiki.