Skip to content

Commit

Permalink
Environment settings script
Browse files Browse the repository at this point in the history
  • Loading branch information
angl-dev committed Nov 6, 2019
1 parent fcddcb7 commit 2cb1030
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/source/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ To build an FPGA, run the following commands:
.. code-block:: bash
cd /path/to/prga/ # cd to the root
source envscr/settings.sh # set up the environment
cd examples/fpga/tiny/k4_N2_8x8 # choose one FPGA building example
make # build the FPGA!
Expand All @@ -48,5 +49,6 @@ following commands:
.. code-block:: bash
cd /path/to/prga/ # cd to the root
source envscr/settings.sh # set up the environment
cd examples/target/bcd2bin/tiny_k4_N2_8x8 # choose one design and one FPGA
make # run all the way to verification
33 changes: 33 additions & 0 deletions envscr/settings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function find_binary() {
binary="$1"
shift
$binary -h 2>&1 >/dev/null
if [ "$?" != 0 ]; then
echo "[Error] Binary not found: $binary"
echo $@
return 1
fi
return 0
}

find_binary vpr "Check out VPR from " \
"https://github.com/verilog-to-routing/vtr-verilog-to-routing, " \
"compile it and find 'vpr' under \$VTR_ROOT/vpr/"
if [ "$?" != 0 ]; then exit 1; fi

find_binary genfasm "Check out VPR from " \
"https://github.com/verilog-to-routing/vtr-verilog-to-routing, " \
"compile it and find 'genfasm' under \$VTR_ROOT/build/utils/fasm/"
if [ "$?" != 0 ]; then exit 1; fi

find_binary "yosys" "Check out Yosys from " \
"http://www.clifford.at/yosys/, compile and install it"
if [ "$?" != 0 ]; then exit 1; fi

rm vpr_stdout.log

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. >/dev/null && pwd )"
export PRGA_ROOT=$DIR
if [[ ":$PYTHONPATH:" != *":$DIR/prga.py:"* ]]; then
export PYTHONPATH="$DIR/prga.py${PYTHONPATH:+":$PYTHONPATH"}"
fi

0 comments on commit 2cb1030

Please sign in to comment.