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

Last change on this file since 144 was 144, checked in by rosiere, 14 years ago

1) compatible gcc 4.4.3
2) Translation file in MORPHEO_PREFIX directory

  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1/*
2 * $Id: Shifter.cpp 144 2010-09-28 11:19:10Z 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#undef  FUNCTION
16#define FUNCTION "Shifter::Shifter"
17  Shifter::Shifter (
18#ifdef SYSTEMC
19                    sc_module_name name
20#else
21                    std::string name
22#endif
23#ifdef STATISTICS
24                    ,morpheo::behavioural::Parameters_Statistics * param_statistics
25#endif
26                    ,morpheo::behavioural::generic::shifter::Parameters *param
27                    ,morpheo::behavioural::Tusage_t                usage ):
28    _name   (name)
29    ,_param (param)
30    ,_usage (usage)
31  {
32
33// #if DEBUG_Shifter == true
34//     log_printf(INFO,Shifter,FUNCTION,_("<%s> Parameters"),_name.c_str());
35
36//     std::cout << *param << std::endl;
37// #endif   
38
39    allocation ();
40
41#ifdef STATISTICS
42    if (usage_is_set(_usage,USE_STATISTICS))
43      {
44        // Allocation of statistics
45        statistics_declaration(param_statistics);
46      }
47#endif
48
49#ifdef VHDL
50    if (usage_is_set(_usage,USE_VHDL))
51      {
52        // generate the vhdl
53        vhdl();
54      }
55#endif
56
57#ifdef SYSTEMC
58    if (usage_is_set(_usage,USE_SYSTEMC))
59      {
60#if (defined(STATISTICS) || defined (VHDL_TESTBENCH))
61    SC_METHOD (transition);
62    dont_initialize ();
63    sensitive << (*(in_CLOCK)).pos();
64#endif
65
66    SC_METHOD (genMealy_shift);
67    dont_initialize ();
68    sensitive << (*(in_CLOCK)).neg()
69              << (*(in_NRESET));
70    for (uint32_t i=0; i<param->_nb_port; i++)
71      {
72        sensitive << (*(in_SHIFTER_DATA      [i]));
73        if (param->_shift_value == 0)
74        sensitive << (*(in_SHIFTER_SHIFT     [i]));
75        if (param->_direction   == external_direction)
76        sensitive << (*(in_SHIFTER_DIRECTION [i]));
77        if (_param->_rotate     == external_rotate)
78        sensitive << (*(in_SHIFTER_TYPE      [i]));
79        if (param->_carry       == external_carry)
80        sensitive << (*(in_SHIFTER_CARRY     [i]));
81        if (param->_carry       == external_completion)
82          {// BURP : ajout de la parenthèse
83            if (_param->_type_completion_bool == true)
84              sensitive << (*(in_SHIFTER_CARRY_IN  [i]));
85            else
86              sensitive << (*(in_SHIFTER_COMPLETION[i]));
87          }
88      }
89
90#ifdef SYSTEMCASS_SPECIFIC
91    // List dependency information
92    for (uint32_t i=0; i<param->_nb_port; i++)
93      {
94        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_DATA      [i]));
95        if (param->_shift_value == 0)
96        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_SHIFT     [i]));
97        if (param->_direction   == external_direction)
98        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_DIRECTION [i]));
99        if (_param->_rotate     == external_rotate)
100        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_TYPE      [i]));
101        if (param->_carry       == external_carry)
102        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_CARRY     [i]));
103        if (param->_carry       == external_completion)
104        if (_param->_type_completion_bool == true)
105        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_CARRY_IN  [i]));
106        else
107        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_COMPLETION[i]));
108      }
109#endif   
110      }
111#endif
112  };
113 
114#undef  FUNCTION
115#define FUNCTION "Shifter::~Shifter"
116  Shifter::~Shifter (void)
117  {
118#ifdef STATISTICS
119    if (usage_is_set(_usage,USE_STATISTICS))
120      delete _stat;
121#endif
122
123    deallocation ();
124  };
125
126}; // end namespace shifter
127}; // end namespace generic
128
129}; // end namespace behavioural
130}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.