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