emmtrix Code Generator

From emmtrix Wiki
Jump to navigation Jump to search

emmtrix Code Generator Icon.png

Our Solution for MATLAB® Code Generation

emmtrix Code Generator (eCG) translated MATLAB®, GNU Octave, or Scilab code into platform-independent and readable C or C++ code suitable for embedded processors. The generated code was easy to understand, prepared for parallelization, and could be adjusted to individual requirements. Automatically generated reports helped with the code certification process. In combination with emmtrix Parallel Studio, eCG enabled multicore programming or vectorization directly from *.m or *.sci script files. Furthermore, eCG worked hand in hand with emmtrix Model Code Generator to support C code generation from Simulink® models.

eCG Workflow

emmtrix Code Generator Workflow.png

emmtrix Code Generator used *.m script files (MATLAB® or GNU Octave) or *.sce/sci script files (Scilab) as input and generated sequential C code according to C89, C99, or C11 standards as output. All generated source and header files could be directly compiled without dependencies on external libraries. A direct generation of executable files was also possible. When fixed-point data types were used, C++ templates were employed to represent them.

The generated C code was static and free of dynamic memory allocation, making it suitable for embedded systems and for parallelization tools like emmtrix Parallel Studio. Data dependencies could easily be analyzed. Matrices were represented by multi-dimensional arrays to enable loop transformations required for parallelization or vectorization.

Users could extend their input scripts with special eCG directives (similar to pragmas in C). These directives were treated as comments by the original tools, ensuring code compatibility. The special directives could be used to provide additional information in the output code, select different algorithms for built-in functions like FFT, or enable various code optimizations to improve performance, memory consumption, or parallelizability.

Features

  • Supported code generation compliant with ISO C90, C99, C11, C18, C++98, C++11, C++14, and C++17 standards
  • 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 - still available

Try out 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.

Go to eCG Online: https://www.emmtrix.com/online-emmtrix-code-generator/