File size: 3,453 Bytes
cb65407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
.. _install:

************
Installation
************

Using cocotb requires installation of prerequisites and installation of cocotb itself.
In this document, we are assuming that you already have a
:ref:`supported simulator<simulator-support>` available in :envvar:`PATH`.


.. _install-prerequisites:

Installation of Prerequisites
=============================

The current stable version of cocotb requires:

* Python 3.6+
* GNU Make 3+
* A Verilog or VHDL simulator, depending on your :term:`RTL` source code

.. versionchanged:: 1.7.0 Dropped requirement of Python development headers and C++ compiler for release versions.

.. versionchanged:: 1.6.0 Dropped Python 3.5 support

.. versionchanged:: 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:

.. tabs::

   .. group-tab:: Windows

      We recommend users who are running Windows and who are more comfortable with a Unix shell,
      or who have legacy Makefile-based projects,
      to use Windows Subsystem for Linux (WSL).
      After installing WSL and a supported Linux distribution, follow the Linux installation instructions for cocotb.

      `Conda <https://conda.io/>`_ is an open-source package and environment management system that we recommend for users who are more comfortable with native Windows development.
      Download and install `Miniconda <https://docs.conda.io/en/latest/miniconda.html>`_ from https://conda.io/.
      From an Anaconda Prompt, use the following line to install a compiler (GCC or Clang) and GNU Make:

      .. code-block::

         conda install -c msys2 m2-base m2-make

   .. group-tab:: Linux - Debian

      In a terminal, run

      .. code-block:: bash

          sudo apt-get install make python3 python3-pip

   .. group-tab:: Linux - Red Hat

      In a terminal, run

      .. code-block:: bash

          sudo yum install make python3 python3-pip

   .. group-tab:: macOS

      We recommend using the `Homebrew <https://brew.sh/>`_ package manager.
      After installing it, run the following line in a terminal:

      .. code-block:: bash

           brew install python

.. _install-cocotb:
.. _installation-via-pip:

Installation of cocotb
======================

The **stable version** of cocotb can be installed by running

.. code-block:: bash

    pip install cocotb

.. note::

    If your user does not have permissions to install cocotb using the instructions above,
    try adding the ``--user`` option to :command:`pip`
    (see `the pip documentation <https://pip.pypa.io/en/stable/user_guide/#user-installs>`_).

.. warning::

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

If you want to install the **development version** of cocotb,
`instructions are here <https://docs.cocotb.org/en/latest/install_devel.html>`_.

After installation, you should be able to execute :command:`cocotb-config`.
If it is not found, you need to append its location to the :envvar:`PATH` environment variable.
This may happen when you use the ``--user`` option to :command:`pip`.

For more installation options, please see `our Wiki <https://github.com/cocotb/cocotb/wiki/Tier-2-Setup-Instructions>`_.