Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to copy example projects #637

Merged
merged 4 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ message.txt
deploy_key
openfpga/openfpga
vpr/vpr

# Ignore temp directories
node_modules
package-lock.json
/_*/
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ RUN npm install @jupyterlab/server-proxy
RUN jupyter serverextension enable --py jupyter_server_proxy
RUN jupyter labextension install @jupyterlab/server-proxy
RUN jupyter lab build
RUN git reset --hard HEAD

# Set up terminal
RUN echo 'export PS1="\[$(tput bold)\]\[\033[38;5;220m\]\u\[$(tput sgr0)\]:\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;14m\]\W\[$(tput sgr0)\]\\$\[$(tput sgr0) \]"' >> ~/.bashrc
RUN mkdir -p .vscode && echo '{"files.associations": {"*.openfpga": "tcl"},"workbench.colorTheme": "Monokai"}' > .vscode/settings.json
RUN echo 'alias codeopen="code-server -r "' >> ~/.bashrc
RUN mkdir -p .vscode && echo '{"files.associations": {"*.openfpga": "shellscript"},"workbench.colorTheme": "Monokai"}' > .vscode/settings.json
8 changes: 5 additions & 3 deletions docs/source/tutorials/getting_started/shell_shortcuts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ Once the ``openfpga.sh`` script is sourced, you can run any following commands d

.. option:: create-task <task_name> <template>

It creates a template project with the task name in the current directory.
There are two templates currently configurate
It creates a template task in the current directory with the given task_name.
the template is an optional argument; there are two templates currently configured
- ``vpr_blif``: A template task for running flow with `.blif` file as an input (VPR + Netlist generation)
- ``yosys_vpr``: A template task for running flow with `.v` file as an input (Synthesis + VPR + Netlist generation)

you can also use this command to copy any example project; use a ``list-tasks`` command to get the list of example projects
for example ``create-task _my_task_copy basic_tests/generate_fabric`` create a copy of the ``basic_tests/generate_fabric`` task in
the current directory with ``_my_task_copy`` name.

.. option:: run-modelsim

Expand Down
16 changes: 13 additions & 3 deletions openfpga.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,20 @@ create-task () {
echo "Task $1 already exists"
return
fi
flow="yosys_vpr"
if [ -z $1 ]; then flow=$2; fi
template="template_tasks/yosys_vpr_template"
if [ ${#2} -ge 1 ]; then
if [[ "$2" == "vpr_blif" ]]; then template="template_tasks/${2}_template/";
elif [[ "$2" == "yosys_vpr" ]]; then template="template_tasks/${2}_template/";
else template="$2"
fi
fi
if [ ! -f $OPENFPGA_PATH/openfpga_flow/tasks/${template}/config/task.conf ]; then
echo "Template project [${template}] does not exist" ; return;
fi
echo "Creating task $1"
echo "Template project ${template}"
mkdir -p $1
cp -r $OPENFPGA_PATH/openfpga_flow/tasks/template_tasks/${flow}_template/* $1/
cp -r $OPENFPGA_PATH/openfpga_flow/tasks/${template}/* $1/
}

run-task () {
Expand Down
4 changes: 4 additions & 0 deletions openfpga_flow/regression_test_scripts/basic_reg_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,7 @@ run-task basic_tests/fix_pins --debug --show_thread_logs
echo -e "Testing project templates";
run-task template_tasks/vpr_blif_template --debug --show_thread_logs
run-task template_tasks/yosys_vpr_template --debug --show_thread_logs

echo -e "Testing create tsk from template and run task"
create-task _task_copy basic_tests/generate_fabric
run-task _task_copy