Skip to content

Commit f046224

Browse files
authored
Merge pull request #637 from lnis-uofu/binder
Added option to copy example projects
2 parents d5716a2 + 53f2335 commit f046224

File tree

5 files changed

+30
-7
lines changed

5 files changed

+30
-7
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ message.txt
4848
deploy_key
4949
openfpga/openfpga
5050
vpr/vpr
51+
52+
# Ignore temp directories
53+
node_modules
54+
package-lock.json
55+
/_*/

Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ RUN npm install @jupyterlab/server-proxy
3535
RUN jupyter serverextension enable --py jupyter_server_proxy
3636
RUN jupyter labextension install @jupyterlab/server-proxy
3737
RUN jupyter lab build
38+
RUN git reset --hard HEAD
3839

3940
# Set up terminal
4041
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
41-
RUN mkdir -p .vscode && echo '{"files.associations": {"*.openfpga": "tcl"},"workbench.colorTheme": "Monokai"}' > .vscode/settings.json
42+
RUN echo 'alias codeopen="code-server -r "' >> ~/.bashrc
43+
RUN mkdir -p .vscode && echo '{"files.associations": {"*.openfpga": "shellscript"},"workbench.colorTheme": "Monokai"}' > .vscode/settings.json

docs/source/tutorials/getting_started/shell_shortcuts.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ Once the ``openfpga.sh`` script is sourced, you can run any following commands d
3030

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

33-
It creates a template project with the task name in the current directory.
34-
There are two templates currently configurate
33+
It creates a template task in the current directory with the given task_name.
34+
the template is an optional argument; there are two templates currently configured
3535
- ``vpr_blif``: A template task for running flow with `.blif` file as an input (VPR + Netlist generation)
3636
- ``yosys_vpr``: A template task for running flow with `.v` file as an input (Synthesis + VPR + Netlist generation)
37-
37+
you can also use this command to copy any example project; use a ``list-tasks`` command to get the list of example projects
38+
for example ``create-task _my_task_copy basic_tests/generate_fabric`` create a copy of the ``basic_tests/generate_fabric`` task in
39+
the current directory with ``_my_task_copy`` name.
3840

3941
.. option:: run-modelsim
4042

openfpga.sh

+13-3
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,20 @@ create-task () {
4040
echo "Task $1 already exists"
4141
return
4242
fi
43-
flow="yosys_vpr"
44-
if [ -z $1 ]; then flow=$2; fi
43+
template="template_tasks/yosys_vpr_template"
44+
if [ ${#2} -ge 1 ]; then
45+
if [[ "$2" == "vpr_blif" ]]; then template="template_tasks/${2}_template/";
46+
elif [[ "$2" == "yosys_vpr" ]]; then template="template_tasks/${2}_template/";
47+
else template="$2"
48+
fi
49+
fi
50+
if [ ! -f $OPENFPGA_PATH/openfpga_flow/tasks/${template}/config/task.conf ]; then
51+
echo "Template project [${template}] does not exist" ; return;
52+
fi
53+
echo "Creating task $1"
54+
echo "Template project ${template}"
4555
mkdir -p $1
46-
cp -r $OPENFPGA_PATH/openfpga_flow/tasks/template_tasks/${flow}_template/* $1/
56+
cp -r $OPENFPGA_PATH/openfpga_flow/tasks/${template}/* $1/
4757
}
4858

4959
run-task () {

openfpga_flow/regression_test_scripts/basic_reg_test.sh

+4
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,7 @@ run-task basic_tests/fix_pins --debug --show_thread_logs
181181
echo -e "Testing project templates";
182182
run-task template_tasks/vpr_blif_template --debug --show_thread_logs
183183
run-task template_tasks/yosys_vpr_template --debug --show_thread_logs
184+
185+
echo -e "Testing create tsk from template and run task"
186+
create-task _task_copy basic_tests/generate_fabric
187+
run-task _task_copy

0 commit comments

Comments
 (0)