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

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

Update all component (except front_end) to :

  • new statistics model
  • no namespace std
File size: 2.6 KB
Line 
1/*
2 * $Id$
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#ifdef SYSTEMC
17  Shifter::Shifter (sc_module_name name
18#else
19  Shifter::Shifter (string name
20#endif
21#ifdef STATISTICS
22                    ,morpheo::behavioural::Parameters_Statistics * param_statistics
23#endif
24                    ,morpheo::behavioural::generic::shifter::Parameters param ):
25                    _name   (name)
26                    ,_param (param)
27  {
28#ifdef SYSTEMC
29    allocation ();
30#endif
31
32#ifdef STATISTICS
33    // Allocation of statistics
34    statistics_declaration(param_statistics);
35#endif
36
37#ifdef VHDL
38    // generate the vhdl
39    vhdl();
40#endif
41
42#ifdef SYSTEMC
43#if (defined(STATISTICS) || defined (VHDL_TESTBENCH))
44    SC_METHOD (transition);
45    dont_initialize ();
46    sensitive << (*(in_CLOCK)).pos();
47#endif
48
49    SC_METHOD (genMealy_shift);
50    dont_initialize ();
51    sensitive << (*(in_CLOCK)).neg();
52    for (uint32_t i=0; i<param._nb_port; i++)
53      {
54        sensitive << (*(in_SHIFTER_DATA      [i]));
55        if (param._shift_value == 0)
56        sensitive << (*(in_SHIFTER_SHIFT     [i]));
57        if (param._direction   == external_direction)
58        sensitive << (*(in_SHIFTER_DIRECTION [i]));
59        if (_param._rotate     == external_rotate)
60        sensitive << (*(in_SHIFTER_TYPE      [i]));
61        if (param._carry       == external_carry)
62        sensitive << (*(in_SHIFTER_CARRY     [i]));
63        if (param._carry       == external_completion)
64          if (_param._type_completion_bool == true)
65            sensitive << (*(in_SHIFTER_CARRY_IN  [i]));
66          else
67            sensitive << (*(in_SHIFTER_COMPLETION[i]));
68      }
69
70#ifdef SYSTEMCASS_SPECIFIC
71    // List dependency information
72    for (uint32_t i=0; i<param._nb_port; i++)
73      {
74        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_DATA      [i]));
75        if (param._shift_value == 0)
76        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_SHIFT     [i]));
77        if (param._direction   == external_direction)
78        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_DIRECTION [i]));
79        if (_param._rotate     == external_rotate)
80        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_TYPE      [i]));
81        if (param._carry       == external_carry)
82        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_CARRY     [i]));
83        if (param._carry       == external_completion)
84        if (_param._type_completion_bool == true)
85        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_CARRY_IN  [i]));
86        else
87        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_COMPLETION[i]));
88      }
89#endif   
90
91#endif
92  };
93 
94  Shifter::~Shifter (void)
95  {
96#ifdef SYSTEMC
97    deallocation ();
98#endif
99
100#ifdef STATISTICS
101    delete _stat;
102#endif
103  };
104
105}; // end namespace shifter
106}; // end namespace generic
107
108}; // end namespace behavioural
109}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.