2022-01-13 20:06:32 +00:00
|
|
|
{ fetchFromGitHub
|
|
|
|
, gtest
|
|
|
|
, lib
|
|
|
|
, python3
|
|
|
|
, readline
|
|
|
|
, stdenv
|
|
|
|
, yosys
|
|
|
|
, zlib
|
|
|
|
, yosys-symbiflow
|
2022-11-04 12:27:35 +00:00
|
|
|
, uhdm
|
2023-04-29 16:46:19 +00:00
|
|
|
, capnproto
|
2022-11-04 12:27:35 +00:00
|
|
|
, surelog
|
2023-04-29 16:46:19 +00:00
|
|
|
, antlr4
|
2022-11-21 17:40:18 +00:00
|
|
|
, flatbuffers
|
2023-04-29 16:46:19 +00:00
|
|
|
, pkg-config
|
2022-01-13 20:06:32 +00:00
|
|
|
}: let
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
version = "1.20230425";
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
src = fetchFromGitHub {
|
2023-04-29 16:46:19 +00:00
|
|
|
owner = "chipsalliance";
|
|
|
|
repo = "yosys-f4pga-plugins";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-KNkmhvpKTby85P88+DqCOOGxIKpzbw5KF9ymqy40pfw=";
|
2022-01-13 20:06:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# 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"
|
2022-11-04 12:27:35 +00:00
|
|
|
"systemverilog"
|
2022-01-13 20:06:32 +00:00
|
|
|
];
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
static_gtest = gtest.overrideAttrs (old: {
|
2022-01-13 20:06:32 +00:00
|
|
|
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;
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
nativeBuildInputs = [ python3 pkg-config ];
|
|
|
|
buildInputs = [
|
|
|
|
yosys
|
|
|
|
readline
|
|
|
|
zlib
|
|
|
|
uhdm
|
|
|
|
surelog
|
|
|
|
capnproto
|
|
|
|
antlr4.runtime.cpp
|
|
|
|
];
|
2022-01-13 20:06:32 +00:00
|
|
|
|
|
|
|
# xdc has an incorrect path to a test which has yet to be patched
|
|
|
|
doCheck = plugin != "xdc";
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ static_gtest ];
|
2022-01-13 20:06:32 +00:00
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
# 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.
|
2022-01-13 20:06:32 +00:00
|
|
|
preBuild = ''
|
2023-04-29 16:46:19 +00:00
|
|
|
ln -s ${yosys.src}/passes/pmgen/pmgen.py pmgen.py
|
2022-01-13 20:06:32 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Providing a symlink avoids the need for patching the test makefile
|
|
|
|
postUnpack = ''
|
2022-11-21 17:40:18 +00:00
|
|
|
mkdir -p source/third_party/googletest/build/
|
|
|
|
ln -s ${static_gtest}/lib source/third_party/googletest/build/lib
|
2022-01-13 20:06:32 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"PLUGIN_LIST=${plugin}"
|
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [
|
2023-02-16 17:41:37 +00:00
|
|
|
"YOSYS_PLUGINS_DIR=\${out}/share/yosys/plugins/"
|
|
|
|
"YOSYS_DATA_DIR=\${out}/share/yosys/"
|
2022-01-13 20:06:32 +00:00
|
|
|
];
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
checkTarget = "test";
|
2022-01-13 20:06:32 +00:00
|
|
|
checkFlags = [
|
2023-04-29 16:46:19 +00:00
|
|
|
( "NIX_YOSYS_PLUGIN_DIRS=\${NIX_BUILD_TOP}/source/${plugin}-plugin/build"
|
2022-01-13 20:06:32 +00:00
|
|
|
# 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 ];
|
|
|
|
};
|
|
|
|
}))
|