2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, fetchFromGitHub
|
|
|
|
, pkgconfig, libftdi1
|
|
|
|
, python3, pypy3
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
# PyPy yields large improvements in build time and runtime performance, and
|
|
|
|
# IceStorm isn't intended to be used as a library other than by the nextpnr
|
|
|
|
# build process (which is also sped up by using PyPy), so we use it by default.
|
|
|
|
# See 18839e1 for more details.
|
|
|
|
#
|
|
|
|
# FIXME(aseipp, 3/1/2021): pypy seems a bit busted since stdenv upgrade to gcc
|
|
|
|
# 10/binutils 2.34, so short-circuit this for now in passthru below (done so
|
|
|
|
# that downstream overrides can't re-enable pypy and break their build somehow)
|
2020-04-24 23:36:52 +00:00
|
|
|
, usePyPy ? stdenv.hostPlatform.system == "x86_64-linux"
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "icestorm";
|
2021-01-05 17:05:55 +00:00
|
|
|
version = "2020.12.04";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
passthru = rec {
|
2021-01-05 17:05:55 +00:00
|
|
|
pythonPkg = if (false && usePyPy) then pypy3 else python3;
|
2020-04-24 23:36:52 +00:00
|
|
|
pythonInterp = pythonPkg.interpreter;
|
|
|
|
};
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-09-25 04:45:31 +00:00
|
|
|
owner = "YosysHQ";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "icestorm";
|
2021-01-05 17:05:55 +00:00
|
|
|
rev = "7afc64b480212c9ac2ce7cb1622731a69a7d212c";
|
|
|
|
sha256 = "0vxhqs2fampglg3xlfwb35229iv96kvlwp1gyxrdrmlpznhkqdrk";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = [ passthru.pythonPkg libftdi1 ];
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
# fix icebox_vlog chipdb path. icestorm issue:
|
|
|
|
# https://github.com/cliffordwolf/icestorm/issues/125
|
|
|
|
#
|
|
|
|
# also, fix up the path to the chosen Python interpreter. for pypy-compatible
|
|
|
|
# platforms, it offers significant performance improvements.
|
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace ./icebox/icebox_vlog.py \
|
|
|
|
--replace /usr/local/share "$out/share"
|
|
|
|
|
|
|
|
for x in icefuzz/Makefile icebox/Makefile icetime/Makefile; do
|
|
|
|
substituteInPlace "$x" --replace python3 "${passthru.pythonInterp}"
|
|
|
|
done
|
|
|
|
|
|
|
|
for x in $(find . -type f -iname '*.py'); do
|
|
|
|
substituteInPlace "$x" \
|
|
|
|
--replace '/usr/bin/env python3' '${passthru.pythonInterp}'
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Documentation and tools for Lattice iCE40 FPGAs";
|
|
|
|
longDescription = ''
|
|
|
|
Project IceStorm aims at reverse engineering and
|
|
|
|
documenting the bitstream format of Lattice iCE40
|
|
|
|
FPGAs and providing simple tools for analyzing and
|
|
|
|
creating bitstream files.
|
|
|
|
'';
|
|
|
|
homepage = "http://www.clifford.at/icestorm/";
|
|
|
|
license = stdenv.lib.licenses.isc;
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ shell thoughtpolice emily ];
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
|
|
|
};
|
|
|
|
}
|