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

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