2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, buildPythonPackage, fetchFromGitHub, setuptools, swig, verilog }:
|
2019-10-17 15:24:02 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cocotb";
|
2020-12-06 23:02:41 +00:00
|
|
|
version = "1.4.0";
|
2019-10-17 15:24:02 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2020-12-06 23:02:41 +00:00
|
|
|
sha256 = "0fv0mg8zh40ffq0q39s195y6hvjrzihpx0i3f7ba5881syw3x7p4";
|
2019-10-17 15:24:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs bin/*.py
|
|
|
|
|
|
|
|
# POSIX portability (TODO: upstream this)
|
|
|
|
for f in \
|
|
|
|
cocotb/share/makefiles/Makefile.* \
|
|
|
|
cocotb/share/makefiles/simulators/Makefile.*
|
|
|
|
do
|
|
|
|
substituteInPlace $f --replace 'shell which' 'shell command -v'
|
|
|
|
done
|
2020-03-01 00:11:49 +00:00
|
|
|
|
2020-10-11 19:50:40 +01:00
|
|
|
# This can perhaps be removed in the next update after 1.3.2?
|
2020-03-01 00:11:49 +00:00
|
|
|
substituteInPlace cocotb/share/makefiles/Makefile.inc --replace "-Werror" ""
|
2019-10-17 15:24:02 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
checkInputs = [ swig verilog ];
|
|
|
|
|
|
|
|
checkPhase = ''
|
2020-10-11 19:49:46 +01:00
|
|
|
# test expected failures actually pass because of a fix in our icarus version
|
|
|
|
# https://github.com/cocotb/cocotb/issues/1952
|
|
|
|
substituteInPlace tests/test_cases/test_discovery/test_discovery.py \
|
|
|
|
--replace 'def access_single_bit' $'def foo(x): pass\ndef foo' \
|
|
|
|
--replace 'def access_single_bit_assignment' $'def foo(x): pass\ndef foo'
|
|
|
|
|
2019-10-17 15:24:02 +01:00
|
|
|
export PATH=$out/bin:$PATH
|
|
|
|
make test
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-10-17 15:24:02 +01:00
|
|
|
description = "Coroutine based cosimulation library for writing VHDL and Verilog testbenches in Python";
|
2020-03-01 00:11:49 +00:00
|
|
|
homepage = "https://github.com/cocotb/cocotb";
|
2019-10-17 15:24:02 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ matthuszagh ];
|
|
|
|
};
|
|
|
|
}
|