d1293a70c7
Signed-off-by: Austin Seipp <aseipp@pobox.com>
80 lines
2.3 KiB
Nix
80 lines
2.3 KiB
Nix
{ stdenv
|
|
, abc-verifier
|
|
, bison
|
|
, fetchFromGitHub
|
|
, flex
|
|
, libffi
|
|
, pkgconfig
|
|
, protobuf
|
|
, python3
|
|
, readline
|
|
, tcl
|
|
, verilog
|
|
, zlib
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "yosys";
|
|
version = "2020.02.25";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "YosysHQ";
|
|
repo = "yosys";
|
|
rev = "6edca05793197a846bbfb0329e836c87fa5aabb6";
|
|
sha256 = "1cwps3nsld80bh2b66l8fx3fa2zsx174mw72kqxyihpfdm0m0z1s";
|
|
};
|
|
|
|
enableParallelBuilding = true;
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
buildInputs = [ tcl readline libffi python3 bison flex protobuf zlib ];
|
|
|
|
makeFlags = [ "ENABLE_PROTOBUF=1" "PREFIX=${placeholder "out"}"];
|
|
|
|
patchPhase = ''
|
|
substituteInPlace ./Makefile \
|
|
--replace 'CXX = clang' "" \
|
|
--replace 'LD = clang++' 'LD = $(CXX)' \
|
|
--replace 'CXX = gcc' "" \
|
|
--replace 'LD = gcc' 'LD = $(CXX)' \
|
|
--replace 'ABCMKARGS = CC="$(CXX)" CXX="$(CXX)"' 'ABCMKARGS =' \
|
|
--replace 'echo UNKNOWN' 'echo ${builtins.substring 0 10 src.rev}'
|
|
patchShebangs tests
|
|
'';
|
|
|
|
preBuild = let
|
|
shortAbcRev = builtins.substring 0 7 abc-verifier.rev;
|
|
in ''
|
|
chmod -R u+w .
|
|
make config-${if stdenv.cc.isClang or false then "clang" else "gcc"}
|
|
echo 'ABCEXTERNAL = ${abc-verifier}/bin/abc' >> Makefile.conf
|
|
|
|
# we have to do this ourselves for some reason...
|
|
(cd misc && ${protobuf}/bin/protoc --cpp_out ../backends/protobuf/ ./yosys.proto)
|
|
|
|
if ! grep -q "ABCREV = ${shortAbcRev}" Makefile;then
|
|
echo "yosys isn't compatible with the provided abc (${shortAbcRev}), failing."
|
|
exit 1
|
|
fi
|
|
'';
|
|
|
|
doCheck = true;
|
|
checkInputs = [ verilog ];
|
|
|
|
meta = {
|
|
description = "Framework for RTL synthesis tools";
|
|
longDescription = ''
|
|
Yosys is a framework for RTL synthesis tools. It currently has
|
|
extensive Verilog-2005 support and provides a basic set of
|
|
synthesis algorithms for various application domains.
|
|
Yosys can be adapted to perform any synthesis job by combining
|
|
the existing passes (algorithms) using synthesis scripts and
|
|
adding additional passes as needed by extending the yosys C++
|
|
code base.
|
|
'';
|
|
homepage = http://www.clifford.at/yosys/;
|
|
license = stdenv.lib.licenses.isc;
|
|
maintainers = with stdenv.lib.maintainers; [ shell thoughtpolice emily ];
|
|
platforms = stdenv.lib.platforms.all;
|
|
};
|
|
}
|