Changeset 78 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic
- Timestamp:
- Mar 27, 2008, 11:04:49 AM (17 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic
- Files:
-
- 87 added
- 38 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/include/Parameters.h
r75 r78 32 32 public : ~Parameters () ; 33 33 34 public : std::stringmsg_error (void);34 public : Parameters_test msg_error (void); 35 35 36 36 public : std::string print (uint32_t depth); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/src/Parameters_msg_error.cpp
r75 r78 17 17 #undef FUNCTION 18 18 #define FUNCTION "Queue::msg_error" 19 std::stringParameters::msg_error(void)19 Parameters_test Parameters::msg_error(void) 20 20 { 21 21 log_printf(FUNC,Queue,FUNCTION,"Begin"); 22 22 23 std::string msg = ""; 24 25 return msg; 23 Parameters_test test("Queue"); 26 24 27 25 log_printf(FUNC,Queue,FUNCTION,"End"); 26 27 return test; 28 28 }; 29 29 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/test.cpp
r71 r78 7 7 */ 8 8 9 #define NB_ITERATION 1 9 #define NB_ITERATION 16 10 10 11 11 #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h" -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/Parameters.h
r75 r78 37 37 public : ~Parameters () ; 38 38 39 public : std::stringmsg_error (void);39 public : Parameters_test msg_error (void); 40 40 public : std::string print (uint32_t depth); 41 41 public : friend std::ostream& operator<< (std::ostream& output_stream, -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h
r75 r78 52 52 private : counter_t * _stat_nb_read; 53 53 private : counter_t * _stat_nb_write; 54 private : counter_t * _stat_average_read ;55 private : counter_t * _stat_average_write;56 private : counter_t * _stat_percent_use_read ;57 private : counter_t * _stat_percent_use_write;58 54 #endif 59 55 … … 88 84 89 85 // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 private : SC_REGISTER (Tdata_t) ** reg_DATA;86 private : Tdata_t * reg_DATA; 91 87 92 88 // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/Parameters_msg_error.cpp
r75 r78 17 17 namespace registerfile_monolithic { 18 18 19 std::stringParameters::msg_error(void)19 Parameters_test Parameters::msg_error(void) 20 20 { 21 std::string msg = "";21 Parameters_test test("RegisterFile_Monolithic"); 22 22 23 23 if ((8*sizeof(Tdata_t)) < _size_word) 24 { 25 msg += " - type \"Tdata_t\" is too little to the size defined by size_word\n"; 26 msg += " * size_word : " + toString(_size_word) + "\n"; 27 msg += " * Tdata_t (bits): " + toString(8*(sizeof(Tdata_t))) + "\n"; 28 } 24 test.error("Type \"Tdata_t\" is too little to the size defined by size_word"); 29 25 30 26 if ((8*sizeof(Taddress_t)) < log2(_nb_word)) 31 { 32 msg += " - type \"Taddress_t\" is too little to the size defined by nb_word\n"; 33 msg += " * nb_word : " + toString(_nb_word) + "\n"; 34 msg += " > size (bits) : " + toString(log2(_nb_word)) + "\n"; 35 msg += " * Taddress_t (bits) : " + toString(8*(sizeof(Taddress_t))) + "\n"; 36 } 27 test.error("type \"Taddress_t\" is too little to the size defined by nb_word"); 37 28 38 29 if ((_nb_port_read + _nb_port_read_write) < 1) 39 { 40 msg += " - you need a read port\n"; 41 msg += " * nb_port_read : " + toString(_nb_port_read) + "\n"; 42 msg += " * nb_port_read_write : " + toString(_nb_port_read_write) + "\n"; 43 } 30 test.error("you need a read port"); 44 31 45 32 if ((_nb_port_write + _nb_port_read_write) < 1) 46 { 47 msg += " - you need a write port\n"; 48 msg += " * nb_port_write : " + toString(_nb_port_write) + "\n"; 49 msg += " * nb_port_read_write : " + toString(_nb_port_read_write) + "\n"; 50 } 51 // if (_nb_word < 2) 52 // { 53 // msg += " - nb_word must be >= 2\n"; 54 // msg += " * nb_word : " + toString(_nb_word) + "\n"; 55 // } 33 test.error("you need a write port"); 56 34 57 return msg;35 return test; 58 36 }; 59 37 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_allocation.cpp
r75 r78 120 120 121 121 // ----- Register 122 reg_DATA = new SC_REGISTER (Tdata_t) *[_param->_nb_word];122 reg_DATA = new Tdata_t [_param->_nb_word]; 123 123 124 for (uint32_t i=0; i<_param->_nb_word; i++)125 {126 std::string rename = "reg_DATA[" + toString(i) + "]";127 reg_DATA [i] = new SC_REGISTER (Tdata_t) (rename.c_str());128 }129 130 124 #ifdef POSITION 131 125 _component->generate_file(); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_genMealy_read.cpp
r71 r78 29 29 else 30 30 address = 0; 31 Tdata_t data = REGISTER_READ(reg_DATA[address]);31 Tdata_t data = reg_DATA[address]; 32 32 33 33 log_printf(TRACE,RegisterFile,"genMealy_read","[%d] -> %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); 34 34 35 #ifdef STATISTICS36 (*_stat_nb_read) ++;37 #endif38 35 // Write in registerFile 39 36 PORT_WRITE(out_READ_DATA[i],data); … … 61 58 address = 0; 62 59 63 data = REGISTER_READ(reg_DATA[address]);60 data = reg_DATA[address]; 64 61 65 62 log_printf(TRACE,RegisterFile,"genMealy_read","[%d] -> %.8x",static_cast<uint32_t>(address),static_cast<uint32_t>(data)); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_statistics_declaration.cpp
r75 r78 23 23 _stat_nb_read = _stat->create_variable("nb_read" ); 24 24 _stat_nb_write = _stat->create_variable("nb_write"); 25 26 _stat_average_read = _stat->create_counter("average_read" , "", "Average read by cycle");27 _stat_average_write = _stat->create_counter("average_write", "", "Average write by cycle");28 25 29 _stat _percent_use_read = _stat->create_counter("percent_use_read" , "%", "Read port usage");30 _stat _percent_use_write = _stat->create_counter("percent_use_write", "%", "Write port usage");26 _stat->create_expr_average_by_cycle("average_read" , "nb_read" , "", "Average read by cycle" ); 27 _stat->create_expr_average_by_cycle("average_write", "nb_write", "", "Average write by cycle"); 31 28 32 _stat->create_expr("average_read" , "/ nb_read cycle", false); 33 _stat->create_expr("average_write", "/ nb_write cycle", false); 34 35 _stat->create_expr("percent_use_read" , "/ * average_read 100 " + toString(_param->_nb_port_read +_param->_nb_port_read_write), false); 36 _stat->create_expr("percent_use_write", "/ * average_write 100 " + toString(_param->_nb_port_write+_param->_nb_port_read_write), false); 29 _stat->create_expr_percent ("percent_use_read" , "average_read" , toString(_param->_nb_port_read +_param->_nb_port_read_write), "Percent read by cycle" ); 30 _stat->create_expr_percent ("percent_use_write", "average_write", toString(_param->_nb_port_write+_param->_nb_port_read_write), "Percent write by cycle"); 37 31 38 32 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_transition.cpp
r75 r78 38 38 39 39 // Write in registerFile 40 REGISTER_WRITE(reg_DATA[address],data);40 reg_DATA[address] = data; 41 41 } 42 42 } … … 62 62 63 63 // Write in registerFile 64 REGISTER_WRITE(reg_DATA[address],data);64 reg_DATA[address] = data; 65 65 } 66 66 #ifdef STATISTICS -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/Parameters.h
r75 r78 64 64 public : ~Parameters () ; 65 65 66 public : std::stringmsg_error (void);66 public : Parameters_test msg_error (void); 67 67 public : std::string print (uint32_t depth); 68 68 public : friend std::ostream& operator<< (std::ostream& output_stream, -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/RegisterFile_Multi_Banked.h
r75 r78 73 73 74 74 // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 private : SC_REGISTER (Tdata_t) *** reg_DATA;75 private : Tdata_t ** reg_DATA; 76 76 77 77 // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/Parameters_msg_error.cpp
r75 r78 15 15 16 16 17 std::stringParameters::msg_error(void)17 Parameters_test Parameters::msg_error(void) 18 18 { 19 19 log_printf(FUNC,RegisterFile_Multi_Banked,"msg_error","Begin"); 20 20 21 std::string msg = "";21 Parameters_test test("RegisterFile_Multi_Banked"); 22 22 23 23 if (_nb_port_read < _nb_port_read_by_bank) 24 { 25 msg += " - Each bank read's port must be higher at number of read port\n"; 26 msg += " * nb_port_read : " + toString(_nb_port_read ) + "\n"; 27 msg += " * nb_port_read_by_bank : " + toString(_nb_port_read_by_bank) + "\n"; 28 } 24 test.error("Each bank read's port must be higher at number of read port"); 29 25 30 26 if (_nb_port_write < _nb_port_write_by_bank) 31 { 32 msg += " - Each bank write's port must be higher at number of write port\n"; 33 msg += " * nb_port_write : " + toString(_nb_port_write ) + "\n"; 34 msg += " * nb_port_write_by_bank : " + toString(_nb_port_write_by_bank) + "\n"; 35 } 27 test.error("Each bank write's port must be higher at number of write port"); 36 28 37 29 if (_nb_bank < 1) 38 { 39 msg += " - nb_bank must be higher at 1\n"; 40 msg += " * nb_bank : " + toString(_nb_bank ) + "\n"; 41 } 42 43 return msg; 30 test.error("nb_bank must be higher at 1"); 44 31 45 32 log_printf(FUNC,RegisterFile_Multi_Banked,"msg_error","End"); 33 34 return test; 46 35 }; 47 36 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_allocation.cpp
r75 r78 96 96 // ~~~~~[ Registers ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 97 98 reg_DATA = new SC_REGISTER (Tdata_t) ** [_param->_nb_bank];98 reg_DATA = new Tdata_t * [_param->_nb_bank]; 99 99 100 100 for (uint32_t i=0; i<_param->_nb_bank; i++) 101 101 { 102 reg_DATA [i] = new SC_REGISTER (Tdata_t) * [_param->_nb_word]; 103 104 for (uint32_t j=0; j<_param->_nb_word; j++) 105 { 106 std::string rename = "reg_DATA_" + toString(i) + "_" + toString(j); 107 reg_DATA [i][j] = new SC_REGISTER (Tdata_t) (rename.c_str()); 108 } 102 reg_DATA [i] = new Tdata_t [_param->_nb_word]; 109 103 } 110 104 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_full_crossbar_genMealy_read.cpp
r62 r78 62 62 log_printf(TRACE,RegisterFile_Multi_Banked,"full_crossbar_genMealy_read"," * bank_port : %d",j); 63 63 64 Tdata_t data = REGISTER_READ(reg_DATA[bank][num_reg]);64 Tdata_t data = reg_DATA[bank][num_reg]; 65 65 66 66 log_printf(TRACE,RegisterFile_Multi_Banked,"full_crossbar_genMealy_read"," * data : %d",data); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_partial_crossbar_genMealy_read.cpp
r62 r78 64 64 log_printf(TRACE,RegisterFile_Multi_Banked,"full_crossbar_genMealy_read"," * bank_port : %d",j); 65 65 66 Tdata_t data = REGISTER_READ(reg_DATA[bank][num_reg]);66 Tdata_t data = reg_DATA[bank][num_reg]; 67 67 68 68 log_printf(TRACE,RegisterFile_Multi_Banked,"full_crossbar_genMealy_read"," * data : %d",data); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/src/RegisterFile_Multi_Banked_transition.cpp
r75 r78 31 31 32 32 // Write in registerFile 33 REGISTER_WRITE(reg_DATA[internal_WRITE_BANK[i]][internal_WRITE_NUM_REG[i]],data);33 reg_DATA[internal_WRITE_BANK[i]][internal_WRITE_NUM_REG[i]] = data; 34 34 } 35 35 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/include/Parameters.h
r75 r78 43 43 public : ~Parameters () ; 44 44 45 public : std::stringmsg_error (void);45 public : Parameters_test msg_error (void); 46 46 public : std::string print (uint32_t depth); 47 47 public : friend std::ostream& operator<< (std::ostream& output_stream, -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/include/RegisterFile.h
r75 r78 5 5 * $Id$ 6 6 * 7 * [ 7 * [ Description ] 8 8 * 9 9 */ … … 41 41 #endif 42 42 { 43 // -----[ 43 // -----[ fields ]---------------------------------------------------- 44 44 // Parameters 45 45 protected : const std::string _name; … … 54 54 55 55 #ifdef SYSTEMC 56 // ~~~~~[ 56 // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 57 57 // Interface 58 58 public : SC_CLOCK * in_CLOCK ; … … 73 73 #endif 74 74 75 // ~~~~~[ 75 // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 76 protected : morpheo::behavioural::generic::registerfile::registerfile_monolithic ::RegisterFile_Monolithic ::RegisterFile_Monolithic * component_RegisterFile_Monolithic ; 77 77 protected : morpheo::behavioural::generic::registerfile::registerfile_multi_banked::RegisterFile_Multi_Banked::RegisterFile_Multi_Banked * component_RegisterFile_Multi_Banked; 78 78 79 // ~~~~~[ 79 // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 80 81 // ~~~~~[ 81 // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 82 83 // -----[ 83 // -----[ methods ]--------------------------------------------------- 84 84 85 85 #ifdef SYSTEMC -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/src/Parameters_msg_error.cpp
r75 r78 16 16 17 17 18 std::stringParameters::msg_error(void)18 Parameters_test Parameters::msg_error(void) 19 19 { 20 log_printf(FUNC,RegisterFile,"msg_error","Begin");21 22 20 if (_instance == instance_RegisterFile_Monolithic) 23 21 return _param_registerfile_monolithic ->msg_error(); 24 22 else 25 23 return _param_registerfile_multi_banked->msg_error(); 26 27 log_printf(FUNC,RegisterFile,"msg_error","End");28 24 }; 29 25 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Select/Select_Priority_Fixed/include/Parameters.h
r75 r78 34 34 public : ~Parameters () ; 35 35 36 public : std::stringmsg_error (void);36 public : Parameters_test msg_error (void); 37 37 public : std::string print (uint32_t depth); 38 38 public : friend std::ostream& operator<< (std::ostream& output_stream, -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Select/Select_Priority_Fixed/src/Parameters_msg_error.cpp
r75 r78 17 17 18 18 19 std::stringParameters::msg_error(void)19 Parameters_test Parameters::msg_error(void) 20 20 { 21 21 log_printf(FUNC,Select_Priority_Fixed,"msg_error","Begin"); 22 22 23 std::string msg = "";23 Parameters_test test ("Select_Priority_Fixed"); 24 24 25 25 if ((_encoding_one_hot or _encoding_compact) == false) 26 { 27 msg += " - you must select a less one encoding\n"; 28 msg += " * encoding_one_hot : " + toString(_encoding_one_hot) + "\n"; 29 msg += " * encoding_compact : " + toString(_encoding_compact) + "\n"; 30 } 26 test.error("you must select a less one encoding"); 31 27 32 28 log_printf(FUNC,Select_Priority_Fixed,"msg_error","End"); 33 29 34 return msg;30 return test; 35 31 }; 36 32 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/TODO
r10 r78 1 1 - Ajouter quelques algorithme de selection 2 * Random 3 -> LFSR (?) qui ne tourne pas à chaque cycle mais à chaque in_access_val = '1' 2 4 * Round Robin 3 5 -> simple compteur de log2(N) bits 6 * Not Last Used 7 -> idem random mais : sauvegarde le dernier élément accéder. Si rand = last_elt, alors on renvoye not rand 4 8 * True LRU 5 9 -> fifo matériel. Un élément accéder sera placer en fin de fifo. 6 * Random7 -> LFSR (?) qui ne tourne pas à chaque cycle mais à chaque in_access_val = '1'10 * fifo 11 idem true LRU mais aucun evenement lors de l'accès -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/SelfTest/configuration.cfg
r42 r78 1 1 Victim_Pseudo_LRU 2 4 16 * 2# nb_entity3 1 4 * 2 # nb_access4 1 4 *2 # nb_update5 1 16 *2 # size_table 2 4 16 *4 # nb_entity 3 1 4 *4 # nb_access # 1 4 *4 # nb_update 4 1 16 *4 # size_table 5 0 1 +1 # table_global -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/SelfTest/src/main.cpp
r15 r78 14 14 cerr << "<Usage> " << exec << " name_instance list_params" << endl 15 15 << "list_params is :" << endl 16 << " - nb_entity (unsigned int)" << endl 17 << " - nb_access (unsigned int)" << endl 18 << " - nb_update (unsigned int)" << endl 19 << " - size_table (unsigned int)" << endl; 16 << " - nb_entity (unsigned int)" << endl 17 << " - nb_access (unsigned int)" << endl 18 // << " - nb_update (unsigned int)" << endl 19 << " - size_table (unsigned int)" << endl 20 << " - table_global (bool )" << endl; 20 21 exit (1); 21 22 } … … 30 31 usage (argv[0]); 31 32 32 const string name = argv[1]; 33 const uint32_t nb_entity = atoi(argv[2]); 34 const uint32_t nb_access = atoi(argv[3]); 35 const uint32_t nb_update = atoi(argv[4]); 36 const uint32_t size_table = atoi(argv[5]); 37 38 morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters param (nb_entity , 39 nb_access , 40 nb_update , 41 size_table); 33 const string name = argv[1]; 34 const uint32_t nb_entity = atoi(argv[2]); 35 const uint32_t nb_access = atoi(argv[3]); 36 // const uint32_t nb_update = atoi(argv[4]); 37 const uint32_t size_table = atoi(argv[4]); 38 const bool table_global = atoi(argv[5]); 39 morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters param 40 (nb_entity , 41 nb_access , 42 // nb_update , 43 size_table, 44 table_global); 42 45 43 46 test (name,param); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/SelfTest/src/test.cpp
r75 r78 15 15 cout << "<" << name << "> : Simulation SystemC" << endl; 16 16 17 if (param._nb_update < 1)18 {19 cerr << "<" << name << "> : To test, need a less one update's port" << endl;20 exit (EXIT_FAILURE);21 }22 23 17 try 24 18 { … … 45 39 param_stat, 46 40 #endif 47 param);41 ¶m); 48 42 49 43 #ifdef SYSTEMC … … 57 51 sc_signal<Tcontrol_t> ACCESS_ACK [param._nb_access]; 58 52 sc_signal<Taddress_t> ACCESS_ADDRESS [param._nb_access]; 53 sc_signal<Tcontrol_t> ACCESS_HIT [param._nb_access]; 59 54 sc_signal<Tentity_t > ACCESS_ENTITY [param._nb_access]; 60 61 sc_signal<Tcontrol_t> UPDATE_VAL [param._nb_update]; 62 sc_signal<Tcontrol_t> UPDATE_ACK [param._nb_update]; 63 sc_signal<Taddress_t> UPDATE_ADDRESS [param._nb_update]; 64 sc_signal<Tentity_t > UPDATE_ENTITY [param._nb_update]; 55 sc_signal<Tentity_t > ACCESS_VICTIM [param._nb_access]; 65 56 66 57 /******************************************************** … … 77 68 (*(_Victim_Pseudo_LRU-> in_ACCESS_VAL [i])) (ACCESS_VAL [i]); 78 69 (*(_Victim_Pseudo_LRU->out_ACCESS_ACK [i])) (ACCESS_ACK [i]); 79 if (param._size_ table>1)70 if (param._size_address>1) 80 71 (*(_Victim_Pseudo_LRU-> in_ACCESS_ADDRESS [i])) (ACCESS_ADDRESS [i]); 81 (*(_Victim_Pseudo_LRU->out_ACCESS_ENTITY [i])) (ACCESS_ENTITY [i]); 72 (*(_Victim_Pseudo_LRU-> in_ACCESS_HIT [i])) (ACCESS_HIT [i]); 73 (*(_Victim_Pseudo_LRU-> in_ACCESS_ENTITY [i])) (ACCESS_ENTITY [i]); 74 (*(_Victim_Pseudo_LRU->out_ACCESS_VICTIM [i])) (ACCESS_VICTIM [i]); 82 75 } 83 76 84 for (uint32_t i=0; i<param._nb_update; i++)85 {86 (*(_Victim_Pseudo_LRU-> in_UPDATE_VAL [i])) (UPDATE_VAL [i]);87 (*(_Victim_Pseudo_LRU->out_UPDATE_ACK [i])) (UPDATE_ACK [i]);88 if (param._size_table>1)89 (*(_Victim_Pseudo_LRU-> in_UPDATE_ADDRESS [i])) (UPDATE_ADDRESS [i]);90 (*(_Victim_Pseudo_LRU-> in_UPDATE_ENTITY [i])) (UPDATE_ENTITY [i]);91 }92 77 /******************************************************** 93 78 * Simulation - Begin … … 105 90 ACCESS_VAL[i].write(0); 106 91 } 107 for (uint32_t i=0; i<param._nb_update; i++)108 {109 UPDATE_VAL[i].write(0);110 }111 92 112 93 sc_start(5); 113 94 cout << "-----[ Test Update ]------------------------------" << endl; 114 for (uint32_t i=0; i<param._nb_update; i++) 115 { 116 UPDATE_VAL[i].write(1); 117 } 118 119 for (uint32_t j=0; j<param._size_table; j+=param._nb_update) 95 for (uint32_t i=0; i<param._nb_access; i++) 96 { 97 ACCESS_VAL[i].write(1); 98 ACCESS_HIT[i].write(1); 99 } 100 101 for (uint32_t j=0; j<param._size_table; j+=param._nb_access) 120 102 for (uint32_t k=0; k<param._nb_entity; k++) 121 103 { 122 104 cout << "time : " << static_cast<uint32_t>(sc_simulation_time()) << endl; 123 for (uint32_t i=0; i<param._nb_ update; i++)105 for (uint32_t i=0; i<param._nb_access; i++) 124 106 { 125 107 … … 131 113 addr = 0; 132 114 Tentity_t entity = (k+1)%param._nb_entity; 133 UPDATE_VAL [i].write(val );134 if (param._size_ table>1)135 UPDATE_ADDRESS [i].write(addr);136 UPDATE_ENTITY [i].write(entity);115 ACCESS_VAL [i].write(val ); 116 if (param._size_address>1) 117 ACCESS_ADDRESS [i].write(addr); 118 ACCESS_ENTITY [i].write(entity); 137 119 138 120 sc_start(0); 139 cout << "\t[" << i << "] " << val << " - " << UPDATE_ACK[i].read() << " addr : " << addr << " -> " << entity << endl;121 cout << "\t[" << i << "] " << val << " - " << ACCESS_ACK[i].read() << " addr : " << addr << " -> " << entity << endl; 140 122 } 141 123 sc_start(1); … … 143 125 144 126 145 for (uint32_t i=0; i<param._nb_ update; i++)146 { 147 UPDATE_VAL[i].write(0);127 for (uint32_t i=0; i<param._nb_access; i++) 128 { 129 ACCESS_VAL[i].write(0); 148 130 } 149 131 … … 151 133 152 134 cout << "-----[ Test Access ]------------------------------" << endl; 135 136 for (uint32_t i=0; i<param._nb_access; i++) 137 { 138 ACCESS_HIT[i].write(0); 139 } 153 140 154 141 … … 171 158 addr = 0; 172 159 ACCESS_VAL [i].write(val ); 173 if (param._size_ table>1)160 if (param._size_address>1) 174 161 ACCESS_ADDRESS [i].write(addr); 175 162 176 163 sc_start(0); 177 164 178 Tentity_t entity = ACCESS_ ENTITY[i].read();165 Tentity_t entity = ACCESS_VICTIM [i].read(); 179 166 180 167 cout << "\t[" << i << "] " << val << " - " << ACCESS_ACK[i].read() << " addr : " << addr << " -> " << entity << endl; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Parameters.h
r75 r78 24 24 public : const uint32_t _nb_entity ; // number of entity 25 25 public : const uint32_t _nb_access ; // number of port to select an entity 26 26 //public : const uint32_t _nb_update ; // number of port to update the internal entity 27 27 public : const uint32_t _size_table; // Size of victim_pseudo_lru's table 28 public : const bool _table_global; 29 public : const uint32_t _size_address; 28 30 29 31 //-----[ methods ]----------------------------------------------------------- 30 32 public : Parameters (uint32_t nb_entity , 31 33 uint32_t nb_access , 32 uint32_t nb_update , 33 uint32_t size_table); 34 // uint32_t nb_update , 35 uint32_t size_table, 36 bool table_global); 34 37 public : Parameters (Parameters & param) ; 35 38 public : ~Parameters () ; 36 39 37 public : std::stringmsg_error (void);38 public : std::string print (uint32_t depth);39 public : friend std::ostream& operator<< (std::ostream& output_stream,40 morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters & x);40 public : Parameters_test msg_error (void); 41 public : std::string print (uint32_t depth); 42 public : friend std::ostream& operator<< (std::ostream& output_stream, 43 morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters & x); 41 44 }; 42 45 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Types.h
r75 r78 9 9 */ 10 10 11 #include "Behavioural/ include/Types.h"11 #include "Behavioural/Generic/Victim/include/Types.h" 12 12 13 13 namespace morpheo { … … 17 17 namespace victim_pseudo_lru { 18 18 19 typedef uint32_t Taddress_t; 20 typedef uint32_t Tentity_t; 19 class entry_t 20 { 21 // Numerotation of victim_pseudo_lru's tree 22 // Tree of Pseudo-LRU 23 // 24 // | d2 [3] | 25 // | 0_______|_______1 | 26 // | | | | 27 // | d1 [1] [5] | 28 // | 0___|___1 0___|___1 | 29 // | | | | | | 30 // | d0 [0] [2] [4] [6] | 31 // | 0_|_1 0_|_1 0_|_1 0_|_1 | 32 // | | | | | | | | | | 33 // | Way Way Way Way Way Way Way Way | 34 // | 0 1 2 3 4 5 6 7 | 35 // 36 // Access : Way N with N=2*n -> bit 2*n = 0 37 // with N=2*n+1 -> bit 2*n = 1 38 // 39 // if bit = B, depth = D, next_B = B+D if B==1 40 // = B-D if B==0 41 // 42 // Update : 43 44 private : bool * _entry; 45 private : uint32_t _size; 46 47 public : entry_t () 48 { 49 }; 50 public : entry_t (uint32_t size) : _size (size) 51 { 52 _entry = new bool [size]; 53 54 // initialisation 55 for (uint32_t i=0; i<size; i++) 56 _entry [i] = false; 57 } 58 59 public : ~entry_t () 60 { 61 delete _entry; 62 } 63 64 private : uint32_t one_access (uint32_t index, uint32_t offset) 65 { 66 bool val = _entry[index]; 67 68 // Compute next slot 69 if (val == true) 70 return index + offset; 71 else 72 return index - offset; 73 } 74 75 public : uint32_t access () 76 { 77 uint32_t index = (_size>>1)-1; // middle 78 79 for (int32_t i=static_cast<uint32_t>(log2(_size)-1); i>= 1; i--) 80 { 81 index = one_access (index,(1<<(i-1))); 82 } 83 index = one_access (index,0); 84 85 // reverse by one_access make always a reverse 86 uint32_t offset = (_entry[index]==true)?1:0; 87 88 return index+offset; 89 } 90 91 private : uint32_t one_update (uint32_t index, uint32_t offset, uint32_t value) 92 { 93 uint32_t mask = (offset==0)?1:(offset<<1); 94 bool val = ((value & mask) != 0); 95 96 // reverse 97 _entry[index] = not val; 98 99 if (val == true) 100 // Compute next slot 101 return index + offset; 102 else 103 return index - offset; 104 } 105 public : void update (uint32_t value) 106 { 107 uint32_t index = (_size>>1)-1; // middle 108 109 for (int32_t i=static_cast<uint32_t>(log2(_size)-1); i>=1; i--) 110 { 111 index = one_update (index,1<<(i-1),value); 112 } 113 index = one_update (index,0,value); 114 } 115 116 public : std::string print () 117 { 118 std::string res = ""; 119 120 for (int32_t i=static_cast<int32_t>(_size)-1; i>=0; i--) 121 res += toString(_entry[i]) + " "; 122 123 return res; 124 } 125 }; 21 126 22 127 }; // end namespace victim_pseudo_lru -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Victim_Pseudo_LRU.h
r75 r78 5 5 * $Id$ 6 6 * 7 * [ 7 * [ Description ] 8 8 * 9 9 */ … … 53 53 #endif 54 54 { 55 // -----[ internal class ]-------------------------------------------- 56 protected : class entry_t 57 { 58 // Numerotation of victim_pseudo_lru's tree 59 // Tree of Pseudo-LRU 60 // 61 // | d2 [3] | 62 // | 0_______|_______1 | 63 // | | | | 64 // | d1 [1] [5] | 65 // | 0___|___1 0___|___1 | 66 // | | | | | | 67 // | d0 [0] [2] [4] [6] | 68 // | 0_|_1 0_|_1 0_|_1 0_|_1 | 69 // | | | | | | | | | | 70 // | Way Way Way Way Way Way Way Way | 71 // | 0 1 2 3 4 5 6 7 | 72 // 73 // Access : Way N with N=2*n -> bit 2*n = 0 74 // with N=2*n+1 -> bit 2*n = 1 75 // 76 // if bit = B, depth = D, next_B = B+D if B==1 77 // = B-D if B==0 78 // 79 // Update : 55 // -----[ fields ]---------------------------------------------------- 56 // Parameters 57 protected : const std::string _name; 80 58 81 private : bool * _entry; 82 private : uint32_t _size; 83 84 public : entry_t () 85 { 86 }; 87 public : entry_t (uint32_t size) : _size (size) 88 { 89 _entry = new bool [size]; 90 91 // initialisation 92 for (uint32_t i=0; i<size; i++) 93 _entry [i] = false; 94 } 95 96 public : ~entry_t () 97 { 98 delete _entry; 99 } 100 101 private : uint32_t one_access (uint32_t index, uint32_t offset) 102 { 103 bool val = _entry[index]; 104 105 // Compute next slot 106 if (val == true) 107 return index + offset; 108 else 109 return index - offset; 110 } 111 112 public : uint32_t access () 113 { 114 uint32_t index = (_size>>1)-1; // medium 115 116 for (int32_t i=static_cast<uint32_t>(log2(_size)-1); i>= 1; i--) 117 { 118 index = one_access (index,(1<<(i-1))); 119 } 120 index = one_access (index,0); 121 122 // reverse by one_access make always a reverse 123 uint32_t offset = (_entry[index]==true)?1:0; 124 125 return index+offset; 126 } 127 128 private : uint32_t one_update (uint32_t index, uint32_t offset, uint32_t value) 129 { 130 uint32_t mask = (offset==0)?1:(offset<<1); 131 bool val = ((value & mask) != 0); 132 133 // reverse 134 _entry[index] = not val; 135 136 if (val == true) 137 // Compute next slot 138 return index + offset; 139 else 140 return index - offset; 141 } 142 public : void update (uint32_t value) 143 { 144 uint32_t index = (_size>>1)-1; // medium 145 146 for (int32_t i=static_cast<uint32_t>(log2(_size)-1); i>=1; i--) 147 { 148 index = one_update (index,1<<(i-1),value); 149 } 150 index = one_update (index,0,value); 151 } 152 153 public : std::string print () 154 { 155 std::string res = ""; 156 157 for (int32_t i=static_cast<int32_t>(_size)-1; i>=0; i--) 158 res += toString(_entry[i]) + " "; 159 160 return res; 161 } 162 163 }; 164 // -----[ fields ]---------------------------------------------------- 165 // Parameters 166 protected : const std::string _name; 167 168 protected : const Parameters _param; 59 protected : const Parameters * _param; 169 60 #ifdef STATISTICS 170 61 public : Stat * _stat; … … 175 66 176 67 #ifdef SYSTEMC 177 // ~~~~~[ 68 // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 178 69 // Interface 179 70 public : SC_CLOCK * in_CLOCK ; … … 184 75 public : SC_OUT(Tcontrol_t) ** out_ACCESS_ACK ; 185 76 public : SC_IN (Taddress_t) ** in_ACCESS_ADDRESS; 186 public : SC_OUT(Tentity_t ) ** out_ACCESS_ENTITY ; 187 // Interface update 188 public : SC_IN (Tcontrol_t) ** in_UPDATE_VAL ; 189 public : SC_OUT(Tcontrol_t) ** out_UPDATE_ACK ; 190 public : SC_IN (Taddress_t) ** in_UPDATE_ADDRESS; 191 public : SC_IN (Tentity_t ) ** in_UPDATE_ENTITY ; 77 public : SC_IN (Tcontrol_t) ** in_ACCESS_HIT ; // hit = 1 : update next_victim with in_entity else with out_victim 78 public : SC_IN (Tentity_t ) ** in_ACCESS_ENTITY ; 79 public : SC_OUT(Tentity_t ) ** out_ACCESS_VICTIM ; 192 80 193 81 // Interface update 194 // ~~~~~[ 82 // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 83 private : entry_t ** reg_TABLE; 196 84 197 // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 private : Tentity_t * internal_ACCESS_ENTITY; 85 // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 86 private : Tcontrol_t * internal_ACCESS_ACK ; 87 private : Tentity_t * internal_ACCESS_VICTIM; 199 88 #endif 200 89 201 // -----[ 90 // -----[ methods ]--------------------------------------------------- 202 91 203 92 #ifdef SYSTEMC … … 205 94 #endif 206 95 207 public : Victim_Pseudo_LRU ( 96 public : Victim_Pseudo_LRU 97 ( 208 98 #ifdef SYSTEMC 209 99 sc_module_name name, 210 100 #else 211 101 std::string name, 212 102 #endif 213 103 #ifdef STATISTICS 214 104 morpheo::behavioural::Parameters_Statistics * param_statistics, 215 105 #endif 216 Parametersparam );106 Parameters * param ); 217 107 218 108 public : Victim_Pseudo_LRU (Parameters param ); … … 224 114 225 115 public : void transition (void); 226 public : void genM ealy_access(void);116 public : void genMoore (void); 227 117 #endif 228 118 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Parameters.cpp
r15 r78 17 17 Parameters::Parameters (uint32_t nb_entity , 18 18 uint32_t nb_access , 19 uint32_t nb_update , 20 uint32_t size_table): 19 // uint32_t nb_update , 20 uint32_t size_table, 21 bool table_global): 21 22 _nb_entity (nb_entity ), 22 23 _nb_access (nb_access ), 23 _nb_update (nb_update ), 24 _size_table (size_table) 24 // _nb_update (nb_update ), 25 _size_table ((table_global == true)?1:size_table), 26 _table_global (table_global), 27 _size_address (size_table) 25 28 { 26 29 test(); … … 30 33 _nb_entity (param._nb_entity ), 31 34 _nb_access (param._nb_access ), 32 _nb_update (param._nb_update ), 33 _size_table (param._size_table) 35 // _nb_update (param._nb_update ), 36 _size_table (param._size_table), 37 _table_global(param._table_global), 38 _size_address(param._size_address) 34 39 { 35 40 test(); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Parameters_msg_error.cpp
r75 r78 16 16 namespace victim_pseudo_lru { 17 17 18 std::stringParameters::msg_error(void)18 Parameters_test Parameters::msg_error(void) 19 19 { 20 std::string msg = "";20 Parameters_test test ("Victime_Pseudo_LRU"); 21 21 22 22 if (_nb_entity < 2) 23 { 24 msg += " - nb_entity must be >= 2\n"; 25 msg += " * nb_entity : " + toString(_nb_entity) + "\n"; 26 } 27 23 test.error("nb_entity must be >= 2"); 24 28 25 if (is_positive(log2(_nb_entity)) == false) 29 { 30 msg += " - nb_entity is not a power of 2\n"; 31 msg += " * nb_entity : " + toString(_nb_entity) + "\n"; 32 } 26 test.error("nb_entity is not a power of 2"); 33 27 34 28 if (_nb_access < 1) 35 { 36 msg += " - nb_access must be >= 1\n"; 37 msg += " * nb_access : " + toString(_nb_access) + "\n"; 38 } 29 test.error("nb_access must be >= 1"); 39 30 40 31 if (_size_table < 1) 41 { 42 msg += " - size_table must be >= 1\n"; 43 msg += " * size_table : " + toString(_size_table) + "\n"; 44 } 32 test.error("size_table must be >= 1"); 45 33 46 34 if (is_between_inclusive (static_cast<uint32_t>(log2(_nb_entity)),0 ,(8*sizeof(Tentity_t))) == false) 47 { 48 msg += " - type \"Tentity_t\" is too little to the size defined by nb_entity\n"; 49 msg += " * nb_entity : " + toString(_nb_entity) + "\n"; 50 msg += " * Tentity_t (bits) : " + toString(8*(sizeof(Tentity_t))) + "\n"; 51 } 35 test.error("type \"Tentity_t\" is too little to the size defined by nb_entity"); 52 36 53 37 if (is_between_inclusive (static_cast<uint32_t>(log2(_size_table)),0 ,(8*sizeof(Taddress_t))) == false) 54 { 55 msg += " - type \"Taddress_t\" is too little to the size defined by size_table\n"; 56 msg += " * size_table : " + toString(_size_table) + "\n"; 57 msg += " > size (bits) : " + toString(log2(_size_table)) + "\n"; 58 msg += " * Taddress_t (bits) : " + toString(8*(sizeof(Taddress_t))) + "\n"; 59 } 38 test.error("type \"Taddress_t\" is too little to the size defined by size_table"); 60 39 61 62 63 return msg; 40 return test; 64 41 }; 65 42 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Parameters_print.cpp
r75 r78 21 21 22 22 xml.balise_open("victim_pseudo_lru"); 23 xml.singleton_begin("nb_entity "); xml.attribut("value",toString(_nb_entity )); xml.singleton_end(); 24 xml.singleton_begin("nb_access "); xml.attribut("value",toString(_nb_access )); xml.singleton_end(); 25 xml.singleton_begin("nb_update "); xml.attribut("value",toString(_nb_update )); xml.singleton_end(); 26 xml.singleton_begin("size_table"); xml.attribut("value",toString(_size_table)); xml.singleton_end(); 23 xml.singleton_begin("nb_entity "); xml.attribut("value",toString(_nb_entity )); xml.singleton_end(); 24 xml.singleton_begin("nb_access "); xml.attribut("value",toString(_nb_access )); xml.singleton_end(); 25 // xml.singleton_begin("nb_update "); xml.attribut("value",toString(_nb_update )); xml.singleton_end(); 26 xml.singleton_begin("size_table "); xml.attribut("value",toString(_size_table )); xml.singleton_end(); 27 xml.singleton_begin("table_global"); xml.attribut("value",toString(_table_global)); xml.singleton_end(); 27 28 xml.balise_close(); 28 29 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU.cpp
r75 r78 22 22 morpheo::behavioural::Parameters_Statistics * param_statistics, 23 23 #endif 24 morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters param ):24 morpheo::behavioural::generic::victim::victim_pseudo_lru::Parameters * param ): 25 25 _name (name) 26 26 ,_param (param) … … 52 52 sensitive << (*(in_CLOCK)).pos(); 53 53 54 SC_METHOD (genM ealy_access);54 SC_METHOD (genMoore); 55 55 dont_initialize (); 56 56 sensitive << (*(in_CLOCK)).neg(); 57 for (uint32_t i=0; i<_param._nb_access; i++)58 {59 sensitive << *(in_ACCESS_VAL [i]);60 if (_param._size_table>1)61 sensitive << *(in_ACCESS_ADDRESS [i]);62 }63 57 64 58 #ifdef SYSTEMCASS_SPECIFIC 65 log_printf(TRACE,Victim_Pseudo_LRU,"Victim_Pseudo_LRU","List dependency information");66 // List dependency information67 for (uint32_t i=0; i<_param._nb_access; i++)68 {69 (*(out_ACCESS_ENTITY [i])) (*( in_ACCESS_VAL [i]));70 if (_param._size_table>1)71 (*(out_ACCESS_ENTITY [i])) (*( in_ACCESS_ADDRESS [i]));72 }73 59 #endif 74 60 75 61 // Constant - ack is always at one 76 for (uint32_t i=0; i<_param._nb_access; i++) 77 PORT_WRITE (out_ACCESS_ACK [i], 1); 78 for (uint32_t i=0; i<_param._nb_update; i++) 79 PORT_WRITE (out_UPDATE_ACK [i], 1); 62 for (uint32_t i=0; i<_param->_nb_access; i++) 63 { 64 internal_ACCESS_ACK [i] = 1; 65 PORT_WRITE (out_ACCESS_ACK [i], internal_ACCESS_ACK [i]); 66 } 80 67 81 68 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_allocation.cpp
r75 r78 8 8 9 9 #include "Behavioural/Generic/Victim/Victim_Pseudo_LRU/include/Victim_Pseudo_LRU.h" 10 #include "Behavioural/include/Allocation.h" 10 11 11 12 namespace morpheo { … … 42 43 // ~~~~~[ Interface : "access" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 44 { 44 in_ACCESS_VAL = new SC_IN (Tcontrol_t) * [_param._nb_access]; 45 out_ACCESS_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_access]; 46 if (_param._size_table>1) 47 in_ACCESS_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_access]; 48 out_ACCESS_ENTITY = new SC_OUT(Tentity_t ) * [_param._nb_access]; 49 50 for (uint32_t i=0; i<_param._nb_access; i++) 51 { 52 Interface_fifo * interface = _interfaces->set_interface("access_"+toString(i) 53 #ifdef POSITION 54 , IN ,WEST, "Access" 55 #endif 56 ); 45 ALLOC1_INTERFACE("access",IN,WEST, "Access", _param->_nb_access); 57 46 58 in_ACCESS_VAL [i] = interface->set_signal_valack_in ("val" , VAL); 59 out_ACCESS_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); 60 61 if (_param._size_table>1) 62 in_ACCESS_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table))); 63 out_ACCESS_ENTITY [i] = interface->set_signal_out <Tentity_t> ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity ))); 64 } 47 ALLOC1_VALACK_IN ( in_ACCESS_VAL ,VAL); 48 ALLOC1_VALACK_OUT(out_ACCESS_ACK ,ACK); 49 ALLOC1_SIGNAL_IN ( in_ACCESS_HIT ,"hit" ,Tcontrol_t,1); 50 ALLOC1_SIGNAL_IN ( in_ACCESS_ADDRESS,"address",Taddress_t,log2(_param->_size_address)); 51 ALLOC1_SIGNAL_IN ( in_ACCESS_ENTITY ,"entity" ,Tentity_t ,log2(_param->_nb_entity )); 52 ALLOC1_SIGNAL_OUT(out_ACCESS_VICTIM ,"victim" ,Tentity_t ,log2(_param->_nb_entity )); 65 53 } 66 54 67 // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 69 { 70 in_UPDATE_VAL = new SC_IN (Tcontrol_t) * [_param._nb_update]; 71 out_UPDATE_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_update]; 72 if (_param._size_table>1) 73 in_UPDATE_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_update]; 74 in_UPDATE_ENTITY = new SC_IN (Tentity_t ) * [_param._nb_update]; 75 76 for (uint32_t i=0; i<_param._nb_update; i++) 77 { 78 Interface_fifo * interface = _interfaces->set_interface("update_"+toString(i) 79 #ifdef POSITION 80 , IN ,EAST, "Update" 81 #endif 82 ); 55 // -----[ Register ]--------------------------------------------------- 56 reg_TABLE = new entry_t * [_param->_size_table]; 83 57 84 in_UPDATE_VAL [i] = interface->set_signal_valack_in ("val" , VAL); 85 out_UPDATE_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); 86 if (_param._size_table>1) 87 in_UPDATE_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address",static_cast<uint32_t>(log2(_param._size_table))); 88 in_UPDATE_ENTITY [i] = interface->set_signal_in <Tentity_t> ("entity" ,static_cast<uint32_t>(log2(_param._nb_entity ))); 89 } 90 } 91 // -----[ Register ]--------------------------------------------------- 92 reg_TABLE = new entry_t * [_param._size_table]; 93 94 for (uint32_t i=0; i<_param._size_table; i++) 95 reg_TABLE [i] = new entry_t (_param._nb_entity); 58 for (uint32_t i=0; i<_param->_size_table; i++) 59 reg_TABLE [i] = new entry_t (_param->_nb_entity); 96 60 97 61 // -----[ Internal ]--------------------------------------------------- 98 internal_ACCESS_ENTITY = new Tentity_t [_param._nb_entity]; 62 internal_ACCESS_ACK = new Tcontrol_t [_param->_nb_access]; 63 internal_ACCESS_VICTIM = new Tentity_t [_param->_nb_access]; 99 64 100 65 #ifdef POSITION -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_deallocation.cpp
r42 r78 3 3 * $Id$ 4 4 * 5 * [ 5 * [ Description ] 6 6 * 7 7 */ … … 19 19 delete in_CLOCK; 20 20 delete in_NRESET; 21 // -----[ 21 // -----[ Interface access ]------------------------------------------- 22 22 delete [] in_ACCESS_VAL ; 23 23 delete [] out_ACCESS_ACK ; 24 if (_param ._size_table>1)24 if (_param->_size_address>1) 25 25 delete [] in_ACCESS_ADDRESS; 26 delete [] out_ACCESS_ENTITY ; 26 delete [] in_ACCESS_HIT ; 27 delete [] in_ACCESS_ENTITY ; 28 delete [] out_ACCESS_VICTIM ; 27 29 28 // -----[ Interface update ]------------------------------------------- 29 delete [] in_UPDATE_VAL ; 30 delete [] out_UPDATE_ACK ; 31 if (_param._size_table>1) 32 delete [] in_UPDATE_ADDRESS; 33 delete [] in_UPDATE_ENTITY ; 34 35 // -----[ Register ]--------------------------------------------------- 30 // -----[ Register ]--------------------------------------------------- 36 31 delete [] reg_TABLE; 37 32 38 // -----[ Internal ]--------------------------------------------------- 39 delete [] internal_ACCESS_ENTITY; 33 // -----[ Internal ]--------------------------------------------------- 34 delete [] internal_ACCESS_ACK ; 35 delete [] internal_ACCESS_VICTIM; 40 36 41 #ifdef POSITION42 37 delete _component; 43 #else44 delete _interfaces;45 #endif46 38 }; 47 39 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_genMoore.cpp
r59 r78 15 15 namespace victim_pseudo_lru { 16 16 17 void Victim_Pseudo_LRU::genM ealy_access(void)17 void Victim_Pseudo_LRU::genMoore (void) 18 18 { 19 for (uint32_t i=0; i<_param ._nb_access; i++)19 for (uint32_t i=0; i<_param->_nb_access; i++) 20 20 { 21 if (PORT_READ (in_ACCESS_VAL[i]) == 1) 22 { 23 Taddress_t address; 21 Taddress_t address = (_param->_size_table>1)?PORT_READ(in_ACCESS_ADDRESS[i]):0; 24 22 25 if (_param._size_table>1) 26 address = PORT_READ (in_ACCESS_ADDRESS[i]); 27 else 28 address = 0; 29 30 internal_ACCESS_ENTITY[i] = reg_TABLE[address]->access(); 31 } 32 else 33 { 34 internal_ACCESS_ENTITY[i] = 0; 35 } 23 internal_ACCESS_VICTIM[i] = reg_TABLE[address]->access(); 36 24 37 PORT_WRITE(out_ACCESS_ ENTITY[i], internal_ACCESS_ENTITY[i]);25 PORT_WRITE(out_ACCESS_VICTIM[i], internal_ACCESS_VICTIM[i]); 38 26 }//end for i 39 27 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_transition.cpp
r75 r78 17 17 void Victim_Pseudo_LRU::transition (void) 18 18 { 19 #ifdef STATISTICS 20 uint32_t _stat_nb_access = 0; 21 uint32_t _stat_nb_update = 0; 22 #endif 19 for (uint32_t i=0; i<_param->_nb_access; i++) 20 { 21 if (PORT_READ (in_ACCESS_VAL[i]) and internal_ACCESS_ACK) 22 { 23 Taddress_t address = (_param->_size_table>1)?PORT_READ(in_ACCESS_ADDRESS[i]):0; 24 Tentity_t entity; 23 25 24 for (uint32_t i=0; i<_param._nb_access; i++) 25 { 26 // Access ... (ack is always at 1) 27 if (PORT_READ (in_ACCESS_VAL[i]) == 1) 28 { 29 #ifdef STATISTICS 30 _stat_nb_access ++; 31 #endif 32 Taddress_t address; 26 if (PORT_READ(in_ACCESS_HIT [i])) 27 { 28 // Hit : don't need a victim 29 // #ifdef STATISTICS 30 // _stat_nb_update ++; 31 // #endif 32 entity = PORT_READ(in_ACCESS_ENTITY[i]); 33 } 34 else 35 { 36 // Miss : need victim 37 // #ifdef STATISTICS 38 // _stat_nb_access ++; 39 // #endif 40 entity = internal_ACCESS_VICTIM[i]; 41 } 33 42 34 if (_param._size_table>1) 35 address = PORT_READ (in_ACCESS_ADDRESS[i]); 36 else 37 address = 0; 38 39 reg_TABLE[address]->update(internal_ACCESS_ENTITY[i]); 43 reg_TABLE[address]->update(entity); 40 44 } 41 45 }//end for i 42 46 43 for (uint32_t i=0; i<_param._nb_update; i++)44 {45 // Update ... (ack is always at 1)46 if (PORT_READ (in_UPDATE_VAL[i]) == 1)47 {48 #ifdef STATISTICS49 _stat_nb_update ++;50 #endif51 52 Taddress_t address;53 54 if (_param._size_table>1)55 address = PORT_READ (in_UPDATE_ADDRESS[i]);56 else57 address = 0;58 59 reg_TABLE[address]->update(PORT_READ(in_UPDATE_ENTITY[i]));60 }61 }//end for i62 63 47 #if defined(STATISTICS) or defined(VHDL_TESTBENCH) 64 48 end_cycle (); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_vhdl_body.cpp
r75 r78 35 35 vhdl->set_body ("-- Way Way Way Way Way Way Way Way "); 36 36 vhdl->set_body ("-- 0 1 2 3 4 5 6 7 "); 37 for (uint32_t i=0; i<_param ._nb_access; i++)37 for (uint32_t i=0; i<_param->_nb_access; i++) 38 38 { 39 39 vhdl->set_body (""); … … 42 42 std::string access_address; 43 43 44 if (_param ._size_table>1)44 if (_param->_size_table>1) 45 45 access_address = "conv_integer(in_ACCESS_"+toString(i)+"_ADDRESS)"; 46 46 else … … 50 50 vhdl->set_body (""); 51 51 52 for (int32_t j=static_cast<uint32_t>(log2(_param ._nb_entity)-1); j>=0; j--)52 for (int32_t j=static_cast<uint32_t>(log2(_param->_nb_entity)-1); j>=0; j--) 53 53 { 54 54 vhdl->set_body ("access_entity_"+toString(i)+"("+toString(j)+") <= "); … … 56 56 uint32_t cpt=0; 57 57 58 for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param ._nb_entity-1); k+=(1<<(j+1)))58 for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param->_nb_entity-1); k+=(1<<(j+1))) 59 59 { 60 60 std::string cond = ""; 61 61 62 62 // Create the condition 63 for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param ._nb_entity));l++)63 for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param->_nb_entity));l++) 64 64 { 65 65 if (l==static_cast<uint32_t>(j+1)) … … 85 85 vhdl->set_body (""); 86 86 vhdl->set_body ("-- port access"); 87 for (uint32_t i=0; i<_param ._nb_access; i++)88 for (int32_t j=static_cast<uint32_t>(log2(_param ._nb_entity)-1); j>=0; j--)87 for (uint32_t i=0; i<_param->_nb_access; i++) 88 for (int32_t j=static_cast<uint32_t>(log2(_param->_nb_entity)-1); j>=0; j--) 89 89 { 90 90 uint32_t cpt=0; 91 91 92 for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param ._nb_entity-1); k+=(1<<(j+1)))92 for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param->_nb_entity-1); k+=(1<<(j+1))) 93 93 { 94 94 bool have_cond = false; … … 96 96 97 97 // condition to change the bit 98 for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param ._nb_entity));l++)98 for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param->_nb_entity));l++) 99 99 { 100 100 have_cond = true; … … 118 118 vhdl->set_body (""); 119 119 vhdl->set_body ("-- port update"); 120 for (uint32_t i=0; i<_param ._nb_update; i++)121 for (int32_t j=static_cast<uint32_t>(log2(_param ._nb_entity)-1); j>=0; j--)120 for (uint32_t i=0; i<_param->_nb_update; i++) 121 for (int32_t j=static_cast<uint32_t>(log2(_param->_nb_entity)-1); j>=0; j--) 122 122 { 123 123 uint32_t cpt=0; 124 124 125 for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param ._nb_entity-1); k+=(1<<(j+1)))125 for (int32_t k=(1<<j)-1; k<static_cast<int32_t>(_param->_nb_entity-1); k+=(1<<(j+1))) 126 126 { 127 127 bool have_cond = false; … … 129 129 130 130 // condition to change the bit 131 for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param ._nb_entity));l++)131 for (uint32_t l=j+1; l<static_cast<uint32_t>(log2(_param->_nb_entity));l++) 132 132 { 133 133 have_cond = true; … … 146 146 std::string update_address; 147 147 148 if (_param ._size_table>1)148 if (_param->_size_table>1) 149 149 update_address = "conv_integer(in_UPDATE_"+toString(i)+"_ADDRESS)"; 150 150 else … … 168 168 vhdl->set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then"); 169 169 vhdl->set_body ("\t\t-- Access port"); 170 for (uint32_t i=0; i<_param ._nb_access; i++)170 for (uint32_t i=0; i<_param->_nb_access; i++) 171 171 { 172 172 std::string access_address; 173 173 174 if (_param ._size_table>1)174 if (_param->_size_table>1) 175 175 access_address = "conv_integer(in_ACCESS_"+toString(i)+"_ADDRESS)"; 176 176 else … … 183 183 184 184 vhdl->set_body ("\t\t-- Update port"); 185 for (uint32_t i=0; i<_param ._nb_update; i++)185 for (uint32_t i=0; i<_param->_nb_update; i++) 186 186 { 187 187 std::string update_address; 188 188 189 if (_param ._size_table>1)189 if (_param->_size_table>1) 190 190 update_address = "conv_integer(in_UPDATE_"+toString(i)+"_ADDRESS)"; 191 191 else … … 207 207 vhdl->set_body ("-- Ack is always "); 208 208 vhdl->set_body (""); 209 for (uint32_t i=0; i<_param ._nb_access; i++)209 for (uint32_t i=0; i<_param->_nb_access; i++) 210 210 { 211 211 vhdl->set_body ("out_ACCESS_"+toString(i)+"_ACK <= '1';"); … … 213 213 } 214 214 vhdl->set_body (""); 215 for (uint32_t i=0; i<_param ._nb_update; i++)215 for (uint32_t i=0; i<_param->_nb_update; i++) 216 216 { 217 217 vhdl->set_body ("out_UPDATE_"+toString(i)+"_ACK <= '1';"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/Victim_Pseudo_LRU/src/Victim_Pseudo_LRU_vhdl_declaration.cpp
r42 r78 18 18 void Victim_Pseudo_LRU::vhdl_declaration (Vhdl * & vhdl) 19 19 { 20 vhdl->set_type ("Ttable", "array (" + toString(_param ._size_table-1) + " downto 0) of "+std_logic(_param._nb_entity-1));20 vhdl->set_type ("Ttable", "array (" + toString(_param->_size_table-1) + " downto 0) of "+std_logic(_param->_nb_entity-1)); 21 21 22 22 23 23 vhdl->set_signal ("reg_TABLE", "Ttable"); 24 for (uint32_t i=0; i<_param ._nb_access; i++)24 for (uint32_t i=0; i<_param->_nb_access; i++) 25 25 { 26 vhdl->set_signal ("access_entry_"+toString(i)+" ",std_logic(_param ._nb_entity-1));27 vhdl->set_signal ("access_next_entry_"+toString(i)+"",std_logic(_param ._nb_entity-1));28 vhdl->set_signal ("access_entity_"+toString(i)+" ",std_logic(static_cast<uint32_t>(log2(_param ._nb_entity))));26 vhdl->set_signal ("access_entry_"+toString(i)+" ",std_logic(_param->_nb_entity-1)); 27 vhdl->set_signal ("access_next_entry_"+toString(i)+"",std_logic(_param->_nb_entity-1)); 28 vhdl->set_signal ("access_entity_"+toString(i)+" ",std_logic(static_cast<uint32_t>(log2(_param->_nb_entity)))); 29 29 } 30 30 31 for (uint32_t i=0; i<_param ._nb_update; i++)31 for (uint32_t i=0; i<_param->_nb_update; i++) 32 32 { 33 vhdl->set_signal ("update_next_entry_"+toString(i)+"",std_logic(_param ._nb_entity-1));33 vhdl->set_signal ("update_next_entry_"+toString(i)+"",std_logic(_param->_nb_entity-1)); 34 34 } 35 35 };
Note: See TracChangeset
for help on using the changeset viewer.