Skip to content

Commit

Permalink
[nix] add new attribute online-dpi-static-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Avimitin committed Jul 23, 2024
1 parent 6e3e0a0 commit e09e675
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 25 deletions.
63 changes: 39 additions & 24 deletions difftest/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,46 @@
let
spike_interfaces = callPackage ./spike_interfaces { };

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

env = {
VERILATED_INC_DIR = "${verilated}/include";
VERILATED_LIB_DIR = "${verilated}/lib";
SPIKE_LIB_DIR = "${libspike}/lib";
SPIKE_INTERFACES_LIB_DIR = "${spike_interfaces}/lib";
DESIGN_VLEN = elaborateConfig.parameter.vLen;
DESIGN_DLEN = elaborateConfig.parameter.dLen;
};

online-dpi-static-lib = rustPlatform.buildRustPackage {
name = "online-dpi-static-lib";

inherit src env;

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

buildFeatures = [ "svvpi" ];
buildAndTestSubdir = "./online_dpi";
};

self = rustPlatform.buildRustPackage {
name = "verilator-emu" + (lib.optionalString verilated.enable-trace "-trace");
inherit src env;

buildInputs = [
spike_interfaces
verilated
Expand All @@ -46,15 +70,6 @@ let
buildFeatures = lib.optionals verilated.enable-trace [ "trace" ];
buildAndTestSubdir = "./online_drive";

env = {
VERILATED_INC_DIR = "${verilated}/include";
VERILATED_LIB_DIR = "${verilated}/lib";
SPIKE_LIB_DIR = "${libspike}/lib";
SPIKE_INTERFACES_LIB_DIR = "${spike_interfaces}/lib";
DESIGN_VLEN = elaborateConfig.parameter.vLen;
DESIGN_DLEN = elaborateConfig.parameter.dLen;
};

cargoLock = {
lockFile = ./Cargo.lock;
};
Expand All @@ -69,7 +84,7 @@ let
clang-tools
];
});
inherit spike_interfaces;
inherit spike_interfaces online-dpi-static-lib;
};
};
in
Expand Down
1 change: 1 addition & 0 deletions difftest/online_dpi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "online_dpi"
edition = "2021"
version.workspace = true
crate-type = ["staticlib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion nix/t1/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ lib.makeScope newScope
elaborateConfigJson = configPath;
elaborateConfig = builtins.fromJSON (lib.readFile configPath);

cases = innerSelf.callPackage ../../tests { difftest = ip.difftest; difftest-trace = ip.difftest-trace; };
cases = innerSelf.callPackage ../../tests { verilator-emu = ip.verilator-emu; verilator-emu-trace = ip.verilator-emu-trace; };

# for the convenience to use x86 cases on non-x86 machines, avoiding the extra build time
cases-x86 =
Expand Down

0 comments on commit e09e675

Please sign in to comment.