我正在使用CocoTB来测试我的HDL设计,但据我所知,可以将它与python2.7或python3一起使用。
在setup.py配置文件中,我可以看到两者都受支持:
[...]
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
[...]
在endian_swapper test(examples / endian_swapper / tests / test_endian_swapper.py)中,如果我修改测试脚本以查看使用的版本:
@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))
我可以看到当我使用«make»命令启动测试时使用了python2.7:
Python version used sys.version_info(major=2, minor=7, micro=9, releaselevel='final', serial=0)
我的python3可执行文件实际上被命名为... python3(debian)。是否有一种规范的方法来强制cocotb使用python3而不是python2?
由于linuxconfig.org,我在themperek找到了解决方案。但这并不是我想要的。
别名解决方案对我不起作用。更新替代方案有效但只能在debian上安装«official»python3。我无法使用手动安装的替代方案(3.7)。
$ sudo update-alternatives --config python
There are 3 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/python3.7 2 auto mode
1 /usr/bin/python2.7 0 manual mode
2 /usr/bin/python3.4 1 manual mode
* 3 /usr/bin/python3.7 2 manual mode
Press enter to keep the current choice[*], or type selection number: 3
$ make clean;make
0.00ns INFO Running on Icarus Verilog version 11.0 (devel)
0.00ns INFO Python interpreter initialised and cocotb loaded!
0.00ns INFO Running tests with Cocotb v1.0.1 from /opt/cocotb
0.00ns INFO Seeding Python random module with 1554105931
0.00ns INFO Found test test_ttl.ttl_test
0.00ns INFO Running test 1/1: ttl_test
0.00ns INFO Starting test: "ttl_test"
Description: simple ttl test function
[...]
3.4.2 (default, Feb 7 2019, 06:11:23)
[...]