Skip to content

Commit

Permalink
[nix] switch to use dpi_t1rocket
Browse files Browse the repository at this point in the history
  • Loading branch information
FanShupei authored and sequencer committed Aug 29, 2024
1 parent a813d81 commit 17f2b23
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
43 changes: 43 additions & 0 deletions difftest/vcs_t1rocket.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{ lib
, libspike
, libspike_interfaces
, rustPlatform
, rtlDesignMetadata
, enable-trace ? false
}:

rustPlatform.buildRustPackage {
name = "vcs-dpi-lib";
src = with lib.fileset; toSource {
root = ./.;
fileset = unions [
./spike_rs
./offline
./dpi_common
./dpi_t1
./dpi_t1rocket
./test_common
./Cargo.lock
./Cargo.toml
];
};

buildFeatures = ["dpi_common/vcs"] ++ lib.optionals enable-trace [ "dpi_common/trace" ];
buildAndTestSubdir = "./dpi_t1rocket";

env = {
SPIKE_LIB_DIR = "${libspike}/lib";
SPIKE_INTERFACES_LIB_DIR = "${libspike_interfaces}/lib";
DESIGN_VLEN = rtlDesignMetadata.vlen;
DESIGN_DLEN = rtlDesignMetadata.dlen;
SPIKE_ISA_STRING = rtlDesignMetadata.march;
};

cargoLock = {
lockFile = ./Cargo.lock;
};

passthru = {
inherit enable-trace;
};
}
5 changes: 4 additions & 1 deletion t1rocketemu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
verilator-emu-trace = scope.callPackage ./nix/verilator.nix { verilated-c-lib = scope.verilated-c-lib-trace; };

vcs-rust-package = scope.callPackage ./online_vcs { };
inherit (scope.vcs-rust-package) vcs-dpi-lib vcs-dpi-lib-trace vcs-offline-checker;
inherit (scope.vcs-rust-package) vcs-offline-checker;

vcs-dpi-lib = scope.callPackage ../difftest/vcs_t1rocket.nix { };
vcs-dpi-lib-trace = scope.vcs-dpi-lib.override { enable-trace = true; };

vcs-emu = scope.callPackage ./nix/vcs.nix { };
vcs-emu-trace = scope.callPackage ./nix/vcs.nix { vcs-dpi-lib = scope.vcs-dpi-lib-trace; };
Expand Down
6 changes: 2 additions & 4 deletions t1rocketemu/nix/run-vcs-emulation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ stdenvNoCC.mkDerivation (finalAttr: {
mkdir -p "$out"
emuDriverArgsArray=(
"--elf-file"
"${testCase}/bin/${testCase.pname}.elf"
${lib.optionalString emulator.enable-trace "--wave-path"}
${lib.optionalString emulator.enable-trace "${testCase.pname}.fsdb"}
"+t1_elf_file=${testCase}/bin/${testCase.pname}.elf"
${lib.optionalString emulator.enable-trace "+t1_wave_path=${testCase.pname}.fsdb"}
)
emuDriverArgs="''${emuDriverArgsArray[@]}"
emuDriver="${emulator}/bin/t1-vcs-simulator"
Expand Down
2 changes: 1 addition & 1 deletion t1rocketemu/nix/vcs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let
-debug_access+pp+dmptf+thread \
-kdb=common_elab,hgldd_all''} \
-file filelist.f \
${vcs-dpi-lib}/lib/libdpi.a \
${vcs-dpi-lib}/lib/libdpi_t1rocket.a \
-o t1-vcs-simulator
runHook postBuild
Expand Down

0 comments on commit 17f2b23

Please sign in to comment.