Skip to content

Commit

Permalink
[nix] separate build phase for mlirbc builder
Browse files Browse the repository at this point in the history
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.<config-name>.<top-name>.mlirbc
eval "$configGenPhase"
ls stage1
```

Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin authored and sequencer committed Oct 16, 2024
1 parent 9f4bad7 commit c374efe
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions nix/t1/conversion/chisel-to-mlirbc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit c374efe

Please sign in to comment.