Skip to content

Commit

Permalink
[nix] set enableCover option to control output vdb
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf authored and sequencer committed Oct 7, 2024
1 parent 3408b3e commit ca57058
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions nix/t1/conversion/sv-to-vcs-simulator.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ stdenv.mkDerivation rec {
# require license
__noChroot = true;
dontPatchELF = true;
enableCover = true;

src = rtl;

Expand All @@ -30,6 +31,8 @@ stdenv.mkDerivation rec {
"-timescale=1ns/1ps"
"-file"
"filelist.f"
]
++ lib.optionals (enableCover) [
"-cm"
"line+cond+fsm+tgl+branch+assert"
"-cm_dir"
Expand All @@ -39,6 +42,8 @@ stdenv.mkDerivation rec {
"+define+T1_ENABLE_TRACE"
"-debug_access+pp+dmptf+thread"
"-kdb=common_elab,hgldd_all"
"-assert"
"disable_cover"
]
++ vcsLinkLibs;

Expand Down Expand Up @@ -69,16 +74,21 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin $out/lib
cp $mainProgram $out/lib
cp -r $mainProgram.daidir $out/lib
cp -r ./cm.vdb $out/lib
${lib.optionalString enableCover ''
cp -r ./cm.vdb $out/lib
''}
# We need to carefully handle string escape here, so don't use makeWrapper
tee $out/bin/$mainProgram <<EOF
#!${bash}/bin/bash
export LD_LIBRARY_PATH="$out/lib/$mainProgram.daidir:\$LD_LIBRARY_PATH"
_argv="\$@"
cp -r $out/lib/cm.vdb ./cm.vdb
chmod +w -R ./cm.vdb
${vcs-fhs-env}/bin/vcs-fhs-env -c "$out/lib/$mainProgram -cm_dir ./cm.vdb \$_argv"
${lib.optionalString enableCover ''
cp -r $out/lib/cm.vdb ./cm.vdb
chmod +w -R ./cm.vdb
''}
${vcs-fhs-env}/bin/vcs-fhs-env -c "$out/lib/$mainProgram ${lib.optionalString enableCover ''-cm_dir ./cm.vdb''} \$_argv"
EOF
chmod +x $out/bin/$mainProgram
Expand Down
2 changes: 1 addition & 1 deletion script/emu/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ object Main:
)

val isTrace = finalEmuType.get.contains("-trace")
val isCover = isTrace
val isCover = true

val finalConfig = tryRestoreFromCache("config", config)
if finalConfig.isEmpty then
Expand Down

0 comments on commit ca57058

Please sign in to comment.