-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nix] refactor test case to allow t1rocket attr opt-in
Signed-off-by: Avimitin <[email protected]>
- Loading branch information
Showing
15 changed files
with
278 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,18 @@ | ||
{ lib | ||
, newScope | ||
, rustPlatform | ||
, zlib | ||
, libspike | ||
, libspike_interfaces | ||
, cmake | ||
, verilator | ||
}: | ||
lib.makeScope newScope (scope: rec { | ||
lib.makeScope newScope (scope: { | ||
mlirbc = scope.callPackage ./nix/mlirbc.nix { }; | ||
rtl = scope.callPackage ./nix/rtl.nix { }; | ||
verilated-c-lib = scope.callPackage ./nix/verilated-c-lib.nix { }; | ||
|
||
emu = rustPlatform.buildRustPackage { | ||
name = "t1rocketemu"; | ||
|
||
src = with lib.fileset; toSource { | ||
root = ./.; | ||
fileset = unions [ | ||
./test_common | ||
./spike_rs | ||
./offline | ||
./online_dpi | ||
./online_drive | ||
./online_vcs | ||
./Cargo.lock | ||
./Cargo.toml | ||
]; | ||
emu = scope.callPackage ./emu.nix { }; | ||
designConfig = with builtins; (fromJSON (readFile ./configs/default.json)).parameter; | ||
cases = scope.callPackage ../tests { | ||
configName = "t1rocket"; | ||
t1rocket-emu = scope.emu; | ||
rtlDesignMetadata = { | ||
march = "rv32iafcv_zve32x_zvl1024b"; | ||
dlen = scope.designConfig.dLen; | ||
}; | ||
|
||
buildInputs = [ | ||
zlib | ||
libspike_interfaces | ||
verilated-c-lib | ||
]; | ||
|
||
nativeBuildInputs = [ | ||
verilator | ||
cmake | ||
]; | ||
|
||
# FIXME: can we hack this into derivations, so that we don't need to specify library dir explicitly? | ||
env = | ||
let | ||
toLib = drv: "${drv}/lib"; | ||
in | ||
{ | ||
SPIKE_LIB_DIR = toLib libspike; | ||
SPIKE_INTERFACES_LIB_DIR = toLib libspike_interfaces; | ||
VERILATED_INC_DIR = "${verilated-c-lib}/include"; | ||
VERILATED_LIB_DIR = "${verilated-c-lib}/lib"; | ||
}; | ||
|
||
cargoLock = { | ||
lockFile = ./Cargo.lock; | ||
}; | ||
|
||
outputs = [ "out" "driver" "offline" ]; | ||
|
||
postInstall = '' | ||
mkdir -p $driver/bin $offline/bin | ||
ln -s $out/bin/driver $driver/bin/driver | ||
ln -s $out/bin/offline $driver/bin/offline | ||
''; | ||
}; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ lib | ||
, rustPlatform | ||
, zlib | ||
, libspike | ||
, libspike_interfaces | ||
, cmake | ||
, verilator | ||
, verilated-c-lib | ||
}: | ||
rustPlatform.buildRustPackage { | ||
name = "t1rocketemu"; | ||
|
||
src = with lib.fileset; toSource { | ||
root = ./.; | ||
fileset = unions [ | ||
./test_common | ||
./spike_rs | ||
./offline | ||
./online_dpi | ||
./online_drive | ||
./online_vcs | ||
./Cargo.lock | ||
./Cargo.toml | ||
]; | ||
}; | ||
|
||
buildInputs = [ | ||
zlib | ||
libspike_interfaces | ||
verilated-c-lib | ||
]; | ||
|
||
nativeBuildInputs = [ | ||
verilator | ||
cmake | ||
]; | ||
|
||
# FIXME: can we hack this into derivations, so that we don't need to specify library dir explicitly? | ||
env = | ||
let | ||
toLib = drv: "${drv}/lib"; | ||
in | ||
{ | ||
SPIKE_LIB_DIR = toLib libspike; | ||
SPIKE_INTERFACES_LIB_DIR = toLib libspike_interfaces; | ||
VERILATED_INC_DIR = "${verilated-c-lib}/include"; | ||
VERILATED_LIB_DIR = "${verilated-c-lib}/lib"; | ||
}; | ||
|
||
cargoLock = { | ||
lockFile = ./Cargo.lock; | ||
}; | ||
|
||
outputs = [ "out" "driver" "offline" ]; | ||
|
||
postInstall = '' | ||
mkdir -p $driver/bin $offline/bin | ||
ln -s $out/bin/driver $driver/bin/driver | ||
ln -s $out/bin/offline $driver/bin/offline | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.