These examples illustrate how you can use Simulink® and Simulink® Coder™ to realize concurrent execution of a model. These examples also attempt to generate HDL code using HDL Coder™. You can generate HDL code if:
You have an HDL Coder license,
You are generating on Windows or Linux operating systems.
You cannot generate HDL code on Macintosh systems.
If you want to generate code for this model, install Simulink® Coder™. Note that when you simulate the example, Simulink® and Simulink® Coder™ might generate code in the current working folder. If you do not want to (or cannot) generate files in this folder, changechange the current working folder.
We illustrate two examples.
Modeling Concurrent Execution on Multicore TargetsModeling Concurrent Execution on Multicore Targets illustrates the use of concurrency when modeling a closed loop plant controller system. This can be a system deployed on a multicore hardware-in-the-loop (HIL) system or a controller deployed on multicore hardware.
Modeling Concurrent Execution : FFT ExampleModeling Concurrent Execution : FFT Example illustrates a system in which you can accelerate parts of an algorithm by deploying on an FPGA using HDL Coder (TM).
topmdl1 = 'sldemo_concurrent_execution'; open_system(topmdl1); topmdl2 = 'slexFFTConcurrentExecutionExample'; open_system(topmdl2); curDir = pwd; cd(tempdir);
Generating Code and Profile Report
The profile report shows how generated code executes on a host computer. For the example profile report illustrated below, the generated code was run on a four core processor host computer. The Task Execution Time section lists the times in microseconds. The Task Affinitization to Processor Cores section shows how the tasks execute concurrently on the different cores. For details of how concurrent execution is achieved, examine the code illustrated in the Code Generation report or see the documentationdocumentation.
Closing the Models
close_system(topmdl1, 0); close_system([topmdl1,'_plant'], 0); close_system([topmdl1,'_compensator'], 0); close_system([topmdl1,'_controller_A'], 0); close_system([topmdl1,'_controller_B'], 0); close_system(topmdl2, 0); close_system('slexFFTConcurrentExecutionButterflyMdlRef', 0); close_system('slexFFTConcurrentExecutionInputMdlRef', 0); cd(curDir);