Added option to copy example projects

This commit is contained in:
Ganesh Gore 2022-05-03 14:03:52 -06:00
parent 21c3dbf611
commit 1e243650b9
4 changed files with 24 additions and 7 deletions

View File

@ -38,4 +38,5 @@ RUN jupyter lab build
# 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

View File

@ -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

View File

@ -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 () {

View File

@ -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