diff --git a/nix/t1/default.nix b/nix/t1/default.nix index 873db7ac3..4812c2aa1 100644 --- a/nix/t1/default.nix +++ b/nix/t1/default.nix @@ -51,7 +51,9 @@ lib.makeScope newScope elaborateConfigJson = configPath; elaborateConfig = builtins.fromJSON (lib.readFile configPath); - cases = innerSelf.callPackage ../../tests { verilator-emu = ip.verilator-emu; verilator-emu-trace = ip.verilator-emu-trace; }; + cases = innerSelf.callPackage ../../tests { + inherit (ip) verilator-emu verilator-emu-trace vcs-emu-trace; + }; # for the convenience to use x86 cases on non-x86 machines, avoiding the extra build time cases-x86 = @@ -117,8 +119,8 @@ lib.makeScope newScope }; vcs-dpi-lib = innerSelf.callPackage ../../difftest/online_vcs { }; vcs-dpi-lib-trace = vcs-dpi-lib.override { enable-trace = true; }; - vcs-emu-compiled = innerSelf.callPackage ./vcs.nix { inherit vcs-dpi-lib; rtl = vcs-emu-rtl; }; - vcs-emu-compiled-trace = innerSelf.callPackage ./vcs.nix { vcs-dpi-lib = vcs-dpi-lib-trace; rtl = vcs-emu-rtl; }; + vcs-emu = innerSelf.callPackage ./vcs.nix { inherit vcs-dpi-lib; rtl = vcs-emu-rtl; }; + vcs-emu-trace = innerSelf.callPackage ./vcs.nix { vcs-dpi-lib = vcs-dpi-lib-trace; rtl = vcs-emu-rtl; }; }; subsystem = rec { diff --git a/nix/t1/vcs.nix b/nix/t1/vcs.nix index d348ec905..c2a681960 100644 --- a/nix/t1/vcs.nix +++ b/nix/t1/vcs.nix @@ -39,6 +39,7 @@ stdenv.mkDerivation { passthru = { inherit (vcs-dpi-lib) enable-trace; + inherit vcs-fhs-env; }; shellHook = '' diff --git a/tests/default.nix b/tests/default.nix index 009a9be32..83e5873ce 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -6,6 +6,7 @@ , runCommand , verilator-emu , verilator-emu-trace +, vcs-emu-trace }: let @@ -20,7 +21,7 @@ let scope = lib.recurseIntoAttrs (lib.makeScope newScope (casesSelf: { recurseForDerivations = true; - inherit verilator-emu verilator-emu-trace; + inherit xLen vLen isFp verilator-emu verilator-emu-trace vcs-emu-trace; makeEmuResult = casesSelf.callPackage ./make-emu-result.nix { }; @@ -48,8 +49,6 @@ let stdenv = rv32-stdenv; - inherit xLen vLen isFp; - mlir = casesSelf.callPackage ./mlir { }; intrinsic = casesSelf.callPackage ./intrinsic { }; asm = casesSelf.callPackage ./asm { }; diff --git a/tests/make-emu-result.nix b/tests/make-emu-result.nix index 129de6c0f..fd0cd9e79 100644 --- a/tests/make-emu-result.nix +++ b/tests/make-emu-result.nix @@ -5,6 +5,7 @@ , zstd , verilator-emu , verilator-emu-trace +, vcs-emu-trace , elaborateConfigJson }: @@ -76,8 +77,9 @@ let ''; passthru.with-trace = self.overrideAttrs (old: { - difftestDriver = "${verilator-emu-trace}/bin/online_drive"; - difftestArgs = old.difftestArgs ++ [ "--wave-path" "${placeholder "out"}/wave.fst" ]; + name = old.name + "-with-trace"; + emuDriver = "${verilator-emu-trace}/bin/online_drive"; + emuDriverArgs = old.emuDriverArgs ++ [ "--wave-path" "${placeholder "out"}/wave.fst" ]; postCheck = '' if [ ! -r "$out/wave.fst" ]; then echo -e "[nix] \033[0;31mInternal Error\033[0m: waveform not found in output" @@ -87,6 +89,7 @@ let }); passthru.with-offline = self.overrideAttrs (old: { + name = old.name + "-with-offline"; preInstall = '' set +e "${verilator-emu}/bin/offline" \ @@ -97,6 +100,31 @@ let set -e ''; }); + + passthru.with-vcs = self.overrideAttrs (old: { + name = old.name + "-with-vcs"; + buildPhase = '' + runHook preBuild + + mkdir -p "$out" + + echo "[nix] Running VCS for ${testCase.pname}" + + RUST_BACKTRACE=full "${vcs-emu-trace}/bin/t1-vcs-simulator" \ + --elf-file ${testCase}/bin/${testCase.pname}.elf \ + --wave-path $out/${testCase.pname}.fsdb \ + 1> /dev/null \ + 2> $out/rtl-event.jsonl + + echo "[nix] VCS emu done" + + runHook postBuild + ''; + + postInstall = '' + mkdir -p "$out"/share + ''; + }); }; in self