Skip to content

Commit

Permalink
[nix] add cover flow support, wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf committed Oct 1, 2024
1 parent 0f84e26 commit 5fb42ca
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
10 changes: 8 additions & 2 deletions nix/t1/conversion/sv-to-vcs-simulator.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{ mainProgram
, rtl
, enableTrace ? false
, enableCover ? false
, vcsLinkLibs ? [ ]
}:

Expand Down Expand Up @@ -35,9 +36,14 @@ stdenv.mkDerivation rec {
"+define+T1_ENABLE_TRACE"
"-debug_access+pp+dmptf+thread"
"-kdb=common_elab,hgldd_all"
] ++ [
]
++ lib.optionals (enableCover) [
"-cm_dir"
"/tmp/cm"
"$TMPDIR/cm"
]
++ lib.optionals (!enableCover) [
"-assert"
"disable_cover"
]
++ vcsLinkLibs;

Expand Down
2 changes: 2 additions & 0 deletions nix/t1/run/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
, verilator-emu-trace
, vcs-emu
, vcs-emu-trace
, vcs-emu-trace-cover
, cases
, configName
}:
Expand All @@ -31,6 +32,7 @@ let
verilator-emu-trace = runVerilatorEmu verilator-emu-trace case;
vcs-emu = runVCSEmu vcs-emu case;
vcs-emu-trace = runVCSEmu vcs-emu-trace case;
vcs-emu-trace-cover = runVCSEmu vcs-emu-trace-cover case;
};
in
# Now we have { caseName = "hello", case = <derivation> }
Expand Down
7 changes: 6 additions & 1 deletion nix/t1/run/run-vcs-emu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ emulator:
testCase:

stdenvNoCC.mkDerivation (finalAttr: {
name = "${testCase.pname}-vcs-result" + (lib.optionalString emulator.enableTrace "-trace");
name = "${testCase.pname}-vcs-result" + (lib.optionalString emulator.enableTrace "-trace") + (lib.optionalString emulator.enableCover "-cover");
nativeBuildInputs = [ zstd jq ];
__noChroot = true;

Expand Down Expand Up @@ -82,5 +82,10 @@ stdenvNoCC.mkDerivation (finalAttr: {
cp -v ${testCase.pname}.fsdb "$out"
cp -vr ${emulator}/lib/${emulator.mainProgram}.daidir "$out"
''}
${lib.optionalString emulator.enableCover ''
ls ${TMPDIR}
cp -r ${TMPDIR}/cm.vdb "$out"
''}
'';
})
7 changes: 7 additions & 0 deletions nix/t1/t1.nix
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ lib.mapAttrs
enableTrace = true;
vcsLinkLibs = [ "${ipScope.vcs-dpi-lib-trace}/lib/libdpi_t1.a" ];
};
vcs-emu-trace-cover = t1Scope.sv-to-vcs-simulator {
mainProgram = "t1-vcs-trace-cover-simulator";
rtl = ipScope.emu-rtl;
enableTrace = true;
enableCover = true;
vcsLinkLibs = [ "${ipScope.vcs-dpi-lib-trace}/lib/libdpi_t1.a" ];
};

run = ipScope.callPackage ./run { };
}); # end of ipScope
Expand Down
5 changes: 3 additions & 2 deletions script/emu/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ object Main:
s"No cached emulator selection nor --emu argument was provided"
)

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

val finalConfig = tryRestoreFromCache("config", config)
if finalConfig.isEmpty then
Expand Down Expand Up @@ -225,7 +226,7 @@ object Main:
)

// For vcs trace simulator, we need daidir keep at same directory as the wave.fsdb file
if finalEmuType.get == "vcs-emu-trace" then
if finalEmuType.get == "vcs-emu-trace" || finalEmuType.get == "vcs-emu-trace-cover" then
val libPath = emulator / os.up / os.up / "lib"
val daidirPath =
os.walk(libPath)
Expand Down

0 comments on commit 5fb42ca

Please sign in to comment.