1. QGen Toolset Presentation

QGen is a Code Generation and Model Verification toolsuite for Simulink® and Stateflow®. Its primary function is code generation from Simulink® and Stateflow® model to C or Ada/SPARK code. The toolset also includes static analysis capabilities at the model level and the full integration with the AdaCore IDE, GNATStudio in order to provide model-level and S-Function debugging.


QGen is officially supported for MATLAB® R2015b up to R2020b. The toolset most likely works on older and more recent versions of MATLAB but there is no guarantee. We continue to support new MATLAB versions as they come out.

The QGen Code Generator section presents and details the usage of the QGen Code Generator.

The QGen Code Generator is being qualified at Tool Qualification Level 1, which is the highest level of qualification recognized by the FAA and DO-178C standard. For more information about the credits that can be claimed by a project using the Qualified tool and pricing information please visit the https://www.adacore.com/qgen/enterprise webpage or contact us through the ticket system within GNATtracker or by sending an email with your account number in the subject #XXXX to qgen@adacore.com.

The supported subset of QGen is made of 120 Simulink blocks with the majority of the settings available for each block, and a set of Stateflow features that are essential for embedded software. A variety of mechanisms for refining the model and tuning code generation is supported such as Simulink.Signal, Parameters, workspace containers (data dictionaries, model workspace), masks, Storage classes … The detail of the QGen supported subset can be found in the QGen Constraints on Input Models section.

QGen also comes with full IDE integration, with GNATStudio being used to provide a unique model level debugger, allowing to quickly compile the generated code and analyze its behavior in order to find modeling issues, see the QGen Model Debugger and QGen Model Debugger: Step by Step Tutorial sections. This also comes with the capability to build and debug S-Functions for C and Ada as well as debugging them while they are simulated in Simulink, see Calling C or Ada codebases using QGen-SFun block.

Finally, the QGen Model Verifier is part of the QGen Toolset, relying on AdaCore static analysis technology. It automatically generates and analyzes Ada source code and propagates potential violations like division by zero or overflow to the model in Simulink. This technology is still maturing and requires the experimental flags to be activated before being visible in MATLAB. This is detailed under the QGen Model Verifier section.