forked from chipsalliance/t1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
102 lines (91 loc) · 2.91 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
description = "vector";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }@inputs:
let
overlay = import ./overlay.nix;
in
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; overlays = [ overlay ]; };
commonDeps = with pkgs; [
gnused
coreutils
gnumake
gnugrep
which
parallel
];
chiselDeps = with pkgs; [
mill
espresso
circt
protobuf
antlr4
];
testcaseDeps = with pkgs; [
rv32-clang
glibc_multi
llvmForDev.bintools
go
buddy-mlir
rvv-codegen
];
emulatorDeps = with pkgs; [
cmake
libargs
glog
fmt
(enableDebugging libspike)
jsoncpp.dev
ninja
# for verilator
verilator
zlib
# for CI
ammonite
];
mkLLVMShell = pkgs.mkShell.override { stdenv = pkgs.llvmForDev.stdenv; };
in
{
legacyPackages = pkgs;
devShells = {
chisel = pkgs.mkShell {
buildInputs = commonDeps ++ chiselDeps;
};
# This environment is provided for writing and compiling testcase.
# If you are going to run test cases, use the .#testcase devShell.
testcase-bootstrap = mkLLVMShell {
buildInputs = commonDeps ++ testcaseDeps ++ [ pkgs.ammonite pkgs.mill ];
env = {
CODEGEN_BIN_PATH = "${pkgs.rvv-codegen}/bin/single";
CODEGEN_INC_PATH = "${pkgs.rvv-codegen}/include";
CODEGEN_CFG_PATH = "${pkgs.rvv-codegen}/configs";
};
};
# This devShell is used for running testcase
testcase = mkLLVMShell {
# TODO: Currently, the emulator needs all the dependencies to run a test case ,
# but most of them are used to get version information, so they should be cleaned up one day.
buildInputs = commonDeps ++ chiselDeps ++ testcaseDeps ++ emulatorDeps;
env = {
TEST_CASE_DIR = "${pkgs.rvv-testcase}";
};
};
emulator = mkLLVMShell {
buildInputs = commonDeps ++ emulatorDeps;
};
default = mkLLVMShell {
buildInputs = commonDeps ++ chiselDeps ++ testcaseDeps ++ emulatorDeps;
};
};
# nix build .#testcase
packages.testcase = pkgs.callPackage ./nix/rvv-testcase.nix { };
}
)
// { inherit inputs; overlays.default = overlay; };
}