[88] | 1 | #ifndef morpheo_Morpheo_h |
---|
| 2 | #define morpheo_Morpheo_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id: Morpheo.h 110 2009-02-19 16:31:47Z rosiere $ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #ifdef SYSTEMC |
---|
| 12 | #include "systemc.h" |
---|
| 13 | #endif |
---|
| 14 | |
---|
| 15 | #include "Behavioural/Core/include/Core.h" |
---|
| 16 | #include "Behavioural/Custom/include/Custom.h" |
---|
| 17 | #include "Behavioural/Core/include/Parameters.h" |
---|
| 18 | #include "Behavioural/Configuration/include/Configuration.h" |
---|
| 19 | |
---|
| 20 | #include "TopLevel/include/Types.h" |
---|
| 21 | |
---|
| 22 | #ifdef STATISTICS |
---|
| 23 | #include "Behavioural/include/Stat.h" |
---|
| 24 | #endif |
---|
| 25 | #include "Behavioural/include/Component.h" |
---|
| 26 | #ifdef VHDL |
---|
| 27 | #include "Behavioural/include/Vhdl.h" |
---|
| 28 | #endif |
---|
| 29 | #include "Behavioural/include/Usage.h" |
---|
| 30 | |
---|
| 31 | #include "Common/include/ToString.h" |
---|
| 32 | #include "Common/include/Debug.h" |
---|
| 33 | |
---|
| 34 | #include <iostream> |
---|
[110] | 35 | #include <csignal> |
---|
| 36 | #include <unistd.h> |
---|
[88] | 37 | |
---|
| 38 | namespace morpheo { |
---|
| 39 | |
---|
| 40 | class Morpheo |
---|
| 41 | #if SYSTEMC |
---|
| 42 | : public sc_module |
---|
| 43 | #endif |
---|
| 44 | { |
---|
| 45 | // -----[ fields ]---------------------------------------------------- |
---|
| 46 | // Parameters |
---|
| 47 | private : std::string _name; |
---|
| 48 | private : behavioural::Tusage_t _usage; |
---|
| 49 | private : morpheo::behavioural::configuration::Configuration * _config; |
---|
| 50 | private : morpheo::behavioural::core::Parameters * _param_core; |
---|
| 51 | #ifdef STATISTICS |
---|
| 52 | private : morpheo::behavioural::Parameters_Statistics * _param_statistics; |
---|
| 53 | private : behavioural::Stat * _stat; |
---|
| 54 | #endif |
---|
| 55 | |
---|
| 56 | private : behavioural::Component * _component; |
---|
| 57 | private : behavioural::Interfaces * _interfaces; |
---|
| 58 | |
---|
| 59 | // -----[ interface parameters ]-------------------------------------- |
---|
| 60 | public : uint32_t _nb_thread ; |
---|
| 61 | |
---|
| 62 | public : uint32_t _nb_icache_port ; |
---|
| 63 | public : uint32_t _size_icache_thread_id ; |
---|
| 64 | public : uint32_t _size_icache_packet_id ; |
---|
| 65 | public : uint32_t _size_icache_address ; |
---|
| 66 | public : uint32_t _size_icache_type ; |
---|
| 67 | public : uint32_t _size_icache_error ; |
---|
| 68 | public : uint32_t * _icache_nb_instruction ;//[nb_icache_port] |
---|
| 69 | public : uint32_t _size_icache_instruction ; |
---|
| 70 | |
---|
| 71 | public : uint32_t _nb_dcache_port ; |
---|
| 72 | public : uint32_t _size_dcache_thread_id ; |
---|
| 73 | public : uint32_t _size_dcache_packet_id ; |
---|
| 74 | public : uint32_t _size_dcache_address ; |
---|
| 75 | public : uint32_t _size_dcache_data ; |
---|
| 76 | public : uint32_t _size_dcache_type ; |
---|
| 77 | public : uint32_t _size_dcache_error ; |
---|
| 78 | |
---|
| 79 | public : bool _have_port_icache_thread_id; |
---|
| 80 | public : bool _have_port_icache_packet_id; |
---|
| 81 | public : bool _have_port_dcache_thread_id; |
---|
| 82 | public : bool _have_port_dcache_packet_id; |
---|
| 83 | |
---|
| 84 | #ifdef SYSTEMC |
---|
| 85 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 86 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 87 | public : SC_CLOCK * in_CLOCK ; |
---|
| 88 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
| 89 | |
---|
| 90 | // ~~~~~[ Interface "icache_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 91 | public : SC_OUT(Tcontrol_t ) ** out_ICACHE_REQ_VAL ;//[nb_icache_port] |
---|
| 92 | public : SC_IN (Tcontrol_t ) ** in_ICACHE_REQ_ACK ;//[nb_icache_port] |
---|
| 93 | public : SC_OUT(Ticache_context_t ) ** out_ICACHE_REQ_THREAD_ID ;//[nb_icache_port] |
---|
| 94 | public : SC_OUT(Ticache_packet_t ) ** out_ICACHE_REQ_PACKET_ID ;//[nb_icache_port] |
---|
| 95 | public : SC_OUT(Ticache_address_t ) ** out_ICACHE_REQ_ADDRESS ;//[nb_icache_port] |
---|
| 96 | public : SC_OUT(Ticache_type_t ) ** out_ICACHE_REQ_TYPE ;//[nb_icache_port] |
---|
| 97 | |
---|
| 98 | // ~~~~~[ Interface "icache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 99 | public : SC_IN (Tcontrol_t ) ** in_ICACHE_RSP_VAL ;//[nb_icache_port] |
---|
| 100 | public : SC_OUT(Tcontrol_t ) ** out_ICACHE_RSP_ACK ;//[nb_icache_port] |
---|
| 101 | public : SC_IN (Ticache_context_t ) ** in_ICACHE_RSP_THREAD_ID ;//[nb_icache_port] |
---|
| 102 | public : SC_IN (Ticache_packet_t ) ** in_ICACHE_RSP_PACKET_ID ;//[nb_icache_port] |
---|
| 103 | public : SC_IN (Ticache_instruction_t) *** in_ICACHE_RSP_INSTRUCTION ;//[nb_icache_port][icache_nb_instruction] |
---|
| 104 | public : SC_IN (Ticache_error_t ) ** in_ICACHE_RSP_ERROR ;//[nb_icache_port] |
---|
| 105 | |
---|
| 106 | // ~~~~~[ Interface "dcache_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 107 | public : SC_OUT(Tcontrol_t ) ** out_DCACHE_REQ_VAL ;//[nb_dcache_port] |
---|
| 108 | public : SC_IN (Tcontrol_t ) ** in_DCACHE_REQ_ACK ;//[nb_dcache_port] |
---|
| 109 | public : SC_OUT(Tdcache_context_t ) ** out_DCACHE_REQ_THREAD_ID ;//[nb_dcache_port] |
---|
| 110 | public : SC_OUT(Tdcache_packet_t ) ** out_DCACHE_REQ_PACKET_ID ;//[nb_dcache_port] |
---|
| 111 | public : SC_OUT(Tdcache_address_t ) ** out_DCACHE_REQ_ADDRESS ;//[nb_dcache_port] |
---|
| 112 | public : SC_OUT(Tdcache_data_t ) ** out_DCACHE_REQ_WDATA ;//[nb_dcache_port] |
---|
| 113 | public : SC_OUT(Tdcache_type_t ) ** out_DCACHE_REQ_TYPE ;//[nb_dcache_port] |
---|
| 114 | |
---|
| 115 | // ~~~~~[ Interface "dcache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 116 | public : SC_IN (Tcontrol_t ) ** in_DCACHE_RSP_VAL ;//[nb_dcache_port] |
---|
| 117 | public : SC_OUT(Tcontrol_t ) ** out_DCACHE_RSP_ACK ;//[nb_dcache_port] |
---|
| 118 | public : SC_IN (Tdcache_context_t ) ** in_DCACHE_RSP_THREAD_ID ;//[nb_dcache_port] |
---|
| 119 | public : SC_IN (Tdcache_packet_t ) ** in_DCACHE_RSP_PACKET_ID ;//[nb_dcache_port] |
---|
| 120 | public : SC_IN (Tdcache_data_t ) ** in_DCACHE_RSP_RDATA ;//[nb_dcache_port] |
---|
| 121 | public : SC_IN (Tdcache_error_t ) ** in_DCACHE_RSP_ERROR ;//[nb_dcache_port] |
---|
| 122 | |
---|
| 123 | // ~~~~~[ Interface : "interrupt" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 124 | public : SC_IN (Tcontrol_t ) ** in_INTERRUPT_ENABLE ;//[nb_thread] - Interrupt Exception |
---|
| 125 | |
---|
| 126 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 127 | private : morpheo::behavioural::core::Core * _component_core ; |
---|
| 128 | |
---|
| 129 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 130 | |
---|
| 131 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 132 | #endif |
---|
| 133 | |
---|
| 134 | // -----[ Methods ]--------------------------------------------------- |
---|
| 135 | |
---|
| 136 | #ifdef SYSTEMC |
---|
| 137 | SC_HAS_PROCESS (Morpheo); |
---|
| 138 | #endif |
---|
| 139 | public : Morpheo |
---|
| 140 | ( |
---|
| 141 | #ifdef SYSTEMC |
---|
| 142 | sc_module_name name, |
---|
| 143 | #else |
---|
| 144 | std::string name, |
---|
| 145 | #endif |
---|
| 146 | std::string filename_simulator, |
---|
| 147 | std::string filename_generator, |
---|
| 148 | std::string filename_instance , |
---|
| 149 | morpheo::behavioural::custom::custom_information_t (*get_custom_information) (void) |
---|
| 150 | ); |
---|
| 151 | public : ~Morpheo (void); |
---|
| 152 | |
---|
| 153 | private : void configuration (std::string filename_simulator, |
---|
| 154 | std::string filename_generator, |
---|
| 155 | std::string filename_instance , |
---|
| 156 | morpheo::behavioural::custom::custom_information_t (*get_custom_information) (void)); |
---|
| 157 | |
---|
| 158 | private : void allocation ( |
---|
| 159 | #ifdef STATISTICS |
---|
| 160 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
| 161 | #else |
---|
| 162 | void |
---|
| 163 | #endif |
---|
| 164 | ); |
---|
| 165 | private : void deallocation (void); |
---|
| 166 | |
---|
| 167 | #ifdef SYSTEMC |
---|
| 168 | # if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 169 | private : void transition (void); |
---|
| 170 | # endif |
---|
| 171 | #endif |
---|
| 172 | |
---|
| 173 | #if VHDL |
---|
| 174 | private : void vhdl (void); |
---|
| 175 | #endif |
---|
| 176 | |
---|
| 177 | #ifdef STATISTICS |
---|
| 178 | private : void statistics_allocation (morpheo::behavioural::Parameters_Statistics * param_statistics); |
---|
| 179 | private : void statistics_deallocation (void); |
---|
| 180 | #endif |
---|
| 181 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 182 | private : void end_cycle (void); |
---|
| 183 | #endif |
---|
| 184 | |
---|
| 185 | #ifdef SYSTEMC |
---|
| 186 | public : bool simulation_end (void); |
---|
[110] | 187 | private : void signal_init (void); |
---|
| 188 | //private : void signal_handler (int value); |
---|
[88] | 189 | #endif |
---|
| 190 | }; |
---|
| 191 | |
---|
[110] | 192 | void signal_handler (int value); |
---|
| 193 | |
---|
[88] | 194 | }; // end namespace morpheo |
---|
| 195 | |
---|
| 196 | #endif |
---|