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