[2] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 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 { |
---|
[2] | 16 | |
---|
[15] | 17 | void RegisterFile_Monolithic::genMealy_read (void) |
---|
[2] | 18 | { |
---|
[53] | 19 | log_printf(FUNC,RegisterFile,"genMealy_read","Begin"); |
---|
[2] | 20 | |
---|
| 21 | #ifdef STATISTICS |
---|
| 22 | _stat_nb_read = 0; |
---|
| 23 | #endif |
---|
| 24 | |
---|
[55] | 25 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
[2] | 26 | { |
---|
| 27 | // Have a write? |
---|
[6] | 28 | if ( PORT_READ(in_READ_VAL [i]) == 1) |
---|
[2] | 29 | { |
---|
[62] | 30 | Taddress_t address; |
---|
| 31 | if (_param->_have_port_address) |
---|
| 32 | address = PORT_READ(in_READ_ADDRESS[i]); |
---|
| 33 | else |
---|
| 34 | address = 0; |
---|
[3] | 35 | Tdata_t data = REGISTER_READ(reg_DATA[address]); |
---|
| 36 | |
---|
[53] | 37 | log_printf(TRACE,RegisterFile,"genMealy_read","[%d] -> %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); |
---|
[3] | 38 | |
---|
[2] | 39 | #ifdef STATISTICS |
---|
| 40 | _stat_nb_read ++; |
---|
| 41 | #endif |
---|
| 42 | // Write in registerFile |
---|
[3] | 43 | PORT_WRITE(out_READ_DATA[i],data); |
---|
[2] | 44 | } |
---|
| 45 | else |
---|
| 46 | { |
---|
[53] | 47 | //log_printf(TRACE,RegisterFile,"genMealy_read","Read [%d] : No transaction",i); |
---|
[2] | 48 | PORT_WRITE(out_READ_DATA[i],0); |
---|
| 49 | } |
---|
| 50 | } |
---|
[55] | 51 | |
---|
| 52 | for (uint32_t i=0; i<_param->_nb_port_read_write; i++) |
---|
| 53 | { |
---|
| 54 | Tdata_t data; |
---|
| 55 | |
---|
| 56 | // Have a write? |
---|
| 57 | if ( (PORT_READ(in_READ_WRITE_VAL [i]) == 1) and |
---|
| 58 | (PORT_READ(in_READ_WRITE_RW [i]) == RW_READ) |
---|
| 59 | ) |
---|
| 60 | { |
---|
[62] | 61 | Taddress_t address; |
---|
| 62 | if (_param->_have_port_address) |
---|
| 63 | address = PORT_READ(in_READ_WRITE_ADDRESS[i]); |
---|
| 64 | else |
---|
| 65 | address = 0; |
---|
[55] | 66 | |
---|
| 67 | data = REGISTER_READ(reg_DATA[address]); |
---|
| 68 | |
---|
| 69 | log_printf(TRACE,RegisterFile,"genMealy_read","[%d] -> %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); |
---|
| 70 | |
---|
| 71 | #ifdef STATISTICS |
---|
| 72 | _stat_nb_read ++; |
---|
| 73 | #endif |
---|
| 74 | // Write in registerFile |
---|
| 75 | |
---|
| 76 | } |
---|
| 77 | else |
---|
| 78 | { |
---|
| 79 | //log_printf(TRACE,RegisterFile,"genMealy_read","Read [%d] : No transaction",i); |
---|
| 80 | data = 0; |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | PORT_WRITE(out_READ_WRITE_RDATA[i],data); |
---|
| 84 | } |
---|
| 85 | |
---|
[53] | 86 | log_printf(FUNC,RegisterFile,"genMealy_read","End"); |
---|
[2] | 87 | |
---|
| 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 |
---|