[libre-riscv-dev] bisecting nmigen

Jacob Lifshay programmerjake at gmail.com
Sat Jul 11 01:46:14 BST 2020


I wrote a helper script to look for the nmigen bug. Attaching it as a
txt file in case anyone wants to look at it, adapt it, whatever.
Didn't put it in a git repo since I'm not sure it should be there.
save the attached script as a .sh file, run chmod +x on it, then, from
the nmigen repo, run:
git bisect start
git bisect bad 30e2f91176edcd1c8766c2cb11f413b9c77936b9
git bisect good 303ea18cb60567e45a755c6b6289a601f27d46e6
git bisect run ~/projects/nmigen-bisect-script.sh &> ../nmigen-bisect.log

Jacob
-------------- next part --------------
#!/bin/bash
# this script's license is LGPLv2.1+
dir="$(mktemp -d)"
cd "$dir"
git clone ~/projects/nmigen
git clone ~/projects/nmigen-soc
git clone ~/projects/libreriscv/ieee754fpu
git clone ~/projects/libreriscv/nmutil
git clone ~/projects/libreriscv/soc
pushd soc
git submodule init
git config submodule.libreriscv.url ~/projects/libreriscv/soc/libreriscv
git config submodule.nmigen-type-annotations.url ~/projects/libreriscv/soc/nmigen-type-annotations
git submodule update
popd
python3 -m venv "$dir/venv"
(
    set -e
    . "$dir/venv/bin/activate"
    pushd nmigen
    python setup.py develop
    popd
    pushd nmigen-soc
    python setup.py develop
    popd
    pushd nmutil
    python setup.py develop
    popd
    pushd ieee754fpu
    python setup.py develop
    popd
    pushd soc
    make install
    python <<<"from nmigen.back.pysim import Simulator, Delay, Settle"
    popd
)
status=$?
echo "status: $status"
if ((status != 0)); then
    status=125
else
    (
        . "$dir/venv/bin/activate"
        pushd soc
        timeout --kill-after=5s 30s python src/soc/fu/div/test/test_pipe_caller.py DIVTestCase.test_6_regression -f
    )
    if [[ -s soc/div_simulator.vcd ]]; then
        state="$(~/projects/vcdump/target/debug/vcdump --strings soc/div_simulator.vcd |
            jq '.top.alu.pipe_start.setup_stage.ra')"
        echo "state: $state"
        if [[ "$state" == "" || "$state" == "null" ]]; then
            status=125
        elif [[ "$state" =~ ^([^\"]*'"'[^\"]*'"'[^\"]*)*'"''0'*[^0\"][^\"]*'"' ]]; then
            status=0
        else
            status=1
        fi
    else
        status=125
    fi
fi
echo "status: $status"
cd ~
rm -rf "$dir"
exit $status


More information about the libre-riscv-dev mailing list