#ifdef SYSTEMC //#if defined(STATISTICS) or defined(VHDL_TESTBENCH) /* * $Id: RegisterFile_Multi_Banked_transition.cpp 137 2010-02-16 12:35:48Z rosiere $ * * [ Description ] * */ #include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/RegisterFile_Multi_Banked.h" namespace morpheo { namespace behavioural { namespace generic { namespace registerfile { namespace registerfile_multi_banked { #undef FUNCTION #define FUNCTION "RegisterFile_Multi_Banked::transition" void RegisterFile_Multi_Banked::transition (void) { log_begin(RegisterFile_Multi_Banked,FUNCTION); log_function(RegisterFile_Multi_Banked,FUNCTION,_name.c_str()); // call function pointer // (this->*function_transition) (); if (PORT_READ(in_NRESET) == 0) { if (_param->_have_init_value) { for (uint32_t i=0; i<_param->_nb_bank; ++i) for (uint32_t j=0; j<_param->_nb_word; ++j) reg_DATA[i][j] = fromString(_param->_init_value); } else { for (uint32_t i=0; i<_param->_nb_bank; ++i) for (uint32_t j=0; j<_param->_nb_word; ++j) reg_DATA[i][j] = 0; } } else { for (uint32_t i=0; i<_param->_nb_port_write; i++) { if (internal_WRITE_VAL [i] == 1) { Tdata_t data = PORT_READ(in_WRITE_DATA [i]); // Write in registerFile reg_DATA[internal_WRITE_BANK[i]][internal_WRITE_NUM_REG[i]] = data; } #ifdef STATISTICS if (usage_is_set(_usage,USE_STATISTICS)) if (PORT_READ(in_WRITE_VAL [i])) { if (internal_WRITE_VAL [i] == 1) (*_stat_nb_write) ++; else (*_stat_nb_conflict_on_write) ++; } #endif } #ifdef STATISTICS if (usage_is_set(_usage,USE_STATISTICS)) for (uint32_t i=0; i<_param->_nb_port_read; i++) if (PORT_READ(in_READ_VAL [i])) { if (internal_READ_VAL [i] == 1) (*_stat_nb_read) ++; else (*_stat_nb_conflict_on_read) ++; } #endif } #if defined(DEBUG_RegisterFile_Multi_Banked) and DEBUG_RegisterFile_Multi_Banked and (DEBUG >= DEBUG_TRACE) if (0) { log_printf(TRACE,RegisterFile,FUNCTION," * Dump RegisterFile"); uint32_t limit = 4; for (uint32_t i=0; i<_param->_nb_bank; i++) { log_printf(TRACE,RegisterFile,FUNCTION," Bank %d",i); for (uint32_t j=0; j<_param->_nb_word_by_bank; j+=limit) { std::string str = ""; for (uint32_t k=0; k= _param->_nb_word) break; else str+=toString("[%.4d] %.8x ",index,reg_DATA[i][index]); } log_printf(TRACE,RegisterFile,FUNCTION," %s",str.c_str()); } } } #endif #if defined(STATISTICS) or defined(VHDL_TESTBENCH) end_cycle(); #endif log_end(RegisterFile_Multi_Banked,FUNCTION); }; }; // end namespace registerfile_multi_banked }; // end namespace registerfile }; // end namespace generic }; // end namespace behavioural }; // end namespace morpheo #endif //#endif