-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved installation & bugfixes in prga.py
- Loading branch information
Showing
10 changed files
with
229 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
[submodule "prga.py"] | ||
path = prga.py | ||
url = https://github.com/PrincetonUniversity/prga.py.git | ||
[submodule "vtr"] | ||
path = vtr | ||
url = https://github.com/verilog-to-routing/vtr-verilog-to-routing.git | ||
[submodule "yosys"] | ||
path = yosys | ||
url = https://github.com/YosysHQ/yosys.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/utils/fasm/src/fasm.cpp b/utils/fasm/src/fasm.cpp | ||
index ee7c7cd..ca81beb 100644 | ||
--- a/utils/fasm/src/fasm.cpp | ||
+++ b/utils/fasm/src/fasm.cpp | ||
@@ -603,6 +603,7 @@ void FasmWriterVisitor::walk_routing() { | ||
|
||
for(const auto &trace : route_ctx.trace) { | ||
t_trace *head = trace.head; | ||
+ if (!head) continue; | ||
t_rt_node* root = traceback_to_route_tree(head); | ||
walk_route_tree(root); | ||
free_route_tree(root); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
function err() { | ||
>&2 echo -e "\033[0;31m[ERROR]\033[0m" $@ | ||
exit 1 | ||
} | ||
|
||
function info() { | ||
echo -e "\033[0;34m[INFO]\033[0m" $@ | ||
} | ||
|
||
if [ ! -z "${VIRTUAL_ENV}" ]; then | ||
err "Already in a Python virtualenv" | ||
fi | ||
|
||
CWD=${PWD} | ||
OLD_PATH=$PATH | ||
cd "$( dirname "${BASH_SOURCE[0]}" )"/.. # move to PRGA_ROOT | ||
|
||
# choose the correct binaries | ||
info "Setting \$PATH" | ||
export PATH=${PWD}/local/bin:$PATH | ||
|
||
# activate pyenv | ||
if command -v pyenv 2>&1 >/dev/null; then | ||
info "Active 'pyenv' found. Skipping installation/activation of 'pyenv'" | ||
else | ||
info "Activating 'pyenv'" | ||
export PYENV_ROOT=${PWD}/pyenv | ||
export PATH=${PYENV_ROOT}/bin:$PATH | ||
eval "$( pyenv init - )" | ||
info "'pyenv' activated" | ||
fi | ||
|
||
# activate virtual env | ||
cd prga.py | ||
info "Entering virtual environment ..." | ||
PIPENV_VENV_IN_PROJECT=1 pipenv shell cd ${CWD} | ||
info "Leaving virtual environment ..." | ||
|
||
# roll back to the old state | ||
info "Reverting \$PATH" | ||
export PATH=$OLD_PATH | ||
cd $CWD | ||
|
||
info "Thanks for using PRGA. We look forward to your next use :)" | ||
|
||
# vim: set ft=sh: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Choose your desired compiler | ||
COMP=gcc | ||
MAKE_JOBCOUNT=8 | ||
PYTHON_VERSION=3.7.2 | ||
|
||
# Do not modify below this line | ||
CWD=${PWD} | ||
cd "$( dirname "${BASH_SOURCE[0]}" )"/.. # move to PRGA_ROOT | ||
|
||
trap "cd ${CWD}" EXIT | ||
trap "cd ${CWD}" SIGINT | ||
|
||
function err() { | ||
>&2 echo -e "\033[0;31m[ERROR]\033[0m" $@ | ||
exit 1 | ||
} | ||
|
||
function info() { | ||
echo -e "\033[0;34m[INFO]\033[0m" $@ | ||
} | ||
|
||
# find git | ||
GIT=$( command -v git 2>/dev/null ) | ||
if [ -z "${GIT}" ]; then | ||
err "'git' not found" | ||
fi | ||
info "Using 'git': ${GIT}" | ||
|
||
# find make | ||
MAKE=$( command -v make 2>/dev/null ) | ||
if [ -z "${MAKE}" ]; then | ||
err "'make' not found" | ||
fi | ||
info "Using 'make': ${MAKE}" | ||
|
||
# find cmake | ||
CMAKE=$( command -v cmake3 2>/dev/null ) | ||
if [ -z "${CMAKE}" ]; then | ||
CMAKE=$( command -v cmake 2>/dev/null ) | ||
if [ -z "${CMAKE}" ]; then | ||
err "'cmake' not found" | ||
elif [[ $( ${CMAKE} --version | cut -d " " -f 3 ) != "3"* ]]; then | ||
err "CMake 3.x is required to build VPR" | ||
fi | ||
fi | ||
info "Using 'cmake': ${CMAKE}" | ||
|
||
if [ -z "${COMP}" ]; then | ||
COMP=gcc | ||
fi | ||
|
||
if [ -z "${MAKE_JOBCOUNT}" ]; then | ||
MAKE_JOBCOUNT=8 | ||
fi | ||
|
||
# find C compiler | ||
CC=$( command -v ${COMP} 2>/dev/null ) | ||
if [ -z "${CC}" ]; then | ||
err "'${COMP}' not found" | ||
fi | ||
info "Using '${COMP}': ${CC}" | ||
|
||
# find or install pyenv | ||
if command -v pyenv 2>&1 >/dev/null; then | ||
info "Active 'pyenv' found. Skipping installation/activation of 'pyenv'" | ||
else | ||
if [ ! -f pyenv/bin/pyenv ]; then | ||
info "'pyenv' not found. Installing 'pyenv' locally to ${PWD}/pyenv" | ||
${GIT} clone https://github.com/pyenv/pyenv.git || exit 1 | ||
info "'pyenv' installed locally to ${PWD}/pyenv" | ||
else | ||
info "Locally-installed 'pyenv' found. Skipping installation of 'pyenv'" | ||
fi | ||
|
||
info "Activating locally-installed 'pyenv'" | ||
export PYENV_ROOT=${PWD}/pyenv | ||
export PATH=${PYENV_ROOT}/bin:$PATH | ||
eval "$( pyenv init - )" | ||
info "'pyenv' activated" | ||
fi | ||
|
||
# install the desired python if it's not installed already | ||
if [ -z "${PYTHON_VERSION}" ]; then | ||
PYTHON_VERSION=3.7.2 | ||
fi | ||
info "Installing Python ${PYTHON_VERSION} with 'pyenv'" | ||
pyenv install -s ${PYTHON_VERSION} || exit 1 | ||
info "Python ${PYTHON_VERSION} installed with 'pyenv'" | ||
pyenv local ${PYTHON_VERSION} || exit 1 | ||
if [[ $( python --version | cut -d " " -f 2 ) != "${PYTHON_VERSION}" ]]; then | ||
err "'pyenv' is not choosing the correct Python version" | ||
fi | ||
info "Python ${PYTHON_VERSION} chosen as the local version" | ||
|
||
# install pipenv | ||
if [ -z "$( pip show pipenv 2>&1 >/dev/null )" ]; then | ||
info "'pipenv' already installed. Skipping installation of 'pipenv'" | ||
else | ||
info "Installing 'pipenv'" | ||
pip install pipenv || exit 1 | ||
info "'pipenv' installed" | ||
fi | ||
|
||
# check out submodules | ||
info "Checking out submodules" | ||
${GIT} submodule update --init --recursive || exit 1 | ||
|
||
mkdir -p local | ||
|
||
# build VTR | ||
info "Building VTR" | ||
cd vtr | ||
${GIT} apply ../envscr/69a8e95.patch 2>&1 >/dev/null | ||
${MAKE} -j${MAKE_JOBCOUNT} CMAKE=${CMAKE} || exit 1 | ||
cd .. | ||
info "VTR built successfully" | ||
|
||
# build yosys | ||
info "Building Yosys" | ||
cd yosys | ||
${MAKE} -j${MAKE_JOBCOUNT} CONFIG=${COMP} || exit 1 | ||
${MAKE} install CONFIG=${COMP} PREFIX=${PWD}/../local || exit 1 | ||
cd .. | ||
info "Yosys built successfully" | ||
|
||
# link all binaries | ||
info "Linking binaries to ${PWD}/local/bin" | ||
cd local/bin | ||
ln -s -f ../../vtr/vpr/vpr vpr | ||
ln -s -f ../../vtr/build/utils/fasm/genfasm genfasm | ||
cd ../.. | ||
|
||
# build a virtualenv for prga.py | ||
info "Creating a virtual environment for prga.py" | ||
cd prga.py | ||
PIPENV_VENV_IN_PROJECT=1 pipenv --python ${PYTHON_VERSION} install -e . || exit 1 | ||
cd .. | ||
info "Virtual environment created for prga.py" | ||
|
||
info "Installation finished successfully" | ||
|
||
# vim: set ft=sh: |
This file was deleted.
Oops, something went wrong.
Submodule prga.py
updated
19 files
+2 −0 | .gitignore | |
+28 −25 | prga/algorithm/design/array.py | |
+1 −1 | prga/algorithm/design/tile.py | |
+36 −16 | prga/arch/array/array.py | |
+2 −2 | prga/arch/array/instance.py | |
+8 −1 | prga/arch/array/module.py | |
+1 −1 | prga/arch/array/tile.py | |
+48 −2 | prga/arch/common.py | |
+6 −1 | prga/arch/net/bit.py | |
+5 −2 | prga/arch/switch/switch.py | |
+2 −2 | prga/config/bitchain/design/templates/fraclut6.tmpl.v | |
+2 −2 | prga/config/bitchain/design/templates/fraclut6ff.tmpl.v | |
+2 −2 | prga/config/bitchain/design/templates/fraclut6sffc.tmpl.v | |
+8 −5 | prga/flow/context.py | |
+7 −5 | prga/flow/delegate.py | |
+21 −11 | prga/flow/design.py | |
+10 −1 | prga/flow/util.py | |
+2 −2 | prga/rtlgen/templates/lut.tmpl.v | |
+2 −2 | prga/rtlgen/templates/memory.tmpl.v |