wip
[soc.git] / nix / verilog.nix
1 { version }:
2
3 { stdenv, python3Packages, runCommand, python2, yosys }:
4
5 let
6 # If we use ../. as source, then any change to
7 # any unrelated Nix file would cause a rebuild,
8 # since the build would have access to it.
9 src = runCommand "libresoc-verilog-source" {} ''
10 mkdir $out
11 cp -r ${../src} -T $out/src
12 cp -r ${../mkpinmux.sh} -T $out/mkpinmux.sh
13 cp -r ${../pinmux} -T $out/pinmux
14 cp -r ${../Makefile} -T $out/Makefile
15 '';
16 in
17 stdenv.mkDerivation {
18 pname = "libresoc.v";
19 inherit version src;
20
21 strictDeps = true;
22
23 nativeBuildInputs = (with python3Packages; [
24 c4m-jtag nmigen-soc python libresoc-ieee754fpu libresoc-openpower-isa
25 ]) ++ [ yosys ];
26
27 configurePhase = "true";
28
29 buildPhase = ''
30 runHook preBuild
31 env -C pinmux ${python2}/bin/python src/pinmux_generator.py -v -s ls180 -o ls180
32 cp pinmux/ls180/ls180_pins.py src/soc/debug
33 cp pinmux/ls180/ls180_pins.py src/soc/litex/florent/libresoc
34 cd src
35 export PYTHONPATH="$PWD:$PYTHONPATH"
36 python3 soc/simple/issuer_verilog.py \
37 --debug=jtag --enable-core --enable-pll \
38 --enable-xics --enable-sram4x4kblock --disable-svp64 \
39 libresoc.v
40 runHook postBuild
41 '';
42
43 installPhase = ''
44 runHook preInstall
45 mv libresoc.v $out
46 runHook postInstall
47 '';
48
49 fixupPhase = "true";
50 }