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