Simply load an OPENCHAMS file using the static function OpenChams::Circuit::readFromFile() and then get the netlist object (OpenChams::Circuit::getNetlist()) or the sizing procedure (OpenChams::Circuit::getSizing(), might be NULL) or any other useful information (see OpenChams::Circuit).
Using the driver is very simple, user has to create an OpenChams::Circuit object and simply add OpenChams::Netlist (mandatory) and OpenChams::Sizing (optionnal) or OpenChams::Schematic (optionnal) or OpenChams::Layout (optinnal) to it.
Finally use the OpenChams::Circuit::writeToFile() method to dump the database to file.
As said is the global presentation, VLSI SAPD project provides C++ libraries and Python modules for each supported format. In this section we present simple code examples to parse and drive a OPENCHAMS file using C++ or Python. The OPENCHAMS files considered are the same for all examples: \c inverter.xml and \c buffer.xml
\include inverter.xml
\include buffer.xml
All source codes are available in the \c examples directory.
\subsection openChamsC C++
\subsubsection openChamsParseC Parser
The following code (\c parseOpenChams.cpp) is an example of how to parse a OPENCHAMS file using C++ library.
\include parseOpenChams.cpp
\subsubsection openChamsDriveC Driver
This C++ code (\c driveOpenChams.cpp) generates an inverter.xml file equivalent to the included one.
\include driveOpenChams.cpp
\note In order to compile these codes, a CMakeLists.txt file is provided. User must set the $VLSISAPD_TOP variable before running these commands in the directory containing the CMakeLists.txt file:
\code
%> mkdir build; cd build
%> cmake ..
%> make
\endcode
\subsection openChamsPython Python
\subsubsection openChamsParsePython Parser
The following python script (\c parseOpenChams.py) is an example of how to parse a OPENCHAMS file using python module.
\include parseOpenChams.py
\subsubsection openChamsDrivePython Driver
This python script (\c driveOpenChams.py) generates an inverter.xml file equivalent to the included one.
\include driveOpenChams.py
\note In order to run these two scripts (\c parseOpenChams.py & driveOpenChams.py), user must ensure that $PYTHONPATH variable points to the directory containing OPENCHAMS.so module.