Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nix] set enableCover option to control output vdb
Browse files Browse the repository at this point in the history
Clo91eaf authored and Avimitin committed Oct 6, 2024

Verified

This commit was signed with the committer’s verified signature.
Avimitin Jiongjia Lu
1 parent a5c9c81 commit 6946986
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
@@ -21,6 +21,7 @@ stdenv.mkDerivation rec {
# require license
__noChroot = true;
dontPatchELF = true;
enableCover = true;

src = rtl;

@@ -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"
@@ -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;

@@ -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
2 changes: 1 addition & 1 deletion script/emu/src/Main.scala
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6946986

Please sign in to comment.