-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nix] refactor nix for vcs+verilator emulator
- Loading branch information
Showing
11 changed files
with
235 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{ buildFHSEnv | ||
, vcStaticHome | ||
, snpslmdLicenseFile | ||
}: | ||
buildFHSEnv { | ||
name = "vcs-fhs-env"; | ||
|
||
profile = '' | ||
[ ! -e "${vcStaticHome}" ] && echo "env VC_STATIC_HOME not set" && exit 1 | ||
[ ! -d "${vcStaticHome}" ] && echo "VC_STATIC_HOME not accessible" && exit 1 | ||
[ -z "${snpslmdLicenseFile}" ] && echo "env SNPS LICENSE not set" && exit 1 | ||
export VC_STATIC_HOME=${vcStaticHome} | ||
export TCL_TZ=UTC | ||
export VC_STATIC_HOME=$VC_STATIC_HOME | ||
export VCS_HOME=$VC_STATIC_HOME/vcs-mx | ||
export VCS_TARGET_ARCH=amd64 | ||
export VCS_ARCH_OVERRIDE=linux | ||
export VERDI_HOME=$VC_STATIC_HOME/verdi | ||
export NOVAS_HOME=$VC_STATIC_HOME/verdi | ||
export SPYGLASS_HOME=$VC_STATIC_HOME/SG_COMPAT/SPYGLASS_HOME | ||
export SNPS_VERDI_CBUG_LCA=1 | ||
export SNPSLMD_LICENSE_FILE=${snpslmdLicenseFile} | ||
export PATH=$VC_STATIC_HOME/bin:$PATH | ||
export PATH=$VC_STATIC_HOME/verdi/bin:$PATH | ||
export PATH=$VC_STATIC_HOME/vcs-mx/bin:$PATH | ||
export PATH=$VC_STATIC_HOME/SG_COMPAT/SPYGLASS_HOME/bin:$PATH | ||
export LD_LIBRARY_PATH=/usr/lib64/ | ||
export LD_LIBRARY_PATH=$VC_STATIC_HOME/verdi/share/PLI/lib/LINUX64:$LD_LIBRARY_PATH | ||
export LD_LIBRARY_PATH=$VC_STATIC_HOME/verdi/share/NPI/lib/LINUX64:$LD_LIBRARY_PATH | ||
export _oldVcsEnvPath="$PATH" | ||
preHook() { | ||
PATH="$PATH:$_oldVcsEnvPath" | ||
} | ||
export -f preHook | ||
''; | ||
targetPkgs = (ps: with ps; [ | ||
libGL | ||
util-linux | ||
libxcrypt-legacy | ||
coreutils-full | ||
ncurses5 | ||
gmp5 | ||
bzip2 | ||
glib | ||
bc | ||
time | ||
elfutils | ||
ncurses5 | ||
e2fsprogs | ||
cyrus_sasl | ||
expat | ||
sqlite | ||
nssmdns | ||
(libkrb5.overrideAttrs rec { | ||
version = "1.18.2"; | ||
src = fetchurl { | ||
url = "https://kerberos.org/dist/krb5/${lib.versions.majorMinor version}/krb5-${version}.tar.gz"; | ||
hash = "sha256-xuTJ7BqYFBw/XWbd8aE1VJBQyfq06aRiDumyIIWHOuA="; | ||
}; | ||
sourceRoot = "krb5-${version}/src"; | ||
}) | ||
(gnugrep.overrideAttrs rec { | ||
version = "3.1"; | ||
doCheck = false; | ||
src = fetchurl { | ||
url = "mirror://gnu/grep/grep-${version}.tar.xz"; | ||
hash = "sha256-22JcerO7PudXs5JqXPqNnhw5ka0kcHqD3eil7yv3oH4="; | ||
}; | ||
}) | ||
keyutils | ||
graphite2 | ||
libpulseaudio | ||
libxml2 | ||
gcc | ||
gnumake | ||
xorg.libX11 | ||
xorg.libXft | ||
xorg.libXScrnSaver | ||
xorg.libXext | ||
xorg.libxcb | ||
xorg.libXau | ||
xorg.libXrender | ||
xorg.libXcomposite | ||
xorg.libXi | ||
zlib | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ lib | ||
, bash | ||
, stdenv | ||
, configName | ||
, rtl | ||
, vcs-dpi-lib | ||
, vcs-fhs-env | ||
}: | ||
|
||
stdenv.mkDerivation { | ||
name = "${configName}-vcs"; | ||
|
||
# require license | ||
__noChroot = true; | ||
dontPatchELF = true; | ||
|
||
src = rtl; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
echo "[nix] running VCS" | ||
fhsBash=${vcs-fhs-env}/bin/vcs-fhs-env | ||
VERDI_HOME=$("$fhsBash" -c "printenv VERDI_HOME") | ||
"$fhsBash" vcs \ | ||
-sverilog \ | ||
-full64 \ | ||
-timescale=1ns/1ps \ | ||
-P $VERDI_HOME/share/PLI/VCS/LINUX64/novas.tab $VERDI_HOME/share/PLI/VCS/LINUX64/pli.a \ | ||
${lib.optionalString vcs-dpi-lib.enable-trace '' | ||
-debug_access+pp+dmptf+thread \ | ||
-kdb=common_elab,hgldd_all''} \ | ||
-file filelist.f \ | ||
${vcs-dpi-lib}/lib/libdpi.a \ | ||
-o t1-vcs-simulator | ||
runHook postBuild | ||
''; | ||
|
||
passthru = { | ||
inherit (vcs-dpi-lib) enable-trace; | ||
}; | ||
|
||
shellHook = '' | ||
echo "[nix] entering fhs env" | ||
${vcs-fhs-env}/bin/vcs-fhs-env | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/bin $out/lib | ||
cp t1-vcs-simulator $out/lib | ||
cp -r t1-vcs-simulator.daidir $out/lib | ||
# We need to carefully handle string escape here, so don't use makeWrapper | ||
tee $out/bin/t1-vcs-simulator <<EOF | ||
#!${bash}/bin/bash | ||
export LD_LIBRARY_PATH="$out/lib/t1-vcs-simulator.daidir:\$LD_LIBRARY_PATH" | ||
_argv="\$@" | ||
${vcs-fhs-env}/bin/vcs-fhs-env -c "$out/lib/t1-vcs-simulator \$_argv" | ||
EOF | ||
chmod +x $out/bin/t1-vcs-simulator | ||
runHook postInstall | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters