design soc model using system composer
system composer™, in combination with soc blockset™, enables you to define and design a software application to run on a system-on-chip (soc) device. this allows preliminary analysis of your design, for example, analyze whether the software tasks in your application can be scheduled on your chosen hardware. for a general workflow on authoring an architecture model in system composer, see compose and analyze systems using architecture models (system composer).
author architecture model of software system
first author a system composer architecture model of a software system for an soc device. as an example, consider an application with two software tasks.
create a new architecture. from the simulink® toolstrip, on the simulation tab, select new > architecture.
on the simulink start page, select system composer > software architecture model.
apply the profile. on the modeling tab, select profile editor > import. navigate and choose the xml file
./toolbox/soc/processor/utilities/soc_blockset_profile.xml add two (system composer) objects to the architecture model.
specify the components as a periodic and aperiodic software tasks. right-click the component, and select apply stereotype > soc_blockset_profile.periodicsoftwaretask and apply stereotype > soc_blockset_profile.aperiodicsoftwaretask, respectively.
in each component, specify the properties of the tasks, such as
meanexecutiontime
andcoreaffinity
.
this figure shows the resulting architecture model for the soc software system.
author architecture model of hardware system
author a system composer architecture model of the hardware system, specifically the processor system for an soc device. as an example, consider the hardware with two cores.
create a new architecture. from the simulink toolstrip, on the simulation tab, select new > architecture.
on the simulink start page, select system composer > architecture model.
apply the profile. in the modeling tab, select profile editor > import. navigate and choose the xml file
./toolbox/soc/processor/utilities/soc_blockset_profile.xml add two (system composer) objects to the architecture model.
specify each component as a processor cores. right-click the component, and select apply stereotype > soc_blockset_profile.processorcore.
in each component, assign the
core
property of each component to the cores available in the processor.
this figure shows the resulting architecture model for the soc processor system.
allocate processor resources
using the processor and software architecture models that you, defined in the previous sections, create a specification in system composer where the software tasks you allocate to specific cores in the processor. the specification can include multiple implementation scenarios, where the tasks are allocated to cores in various combinations. soc blockset can then analyze whether these scenarios can be realized with the given task properties.
open the (system composer) app. from the simulink toolstrip, on the views tab, click allocation editor.
in the create allocation set window, specify the name of the allocation set such as
myallocation
, set source model to the software architecture model, and set target model to the processor architecture model.in the scenario table, click the intersection between
task1
andcore1
. under allocation properties, select the allocated check box. repeat this step fortask2
andcore2
. the resulting allocation diagram should be similar to the image shown.save the allocation set. in the toolstrip, click the save allocation set button to generate an mldatx file.
you can repeat this process for any number of tasks and cores, assigning multiple tasks to a single core.
analyze scheduling constraints
the allocation set for the software tasks and their assigned processor cores can help
you determine if a software system has sufficient processing time to schedule the tasks.
using the function from soc blockset, you can get metrics that indicate whether the total system and individual
tasks can be scheduled. with the default task specifications that you defined earlier
for the software task components, soctaskschedulability
generates
these statistics.
[schedulable,tasks,cores] = ... soctaskschedulability("myallocation.mldatx","scenario 1");
>> tasks(1) ans = struct with fields: name: 'task1' schedulable: 1
>> cores(1) ans = struct with fields: name: '0' usage: 1.0000e-04
the results show that the system can be scheduled and only 0.01% of the processor core time is occupied. based on this result, you can determine whether the system specification needs to change to meet the design requirements. for example, you could reallocate the software tasks to cores to achieve more balanced core usage.
transform software system architecture to soc blockset model
after authoring your system in system composer, you can create an equivalent soc blockset model using the function. using the software and architecture model that
you created earlier, soccreatemodel
function creates the top-level
and processor soc models shown.
soccreatemodel("myallocation.mldatx","scenario 1")
you can then connect and modify the generated soc models to create your deployable soc model application.
see also
| | | |
related examples
more about
- compose and analyze systems using architecture models (system composer)