Optimization for Embedded System Design

MPOpt Framework > Frontend Compiler

The Frontend Compiler is based on a set of directives which provide the needed abstractions to model a SDF graph, i.e actors, channels and related information: the inherent graph structure of the application is extracted into a GDL representation, used by the Solver block. The directives are also processed to generate C code with platform specific target, used in a further step by the Backend Compiler block.

The figure and its related listing shows an example of SDF graph with four actors, which are called kernels in the framework programming model. Arcs are labeled with the name of the variable holding channel data and input/output rates are specified at both ends of an edge.

SDF graph example

void foo()
{
  /* Shared variables */
  double A[N], B[N], C[N], D[N];
  int i;
  /* N0 - input*/
  #pragma sdf kernel arcout(A, 16) arcout(B,16) input
  {
  for (i=0; i<N; i++)
  {
    A[i] = i*2;
    B[i] = sqrt(i);
  }
  }
  /* N1 */
  #pragma sdf kernel arcin(B, 32) arcout(C, 16)
  {
  for (i=0; i<N-1; i++)
    C[i] = B[i] + B[i+1];
  }
  /* N2 */
  #pragma sdf kernel arcin(A, 16) arcin(C, 16) arcout(D,16)
  {
  for (i=0; i<N; i+=2)
  {
    D[i] = A[i] * C[i];
    D[i+1] = A[i] / C[i];
  }
  }
  /* N3 - output */
  #pragma sdf kernel arcin(D, 1) output
  {
  for (i=0; i<N; i++)
    printf("D[%d] has value %f\n",i, D[i]);
  }
}

An actor is easily identified by enclosing a portion of code within the #pragma sdf kernel directive. Arcs are modeled through specific clauses associated to a kernel directive: e.g. N1 has an incoming arc, associated to array B, and one outgoing arc, associated to C. N1 consumes 32 tokens and produces 16 tokens at every firing: this is specified by attaching a numerical parameter to the arcin and arcout clauses.

Kernel N1 also has a self-loop: self-loops are modeled with a couple of matching (i.e. associated to the same variable) arcin/arcout clauses.

Input and output nodes of a SDF graph do not produce or consume any tokens: they represent I/O activities and are specifically addressed in most hardware architectures.

< Back to MPOpt Framework project page