Main Content

Support NE10 Library C Code Generation of dsp.FIRFilter in MATLAB Function Block

This example shows how to use the Code Replacement Library (CRL) for ARM processor with DSP System object™. The model uses aMATLAB Function blockthat contains a dsp.FIRFilter System object to filter two sine waves of different frequencies.

Task 1: Simulate and Setup the Model for Code Replacement

1.Open themodel, which contains a MATLAB function block and the dsp.FIRFilter System object. Inside the MATLAB Functionfirfun, the dsp.FIRFilter System object is created just once and is declared to bepersistent. This eliminates the overhead in creating new instances of a System object each time the function is called. It also allows users to execute the step function of the dsp.FIRFilter object multiple times with a persistent state by simply running the model with the MATLAB Function block in multiple time steps.

2.Change your current folder in MATLAB® to a writable folder.

3.Simulate and setup the model forARM Cortex-Acode replacement by following Tasks 1 and 2 ofVerify FIR Filter on ARM Cortex-A Processorexample.

Task 2: Configure the dsp.FIRFilter System object for Code Replacement

1.Open theMATLAB Functionblock within theFIRsubsystem.

2.Verify that the dsp.FIRFilter System object has the following settings for its properties:

  • Structure:Direct form(default)

  • NumeratorSource:Property(default)

  • InitialConditions:0(default)

Task 3: Generate code

1.Generate code for theFIRsubsystem by following Task 3 of theVerify FIR Filter on ARM Cortex-A Processorexample.

2.In the code generation report, click on the FIR.c file. Notice the NE10 functions, ne10_fir_init_float and ne10_fir_float_neon in the model'sstep function, FIR_step.

任务4:使用处理器的循环(公益诉讼)

To perform the previous steps using PIL, you must have the Embedded Coder Support Package for ARM Cortex-A Processors and the DST Support Package for ARM Cortex-A Processors. The following example shows you how to use PIL with ARM Cortex-A:

  • Code Verification and Validation with PIL and External Mode example.