The output of Pinapa is composed of
- The abstract syntax trees of the processes (that we call AST)
- The data structure built by the elaboration of the model (that we call ELAB)
- The link between AST and ELAB.
There is no textual syntax for this, it's only a data-structure, useable through GCC and SystemC (plus a few additional for Pinapa) header files. This means Pinapa is a front-end, that is only meaningfull when associated with a back-end.
The example provided with Pinapa is the best starting point if you want to understand how this all works. A good way to write a back-end is to copy and rename the directory containing the example, and to modify it little by little.
The best documentation for AST is actually the chapter "Trees" of the GCC internals manual. The documentation of each node can also be found as comments in the source code of GCC, in the files tree.def, cp/cp-tree.def and c-common.def.
The ELAB is not really well documented, but is also not a complex data-structure. If you know how to write a SystemC program, you know how to build ELAB. Looking at the header files of SystemC should be sufficient.
A rather general decoration mechanism is provided, allowing Pinapa to annotate the AST and ELAB, and Pinapa's backend to add other annotations. It is implemented and documented in pinapa-decoration-base.h.
Some anotations are added on some node of the tree.
The first one is the type of intruction. This is a field of type pinapa::sc_primitive_t.
For AST representing special types, a decoration is also added, of type pinapa::type_of_type.
This is usefull for our back-end LusSy, who does a special treatment on addresses. Note that C++ typing system does not allow the identification of address types in 100% of the cases. In pieces of code like
it is easy to identify x as being of type address, but y will be of type ``plain integer''.
Additionally, for some instructions, an additional decoration is added:
- For all AST representing an sc_object, the a pointer to the corresponding object is added,
- For pinapa::SC_EVENT, a pointer to the actual sc_event is added (we consider this special case because sc_event does not inherit from sc_object),
- For pinapa::SC_WAIT, we also add a representation of the list of sensitivity (information saying when the process will wake up) for this statement, either based on the arguments of the
wait, or on the static sensitivity list for a wait with no argument.
Generated by