Our Solution for MATLAB® Gode Generation
emmtrix Code Generator (eCG) translates MATLAB®, GNU Octave or Scilab code into platform-independent and readable C or C++ code suitable for embedded processors. The generated code is easy to understand, prepared for parallelization and can be adjusted to individual requirements. Automatically generated reports help with the code certification process. In combination with emmtrix Parallel Studio, eCG enables multicore programming or vectorization directly from *.m or *.sci script files. Furthermore, eCG works hand in hand with emmtrix Model Code Generator to support C code generation from Simulink models.
emmtrix Code Generation uses *.m script files (MATLAB® or GNU Octave) or *.sce/sci script files (Scilab) as input and generates sequential C code according to C89, C99 or C11 standards as ouput. All generated source and header files can be directly compiled without dependencies to external libraries. A direct generation of executable file is further possible. When fixed-point data types are used, it employs C++ templates to represent them.
The generated C code is static and free of dynamic memory allocation. It is prepared for embedded systems and for parallelization tools like emmtrix Parallel Studio. Data dependencies can easily be analyzed. Matrices are represented by multi-dimensional arrays to enable loop transformation required for parallelization or vectorization.
The user can extend their input scripts by special eCG directives (like pragmas in C). These directives are treated as comments by the original tools and therefore code compatibility is guaranteed. The special directives may be used to provide additional information inside the output code, select different algorithm for built-in functions like fft or enable various code optimization to improve performance, memory consumption or parallelizability.
- ISO C90, C99, C11, C18, C++98, C++11, C++14 and C++17 compliant code generation
- Performance & memory analysis
- Highly comprehensive target-optimized C/C++ code
- User-controlled cache and memory optimization
- Bidirectional traceability via code generation reports
- Embedded code generation without dynamic memory allocation
- Interfacing custom C/C++ code or libraries
- Automatable back-to-back tests for functional validation
- Usable within continuous integration processes
- Automatic floating-point to integer number conversion
- Profiling-based performance analysis and visualization within GUI
- Worst-case analysis
- Optional array bound checking within generated code
Supported MATLAB®/GNU Octave/Scilab Language Features
- N-dimensional arrays
- Matrix operations
- Processing of multiple input files
- Variable-sized variables (growing arrays)
- Subscripting, linear and logical indexing
- Double-precision, single-precision, and integer data types
- Complex numbers
- Fixed-point arithmetic
- Program control statements if, for, while, break, continue and switch/case
- Arithmetic, relational, and logical operators
- Function handles
- Structures and array of structures
- Global variables
- Recursive function calls
- Global and local functions
- Functions with variable-length input/output arguments
- Over 100 MATLAB®/GNU Octave/Scilab functions supported
emmtrix Code Generator Online
Try out the emmtrix Code Generator online. This version of eCG allows easy conversion of MATLAB® or Scilab scripts to C code. Upload your script files directly or type the code into the editor window and convert the code with a single click of a button.
It offers the following features: generation of HTML reports with lots of information of the automated analysis, access to the latest versions of eCG, use the generated C code without any additional runtime environment or framework, generates all files required for compilation: C sources and headers including utility functions as well as a Makefile
For more information on emmtrix Code Generator or to request a demo, use our contact form or get directly in touch.