I'm using CocoTB to test my HDL design, but as I understand, it's possible to use it with python2.7 or python3.
In setup.py config file I can see that both are supported :
[...]
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
[...]
In endian_swapper test (examples/endian_swapper/tests/test_endian_swapper.py), if I modify a test script to see which version is used :
@cocotb.test()
def wavedrom_test(dut):
"""
Generate a JSON wavedrom diagram of a trace and save it to wavedrom.json
"""
print("Python version used {}".format(sys.version_info))
I can see that python2.7 is used when I launch test with «make» command :
Python version used sys.version_info(major=2, minor=7, micro=9, releaselevel='final', serial=0)
My python3 executable is named ... python3 in fact (debian). Is there a canonical way to force cocotb to use python3 instead of python2 ?
try updating the PATH variable. worked for me.
when cocotb looks for python, it looks for it at the folders that are listed at the PATH variable.
let say that your python3 full path is at/usr/bin/python3
(you can find python3 full path by which python3
)
i also added here link to new place in case both python2 and python3 are at the same folder...
> python -V
Python 2.7.17
> ln -s /usr/bin/python3 /home/$USER/python
> export PATH="/home/$USER:$PATH"
> python -V
Python 3.6.9