Changes between Version 2 and Version 3 of Component/Virtual Coprocessor Wrapper


Ignore:
Timestamp:
Jan 15, 2013, 10:01:39 AM (11 years ago)
Author:
meunier
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Component/Virtual Coprocessor Wrapper

    v2 v3  
    1414
    1515The task thread communicates with the ''wrapper'' with two fifo channels:
    16  * the `cmd` channel, which transmits to the ''wrapper'' the SRL commands:
     16 * the `cmd` channel, which transmits to the ''wrapper'' the SRL commands. These commands take the form of function calls in the task code:
    1717   * `srl_mwmr_read(channel, buffer, size)`
    1818   * `srl_mwmr_write(channel, buffer, size)`
     
    6565
    6666
    67 (A finir)
    68 
    6967= Component usage =
    7068
    71 The virtual Coprocessor Wrapper is primarily intended to be used with Dsx-vm (to be released soon?), but it can also be used "by hand". In the following is an example of a dummy ''adder'' task, which makes a vectorial 32-bit addition of size 8 (i.e. there are 16 words in input and 8 words in output). 3 files must be created:
     69The virtual Coprocessor Wrapper is primarily intended to be used with Dsx-vm (to be released soon?), but it can also be used "by hand".
     70
     71== Example ==
     72
     73In the following is an example of a dummy ''adder'' task, which makes a vectorial 32-bit addition of size 8 (i.e. there are 16 words in input and 8 words in output). 3 files must be created:
    7274 * `my_adder_copro.sd`
    7375 * `my_adder_copro.h`
     
    124126{
    125127
    126 
    127 public:
     128    public:
    128129    ~MyAdderCopro();
    129130    MyAdderCopro(sc_core::sc_module_name insname);
    130131
    131 private:
     132
     133    private:
    132134    void * task_func(); // Task code
    133135
     
    155157
    156158tmpl(/**/)::MyAdderCopro(sc_core::sc_module_name insname)
    157             dsx::caba::VirtualCoprocessorWrapper(insname, stringArray("output", NULL), intArray(1, 8), stringArray("input0", "input1", NULL), intArray(2, 8, 8))
     159           :dsx::caba::VirtualCoprocessorWrapper(insname, stringArray("output", NULL), intArray(1, 8), stringArray("input0", "input1", NULL), intArray(2, 8, 8))
    158160{
    159161}
     
    173175         out[i] = in0[i] + in1[i];
    174176      }
     177      srl_busy_cycles(2); // The computation takes 2 cycles
    175178      srl_mwmr_write(output, &out, 1); // Write 8 words to output
    176179   }
     
    180183}}}
    181184
    182 
    183 À compléter...
    184 
     185The prototype of the parent class `VirtualCoprocessorWrapper` is:
     186{{{
     187#!cpp
     188VirtualCoprocessorWrapper(
     189        sc_core::sc_module_name insname,
     190        const vector<string> &fifos_out,
     191        const vector<int32_t>    &fifos_out_width,
     192        const vector<string> &fifos_in,
     193        const vector<int32_t>    &fifos_in_width)
     194: soclib::caba::BaseModule(insname)
     195}}}
     196
     197with
     198 fifos_out::
     199   a vector containing the names of the output fifos
     200 fifos_out_width::
     201   a vector containing the width of the output fifos
     202 fifos_in::
     203   a vector containing the names of the input fifos
     204 fifos_in_width::
     205   a vector containing the width of the input fifos
     206
     207The functions `stringArray` and `intArray` construct these vectors, the first argument of intArray being the number of fifos.
     208
     209
     210== Component Instanciation ==
     211
     212=== CABA Ports ===
     213
     214 * `sc_in<bool>` '''p_resetn''' : Global system reset
     215 * `sc_in<bool>` '''p_clk''' : Global system clock
     216 * `FifoOutput<uint32_t> *` '''p_to_ctrl''' : list of output ports to connect to a `soclib::caba::VciMwmrControllerCas` via a `soclib::caba::FifoSignals<uint32_t>`.
     217 * `FifoInput<uint32_t> *` '''p_from_ctrl''' : list of input ports to connect to a `soclib::caba::VciMwmrControllerCas` via a `soclib::caba::FifoSignals<uint32_t>`.
     218
     219