add specialized nextpnr, for now
This commit is contained in:
parent
0cb682bf8d
commit
5c34143ba1
12 changed files with 134 additions and 1 deletions
|
@ -180,7 +180,7 @@ with pkgs;
|
|||
clang
|
||||
clang-tools
|
||||
flatbuffers
|
||||
nextpnr
|
||||
deprekages.nextpnr
|
||||
yosys
|
||||
trellis
|
||||
poetry
|
||||
|
|
|
@ -32,6 +32,7 @@ flake-utils.lib.eachDefaultSystem (
|
|||
ffts = callPackage ./scopehal-apps/ffts.nix { };
|
||||
libsigrok4DSL = callPackage ./scopehal-apps/libsigrok4DSL.nix { };
|
||||
vulkan-sdk = callPackage ./scopehal-apps/vulkan-sdk.nix { };
|
||||
nextpnr = callPackage ./nextpnr { };
|
||||
|
||||
# apps
|
||||
navit = callPackage ./navit.nix { };
|
||||
|
|
132
packages/nextpnr/default.nix
Normal file
132
packages/nextpnr/default.nix
Normal file
|
@ -0,0 +1,132 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
cmake,
|
||||
boost,
|
||||
python3,
|
||||
eigen,
|
||||
python3Packages,
|
||||
icestorm,
|
||||
trellis,
|
||||
llvmPackages,
|
||||
|
||||
enableGui ? false,
|
||||
wrapQtAppsHook ? null,
|
||||
qtbase ? null,
|
||||
}:
|
||||
|
||||
let
|
||||
boostPython = boost.override {
|
||||
python = python3;
|
||||
enablePython = true;
|
||||
};
|
||||
|
||||
pname = "nextpnr";
|
||||
version = "2025-08-16";
|
||||
|
||||
prjxray_src = fetchFromGitHub {
|
||||
owner = "f4pga";
|
||||
repo = "prjxray";
|
||||
rev = "faf9c774a340e39cf6802d009996ed6016e63521";
|
||||
hash = "sha256-BEv7vJoOHWHZoc9EXbesfwFFClkuiSpVwHUrj4ahUcA=";
|
||||
};
|
||||
|
||||
prjbeyond_src = fetchFromGitHub {
|
||||
owner = "YosysHQ-GmbH";
|
||||
repo = "prjbeyond-db";
|
||||
rev = "06d3b424dd0e52d678087c891c022544238fb9e3";
|
||||
hash = "sha256-nmyFFUO+/J2lb+lPATEjdYq0d21P1fN3N94JXR8brZ0=";
|
||||
};
|
||||
|
||||
prjpeppercorn_src = fetchFromGitHub {
|
||||
owner = "YosysHQ";
|
||||
repo = "prjpeppercorn";
|
||||
rev = "22ec1e2d7b69a450af759bd727e5601a9924d919";
|
||||
hash = "sha256-PmhweCcJ5+Td69P7M1kaPUj8owXX/DD78AasNgb0UTg=";
|
||||
};
|
||||
prjpeppercorn_delays = ./delay;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit pname version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "YosysHQ";
|
||||
repo = "nextpnr";
|
||||
rev = "95ab16f380bcf62ea967d908d0c61c868576023e";
|
||||
hash = "sha256-cG4sQOCqKuQi9g0KQrEMku0kVG8FZB3BKt4oHwXfscI=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
python3
|
||||
]
|
||||
++ (lib.optional enableGui wrapQtAppsHook);
|
||||
buildInputs = [
|
||||
boostPython
|
||||
eigen
|
||||
python3Packages.apycula
|
||||
]
|
||||
++ (lib.optional enableGui qtbase)
|
||||
++ (lib.optional stdenv.cc.isClang llvmPackages.openmp);
|
||||
|
||||
cmakeFlags =
|
||||
let
|
||||
# the specified version must always start with "nextpnr-", so add it if
|
||||
# missing (e.g. if the user overrides with a git hash)
|
||||
rev = src.rev;
|
||||
version = if (lib.hasPrefix "nextpnr-" rev) then rev else "nextpnr-${rev}";
|
||||
in
|
||||
[
|
||||
"-DCURRENT_GIT_VERSION=${version}"
|
||||
"-DARCH=generic;ice40;ecp5;himbaechel"
|
||||
"-DBUILD_TESTS=ON"
|
||||
"-DICESTORM_INSTALL_PREFIX=${icestorm}"
|
||||
"-DTRELLIS_INSTALL_PREFIX=${trellis}"
|
||||
"-DTRELLIS_LIBDIR=${trellis}/lib/trellis"
|
||||
"-DGOWIN_BBA_EXECUTABLE=${python3Packages.apycula}/bin/gowin_bba"
|
||||
"-DUSE_OPENMP=ON"
|
||||
"-DHIMBAECHEL_UARCH=gatemate" # FIXME: support others once stuff is fixed
|
||||
"-DHIMBAECHEL_GOWIN_DEVICES=all"
|
||||
"-DHIMBAECHEL_PRJXRAY_DB=${prjxray_src}"
|
||||
"-DHIMBAECHEL_PRJBEYOND_DB=${prjbeyond_src}"
|
||||
"-DHIMBAECHEL_PRJBEYOND_DB=${prjbeyond_src}"
|
||||
"-DHIMBAECHEL_PEPPERCORN_PATH=/build/peppercorn" # TODO: should be nix-build-top
|
||||
]
|
||||
++ (lib.optional enableGui "-DBUILD_GUI=ON");
|
||||
|
||||
postUnpack = ''
|
||||
mkdir peppercorn
|
||||
|
||||
cp -r ${prjpeppercorn_src}/* peppercorn/
|
||||
cp -r ${prjpeppercorn_delays} peppercorn/delay
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
# Don't use #embed macro for chipdb binary embeddings - otherwise getting spurious type narrowing errors.
|
||||
# Maybe related to: https://github.com/llvm/llvm-project/issues/119256
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace-fail "check_cxx_compiler_hash_embed(HAS_HASH_EMBED CXX_FLAGS_HASH_EMBED)" ""
|
||||
'';
|
||||
|
||||
doCheck = false;
|
||||
|
||||
postFixup = lib.optionalString enableGui ''
|
||||
wrapQtApp $out/bin/nextpnr-generic
|
||||
wrapQtApp $out/bin/nextpnr-ice40
|
||||
wrapQtApp $out/bin/nextpnr-ecp5
|
||||
wrapQtApp $out/bin/nextpnr-himbaechel
|
||||
'';
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
meta = {
|
||||
description = "Place and route tool for FPGAs";
|
||||
homepage = "https://github.com/yosyshq/nextpnr";
|
||||
license = lib.licenses.isc;
|
||||
platforms = lib.platforms.all;
|
||||
maintainers = with lib.maintainers; [ thoughtpolice ];
|
||||
};
|
||||
}
|
BIN
packages/nextpnr/delay/cc_best_eco_dly.dly
Normal file
BIN
packages/nextpnr/delay/cc_best_eco_dly.dly
Normal file
Binary file not shown.
BIN
packages/nextpnr/delay/cc_best_lpr_dly.dly
Normal file
BIN
packages/nextpnr/delay/cc_best_lpr_dly.dly
Normal file
Binary file not shown.
BIN
packages/nextpnr/delay/cc_best_spd_dly.dly
Normal file
BIN
packages/nextpnr/delay/cc_best_spd_dly.dly
Normal file
Binary file not shown.
BIN
packages/nextpnr/delay/cc_typ_eco_dly.dly
Normal file
BIN
packages/nextpnr/delay/cc_typ_eco_dly.dly
Normal file
Binary file not shown.
BIN
packages/nextpnr/delay/cc_typ_lpr_dly.dly
Normal file
BIN
packages/nextpnr/delay/cc_typ_lpr_dly.dly
Normal file
Binary file not shown.
BIN
packages/nextpnr/delay/cc_typ_spd_dly.dly
Normal file
BIN
packages/nextpnr/delay/cc_typ_spd_dly.dly
Normal file
Binary file not shown.
BIN
packages/nextpnr/delay/cc_worst_eco_dly.dly
Normal file
BIN
packages/nextpnr/delay/cc_worst_eco_dly.dly
Normal file
Binary file not shown.
BIN
packages/nextpnr/delay/cc_worst_lpr_dly.dly
Normal file
BIN
packages/nextpnr/delay/cc_worst_lpr_dly.dly
Normal file
Binary file not shown.
BIN
packages/nextpnr/delay/cc_worst_spd_dly.dly
Normal file
BIN
packages/nextpnr/delay/cc_worst_spd_dly.dly
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue