systems engineering approach for soc applications -凯发k8网页登录
this example shows how to design a sample signal detector application on a system on chip (soc) platform using a systems engineering approach. the workflow in this example maps the application functions onto the selected hardware architecture.
the signal detector application continuously processes the signal data and classifies the signal as either high or low frequency. the signal cannot change between high- and low-frequency classes faster than 1 ms. the signal is sampled at the rate of 10 mhz.
functional architecture
define the functional architecture of the application. at this stage, the implementation of the application components is not known. you can use the system composer™ software to capture the functional architecture.
this model represents the functional architecture with its main software components and their connections.
systemcomposer.openmodel('soc_signaldetector_func');
the functional architecture of the application consists of these top-level components:
generate signal
preprocess signal
classify signal
activate leds
hardware architecture
select the hardware architecture. due to the anticipated application complexity, choose an soc device. the chosen soc device has a hardware programmable logic (fpga) core and an embedded processor (arm) core. you can use the system composer software to capture the details of the hardware architecture.
this model represents the hardware architecture with its main hardware components and their connections.
systemcomposer.openmodel('soc_signaldetector_arch');
behavioral modeling
if the implementations for functional components are available, you can add them to the functional architecture as behaviors. in system composer, for each functional component, you can link the implementation behaviors as simulink® models. to review the component implementations, double-click each component in the functional architecture model.
after you define the behavior of each component, you can simulate the behavior of the entire application and verify its functional correctness. select run in the functional architecture model. then, analyze the signals classification results in the simulation data inspector. to change the signal type, select the generate signal
component and then select the manual switch block. confirm that the source signal is classified correctly.
allocation of functional and hardware elements
after refining the functional and hardware architecture, allocate different functional components to different hardware elements to meet desired system performance benchmarks. in this case, some functional components are constrained as to where in the hardware architecture they can be implemented. you must implement the generate signal
and activate leds
components on the fpga core in the chosen hardware architecture due to input output (i/o) connections. comparatively, you can implement the preprocess signal
and classify signal
components on either the fpga or on the processor core.
component constraint generate signal fpga preprocess signal - classify signal - activate leds fpga
this example shows how to use three possible scenarios for allocating the application functional architecture to the hardware architecture.
the fpga handles preprocessing and classification.
the fpga handles preprocessing and the processor handles classification.
the processor handles preprocessing and classification.
system composer captures these scenarios as scenario 1
, scenario 2
, and scenario 3
using the .
allocset = systemcomposer.allocation.load('soc_signaldetector_allocation');
systemcomposer.allocation.editor
choosing an allocation scenario requires finding an implementation that optimally meets the application requirements. often you can find this implementation via static analysis without detailed simulation. in this example, use static analysis to analyze the computational costs of implementing different functional components on the processor and on the fpga.
implementation cost
the implementation cost of a component depends on the required computation operations. to determine the implementation costs, consider these typical approaches.
component implementation is not available: obtain the computational cost from the available reference implementations.
the implementation and the hardware are available: measure or profile the implementation cost on the candidate hardware.
the implementation is available, but the hardware is not: estimate the implementation cost by using the soc blockset™ algorithm analyzer function
socalgorithmanalyzerreport
.
the socmodelanalyzer
function estimates the number of operations in a simulink model and generates an algorithm analyzer report. to get the number of operations that a model executes to then analyze the implementation cost on the processor, use the dynamic analysis function option. to get the number of operators an algorithm requires to then analyze the implementation cost on the fpga, use the static analysis function option. for an example on how to use socmodelanalyzer
, see this sample function.
soc_signaldetector_costanalysis
*** component: 'preprocess signal' add( ) mul(*) ______ ______ fpga implementation 15 16 processor implementation 15300 16320 *** component: 'classify signal' add( ) mul(*) ______ ______ fpga implementation 32 18 processor implementation 32640 18360
the implementation costs for each functional component obtained in this code are entered in the corresponding stereotypes in the functional architecture. to verify the values, select each component in the functional architecture model and use the property inspector.
to learn more about socmodelanalyzer
, see the compare fir filter implementations using socmodelanalyzer (soc blockset) example. this example shows how to analyze the computational complexity of different implementations of a simulink algorithm.
allocation choice
you can use the number of operators or operations that are required for implementing the application functional components to decide how to allocate the functional components to the hardware components. analyze the candidate allocations by comparing the implementation cost against the available resources of the fpga and the processor. this example uses sample values in the fpga and the processor components in the hardware architecture model for the available computation resources. verify the values by using the property inspector.
typically, the analysis does not use the number of operators or operations directly. rather, the number of operators or operations are multiplied by the cost of each operator or operation first. the cost of the operator or operations is hardware dependent. determining such costs is beyond the scope of this example.
for an example on how to use the cost models, use this function. observe that we require the capacity of the fpga and the processor be greater than the estimated implementation cost as well as that the processor headroom be between 60 and 90 %.
soc_signaldetector_partitionanalysis
fpga dsps used (out of 900) fpga lut used (out of 218600) processor instructions/s (out of 1000000000) processor headroom (%) feasible ___________________________ _____________________________ ____________________________________________ ______________________ ________ scenario 1 34 576 0 100 0 scenario 2 16 192 326400000 100 0 scenario 3 0 0 489600000 100 0
based on the results scenario 2 is feasible.
data path design between fpga and processor
the fpga processes data sample-by-sample, and the processor processes frame-by-frame. because the duration of a processor task can vary, to prevent data loss, a queue is needed to hold the data between the fpga and processor. in this case you must set these parameters that are related to the queue: frame size, number of frame buffers, and fifo size (that is, the number of samples in the fifo). also, in embedded applications, the task durations can vary between different task instances (for example, due to different code execution paths or due to variations in os switching time). as a result, data might be dropped in the memory channel. the streaming data from hardware to software (soc blockset) example shows a systematic approach to choosing the previously mentioned parameters that satisfy the application requirements.
see also
(soc blockset) | (soc blockset) |