34 lines
1.1 KiB
ReStructuredText
34 lines
1.1 KiB
ReStructuredText
|
.. _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"
|
||
|
|
||
|
|