[2] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: RegisterFile_Monolithic_transition.cpp 101 2009-01-15 17:19:08Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
[15] | 9 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h" |
---|
[2] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace generic { |
---|
| 14 | namespace registerfile { |
---|
[15] | 15 | namespace registerfile_monolithic { |
---|
| 16 | void RegisterFile_Monolithic::transition (void) |
---|
[2] | 17 | { |
---|
[53] | 18 | log_printf(FUNC,RegisterFile,"transition","Begin"); |
---|
[2] | 19 | |
---|
[101] | 20 | if (_param->_have_init_value and (PORT_READ(in_NRESET) == 0)) |
---|
[2] | 21 | { |
---|
[101] | 22 | for (uint32_t i=0; i<_param->_nb_word; ++i) |
---|
| 23 | reg_DATA[i] = fromString<Tdata_t>(_param->_init_value); |
---|
[2] | 24 | } |
---|
[101] | 25 | else |
---|
[55] | 26 | { |
---|
[101] | 27 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
| 28 | { |
---|
| 29 | // Have a write? |
---|
| 30 | if ( PORT_READ(in_WRITE_VAL[i]) == true) |
---|
| 31 | { |
---|
[55] | 32 | #ifdef STATISTICS |
---|
[101] | 33 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[88] | 34 | (*_stat_nb_write) ++; |
---|
[55] | 35 | #endif |
---|
[101] | 36 | |
---|
| 37 | Taddress_t address = (_param->_have_port_address)?PORT_READ(in_WRITE_ADDRESS[i]):0; |
---|
| 38 | Tdata_t data = PORT_READ(in_WRITE_DATA [i]); |
---|
| 39 | |
---|
| 40 | log_printf(TRACE,RegisterFile,"transition","[%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); |
---|
| 41 | |
---|
| 42 | // Write in registerFile |
---|
| 43 | reg_DATA[address] = data; |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | for (uint32_t i=0; i<_param->_nb_port_read_write; i++) |
---|
| 47 | { |
---|
| 48 | // Have a read_write? |
---|
| 49 | if (PORT_READ(in_READ_WRITE_VAL[i]) == true) |
---|
| 50 | { |
---|
| 51 | if (PORT_READ(in_READ_WRITE_RW [i]) == RW_WRITE) |
---|
| 52 | { |
---|
[71] | 53 | #ifdef STATISTICS |
---|
[101] | 54 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 55 | (*_stat_nb_write) ++; |
---|
[71] | 56 | #endif |
---|
[101] | 57 | |
---|
| 58 | Taddress_t address = (_param->_have_port_address)?PORT_READ(in_READ_WRITE_ADDRESS[i]):0; |
---|
| 59 | Tdata_t data = PORT_READ(in_READ_WRITE_WDATA [i]); |
---|
| 60 | |
---|
| 61 | log_printf(TRACE,RegisterFile,"transition","[%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); |
---|
| 62 | |
---|
| 63 | // Write in registerFile |
---|
| 64 | reg_DATA[address] = data; |
---|
| 65 | } |
---|
| 66 | #ifdef STATISTICS |
---|
| 67 | else |
---|
| 68 | { |
---|
| 69 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 70 | (*_stat_nb_read) ++; |
---|
| 71 | } |
---|
| 72 | #endif |
---|
| 73 | } |
---|
| 74 | } |
---|
[55] | 75 | } |
---|
| 76 | |
---|
[2] | 77 | #ifdef STATISTICS |
---|
[88] | 78 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 79 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
| 80 | if ( PORT_READ(in_READ_VAL [i]) == 1) |
---|
| 81 | (*_stat_nb_read) ++; |
---|
[2] | 82 | #endif |
---|
| 83 | |
---|
[75] | 84 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
[71] | 85 | end_cycle(); |
---|
[75] | 86 | #endif |
---|
[53] | 87 | log_printf(FUNC,RegisterFile,"transition","End"); |
---|
[2] | 88 | }; |
---|
| 89 | |
---|
[15] | 90 | }; // end namespace registerfile_monolithic |
---|
[2] | 91 | }; // end namespace registerfile |
---|
| 92 | }; // end namespace generic |
---|
| 93 | }; // end namespace behavioural |
---|
| 94 | }; // end namespace morpheo |
---|
| 95 | #endif |
---|