sby: 2021.11.30 -> 0.44, run tests, rename from symbiyosys

This commit is contained in:
Roland Coeurjoly 2024-08-20 00:06:17 +02:00 committed by Austin Seipp
parent 965ba5d533
commit c34208511e
5 changed files with 109 additions and 66 deletions

View File

@ -1,62 +0,0 @@
{ lib, stdenv, fetchFromGitHub
, bash, python3, yosys
, yices, boolector, z3, aiger
}:
stdenv.mkDerivation {
pname = "symbiyosys";
version = "2021.11.30";
src = fetchFromGitHub {
owner = "YosysHQ";
repo = "SymbiYosys";
rev = "b409b1179e36d2a3fff66c85b7d4e271769a2d9e";
hash = "sha256-S7of2upntiMkSdh4kf1RsrjriS31Eh8iEcVvG36isQg=";
};
buildInputs = [ ];
patchPhase = ''
patchShebangs .
# Fix up Yosys imports
substituteInPlace sbysrc/sby.py \
--replace "##yosys-sys-path##" \
"sys.path += [p + \"/share/yosys/python3/\" for p in [\"$out\", \"${yosys}\"]]"
# Fix various executable references
substituteInPlace sbysrc/sby_core.py \
--replace '"/usr/bin/env", "bash"' '"${bash}/bin/bash"' \
--replace ', "btormc"' ', "${boolector}/bin/btormc"' \
--replace ', "aigbmc"' ', "${aiger}/bin/aigbmc"'
substituteInPlace sbysrc/sby_core.py \
--replace '##yosys-program-prefix##' '"${yosys}/bin/"'
substituteInPlace sbysrc/sby.py \
--replace '/usr/bin/env python3' '${python3}/bin/python'
'';
buildPhase = "true";
installPhase = ''
mkdir -p $out/bin $out/share/yosys/python3
cp sbysrc/sby_*.py $out/share/yosys/python3/
cp sbysrc/sby.py $out/bin/sby
chmod +x $out/bin/sby
'';
doCheck = false; # not all provers are yet packaged...
nativeCheckInputs = [ python3 yosys boolector yices z3 aiger ];
checkPhase = "make test";
meta = {
description = "Tooling for Yosys-based verification flows";
homepage = "https://symbiyosys.readthedocs.io/";
license = lib.licenses.isc;
maintainers = with lib.maintainers; [ thoughtpolice ];
mainProgram = "sby";
platforms = lib.platforms.all;
};
}

View File

@ -0,0 +1,106 @@
{
lib,
stdenv,
fetchFromGitHub,
bash,
python3,
yosys,
yices,
boolector,
z3,
aiger,
python3Packages,
nix-update-script,
}:
let
pythonEnv = python3.withPackages (ps: with ps; [ click ]);
in
stdenv.mkDerivation rec {
pname = "sby";
version = "0.44";
src = fetchFromGitHub {
owner = "YosysHQ";
repo = "sby";
rev = "yosys-${version}";
hash = "sha256-/oDbbdZuWPdg0Xrh+c4i283vML9QTfyWVu8kryb4WaE=";
};
nativeBuildInputs = [ bash ];
buildInputs = [
pythonEnv
yosys
boolector
yices
z3
aiger
];
patchPhase = ''
patchShebangs .
# Fix up Yosys imports
substituteInPlace sbysrc/sby.py \
--replace "##yosys-sys-path##" \
"sys.path += [p + \"/share/yosys/python3/\" for p in [\"$out\", \"${yosys}\"]]"
# Fix various executable references
substituteInPlace sbysrc/sby_core.py \
--replace '"/usr/bin/env", "bash"' '"${bash}/bin/bash"' \
--replace ', "btormc"' ', "${boolector}/bin/btormc"' \
--replace ', "aigbmc"' ', "${aiger}/bin/aigbmc"'
substituteInPlace sbysrc/sby_core.py \
--replace '##yosys-program-prefix##' '"${yosys}/bin/"'
substituteInPlace sbysrc/sby.py \
--replace '/usr/bin/env python3' '${pythonEnv}/bin/python'
'';
buildPhase = "true";
installPhase = ''
mkdir -p $out/bin $out/share/yosys/python3
cp sbysrc/sby_*.py $out/share/yosys/python3/
cp sbysrc/sby.py $out/bin/sby
chmod +x $out/bin/sby
'';
doCheck = true;
nativeCheckInputs = [
pythonEnv
yosys
boolector
yices
z3
aiger
];
checkPhase = ''
runHook preCheck
make test
runHook postCheck
'';
passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"yosys-([0-9].*)"
];
};
meta = {
description = "SymbiYosys (sby) -- Front-end for Yosys-based formal verification flows";
homepage = "https://symbiyosys.readthedocs.io/";
license = lib.licenses.isc;
maintainers = with lib.maintainers; [
thoughtpolice
rcoeurjoly
];
mainProgram = "sby";
platforms = lib.platforms.all;
};
}

View File

@ -13,7 +13,7 @@
# for tests
pytestCheckHook,
symbiyosys,
sby,
yices,
yosys,
}:
@ -47,7 +47,7 @@ buildPythonPackage rec {
nativeCheckInputs = [
pytestCheckHook
symbiyosys
sby
yices
yosys
];

View File

@ -1432,6 +1432,7 @@ mapAliases ({
swift-im = throw "swift-im has been removed as it is unmaintained and depends on deprecated Python 2 / Qt WebKit"; # Added 2023-01-06
swtpm-tpm2 = swtpm; # Added 2021-02-26
Sylk = sylk; # Added 2024-06-12
symbiyosys = sby; # Added 2024-08-18
syncthing-cli = syncthing; # Added 2021-04-06
syncthingtray-qt6 = syncthingtray; # Added 2024-03-06

View File

@ -37659,8 +37659,6 @@ with pkgs;
bitwuzla = callPackage ../applications/science/logic/bitwuzla { };
symbiyosys = callPackage ../applications/science/logic/symbiyosys { };
symfpu = callPackage ../applications/science/logic/symfpu { };
uhdm = callPackage ../applications/science/logic/uhdm { };