User Tools

Site Tools


tutos:micro_task_generation_passes

Ultra Low-Power Micro Tasking : LoMiTa

Application Specific Hardware Micro-tasks Synthesis

Power dissipation of current low-power embedded MCUs still remains orders of magnitude too high for many potential applications of WSN (Wireless Sensor Network). We believe that hardware specialization is an interesting way to reduce the power consumption of WSN nodes. In short, instead of running the application/OS tasks on a programmable processor, we propose to generate an application specific micro-architecture, tailored to each task of the application at hand.

We call these application specific micro-architectures hardware micro-tasks. A micro-task can be seen as a small datapath micro-architecture, driven by a control FSM that sequence/executes the micro-code corresponding to the task at hand. It is therefore not programmable, in the general sense.

We implemented a full flow to generate a VHDL representation of such a micro-task from C Level specifications, this page provides a short tutorial to use our flow.

Latest version Installation and user documentation for LoMiTa design-flow (based on Gecos)

The following PDF files contain the installation details and some user guide lines for exploiting LoMiTa design-flow:

Step-1: Setting up the environment

  1. Check out the following repositories to your workspace:
  2. Similarly the source folders present in trunk/datapathmodel/ from Cairn SVN repository (https://scm.gforge.inria.fr/svn/cairn)
  3. From Loparsenno SVN repository also checkout fr.irisa.cairn.wsn.benchmarks from software/pasha/examples/wsnBenchMarks/
    • This repository will provide us with the example C source codes and the Gecos script files.
  4. If you would like to experiment with the BURG description files used in the instruction selection phase, you have to check-out another directory from Loparsenno: fr.irisa.r2d2.gecos.examples from software/pasha/updated_passes/gecos/
  5. The BURG file used in this tutorial example is: mini-mips-reduced.brg

Step-2: Playing with the Passes

Here is a sample C file that has been processed to generate its corresponding micro-task:

Sample source code Gecos script

Open the Gecos script file, called benchmarks.cs present in fr.irisa.cairn.wsn.benchmarks/benchmarks/

There are several Gecos front-end passes (that you would be already familiar with), like RemoveCSpecific, ConstantPropagator, removeArray, FlattenScope etc.

We will talk about the back-end passes (highlihted in the above figure) that have been written to generate the assembly and VHDL descriptions for an application code using an unconstrained set of instruction-patterns. These passes are discussed below:

MemRegMIPSCodeSelector

We use a specialized code selector pass MemRegMIPSCodeSelector that has been written to perform the code selection for direct memory-operand-based instructions. It also generates an assembly code that has typed-register information. The BURG-description file (mini-mips-reduced.brg) used for instruction selection looks like this:

Burg code selector Assembly code

Here you can see that the rules written to generate assembly instruction can involve direct memory operands (the indir type of variables).

A sample assembly code output has been shown in the following snapshot where we can see the highlighted typed assembly instructions:

LI2S (LongInt2Short) and LI2B (LongInt2Byte)

These are the two passes used to convert the 32-bit and 16-bit wordlength instructions to multiple byte or short-level instructions. The output of LI2S has been shown in the following snapshot that converts all the Long-type instructions to series of short-level instructions. These passes can be found in software/pasha/updated_passes/hardwareTask/fr.irisa.cairn.hardwaretask.generic/ repository present at Loparsenno's SVN.

The source code of the LongInt2Short pass is shown in the figure below, it iterates all the instructions of a procedure and converts them appropriately to a set of short-level instructions. As an example, the highlighted piece of code converts a shriL instruction (involving an immediate shift right by one place of a long-level operand) to two shr instructions each having a short-level operand.

The output assembly code of the LI2S pass is shown in the figure below, where we can see that the movLL instruction has been converted into two mov instructions each having a 16-bit operand instead of a 32-bit operand of the original instruction.

Title title

GecosFSMBuilder

This pass interlinks the assembly-level data-structure of Gecos with the Datapath EMF-model and generates the corresponding datapath model which until now consists of only the FSM part. This pass can be found in software/pasha/updated_passes/hardwareTask/fr.irisa.cairn.hardwaretask.example/ repository present at Loparsenno's SVN.

The source code of the GecosFSMBuilder pass is shown in the figure below:

It generates the object of HTDatapath class, that in turns generates the FSM type object of HTUserFSMFactory class. The HTUserFSMFactory is basically the class that is used to convert the Gecos assembly level data-structure to the Datapath EMF-Model data-structure. Some glimpses of these classes are shown in the snapshots below:

Title title title

GecosFSMD2XML

The name tells everything … This pass is used to generate an XML description of the datapath-model. These descriptions can be found in fr.irisa.cairn.wsn.benchmarks/benchmarks/models directory.

GecosFSMD2VHDL

Similarly, this pass is used to generate an VHDL description of the datapath-model. These descriptions can be found in fr.irisa.cairn.wsn.benchmarks/benchmarks/models directory. Several examples of VHDL codes generated for micro-task FSM can be found in the same directory. Here is an example: crc16.vhd.tar.gz

The snapshot below shows the details of the GecosFSMD2VHDL class, where the DatapathVHDLGenerator class is used to generate the VHDL description of the Datapath EMF model created by the GecosFSMBuilder.


Step-3: Sequencer Builder --- A domain specific language (DSL) based method to generate the **micro-task FSMs**

Steven Derrien has developed a DSL for describing small controllers, the details can be found at Sequencer DSL

We generated an intermediate pass, called SequencerBuilder, that extracts a DSL-specific output file using the Gecos assembly-level data-structure. An example including this pass in the main Gecos script file is shown below:


The SequencerBuilder pass is available in software/pasha/updated_passes/hardwareTask/fr.irisa.cairn.hardwaretask.generic/ at the SVN of Loparsenno. The following snapshot shows an extract of this pass.


The pass basically iterates the Gecos assembly-level instructions and generates the DSL-specific XText output file with an .fsmseq extension. Then the DSL-based passes written by Steven convert this textual description of FSM into graphical (Dotty) and hardware (VHDL) descriptions.


tutos/micro_task_generation_passes.txt · Last modified: 2014/11/14 11:24 (external edit)