[112] | 1 | /* |
---|
| 2 | * $Id: Multiplier.cpp 132 2009-07-11 16:39:35Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Generic/Multiplier/include/Multiplier.h" |
---|
| 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace generic { |
---|
| 13 | namespace multiplier { |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | #undef FUNCTION |
---|
| 17 | #define FUNCTION "Multiplier::Multiplier" |
---|
| 18 | Multiplier::Multiplier |
---|
| 19 | ( |
---|
| 20 | #ifdef SYSTEMC |
---|
| 21 | sc_module_name name, |
---|
| 22 | #else |
---|
| 23 | string name, |
---|
| 24 | #endif |
---|
| 25 | #ifdef STATISTICS |
---|
| 26 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 27 | #endif |
---|
| 28 | morpheo::behavioural::generic::multiplier::Parameters * param, |
---|
| 29 | morpheo::behavioural::Tusage_t usage |
---|
| 30 | ): |
---|
| 31 | _name (name) |
---|
| 32 | ,_param (param) |
---|
| 33 | ,_usage (usage) |
---|
| 34 | { |
---|
| 35 | log_begin(Multiplier,FUNCTION); |
---|
| 36 | |
---|
| 37 | usage_environment(_usage); |
---|
| 38 | |
---|
| 39 | log_printf(INFO,Multiplier,FUNCTION,_("<%s> : Allocation"),_name.c_str()); |
---|
| 40 | |
---|
| 41 | allocation ( |
---|
| 42 | #ifdef STATISTICS |
---|
| 43 | param_statistics |
---|
| 44 | #endif |
---|
| 45 | ); |
---|
| 46 | |
---|
| 47 | #ifdef STATISTICS |
---|
| 48 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 49 | { |
---|
| 50 | log_printf(INFO,Multiplier,FUNCTION,_("<%s> : Allocation of statistics"),_name.c_str()); |
---|
| 51 | |
---|
| 52 | statistics_allocation(param_statistics); |
---|
| 53 | } |
---|
| 54 | #endif |
---|
| 55 | |
---|
| 56 | #ifdef VHDL |
---|
| 57 | if (usage_is_set(_usage,USE_VHDL)) |
---|
| 58 | { |
---|
| 59 | // generate the vhdl |
---|
| 60 | log_printf(INFO,Multiplier,FUNCTION,_("<%s> : Generate the vhdl"),_name.c_str()); |
---|
| 61 | |
---|
| 62 | vhdl(); |
---|
| 63 | } |
---|
| 64 | #endif |
---|
| 65 | |
---|
| 66 | #ifdef SYSTEMC |
---|
| 67 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 68 | { |
---|
| 69 | log_printf(INFO,Multiplier,FUNCTION,_("<%s> : Method - transition"),_name.c_str()); |
---|
| 70 | |
---|
| 71 | SC_METHOD (transition); |
---|
| 72 | dont_initialize (); |
---|
| 73 | sensitive << (*(in_CLOCK)).pos(); |
---|
| 74 | |
---|
| 75 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 76 | // List dependency information |
---|
| 77 | # endif |
---|
| 78 | |
---|
[116] | 79 | log_printf(INFO,Multiplier,FUNCTION,_("<%s> : Method - genMealy"),_name.c_str()); |
---|
[112] | 80 | |
---|
[116] | 81 | SC_METHOD (genMealy); |
---|
| 82 | dont_initialize (); |
---|
| 83 | sensitive << (*(in_CLOCK)).neg(); // need internal register |
---|
[132] | 84 | sensitive << (*(in_NRESET)); |
---|
[116] | 85 | |
---|
| 86 | if (_param->_latency == 0) |
---|
| 87 | sensitive << (*(in_MULTIPLIER_DATA_IN_0)) |
---|
| 88 | << (*(in_MULTIPLIER_DATA_IN_1)); |
---|
[112] | 89 | |
---|
[116] | 90 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 91 | // List dependency information |
---|
| 92 | # endif |
---|
[112] | 93 | |
---|
| 94 | #endif |
---|
| 95 | } |
---|
| 96 | log_end(Multiplier,FUNCTION); |
---|
| 97 | }; |
---|
| 98 | |
---|
| 99 | #undef FUNCTION |
---|
| 100 | #define FUNCTION "Multiplier::~Multiplier" |
---|
| 101 | Multiplier::~Multiplier (void) |
---|
| 102 | { |
---|
| 103 | log_begin(Multiplier,FUNCTION); |
---|
| 104 | |
---|
| 105 | #ifdef STATISTICS |
---|
| 106 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 107 | { |
---|
| 108 | statistics_deallocation(); |
---|
| 109 | } |
---|
| 110 | #endif |
---|
| 111 | |
---|
| 112 | log_printf(INFO,Multiplier,FUNCTION,_("<%s> : Deallocation"),_name.c_str()); |
---|
| 113 | deallocation (); |
---|
| 114 | |
---|
| 115 | log_end(Multiplier,FUNCTION); |
---|
| 116 | }; |
---|
| 117 | |
---|
| 118 | }; // end namespace multiplier |
---|
| 119 | }; // end namespace generic |
---|
| 120 | |
---|
| 121 | }; // end namespace behavioural |
---|
| 122 | }; // end namespace morpheo |
---|