-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a reproducible simulation build
Signed-off-by: Hugo McNally <[email protected]>
- Loading branch information
Showing
2 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,48 @@ | ||
{ | ||
description = "Sonata System"; | ||
inputs = { | ||
lowrisc-nix.url = "github:lowRISC/lowrisc-nix"; | ||
nixpkgs.follows = "lowrisc-nix/nixpkgs"; | ||
flake-utils.follows = "lowrisc-nix/flake-utils"; | ||
}; | ||
outputs = { | ||
self, | ||
nixpkgs, | ||
flake-utils, | ||
lowrisc-nix, | ||
}: let | ||
system_outputs = system: let | ||
sonata_version = "0.0.1"; | ||
|
||
pkgs = import nixpkgs { | ||
inherit system; | ||
}; | ||
lr_pkgs = lowrisc-nix.outputs.packages.${system}; | ||
|
||
sonata-simulator = pkgs.stdenv.mkDerivation { | ||
pname = "sonata-system-simulator"; | ||
version = sonata_version; | ||
src = ./.; | ||
buildInputs = with pkgs; [libelf zlib]; | ||
nativeBuildInputs = [pkgs.python311Packages.pip] ++ (with lr_pkgs; [python_ot verilator_ot]); | ||
buildPhase = '' | ||
HOME=$TMPDIR fusesoc --cores-root=. run \ | ||
--target=sim --tool=verilator --setup \ | ||
--build lowrisc:sonata:system | ||
''; | ||
installPhase = '' | ||
mkdir -p $out/bin/ | ||
cp -r build/lowrisc_sonata_system_0/sim-verilator/Vsonata_system $out/bin/ | ||
''; | ||
}; | ||
in { | ||
formatter = pkgs.alejandra; | ||
devShells.default = pkgs.mkShell { | ||
name = "sonata-system-devshell"; | ||
packages = [pkgs.gtkwave] ++ (with sonata-simulator; buildInputs ++ nativeBuildInputs); | ||
}; | ||
packages = {inherit sonata-simulator;}; | ||
}; | ||
in | ||
flake-utils.lib.eachDefaultSystem system_outputs; | ||
} |