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

Last change on this file since 132 was 132, checked in by rosiere, 15 years ago

1) add constant method - compatibility with SystemC
2) add Script to test sensitive list
3) fix bug in sensitive list

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