Skip to content

Commit 2cb1030

Browse files
committed
Environment settings script
1 parent fcddcb7 commit 2cb1030

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

docs/source/intro.rst

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ To build an FPGA, run the following commands:
3939
.. code-block:: bash
4040
4141
cd /path/to/prga/ # cd to the root
42+
source envscr/settings.sh # set up the environment
4243
cd examples/fpga/tiny/k4_N2_8x8 # choose one FPGA building example
4344
make # build the FPGA!
4445
@@ -48,5 +49,6 @@ following commands:
4849
.. code-block:: bash
4950
5051
cd /path/to/prga/ # cd to the root
52+
source envscr/settings.sh # set up the environment
5153
cd examples/target/bcd2bin/tiny_k4_N2_8x8 # choose one design and one FPGA
5254
make # run all the way to verification

envscr/settings.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
function find_binary() {
2+
binary="$1"
3+
shift
4+
$binary -h 2>&1 >/dev/null
5+
if [ "$?" != 0 ]; then
6+
echo "[Error] Binary not found: $binary"
7+
echo $@
8+
return 1
9+
fi
10+
return 0
11+
}
12+
13+
find_binary vpr "Check out VPR from " \
14+
"https://github.com/verilog-to-routing/vtr-verilog-to-routing, " \
15+
"compile it and find 'vpr' under \$VTR_ROOT/vpr/"
16+
if [ "$?" != 0 ]; then exit 1; fi
17+
18+
find_binary genfasm "Check out VPR from " \
19+
"https://github.com/verilog-to-routing/vtr-verilog-to-routing, " \
20+
"compile it and find 'genfasm' under \$VTR_ROOT/build/utils/fasm/"
21+
if [ "$?" != 0 ]; then exit 1; fi
22+
23+
find_binary "yosys" "Check out Yosys from " \
24+
"http://www.clifford.at/yosys/, compile and install it"
25+
if [ "$?" != 0 ]; then exit 1; fi
26+
27+
rm vpr_stdout.log
28+
29+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. >/dev/null && pwd )"
30+
export PRGA_ROOT=$DIR
31+
if [[ ":$PYTHONPATH:" != *":$DIR/prga.py:"* ]]; then
32+
export PYTHONPATH="$DIR/prga.py${PYTHONPATH:+":$PYTHONPATH"}"
33+
fi

0 commit comments

Comments
 (0)