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