[2] | 1 | /* |
---|
| 2 | * $Id: RegisterFile_Monolithic.cpp 98 2008-12-31 10:18:08Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
[15] | 8 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h" |
---|
[2] | 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace generic { |
---|
| 13 | namespace registerfile { |
---|
[15] | 14 | namespace registerfile_monolithic { |
---|
[2] | 15 | |
---|
[57] | 16 | RegisterFile_Monolithic::RegisterFile_Monolithic |
---|
| 17 | ( |
---|
[2] | 18 | #ifdef SYSTEMC |
---|
[57] | 19 | sc_module_name name, |
---|
[2] | 20 | #else |
---|
[75] | 21 | std::string name , |
---|
[2] | 22 | #endif |
---|
| 23 | #ifdef STATISTICS |
---|
[57] | 24 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
[2] | 25 | #endif |
---|
[57] | 26 | morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters * param, |
---|
| 27 | morpheo::behavioural::Tusage_t usage |
---|
| 28 | ): |
---|
| 29 | _name (name), |
---|
| 30 | _param (param), |
---|
| 31 | _usage (usage) |
---|
[2] | 32 | { |
---|
[41] | 33 | log_printf(FUNC,RegisterFile_Monolithic,"RegisterFile_Monolithic","Begin"); |
---|
| 34 | |
---|
[88] | 35 | #if DEBUG_RegisterFile_Monolithic == true |
---|
| 36 | log_printf(INFO,RegisterFile_Monolithic,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
| 37 | |
---|
| 38 | std::cout << *param << std::endl; |
---|
| 39 | #endif |
---|
| 40 | |
---|
[41] | 41 | log_printf(INFO,RegisterFile_Monolithic,"RegisterFile_Monolithic","Allocation"); |
---|
| 42 | allocation (); |
---|
| 43 | |
---|
[2] | 44 | #ifdef STATISTICS |
---|
[88] | 45 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[75] | 46 | statistics_declaration(param_statistics); |
---|
[2] | 47 | #endif |
---|
| 48 | |
---|
| 49 | #ifdef VHDL |
---|
| 50 | // generate the vhdl |
---|
[98] | 51 | if (usage_is_set(_usage,USE_VHDL)) |
---|
| 52 | vhdl(); |
---|
[2] | 53 | #endif |
---|
| 54 | |
---|
| 55 | #ifdef SYSTEMC |
---|
[88] | 56 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
[2] | 57 | { |
---|
[57] | 58 | SC_METHOD (transition); |
---|
| 59 | dont_initialize (); |
---|
[66] | 60 | sensitive << (*(in_CLOCK)).pos(); |
---|
[57] | 61 | |
---|
| 62 | SC_METHOD (genMealy_read); |
---|
| 63 | dont_initialize (); |
---|
[66] | 64 | sensitive << (*(in_CLOCK)).neg(); |
---|
[57] | 65 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
[62] | 66 | { |
---|
| 67 | sensitive << *(in_READ_VAL [i]); |
---|
| 68 | if (_param->_have_port_address) |
---|
| 69 | sensitive << *(in_READ_ADDRESS [i]); |
---|
| 70 | } |
---|
[57] | 71 | for (uint32_t i=0; i<_param->_nb_port_read_write; i++) |
---|
[62] | 72 | { |
---|
| 73 | sensitive << *(in_READ_WRITE_VAL [i]) |
---|
| 74 | << *(in_READ_WRITE_RW [i]); |
---|
| 75 | if (_param->_have_port_address) |
---|
| 76 | sensitive << *(in_READ_WRITE_ADDRESS [i]); |
---|
| 77 | } |
---|
[57] | 78 | |
---|
[71] | 79 | # ifdef SYSTEMCASS_SPECIFIC |
---|
[57] | 80 | // List dependency information |
---|
| 81 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
| 82 | { |
---|
| 83 | (*(out_READ_DATA [i])) (*( in_READ_VAL [i])); |
---|
[62] | 84 | if (_param->_have_port_address) |
---|
| 85 | (*(out_READ_DATA [i])) (*( in_READ_ADDRESS [i])); |
---|
[57] | 86 | } |
---|
| 87 | for (uint32_t i=0; i<_param->_nb_port_read_write; i++) |
---|
| 88 | { |
---|
| 89 | (*(out_READ_WRITE_RDATA [i])) (*( in_READ_WRITE_VAL [i])); |
---|
| 90 | (*(out_READ_WRITE_RDATA [i])) (*( in_READ_WRITE_RW [i])); |
---|
[62] | 91 | if (_param->_have_port_address) |
---|
| 92 | (*(out_READ_WRITE_RDATA [i])) (*( in_READ_WRITE_ADDRESS [i])); |
---|
[57] | 93 | } |
---|
[71] | 94 | # endif |
---|
[57] | 95 | |
---|
| 96 | for (uint32_t i=0; i<_param->_nb_port_read ; i++) |
---|
| 97 | PORT_WRITE(out_READ_ACK [i], 1); |
---|
| 98 | for (uint32_t i=0; i<_param->_nb_port_write ; i++) |
---|
| 99 | PORT_WRITE(out_WRITE_ACK [i], 1); |
---|
| 100 | for (uint32_t i=0; i<_param->_nb_port_read_write ; i++) |
---|
| 101 | PORT_WRITE(out_READ_WRITE_ACK [i], 1); |
---|
[2] | 102 | } |
---|
| 103 | #endif |
---|
[57] | 104 | |
---|
[41] | 105 | log_printf(FUNC,RegisterFile_Monolithic,"RegisterFile_Monolithic","End"); |
---|
[2] | 106 | }; |
---|
| 107 | |
---|
[15] | 108 | RegisterFile_Monolithic::~RegisterFile_Monolithic (void) |
---|
[2] | 109 | { |
---|
| 110 | #ifdef STATISTICS |
---|
[88] | 111 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[75] | 112 | delete _stat; |
---|
[2] | 113 | #endif |
---|
[41] | 114 | |
---|
| 115 | deallocation (); |
---|
[2] | 116 | }; |
---|
| 117 | |
---|
[15] | 118 | }; // end namespace registerfile_monolithic |
---|
[2] | 119 | }; // end namespace registerfile |
---|
| 120 | }; // end namespace generic |
---|
| 121 | }; // end namespace behavioural |
---|
| 122 | }; // end namespace morpheo |
---|