Global Sources
EE Times-Asia
Stay in touch with EE Times Asia
EE Times-Asia > Processors/DSPs

New MATLAB software generates C code

Posted: 04 Oct 2007 ?? ?Print Version ?Bookmark and Share

Keywords:MCUs? DSPs? CPUs? algorithm design? embedded software design?

MATLAB users can now generate embeddable C code from M-files using Embedded MATLAB, a subset of the MATLAB programming language. Embedded MATLAB supports a wide range of MCUs, DSPs and CPUs, making the product appealing to a wide range of developers. It will be included in MATLAB 2007 b at no extra cost to licensees.

Users can generate ANSI/ISO C code directly from M-files via the Real-Time Workshop tool. Alternatively, users can integrate their code into the Simulink graphical programming environment via a new Embedded MATLAB function block. From Simulink, designers have two options: They can use Real-Time Workshop to generate C, or use Simulink HDL Coder to generate synthesizable RTL for implementation on an FPGA or ASIC.

Tapping C code
Embedded MATLAB targets communications, aerospace/defense and automotive applications, among others. The Embedded MATLAB subset includes more than 270 MATLAB operators and functions and more than 90 Fixed-Point Toolbox functions. It also supports MATLAB language constructs such as multidimensional arrays, real and complex numbers, structures, flow control and subscripting. A full list of supported features and functions is available on The MathWorks Web site.

MATLAB is by far the most popular software for algorithm design, but moving from a MATLAB algorithm to an embedded implementation has been problematic. In a typical design flow, the algorithm is designed in MATLAB and then manually converted to C. This conversion process is time-consuming and error prone. The ability to go directly from MATLAB to C will be a huge boon for developer.

The RTL generation capabilities are also quite useful, because ASIC and FPGA designers currently lack a universal design language. With their new capabilities, MATLAB and Simulink may become a de facto standard for ASIC and FPGA design, much in the same way that C has become the standard for embedded software design.

Although automatic code generation has many benefits, developers may still need to perform significant optimization on the generated code. According to Jeff Bier of technology analyst firm BDTI, "This is a long-awaited development that will be welcomed by many, but it isn't a silver bullet. The considerations that engineers focus on when they do algorithm development are different from the key considerations in embedded software or hardware development. For example, a code translation tool isn't going to figure out how to segment your data and schedule your computations for efficient implementation, nor is it going to figure out where to apply parallelism."

The MathWorks is not the first to offer MATLAB to C capabilities. One notable competitor is Catalytic, a company which offers a MATLAB-to-C tool optimized for signal processing applications. Another startup, AccelDSP, which was recently acquired by Xilinx, also offers a DSP-oriented tool which generates RTL or C++ testbenches from MATLAB code. Similarly, Synplicity's Synplify DSP already offers a Simulink-to-RTL path.

Embedded MATLAB also faces competition from National's Instrument's LabVIEW. LabVIEW is a graphical design language similar to Simulink. Much like its competition, LabVIEW can generate embedded C code or FGPA-oriented RTL. This will be an interesting showdown to watch: MATLAB has greater acceptance in the algorithm development community, but LabVIEW has been aggressively expanding its capabilites. Indeed, NI announced a substantial upgrade to its C capabilities two weeks ago.

The Embedded MATLAB subset will be included in the release of MATLAB 2007 b. MathWorks products that support Embedded MATLAB include MATLAB, Simulink, Fixed-Point Toolbox, Stateflow, SimEvents, Real-Time Workshop and Simulink HDL Coder.

- DSP DesignLine

Article Comments - New MATLAB software generates C code
*? You can enter [0] more charecters.
*Verify code:


Visit Asia Webinars to learn about the latest in technology and get practical design tips.

Back to Top