Table Of Contents

Previous topic

The Task abstract model

Next topic

TCG drivers

This Page

The TCG

Application tasks and resources are modeled through Widgets objects, all grouped in a Tcg object. All widget objects inherit from the Widget class:

class dsx.application.widget.Widget

Base class defining an application widget.

Widgets are elements of a Tcg.

Note

Widget inherits dsx.ware.WNode, see dsx.ware.

__init__(type, name)

Creates an instance of this kind of widget.

Should be overridden but must be called in overridden __init__.

usedBy(task)

Informs the widget it is used as resource from a dsx.application.widgets.Task. This permits to build an usage graph.

The Tcg nodes: widgets

Inheritance diagram of dsx.application.widget.Widget, Const, Barrier, Mwmr, Lock, Memspace, Task

class dsx.application.widgets.Const

A Constant resource to use with ConstPort.

__init__(val)

Creates a new constant.

Parameters:val (int) – Value of the constant

Note

Constants have no name, their value yields an unique name directly.

class dsx.application.widgets.Barrier

A Synchronization barrier resource to use with BarrierPort.

__init__(name)

Creates a new Barrier.

Parameters:name (str) – Name of barrier
usedBy(task)

Used to build list of tasks to wait for

class dsx.application.widgets.Mwmr

A MWMR channel resource to use with MwmrInput or MwmrOutput.

__init__(name, width=0, depth=0)

Creates a new MWMR channel.

Parameters:
  • name (str) – Name of MWMR channel
  • width (int, bytes) – Width of one item
  • depth (int, count) – Count of items in the channel
class dsx.application.widgets.Lock

A Lock resource to use with LockPort.

__init__(name)

Creates a new Lock.

Parameters:name (str) – Name of lock
class dsx.application.widgets.Memspace

A Shared-memory buffer resource to use with MemspacePort.

__init__(name, size=0)

Creates a new Memspace.

Parameters:
  • name (str) – Name of memspace
  • size (int, bytes) – Size of memspace
class dsx.application.widgets.Task

Task is an instance of a TaskModel. Here we connect our allocated resources to the ones needed by the Task.

__init__(name, model, portmap={}, defines={})

Creates a new Task. All ports defined by the model must be satisfied. If not, a TaskError is raised.

Parameters:
  • name (str) – Name of instance
  • model (TaskModel or str) – The instantiated Task’s model. If a string is passed here, the task model is looked up by name.
  • portmap (dict) – Mapping of port name to Communication resources objects
  • defines (dict) – Mapping of preprocessor variables to values. All names listed in defines parameter of TaskModel must be listed here.
Raises :

TaskError if there is a mapping error

exception dsx.application.widgets.TaskError

A Task creation error.

The Tcg class

class dsx.application.tcg.Tcg

A Task and Communication Graph.

Note

Tcg inherits dsx.ware.Ware, see dsx.ware.

__init__(*tasks)

Create a Tcg. Only pass in tasks, associated resources will be retrieved through their connections.

Parameters:tasks (variadic of Task objects) – All the Tasks in the Tcg.

Tcg inherits dsx.ware.Ware.