HeavyX/cores/vexriscv.nix

29 lines
982 B
Nix
Raw Normal View History

2019-04-05 18:58:11 +08:00
{ runCommand, fetchFromGitHub, makeWrapper, scala-spinalhdl, name, scalaToRun }:
let
vexriscv-src = fetchFromGitHub {
2019-04-28 01:41:57 +08:00
rev = "fa13e46e873c3ec35e5c7c07c320259eda6ef789";
2019-04-05 18:58:11 +08:00
owner = "SpinalHDL";
repo = "VexRiscv";
2019-04-28 01:41:57 +08:00
sha256 = "146m8m00zf7sqhfqg2aybv0m9if3q9asbji0ff0sf4aq652b5b4y";
2019-04-05 18:58:11 +08:00
};
vexriscv-compiled = runCommand "vexriscv-compiled" {}
''
mkdir $out
${scala-spinalhdl}/bin/scalac-spinalhdl -d $out/VexRiscv.jar `find ${vexriscv-src}/src/main/scala -type f`
'';
scala-vexriscv = runCommand "scala-vexriscv" { nativeBuildInputs = [ makeWrapper ]; }
''
mkdir -p $out/bin
makeWrapper ${scala-spinalhdl}/bin/scala-spinalhdl $out/bin/scala-vexriscv --prefix CLASSPATH : ${vexriscv-compiled}/VexRiscv.jar
'';
in
runCommand name {}
''
mkdir $out
cd $out
${scala-vexriscv}/bin/scala-vexriscv ${scalaToRun}
mkdir -p $out/nix-support
echo file verilog $out/VexRiscv.v >> $out/nix-support/hydra-build-products
''