Skip to content

Commit

Permalink
[nix] use urgReport as vcs-emu-cover's target instead of vdb data
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf committed Dec 6, 2024
1 parent 7fae948 commit fa2d7ef
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
6 changes: 3 additions & 3 deletions nix/t1/run/run-vcs-emu.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenvNoCC, zstd, jq, offline-checker }:
{ lib, stdenvNoCC, zstd, jq, offline-checker, snps-fhs-env }:

{ emulator
, dpilib ? null
Expand Down Expand Up @@ -89,8 +89,8 @@ stdenvNoCC.mkDerivation (finalAttr: {
fi
${lib.optionalString emulator.enableCover ''
cp -v cm.log "$out"
cp -vr cm.vdb "$out"
${snps-fhs-env}/bin/snps-fhs-env -c "urg -dir cm.vdb -format text -metric assert -show summary"
cp -vr urgReport $out/
''}
${lib.optionalString emulator.enableTrace ''
Expand Down
44 changes: 39 additions & 5 deletions script/emu/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,45 @@ object Main:
Logger.info("Driver finished")

if isCover then
if os.exists(os.pwd / "cm.vdb") && os.exists(os.pwd / "cm.log") then
os.move(os.pwd / "cm.vdb", outputPath / "cm.vdb", replaceExisting = true)
os.move(os.pwd / "cm.log", outputPath / "cm.log", replaceExisting = true)
Logger.info(s"Coverage database saved under ${outputPath}/cm.vdb")
else if !finalEmuType.get.startsWith("verilator-emu") then Logger.error("No cm.vdb cm.log found")
if os.exists(os.pwd / "cm.vdb") then
Logger.info(s"Coverage database saved under ${os.pwd}/cm.vdb")

val snpsArgs = Seq(
"nix",
"run",
".#snps-fhs-env",
"--impure",
"--",
)
val urgArgs = Seq(
"urg",
"-dir",
s"${os.pwd}/cm.vdb",
"-format",
"text",
"-metric",
"assert",
"-show",
"summary"
)
Logger.info(s"Starting Urg Report: `${urgArgs.mkString(" ")}`")
val urgProc = os.proc(snpsArgs ++ urgArgs)
.spawn(
stdout = os.Inherit,
stderr = os.Inherit
)
urgProc.join(-1)
if urgProc.exitCode() != 0 then Logger.fatal("urg report run failed")

Logger.info("Urg Report finished")

else if !finalEmuType.get.startsWith("verilator-emu") then Logger.error("No cm.vdb found")


if os.exists(os.pwd / "urgReport") then
os.move(os.pwd / "urgReport", outputPath / "urgReport", replaceExisting = true)
Logger.info(s"Coverage database saved under ${outputPath}/urgReport")
else if !finalEmuType.get.startsWith("verilator-emu") then Logger.error("No urgReport found")

if os.exists(os.pwd / "perf.json") then
os.move(os.pwd / "perf.json", outputPath / "perf.json", replaceExisting = true)
Expand Down

0 comments on commit fa2d7ef

Please sign in to comment.