[doc] add tcl api

This commit is contained in:
tangxifan 2022-12-06 16:46:57 -08:00
parent b179f4bd7f
commit b1dd2136f1
2 changed files with 35 additions and 0 deletions

View File

@ -12,3 +12,5 @@
regression_tests
tcl_api

View File

@ -0,0 +1,33 @@
.. _dev_manual_tcl_api:
Tcl API
-------
OpenFPGA can be loaded to a Tcl shell in the format of shared library.
OpenFPGA's Tcl APIs are generated by SWIG during compilation.
By integrating OpenFPGA to Tcl, developers can utilize OpenFPGA commands in a common shell with other EDA tools, considering most of modern EDA tools adopt Tcl as their user interface.
Currently, Tcl 8.6 is supported. Other versions may also work.
Here are the steps to follow:
- Compile OpenFPGA with SWIG enabled. See details in :ref:`tutorial_compile`.
- The shared library of OpenFPGA is available under the ``build/openfpga/openfpgashell.so``
- Launch a tcl shell and load the shared library. For example
.. code-block::
load openfpga_shell.so
- Create a new OpenFPGA shell object. For example
.. code-block::
std::OpenfpgaShell my_shell
- OpenFPGA command can be called by through a sub command ``run_command``. For example, the command ``read_openfpga_arch`` (see :ref:`openfpga_setup_commands` for details) is now run in the following way:
.. code-block::
my_shell run_command "read_openfpga_arch --file ~/OpenFPGA/openfpga_flow/openfpga_arch/k4_N4_40nm_bank_openfpga.xml"