diff --git a/nix/t1/conversion/sv-to-vcs-simulator.nix b/nix/t1/conversion/sv-to-vcs-simulator.nix index 1603a8575..25cd6b776 100644 --- a/nix/t1/conversion/sv-to-vcs-simulator.nix +++ b/nix/t1/conversion/sv-to-vcs-simulator.nix @@ -8,6 +8,7 @@ { mainProgram , rtl , enableTrace ? false +, enableCover ? false , vcsLinkLibs ? [ ] }: @@ -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; diff --git a/nix/t1/run/default.nix b/nix/t1/run/default.nix index 2a326d416..b8dd34a52 100644 --- a/nix/t1/run/default.nix +++ b/nix/t1/run/default.nix @@ -5,6 +5,7 @@ , verilator-emu-trace , vcs-emu , vcs-emu-trace +, vcs-emu-trace-cover , cases , configName }: @@ -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 = } diff --git a/nix/t1/run/run-vcs-emu.nix b/nix/t1/run/run-vcs-emu.nix index 8f5e5c039..988d13cea 100644 --- a/nix/t1/run/run-vcs-emu.nix +++ b/nix/t1/run/run-vcs-emu.nix @@ -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; @@ -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" + ''} ''; }) diff --git a/nix/t1/t1.nix b/nix/t1/t1.nix index 3f6daa337..d5c414c2e 100644 --- a/nix/t1/t1.nix +++ b/nix/t1/t1.nix @@ -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 diff --git a/script/emu/src/Main.scala b/script/emu/src/Main.scala index 3a7457300..373d86142 100644 --- a/script/emu/src/Main.scala +++ b/script/emu/src/Main.scala @@ -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 @@ -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)