| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink HDL Coder |
| Contents | Index |
| On this page… |
|---|
The Embedded MATLAB Function block contains a MATLAB function in a model. The function's inputs and outputs are represented by ports on the block, which allow you to interface your model to the function code. When you generate HDL code for an Embedded MATLAB Function block, the coder generates two main HDL code files:
A file containing entity and architecture code that implement the actual algorithm or computations generated for the Embedded MATLAB Function block.
A file containing an entity definition and RTL architecture that provide a black box interface to the algorithmic code generated for the Embedded MATLAB Function block.
The structure of these code files is analogous to the structure of the model, in which a subsystem provides an interface between the root model and the function in the Embedded MATLAB Function block.
The Embedded MATLAB Function block supports a powerful subset of the MATLAB language that is well-suited to HDL implementation of various DSP and telecommunications algorithms, such as:
Sequence and pattern generators
Encoders and decoders
Interleavers and deinterleaver
Modulators and demodulators
Multipath channel models; impairment models
Timing recovery algorithms
Viterbi algorithm; Maximum Likelihood Sequence Estimation (MLSE)
Adaptive equalizer algorithms
The following documentation and demos provide further information on the Embedded MATLAB Function block.
For general documentation on the Embedded MATLAB Function block, see:
Embedded MATLAB Function block reference
The coder supports most of the fixed-point runtime library functions supported by the Embedded MATLAB Function block. See Working with the Fixed-Point Embedded MATLAB Subset in the Fixed-Point Toolbox documentation for a complete list of these functions, and general information on limitations that apply to the use of Fixed-Point Toolbox with the Embedded MATLAB function block.
The hdlcoderviterbi2.mdl demo models a Viterbi decoder, incorporating an Embedded MATLAB Function block for use in simulation and HDL code generation. To open the model, type the following command at the MATLAB command prompt:
hdlcoderviterbi2
The hdlcodercpu_eml.mdl demo models a CPU with a Harvard RISC architecture, incorporating many Embedded MATLAB Function blocks to simulate and generate code for CPU and memory elements. To open the model, type the following command at the MATLAB command prompt:
hdlcodercpu_eml
![]() | Generating HDL Code with the Embedded MATLAB Function Block | Tutorial Example: Incrementer | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |