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 How to 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
load openfpga_shell.so
Create a new OpenFPGA shell object. For example
std::OpenfpgaShell my_shell
OpenFPGA command can be called by through a sub command
run_command
. For example, the commandread_openfpga_arch
(see Setup OpenFPGA for details) is now run in the following way:
my_shell run_command "read_openfpga_arch --file ~/OpenFPGA/openfpga_flow/openfpga_arch/k4_N4_40nm_bank_openfpga.xml"