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 9c96cb3 commit 7978a65
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion difftest/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
, rust-bindgen

, verilator
, verilated
, verilated ? null

, vcs-lib ? null

, cmake
, clang-tools
}:
Expand All @@ -35,6 +38,7 @@ let
buildInputs = [
spike_interfaces
verilated
vcs-lib
];

nativeBuildInputs = [
Expand All @@ -43,10 +47,12 @@ let
];

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

env = {
VERILATED_INC_DIR = "${verilated}/include";
VERILATED_LIB_DIR = "${verilated}/lib";
VCS_LIB_DIR = "${vcs-lib}/lib";
DESIGN_VLEN = elaborateConfig.parameter.vLen;
DESIGN_DLEN = elaborateConfig.parameter.dLen;
};
Expand Down
2 changes: 2 additions & 0 deletions difftest/online_vcs/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
fn main() {
let vcs_lib_dir = env::var("VCS_LIB_DIR").unwrap();
println!("cargo:rustc-link-search=native={}", Path::new(&vcs_lib_dir).join("lib").display());
println!("cargo::rustc-link-lib=TestBench");
}
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 { verilated = vcs-emu-compiled; };
vcs-emu-trace = innerSelf.callPackage ../../difftest/default.nix { verilated = vcs-emu-compiled-trace; };
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; };
};

subsystem = rec {
Expand Down

0 comments on commit 7978a65

Please sign in to comment.