From c374efe1bff9a5e4f623d6829b140146f1a92703 Mon Sep 17 00:00:00 2001 From: Avimitin Date: Wed, 16 Oct 2024 14:36:22 +0800 Subject: [PATCH] [nix] separate build phase for mlirbc builder This commit simplify the process developers should take for debugging elaborator. To get parameter that feeds to elaborator, developer can now run the following command line: ```bash nix develop .#t1...mlirbc eval "$configGenPhase" ls stage1 ``` Signed-off-by: Avimitin --- nix/t1/conversion/chisel-to-mlirbc.nix | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) 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 \