nixpkgs/pkgs/development/compilers/yosys/plugins/symbiflow.nix
Henner Zeller 123b92da6c yosys-symbiflow: 2023.02.08 -> 1.20230425
The plugin now has a tagged version that is based on the date.
Previously, we had to use a random commit and manually choose the
relevant date. Now, we use the official tag as a version here
and to fetch from git.

While at it: fix the tests - somewhere over the course of the
lasts year, the tests stopped being run. Fixed now.
2023-04-26 01:47:32 -05:00

110 lines
2.5 KiB
Nix

{ fetchFromGitHub
, gtest
, lib
, python3
, readline
, stdenv
, yosys
, zlib
, yosys-symbiflow
, uhdm
, capnproto
, surelog
, antlr4
, flatbuffers
, pkg-config
}: let
version = "1.20230425";
src = fetchFromGitHub {
owner = "chipsalliance";
repo = "yosys-f4pga-plugins";
rev = "v${version}";
hash = "sha256-KNkmhvpKTby85P88+DqCOOGxIKpzbw5KF9ymqy40pfw=";
};
# Supported symbiflow plugins.
#
# The following are disabled:
#
# "ql-qlf" builds but fails to load the plugin, so is not currently supported.
plugins = [
"design_introspection"
"fasm"
"integrateinv"
"params"
"ql-iob"
# "ql-qlf"
"sdc"
"xdc"
"systemverilog"
];
static_gtest = gtest.overrideAttrs (old: {
dontDisableStatic = true;
disableHardening = [ "pie" ];
cmakeFlags = old.cmakeFlags ++ ["-DBUILD_SHARED_LIBS=OFF"];
});
in lib.genAttrs plugins (plugin: stdenv.mkDerivation (rec {
pname = "yosys-symbiflow-${plugin}-plugin";
inherit src version plugin;
enableParallelBuilding = true;
nativeBuildInputs = [ python3 pkg-config ];
buildInputs = [
yosys
readline
zlib
uhdm
surelog
capnproto
antlr4.runtime.cpp
];
# xdc has an incorrect path to a test which has yet to be patched
doCheck = plugin != "xdc";
nativeCheckInputs = [ static_gtest ];
# A Makefile rule tries to wget-fetch a yosys script from github.
# Link the script from our yosys sources in preBuild instead, so that
# the Makefile rule is a no-op.
preBuild = ''
ln -s ${yosys.src}/passes/pmgen/pmgen.py pmgen.py
'';
# Providing a symlink avoids the need for patching the test makefile
postUnpack = ''
mkdir -p source/third_party/googletest/build/
ln -s ${static_gtest}/lib source/third_party/googletest/build/lib
'';
makeFlags = [
"PLUGIN_LIST=${plugin}"
];
buildFlags = [
"YOSYS_PLUGINS_DIR=\${out}/share/yosys/plugins/"
"YOSYS_DATA_DIR=\${out}/share/yosys/"
];
checkTarget = "test";
checkFlags = [
( "NIX_YOSYS_PLUGIN_DIRS=\${NIX_BUILD_TOP}/source/${plugin}-plugin/build"
# sdc and xdc plugins use design introspection for their tests
+ (lib.optionalString ( plugin == "sdc" || plugin == "xdc" )
":${yosys-symbiflow.design_introspection}/share/yosys/plugins/")
)
];
installFlags = buildFlags;
meta = with lib; {
description = "Symbiflow ${plugin} plugin for Yosys";
license = licenses.isc;
platforms = platforms.all;
maintainers = with maintainers; [ ollieB thoughtpolice ];
};
}))