diff --git a/nix/t1/conversion/chisel-to-mlirbc.nix b/nix/t1/conversion/chisel-to-mlirbc.nix index 04568c69b..46a193586 100644 --- a/nix/t1/conversion/chisel-to-mlirbc.nix +++ b/nix/t1/conversion/chisel-to-mlirbc.nix @@ -22,23 +22,30 @@ stdenvNoCC.mkDerivation { nativeBuildInputs = [ espresso circt ]; - buildCommand = '' - mkdir -p "$out" - + configGenPhase = '' mkdir stage1 && pushd stage1 - elaborateProc="${elaborator}/bin/elaborator ${generatorClassName} ${elaboratorArgs}" - echo "[nix] Generating config with cmd opt: $elaborateProc" - eval "$elaborateProc" + ${elaborator}/bin/elaborator ${generatorClassName} ${elaboratorArgs} + popd + ''; + elaboratePhase = '' mkdir stage2 && pushd stage2 + echo "[nix] Elaborating with generated config" ${elaborator}/bin/elaborator ${generatorClassName} design --parameter ../stage1/*.json + ''; + + buildCommand = '' + mkdir -p "$out" + + echo "[nix] Generating config with cmd opt: $configGenPhase" + eval "$configGenPhase" + + echo "[nix] Elaborate mlirbc with cmd opt: $elaboratePhase" + eval "$elaboratePhase" - # --------------------------------------------------------------------------------- - # Run circt toolchain - # --------------------------------------------------------------------------------- echo "[nix] elaborate finish, parsing output with firtool" firtool *.fir \ --annotation-file *.json \