29.01.2015 Views

Embedded Software for SoC - Grupo de Mecatrônica EESC/USP

Embedded Software for SoC - Grupo de Mecatrônica EESC/USP

Embedded Software for SoC - Grupo de Mecatrônica EESC/USP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Exploring SW Per<strong>for</strong>mance 105<br />

2.2. Timing annotation<br />

Providing timing annotations is a complex task. The camera module example<br />

shows the limited un<strong>de</strong>rlying systemc 2.0 mechanisms. Mainly we rely on an<br />

event which is never notified but this event has a timeout to resume the execution.<br />

This is satisfying <strong>for</strong> the hardware mo<strong>de</strong>ls, not <strong>for</strong> the software mo<strong>de</strong>ls.<br />

These mo<strong>de</strong>ls shall distinguish active wait from passive wait. The approach<br />

is very similar to SystemC 3.0 direction [8], with the wait and consume functions,<br />

though some other aspects are also taken into consi<strong>de</strong>ration which leads<br />

to have several consume-like functions.<br />

The goal is to avoid annotating and recompiling anew the system each time<br />

a new cpu is selected, or each time a cpu frequency changes. Hence the annotation<br />

doesn’t contain a timing, but a timing table in<strong>de</strong>x. The table in<strong>de</strong>xes<br />

are the cpu in<strong>de</strong>x and the co<strong>de</strong> chunk in<strong>de</strong>x. The cpu in<strong>de</strong>x is maintained by<br />

the simulation engine.<br />

void consume(int cycle_idx, int ad_idx = 0);<br />

vs_timing_table_t consume(vs_timing_table_t, int cycle_idx,<br />

vs_address_table_t = 0, int ad_idx);<br />

Because of the function inlining, preserving the modularity of the compilation<br />

requires to have a separate consume function that allows to change the<br />

current timing table and thus using the inline function tables. The timing in<br />

the table doesn’t inclu<strong>de</strong> absolute time, but a number of CPU cycles so that<br />

the elapsed time can be calculated accordingly to the CPU frequency. The last<br />

parameter is <strong>for</strong> a future version: the i<strong>de</strong>a is to use a co<strong>de</strong> offset to take into<br />

account the effect of an instruction cache. The consume functions shall be<br />

regar<strong>de</strong>d as transaction calls to the operating system which guards the<br />

execution of the co<strong>de</strong>. Consume suspends the execution of the co<strong>de</strong> until the<br />

cycles required to execute this co<strong>de</strong> have been allocated to that particular<br />

segment. Then one have to <strong>de</strong>ci<strong>de</strong> of the good tra<strong>de</strong>offs <strong>for</strong> the simulation<br />

speed and the granularity of the annotations.<br />

3. MPEG VIDEO DECODER CASE STUDY<br />

The MPEG vi<strong>de</strong>o <strong>de</strong>co<strong>de</strong>r, illustrated in Figure 8-7, is a application built to<br />

show the way of mo<strong>de</strong>ling a system at transaction level with the access<br />

mechanism. Its purpose was to get a hint on how fast a simulation of this level<br />

could, and which <strong>de</strong>tails are necessary to build an analysis. The first step<br />

was to <strong>de</strong>sign the plat<strong>for</strong>m architecture. The edit mo<strong>de</strong> of the tool allows to<br />

draw the hierarchical blocks of the <strong>de</strong>sign with their operations. We can either<br />

<strong>de</strong>fine new modules or reuse existing ones that are already inclu<strong>de</strong>d into a<br />

component library. Some components are provi<strong>de</strong>d with the tool such as the<br />

AMBA AHB bus.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!