[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 { |
---|
| 16 | void RegisterFile_Monolithic::transition (void) |
---|
[2] | 17 | { |
---|
[53] | 18 | log_printf(FUNC,RegisterFile,"transition","Begin"); |
---|
[2] | 19 | #ifdef STATISTICS |
---|
| 20 | _stat_nb_write = 0; |
---|
| 21 | #endif |
---|
| 22 | |
---|
[55] | 23 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
[2] | 24 | { |
---|
| 25 | // Have a write? |
---|
[6] | 26 | if ( PORT_READ(in_WRITE_VAL[i]) == true) |
---|
[2] | 27 | { |
---|
| 28 | #ifdef STATISTICS |
---|
| 29 | _stat_nb_write ++; |
---|
| 30 | #endif |
---|
| 31 | |
---|
[62] | 32 | Taddress_t address; |
---|
| 33 | if (_param->_have_port_address) |
---|
| 34 | address = PORT_READ(in_WRITE_ADDRESS[i]); |
---|
| 35 | else |
---|
| 36 | address = 0; |
---|
| 37 | |
---|
[2] | 38 | Tdata_t data = PORT_READ(in_WRITE_DATA [i]); |
---|
| 39 | |
---|
[53] | 40 | log_printf(TRACE,RegisterFile,"transition","[%d] <- %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); |
---|
[3] | 41 | |
---|
[2] | 42 | // Write in registerFile |
---|
| 43 | REGISTER_WRITE(reg_DATA[address],data); |
---|
| 44 | } |
---|
| 45 | } |
---|
[55] | 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) and |
---|
| 50 | (PORT_READ(in_READ_WRITE_RW [i]) == RW_WRITE)) |
---|
| 51 | { |
---|
| 52 | #ifdef STATISTICS |
---|
| 53 | _stat_nb_write ++; |
---|
| 54 | #endif |
---|
[2] | 55 | |
---|
[62] | 56 | Taddress_t address; |
---|
| 57 | if (_param->_have_port_address) |
---|
| 58 | address = PORT_READ(in_READ_WRITE_ADDRESS[i]); |
---|
| 59 | else |
---|
| 60 | address = 0; |
---|
[55] | 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 |
---|
| 66 | REGISTER_WRITE(reg_DATA[address],data); |
---|
| 67 | } |
---|
| 68 | } |
---|
| 69 | |
---|
[2] | 70 | #ifdef STATISTICS |
---|
| 71 | _stat->add(_stat_nb_read,_stat_nb_write); |
---|
| 72 | #endif |
---|
| 73 | |
---|
| 74 | #ifdef VHDL_TESTBENCH |
---|
[41] | 75 | vhdl_testbench_transition (); |
---|
[2] | 76 | #endif |
---|
[53] | 77 | log_printf(FUNC,RegisterFile,"transition","End"); |
---|
[2] | 78 | }; |
---|
| 79 | |
---|
[15] | 80 | }; // end namespace registerfile_monolithic |
---|
[2] | 81 | }; // end namespace registerfile |
---|
| 82 | }; // end namespace generic |
---|
| 83 | }; // end namespace behavioural |
---|
| 84 | }; // end namespace morpheo |
---|
| 85 | #endif |
---|