Newsletter

DSP DesignLine  >  Design Center

Embedded MATLAB, part 2: System-level integration and verification



Page 1 of 5

DSP DesignLine

This article discusses the integration of Embedded MATLAB code within graphical models for system-level design and verification. Part one of this series of articles described the generation of embeddable C code from MATLAB algorithms using the Embedded MATLAB language subset.

Introduction
The MATLAB language is widely used by engineers to develop algorithms that are then implemented in embedded software, typically through manual translation into C code. The algorithm intellectual property (IP) created in MATLAB is frequently a component of a larger hardware or software system.

To facilitate integration into the embedded system, algorithm functionality and interfaces need to be verified in the context of the overall system design. Creating a realistic test bench in lower-level languages such as C can be a time-consuming engineering effort that will most likely be discarded at the end of the project. It can be more efficient to integrate the algorithm using a graphical system design environment like Simulink.

Simulink allows the user to quickly construct a test bench, model and simulate a system with a set of pre-defined blocks, and verify algorithm operation within the context of the complete system. Algorithm debugging and design iterations are easier in this environment because the algorithm remains in MATLAB. When the algorithm meets requirements, you can generate embeddable C code from the Simulink model or by using the workflow from MATLAB to C described in the previous article.

This article presents a workflow for system-level integration and verification of algorithms written in the Embedded MATLAB language subset. As an example, we use an adaptive noise filtering algorithm to enhance a video signal received over a wireless multimedia system. We construct a Simulink test bench to test the Embedded MATLAB algorithm, integrate the algorithm into a system-level wireless model, refine the algorithm to meet system-level metrics, and add control logic to improve processing efficiency.

Our example features a simplified algorithm and system model for the purpose of clarity. However, the workflow can be extended to more complex algorithms and systems.

Design Problem
Imagine that you are tasked with designing a video post-processing algorithm that compensates for errors in a live video stream over a mobile communications network. You need to verify that your design provides adequate video quality even in areas where the signal reception is poor.

The overall quality of the received video greatly depends on the interaction between the communications and video codec subsystems. Taking into account the system-level perspective will help you find the best solution. Therefore, you need a single environment in which to develop your algorithm that can accurately model the behavior of each individual subsystem as well as their interactions.

MATLAB is well-known as an algorithm development environment. Simulink is a graphical environment that enables multi-domain modeling and simulation that is useful for system-level design and integration. In the section below, we explain how to integrate existing MATLAB algorithms into a Simulink model.

Embedded MATLAB Function Block in Simulink
In this example, we assume that an algorithm has already been developed in MATLAB and complies with the Embedded MATLAB requirements discussed in the first article of this series. We also assume that system-level models are constructed in Simulink and may contain other blocks that use Embedded MATLAB code.

To integrate an Embedded MATLAB function into a Simulink model, you place an Embedded MATLAB Function block in your model. The Embedded MATLAB Function block in Simulink is specifically designed for the purpose of integrating MATLAB code into a Simulink model. The process starts by defining a top-level MATLAB function in the Embedded MATLAB Function block. Input variables of the top-level function automatically become either input ports or parameters of the block, and output variables of the function become output ports on the block, as shown in Figure 1.

From within the Embedded MATLAB Function block you can:

  • Call Embedded MATLAB compliant M-code anywhere on the MATLAB path
  • Take advantage of the MATLAB debugger to identify and correct problems
  • Call your own C functions for maximum performance and reuse
At the start of a simulation, Simulink first compiles code included in the Embedded MATLAB Function block and executes it as part of the Simulink model. The Embedded MATLAB code executes at compiled C-code speed.


(Click to enlarge)

Figure 1. Embedded MATLAB Function block referencing a MATLAB function.


Page 2: Functional and Interface Verification of Embedded MATLAB Code in Simulink  

Page 1 | 2 | 3 | 4 | 5



Rate this article
WORSE | BETTER
1 2 3 4 5




Related Content

TECH PAPER
1. Microtec C/C++ Compiler Toolkit for PowerPC

TECH PAPER
2. Package Characterization: Simulations or Measurements?

TECH PAPER
3. Enabling Design Separation for High-Reliability and Information-Assurance Systems

TECH PAPER
4. Embedded Product Development: Model-Driven Development that leads to embedded developer productivity

 


 Featured Jobs
Boeing seeking Embedded Software Engineer 5 in Huntington Beach, CA

SEL seeking Lead DSP Engineer in Pullman, WA

SEL seeking Power Systems Instructor in Pullman, WA

Rutland Regional Medical seeking Server Engineer in Rutland, VT

Osram Sylvania seeking Mechanical Design Engineer in Danvers, MA

More jobs on EETimesCareers
 Sponsor
 CAREER CENTER
Ready to take that job and shove it?
SEARCH JOBS:

 SPONSOR

 RECENT JOB POSTINGS
For more great jobs, career related news, features and services, please visit EETimes' Career Center.