Skip to content

Commit

Permalink
[nix] draft vcs linking
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Jul 21, 2024
1 parent 6b3fd7e commit 8bc8b33
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
65 changes: 65 additions & 0 deletions difftest/vcs-emu.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{ lib
, callPackage
, elaborateConfig

, rustPlatform

, rust-analyzer
, rust-bindgen

, vcs-lib

, cmake
, clang-tools
}:

let
spike_interfaces = callPackage ./spike_interfaces { };

self = rustPlatform.buildRustPackage {
name = "t1-vcs-emu";
src = with lib.fileset; toSource {
root = ./.;
fileset = unions [
./spike_rs
./offline
./online_dpi
./online_vcs
./test_common
./Cargo.lock
./Cargo.toml
];
};

buildInputs = [
spike_interfaces
vcs-lib
];

buildFeatures = lib.optionals vcs-lib.enable-trace [ "trace" ];

env = {
VCS_LIB_DIR = "${vcs-lib}/lib";
DESIGN_VLEN = elaborateConfig.parameter.vLen;
DESIGN_DLEN = elaborateConfig.parameter.dLen;
};

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

dontUseCmakeConfigure = true;

passthru = {
devShell = self.overrideAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
rust-analyzer
rust-bindgen
clang-tools
];
});
inherit spike_interfaces;
};
};
in
self
4 changes: 2 additions & 2 deletions nix/t1/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ lib.makeScope newScope
};
vcs-emu-compiled = innerSelf.callPackage ./vcs.nix { rtl = vcs-emu-rtl; };
vcs-emu-compiled-trace = innerSelf.callPackage ./vcs.nix { rtl = vcs-emu-rtl; enable-trace = true; };
vcs-emu = innerSelf.callPackage ../../difftest/default.nix { vcs-lib = vcs-emu-compiled; };
vcs-emu-trace = innerSelf.callPackage ../../difftest/default.nix { vcs-lib = vcs-emu-compiled-trace; };
vcs-emu = innerSelf.callPackage ../../difftest/vcs-emu.nix { vcs-lib = vcs-emu-compiled; };
vcs-emu-trace = innerSelf.callPackage ../../difftest/vcs-emu.nix { vcs-lib = vcs-emu-compiled-trace; };
};

subsystem = rec {
Expand Down

0 comments on commit 8bc8b33

Please sign in to comment.