From 4fe9281b314211f29cf5c04ee0a238bd989099d4 Mon Sep 17 00:00:00 2001 From: Jack Leightcap Date: Wed, 27 Sep 2023 19:29:03 -0400 Subject: [PATCH] nextpnr-xilinx: init at 0.5.0 Signed-off-by: Jack Leightcap --- .../compilers/nextpnr-xilinx/default.nix | 54 +++++++++++++++++++ .../nextpnr-xilinx/nextpnr-setup-hook.sh | 5 ++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 61 insertions(+) create mode 100644 pkgs/development/compilers/nextpnr-xilinx/default.nix create mode 100644 pkgs/development/compilers/nextpnr-xilinx/nextpnr-setup-hook.sh diff --git a/pkgs/development/compilers/nextpnr-xilinx/default.nix b/pkgs/development/compilers/nextpnr-xilinx/default.nix new file mode 100644 index 0000000000000..eae437ec3fac7 --- /dev/null +++ b/pkgs/development/compilers/nextpnr-xilinx/default.nix @@ -0,0 +1,54 @@ +{ stdenv +, cmake +, git +, lib +, fetchFromGitHub +, python310Packages +, python310 +, eigen +, llvmPackages +}: +stdenv.mkDerivation rec { + pname = "nextpnr-xilinx"; + version = "0.5.0"; + + src = fetchFromGitHub { + owner = "openXC7"; + repo = "nextpnr-xilinx"; + rev = version; + hash = "sha256-mDYEmq3MW1kK9HeR4PyGmKQnAzpvlOf+H66o7QTFx3k="; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ cmake git ]; + buildInputs = [ python310Packages.boost python310 eigen ] + ++ (lib.optional stdenv.cc.isClang [ llvmPackages.openmp ]); + + setupHook = ./nextpnr-setup-hook.sh; + + cmakeFlags = [ + "-DCURRENT_GIT_VERSION=${lib.substring 0 7 src.rev}" + "-DARCH=xilinx" + "-DBUILD_GUI=OFF" + "-DBUILD_TESTS=OFF" + "-DUSE_OPENMP=ON" + ]; + + installPhase = '' + mkdir -p $out/bin + cp nextpnr-xilinx bba/bbasm $out/bin/ + mkdir -p $out/share/nextpnr/external + cp -rv ../xilinx/external/prjxray-db $out/share/nextpnr/external/ + cp -rv ../xilinx/external/nextpnr-xilinx-meta $out/share/nextpnr/external/ + cp -rv ../xilinx/python/ $out/share/nextpnr/python/ + cp ../xilinx/constids.inc $out/share/nextpnr + ''; + + meta = with lib; { + description = "Place and route tool for FPGAs"; + homepage = "https://github.com/openXC7/nextpnr-xilinx"; + license = licenses.isc; + platforms = platforms.all; + maintainers = with maintainers; [ jleightcap hansfbaier ]; + }; +} diff --git a/pkgs/development/compilers/nextpnr-xilinx/nextpnr-setup-hook.sh b/pkgs/development/compilers/nextpnr-xilinx/nextpnr-setup-hook.sh new file mode 100644 index 0000000000000..25baf81576380 --- /dev/null +++ b/pkgs/development/compilers/nextpnr-xilinx/nextpnr-setup-hook.sh @@ -0,0 +1,5 @@ +addNextpnrPaths() { + addToSearchPath NEXTPNR_XILINX_DIR "$1/usr/share/nextpnr" +} + +addEnvHooks "$targetOffset" addNextpnrPaths diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7c51a4ea45758..bcf2c6f1450e1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16826,6 +16826,8 @@ with pkgs; nextpnr = callPackage ../development/compilers/nextpnr { }; + nextpnr-xilinx = callPackage ../development/compilers/nextpnr-xilinx { }; + nextpnrWithGui = libsForQt5.callPackage ../development/compilers/nextpnr { enableGui = true; inherit (darwin.apple_sdk.frameworks) OpenGL;