Changes between Initial Version and Version 1 of MwmrCoprocCreation


Ignore:
Timestamp:
Aug 9, 2006, 5:18:41 PM (19 years ago)
Author:
Nicolas Pouillon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MwmrCoprocCreation

    v1 v1  
     1Here we will explain how to create an hardware version of a task, writing its SocLib equivalent model.
     2
     3For instance in the explaination of the process, we'll write a IDCT (inverse discrete cosine transform) coprocessor.
     4 * It handles packets of 64 values, representing a block of 8*8 coefficients
     5 * It has one input and one output fifo
     6 * It handles 16-bit values
     7
     8== Coprocessor ==
     9
     10First we'll write the coprocessor in Caba [wiki:SystemC].
     11
     12{{{
     13
     14}}}
     15
     16== Declaration for SocLib code generation ==
     17
     18We have to declare this component to DSX:
     19
     20{{{
     21#!python
     22class HwIdct(MwmrCoproc):
     23    def __init__(self, name, **d):
     24        MwmrCoproc.__init__(self, name, ['input'], ['output'], **d)
     25}}}
     26
     27And register a Caba driver for this component:
     28
     29{{{
     30#!python
     31
     32# Heritage from MwmrCoprocCabaDriver is important
     33class idctgen(MwmrCoprocCabaDriver):
     34    # Here goal is to map between TaskModel fifo names and actual component's fifos
     35    namemap = {'output':'OUT', 'input':'IN'}
     36    # For all below, see [1]
     37    headers = 'hw_components/hw_idct.h',
     38    def __init__(self, node):
     39        MwmrCoprocCabaDriver.__init__(self, node)
     40        self.plugmap['output'] = "OUT"
     41        self.plugmap['input'] = "IN"
     42    def genType(self, driver):
     43        return 'HW_IDCT'
     44    def genDecl(self, driver):
     45        return '("%s")'%(self.node.name)
     46Caba.register(HwIdct, idctgen)
     47}}}
     48
     49Notes:
     50 1. CabaDriver
     51
     52== Task declaration ==
     53
     54{{{
     55#!python
     56
     57idct = TaskModel(
     58    'idct',
     59    infifos = [ 'input' ],
     60    outfifos = [ 'output' ],
     61    impl = [ SwTask( 'idct',
     62                     stack_size = 1024,
     63                     sources = [ 'src/idct.c' ] ),
     64             HwTask( HwIdct )
     65           ] )
     66}}}
     67
     68== That's all ==
     69
     70Now we can map this coprocessor as an hardware task