source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_allocation.cpp @ 104

Last change on this file since 104 was 88, checked in by rosiere, 16 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 3.4 KB
RevLine 
[2]1/*
2 * $Id: Shifter_allocation.cpp 88 2008-12-10 18:31:39Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Generic/Shifter/include/Shifter.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace generic {
13namespace shifter {
14
15
16  void Shifter::allocation (void)
17  {
[82]18    _component   = new Component (_usage);
[2]19
[42]20    Entity * entity = _component->set_entity (_name       
21                                             ,"Shifter"   
22#ifdef POSITION
23                                             ,COMBINATORY
24#endif
25                                             );
26   
27    _interfaces = entity->set_interfaces();
28
[2]29#if (defined(STATISTICS) || defined (VHDL_TESTBENCH))
[42]30    {
31      Interface_fifo * interface = _interfaces->set_interface(""
32#ifdef POSITION
33                                                              , IN 
34                                                              , SOUTH
35                                                              , "Generalist interface"
[2]36#endif
[42]37                                                              );
38     
39       in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_NO);
40       in_NRESET       = interface->set_signal_in <Tcontrol_t>  ("nreset",1, RESET_VHDL_NO);
41    }
42#endif
[2]43   
[42]44    {
45      // Interface "shifter"
[82]46       in_SHIFTER_DATA      = new SC_IN (Tdata_t)      * [_param->_nb_port];
47      if (_param->_shift_value == 0)
48       in_SHIFTER_SHIFT     = new SC_IN (Tshift_t)     * [_param->_nb_port];
49      if (_param->_direction   == external_direction)
50       in_SHIFTER_DIRECTION = new SC_IN (Tdirection_t) * [_param->_nb_port];
51      if (_param->_rotate      == external_rotate)
52       in_SHIFTER_TYPE      = new SC_IN (Ttype_t)      * [_param->_nb_port];
53      if (_param->_carry       == external_carry)
54       in_SHIFTER_CARRY     = new SC_IN (Tcarry_t)     * [_param->_nb_port];
55      if (_param->_carry       == external_completion)
56      if (_param->_type_completion_bool == true)
57       in_SHIFTER_CARRY_IN  = new SC_IN (Tcontrol_t)   * [_param->_nb_port];
[42]58      else
[82]59       in_SHIFTER_COMPLETION= new SC_IN (Tdata_t)      * [_param->_nb_port];
60      out_SHIFTER_DATA      = new SC_OUT(Tdata_t)      * [_param->_nb_port];
[42]61     
[82]62      for (uint32_t i=0; i<_param->_nb_port; i++)
[42]63        {
64          Interface_fifo * interface = _interfaces->set_interface("shifter_"+toString(i)
65#ifdef POSITION
66                                                                  , IN 
67                                                                  , SOUTH
68                                                                  , "Generalist interface"
69#endif
70                                                                  );
71         
[82]72           in_SHIFTER_DATA       [i] = interface->set_signal_in  <Tdata_t     > ("data"      ,_param->_size_data);
73          if (_param->_shift_value == 0)
74           in_SHIFTER_SHIFT      [i] = interface->set_signal_in  <Tshift_t    > ("shift"     ,static_cast<uint32_t>(ceil(log2(_param->_size_data))));
75          if (_param->_direction == external_direction)
[42]76           in_SHIFTER_DIRECTION  [i] = interface->set_signal_in  <Tdirection_t> ("direction" ,1);
[82]77          if (_param->_rotate  == external_rotate)
[42]78           in_SHIFTER_TYPE       [i] = interface->set_signal_in  <Ttype_t     > ("type"      ,1);
[82]79          if (_param->_carry == external_carry)
[42]80           in_SHIFTER_CARRY      [i] = interface->set_signal_in  <Tcarry_t    > ("carry"     ,1);
[82]81          if (_param->_carry       == external_completion)
82          if (_param->_type_completion_bool == true)
[42]83           in_SHIFTER_CARRY_IN   [i] = interface->set_signal_in  <Tcontrol_t  > ("carry_in"  ,1);
84          else
[82]85           in_SHIFTER_COMPLETION [i] = interface->set_signal_in  <Tdata_t     > ("completion",_param->_size_data_completion);
86          out_SHIFTER_DATA       [i] = interface->set_signal_out <Tdata_t     > ("data"      ,_param->_size_data);
[88]87        }
[42]88    }
[2]89
[42]90#ifdef POSITION
[88]91    if (usage_is_set(_usage,USE_POSITION))
92      _component->generate_file();
[42]93#endif
[2]94
95  };
[42]96 
[2]97}; // end namespace shifter
98}; // end namespace generic
99}; // end namespace behavioural
100}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.