Main Content

Specify a Target Architecture

For models configured for concurrent execution, you can choose the architecture to which you want to deploy your model. Choose from a set of predefined architectures in Simulink®, or you can create an interface for a custom architecture. After selecting your architecture, you can use explicit partitioning to specify which tasks run on it. For more information, see Partition Your Model Using Explicit Partitioning.

Choose from Predefined Architectures

You can choose from the predefined architectures available in Simulink, or you can download support packages for different available architectures.

  1. In the Concurrent Execution dialog box, in the Concurrent Execution pane, click Select. The concurrent execution target architecture selector appears.

  2. Select your target.

    PropertyDescription

    Multicore

    Single CPU with multiple cores.

    Sample Architecture

    Single CPU with multiple cores and two FPGAs.

    Get more ...

    Click OK to start the Support Package Installer. From the list, select the target and follow the instructions.

  3. In the Target architecture window, clear the Preserve compatible properties check box to reset existing target property settings to their default. Alternatively, select the Preserve compatible properties check box to preserve existing target property settings.

  4. Click OK.

    Simulink adds the corresponding software and hardware nodes to the configuration tree hierarchy. For example, the following illustrates one software node and two hardware nodes added to the configuration tree when you select Sample architecture as the target architecture.

    Concurrent Execution tool.

Define a Custom Architecture File

A custom architecture file is an XML file that allows you to define custom target properties for tasks and triggers. For example, you may want to define custom properties to represent threading APIs. Threading APIs are necessary to take advantage of concurrency on your target processor.

The following is an example custom architecture file:

<architecture brief="Multicore with custom threading API"
              format="1.1"  revision="1.1"
              uuid="MulticoreCustomAPI"  name="MulticoreCustomAPI">
<configurationSet> 
     <parameter name="SystemTargetFile" value="ert.tlc"/> 
     <parameter name="SystemTargetFile" value="grt.tlc"/> 
</configurationSet>          
<node name="MulticoreProcessor" type="SoftwareNode" uuid="MulticoreProcessor"/>
<template name="CustomTask" type="Task" uuid="CustomTask">
     <property name="affinity" prompt="Affinity:" value="1" evaluate="true"/>
     <property name="schedulingPolicy" prompt="Scheduling policy:" value="Rate-monotonic">
           <allowedValue>Rate-monotonic</allowedValue>
           <allowedValue>Round-robin</allowedValue>
        </property>
   </template>
</architecture>

An architecture file must contain:

  • The architecture element that defines basic information used by Simulink to identify the architecture.

  • A configurationSet element that lists the system target files for which this architecture is valid.

  • One node element that Simulink uses to identify the multicore processing element.

    Note

    The architecture must contain exactly one node element that identifies a multicore processing element. You cannot create multiple nodes identifying multiple processing elements or an architecture with no multicore processing element.

  • One or more template elements that list custom properties for tasks and triggers.

    • The type attribute can be Task, PeriodicTrigger, or AperiodicTrigger.

    • Each property is editable and has the default value specified in the value attribute.

    • Each property can be a text box, check box, or combo box. A check box is one where you can set the value attribute to on or off. A combo box is one where you can optionally list allowedValue elements as part of the property.

    • Each text box property can also optionally define an evaluate attribute. This lets you place MATLAB® variable names as the value of the property.

    Assuming that you have saved the custom target architecture file in C:\custom_arch.xml, register this file with Simulink using the Simulink.architecture.register function.

For example:

  1. Save the contents of the listed XML file in custom_arch.xml.

  2. In the MATLAB Command Window, type:

    Simulink.architecture.register('custom_arch.xml') 
  3. In the MATLAB Command Window, type:

    openExample('slexMulticoreSolverExample')
  4. In the Simulink editor, open the Configuration Parameters > Solver pane and click Configure Tasks. The Concurrent Execution dialog box displays.

  5. In the Concurrent Execution pane, click Select... under Target Architecture. The Target architecture window displays.

  6. Select MulticoreCustomAPI and click OK.

Your Concurrent Execution dialog box updates to contain Code Generation properties for the tasks as shown. These are the properties defined in the XML file.

Concurrent Execution tool highlighting the custom code generation properties for a task.

Related Topics