Skip to content

Commit

Permalink
[nix] add 'dev-mode' into nix
Browse files Browse the repository at this point in the history
It is incovenient for users to always input strings like
".#t1.blastoise.ip.cases.mlir.hello.emu-result". So here is an env to
help improve the current situation. With the "dev-mode" shell, users
will have many bash function to help them set the current development "mode".

For example, if users want to test "intrinsic.linear_optimisation" with VCS emulator,
and compare the result with verilator-emulator,
they will have to write "nix build
.#t1.blastoise.ip.vcs-emu.cases.intrinsic.linear_optimisation",
then ".#t1.blastoise.ip.verilator-emu.cases.intrinsic.linear_optimisation"

With the new script, the test flow is separate into different phrases:

* Firstly, get into the dev-mode shell: `nix develop .#dev-mode`
* Then, set the config: `set_config blastoise`
* Users can inspect RTL with simple command too: `build vcs-emu-rtl`
* To switch between verilator and VCS, they can use: `set_emulator
  vcs-emu` or `set_emulator verilator-emu`
* Finally, run the case: `test intrinsic.linear_optimisation`

Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin authored and qinjun-li committed Aug 24, 2024
1 parent 6e3748a commit 0ffeb0f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nix/pkgs/dev-mode/dev-mode.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export TMPDIR=/tmp

# prefer terminal safe colored and bold text when tput is supported
if tput setaf 0 &>/dev/null; then
ALL_OFF="$(tput sgr0)"
Expand Down Expand Up @@ -210,8 +212,14 @@ test() {
return 1
fi

DEBUG=${DEBUG:-0}
caseAttr=".#t1.$_CFG.ip.$_EMU.cases.$case.emu-result"
if (( DEBUG )); then
caseAttr="$caseAttr.debug"
fi

info "Running test case $case with emulator $_EMU, output result to ./result-$case"
nix build --no-warn-dirty --out-link ./result-$case ".#t1.$_CFG.ip.$_EMU.cases.$case.emu-result"
nix build --no-warn-dirty --out-link ./result-$case "$caseAttr" $@
ls -l ./result-$case/
}

Expand Down

0 comments on commit 0ffeb0f

Please sign in to comment.