Skip to content

Commit 2b9ed4f

Browse files
committed
[nix] run nixfmt
Signed-off-by: Avimitin <[email protected]>
1 parent 186a7f4 commit 2b9ed4f

File tree

6 files changed

+92
-65
lines changed

6 files changed

+92
-65
lines changed

Diff for: templates/chisel/flake.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
overlays = [ overlay ];
2121
inherit system;
2222
};
23-
in {
23+
in
24+
{
2425
formatter = pkgs.nixpkgs-fmt;
2526
legacyPackages = pkgs;
2627
devShells.default = pkgs.mkShell ({

Diff for: templates/chisel/nix/gcd/default.nix

+46-45
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,57 @@
33

44
{ lib, newScope, }:
55
lib.makeScope newScope (scope:
6-
let
7-
designTarget = "GCD";
8-
tbTarget = "GCDTestBench";
9-
dpiLibName = "gcdemu";
10-
in {
11-
# RTL
12-
gcd-compiled = scope.callPackage ./gcd.nix { target = designTarget; };
13-
elaborate = scope.callPackage ./elaborate.nix {
14-
elaborator = scope.gcd-compiled.elaborator;
15-
};
16-
mlirbc = scope.callPackage ./mlirbc.nix { };
17-
rtl = scope.callPackage ./rtl.nix { };
6+
let
7+
designTarget = "GCD";
8+
tbTarget = "GCDTestBench";
9+
dpiLibName = "gcdemu";
10+
in
11+
{
12+
# RTL
13+
gcd-compiled = scope.callPackage ./gcd.nix { target = designTarget; };
14+
elaborate = scope.callPackage ./elaborate.nix {
15+
elaborator = scope.gcd-compiled.elaborator;
16+
};
17+
mlirbc = scope.callPackage ./mlirbc.nix { };
18+
rtl = scope.callPackage ./rtl.nix { };
1819

19-
# Testbench
20-
tb-compiled = scope.callPackage ./gcd.nix { target = tbTarget; };
21-
tb-elaborate = scope.callPackage ./elaborate.nix {
22-
elaborator = scope.tb-compiled.elaborator;
23-
};
24-
tb-mlirbc =
25-
scope.callPackage ./mlirbc.nix { elaborate = scope.tb-elaborate; };
26-
tb-rtl = scope.callPackage ./rtl.nix { mlirbc = scope.tb-mlirbc; };
27-
tb-dpi-lib = scope.callPackage ./dpi-lib.nix { inherit dpiLibName; };
20+
# Testbench
21+
tb-compiled = scope.callPackage ./gcd.nix { target = tbTarget; };
22+
tb-elaborate = scope.callPackage ./elaborate.nix {
23+
elaborator = scope.tb-compiled.elaborator;
24+
};
25+
tb-mlirbc =
26+
scope.callPackage ./mlirbc.nix { elaborate = scope.tb-elaborate; };
27+
tb-rtl = scope.callPackage ./rtl.nix { mlirbc = scope.tb-mlirbc; };
28+
tb-dpi-lib = scope.callPackage ./dpi-lib.nix { inherit dpiLibName; };
2829

29-
verilated = scope.callPackage ./verilated.nix {
30-
rtl = scope.tb-rtl.override { enable-layers = [ "Verification" ]; };
31-
dpi-lib = scope.tb-dpi-lib;
32-
};
33-
verilated-trace = scope.verilated.override {
34-
dpi-lib = scope.verilated.dpi-lib.override { enable-trace = true; };
30+
verilated = scope.callPackage ./verilated.nix {
31+
rtl = scope.tb-rtl.override { enable-layers = [ "Verification" ]; };
32+
dpi-lib = scope.tb-dpi-lib;
33+
};
34+
verilated-trace = scope.verilated.override {
35+
dpi-lib = scope.verilated.dpi-lib.override { enable-trace = true; };
36+
};
37+
vcs = scope.callPackage ./vcs.nix {
38+
dpi-lib = scope.tb-dpi-lib.override {
39+
sv2023 = false;
40+
vpi = true;
3541
};
36-
vcs = scope.callPackage ./vcs.nix {
37-
dpi-lib = scope.tb-dpi-lib.override {
38-
sv2023 = false;
39-
vpi = true;
40-
};
41-
rtl = scope.tb-rtl.override {
42-
enable-layers =
43-
[ "Verification" "Verification.Assert" "Verification.Cover" ];
44-
};
42+
rtl = scope.tb-rtl.override {
43+
enable-layers =
44+
[ "Verification" "Verification.Assert" "Verification.Cover" ];
4545
};
46-
vcs-trace = scope.vcs.override {
47-
dpi-lib = scope.vcs.dpi-lib.override {
48-
enable-trace = true;
49-
timescale = 1000;
50-
};
46+
};
47+
vcs-trace = scope.vcs.override {
48+
dpi-lib = scope.vcs.dpi-lib.override {
49+
enable-trace = true;
50+
timescale = 1000;
5151
};
52+
};
5253

53-
# TODO: designConfig should be read from OM
54-
tbConfig = with builtins;
55-
fromJSON (readFile ./../../configs/${tbTarget}Main.json);
54+
# TODO: designConfig should be read from OM
55+
tbConfig = with builtins;
56+
fromJSON (readFile ./../../configs/${tbTarget}Main.json);
5657

57-
})
58+
})
5859

Diff for: templates/chisel/nix/gcd/dpi-lib.nix

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# SPDX-FileCopyrightText: 2024 Jiuyang Liu <[email protected]>
33

4-
{ lib, rustPlatform, tbConfig, dpiLibName, sv2023 ? true, vpi ? false
5-
, enable-trace ? false, timescale ? 1 }:
4+
{ lib
5+
, rustPlatform
6+
, tbConfig
7+
, dpiLibName
8+
, sv2023 ? true
9+
, vpi ? false
10+
, enable-trace ? false
11+
, timescale ? 1
12+
}:
613

714
rustPlatform.buildRustPackage rec {
815
name = "dpi-lib";

Diff for: templates/chisel/nix/gcd/gcd.nix

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# SPDX-FileCopyrightText: 2024 Jiuyang Liu <[email protected]>
33

4-
{ lib, stdenv, fetchMillDeps, makeWrapper, jdk21
5-
6-
# chisel deps
7-
, mill, espresso, circt-full, jextract-21, add-determinism
4+
{ lib
5+
, stdenv
6+
, fetchMillDeps
7+
, makeWrapper
8+
, jdk21
9+
10+
# chisel deps
11+
, mill
12+
, espresso
13+
, circt-full
14+
, jextract-21
15+
, add-determinism
816

917
, projectDependencies
1018

11-
, target }:
19+
, target
20+
}:
1221

1322
let
1423
self = stdenv.mkDerivation rec {
@@ -88,4 +97,5 @@ let
8897
--add-flags "--enable-preview -Djava.library.path=${circt-full}/lib -cp $out/share/java/elaborator.jar ${mainClass}"
8998
'';
9099
};
91-
in self
100+
in
101+
self

Diff for: templates/chisel/nix/gcd/rtl.nix

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# SPDX-FileCopyrightText: 2024 Jiuyang Liu <[email protected]>
33

4-
{ lib, stdenvNoCC, circt, mlirbc, mfcArgs ? [
5-
"-O=release"
6-
"--split-verilog"
7-
"--preserve-values=all"
8-
"--lowering-options=verifLabels,omitVersionComment"
9-
"--strip-debug-info"
10-
], enable-layers ? [ ] }:
4+
{ lib
5+
, stdenvNoCC
6+
, circt
7+
, mlirbc
8+
, mfcArgs ? [
9+
"-O=release"
10+
"--split-verilog"
11+
"--preserve-values=all"
12+
"--lowering-options=verifLabels,omitVersionComment"
13+
"--strip-debug-info"
14+
]
15+
, enable-layers ? [ ]
16+
}:
1117
let
1218
processLayer = lib.map (str: "./" + lib.replaceStrings [ "." ] [ "/" ] str);
1319
enableLayersDirs = processLayer enable-layers;
14-
in stdenvNoCC.mkDerivation {
20+
in
21+
stdenvNoCC.mkDerivation {
1522
name = "${mlirbc.name}-rtl";
1623
nativeBuildInputs = [ circt ];
1724

Diff for: templates/chisel/nix/overlay.nix

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44
final: prev: {
55
espresso = final.callPackage ./pkgs/espresso.nix { };
6-
mill = let jre = final.jdk21;
7-
in (prev.mill.override { inherit jre; }).overrideAttrs
8-
(_: { passthru = { inherit jre; }; });
6+
mill =
7+
let jre = final.jdk21;
8+
in (prev.mill.override { inherit jre; }).overrideAttrs
9+
(_: { passthru = { inherit jre; }; });
910
fetchMillDeps = final.callPackage ./pkgs/mill-builder.nix { };
1011
circt-full = final.callPackage ./pkgs/circt-full.nix { };
1112
add-determinism =

0 commit comments

Comments
 (0)