From ed25d58982a66df5219eeee3609284e1c992318d Mon Sep 17 00:00:00 2001 From: Shupei Fan Date: Wed, 30 Oct 2024 08:45:45 +0000 Subject: [PATCH] [nix] add vcs-prof-vcd derivation --- nix/t1/run/default.nix | 2 ++ nix/t1/run/run-fsdb2vcd.nix | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 nix/t1/run/run-fsdb2vcd.nix diff --git a/nix/t1/run/default.nix b/nix/t1/run/default.nix index 252f08574..922dbf02c 100644 --- a/nix/t1/run/default.nix +++ b/nix/t1/run/default.nix @@ -12,6 +12,7 @@ let runVerilatorEmu = callPackage ./run-verilator-emu.nix { }; runVCSEmu = callPackage ./run-vcs-emu.nix { }; + runFsdb2vcd = callPackage ./run-fsdb2vcd.nix { }; # cases is now { mlir = { hello = ...; ... }; ... } emuAttrs = lib.pipe cases [ @@ -32,6 +33,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-prof-vcd = runFsdb2vcd (runVCSEmu vcs-emu-trace case); }; in # Now we have { caseName = "hello", case = } diff --git a/nix/t1/run/run-fsdb2vcd.nix b/nix/t1/run/run-fsdb2vcd.nix new file mode 100644 index 000000000..2ea642597 --- /dev/null +++ b/nix/t1/run/run-fsdb2vcd.nix @@ -0,0 +1,22 @@ +{ lib, stdenvNoCC, vcs-fhs-env }: +vcs-emu-trace: + +let + caseName = vcs-emu-trace.caseName; +in +stdenvNoCC.mkDerivation (finalAttr: { + name = "${caseName}-vcs-prof-vcd"; + + __noChroot = true; + + dontUnpack = true; + + buildCommand = '' + mkdir -p "$out" + + fhsEnv="${vcs-fhs-env}/bin/vcs-fhs-env" + "$fhsEnv" -c "fsdb2vcd ${vcs-emu-trace}/*.fsdb -o ${caseName}.prof.vcd -s /TestBench/verification/profData" + + cp -t "$out" "${caseName}.prof.vcd" + ''; +})