Extracting Behavior and Dynamically Generated Hierarchy from SystemC Models

More Info


Modern embedded systems are far to complex to describe their hardware and software at a low-level of abstraction. SystemC is a popular modeling language which can be used to specify systems at a higher abstraction level. The primary way to deal with complexity in SystemC is to apply modularization. The module hierarchy of a SystemC model is dynamically constructed during the execution of the elaboration phase of the model. This means that a system designer can build regular structures using loops and conditional statements. Currently, SystemC tools can not cope with SystemC models for which the module hierarchy depends on dynamic parameters. We present a novel approach to extract the dynamically generated module hierarchy and its behavior from a SystemC model. In our approach the hierarchical information of a SystemC model is retrieved by executing the elaboration phase of the model under control of a debugger. Thereafter, the behavioral information of the model is retrieved by using a C++ compiler extension. Finally, the behavioral information is linked with the hierarchical information. Our approach is completely non-intrusive. The SystemC model and the SystemC reference implementation can both be used without any modification. The only precondition is that they both are compiled to include debug information. To identify the information which must be extracted by a SystemC front-end a SystemC metamodel is defined. This metamodel, models the module hierarchy of a SystemC model at the end of the elaboration phase. Currently, no other detailed SystemC metamodel has been published. We have implemented our approach in an open-source SystemC front-end called Systemc Hierarchy and Behavior Extractor (SHaBE). SHaBE can extract all relevant hierarchical information and a well defined subset of all behavioral information from a model. The implementation is based on open-source tools and is developed using a test-first approach during which more than 250 test cases were successfully implemented. To extract the module hierarchy from the model the source code of the SystemC reference implementation has been carefully analyzed to determine the function calls which need to be monitored. Breakpoints are placed on these function calls and crucial information is extracted by using debug commands to inspect the stack, the function arguments, the members of an object, etc. The extraction of the module hierarchy of the model has a time complexity of O(n log n), where n is the number of SystemC objects used in the model. The behavior of the model is extracted by a compiler plug-in which extracts the abstract syntax tree in static single assignment form from the source code of the functions which define the behavior of the SystemC processes. The output of SHaBE is saved in an XML based format which describes the module hierarchy and the behavior of a SystemC Model. Presently, there is no other XML format available which can be used to describe the module hierarchy of a SystemC model as well as its behavior. This front-end facilitates the development of SystemC visualization, debugging, static verification, and synthesis tools.