Changeset 78 for trunk/IPs/systemC/processor/Morpheo/Behavioural/include
- Timestamp:
- Mar 27, 2008, 11:04:49 AM (17 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Behavioural/include
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Allocation.h
r76 r78 7 7 // -----[ NO ITERATION ]------------------------------------------------- 8 8 // ---------------------------------------------------------------------- 9 10 #define __ALLOC_SIGNAL(sig, name, type) \ 11 { \ 12 sig = new type (name); \ 13 } 9 14 10 15 #ifdef POSITION … … 16 21 #endif 17 22 18 #define ALLOC_VAL ACK_IN( sig, name, type) \23 #define ALLOC_VAL_ACK_IN( sig, name, type) \ 19 24 { \ 20 25 sig = interface->set_signal_valack_in (name, type); \ 21 26 } 22 #define ALLOC_VAL ACK_OUT( sig, name, type) \27 #define ALLOC_VAL_ACK_OUT( sig, name, type) \ 23 28 { \ 24 29 sig = interface->set_signal_valack_out(name, type); \ 25 30 } 26 #define ALLOC_VAL _IN( sig)\27 { \ 28 sig = interface->set_signal_valack_in ( VAL); \31 #define ALLOC_VALACK_IN( sig, type) \ 32 { \ 33 sig = interface->set_signal_valack_in (type); \ 29 34 } 30 #define ALLOC_VAL_OUT( sig) \ 31 { \ 32 sig = interface->set_signal_valack_out(VAL); \ 33 } 34 #define ALLOC_ACK_IN( sig) \ 35 { \ 36 sig = interface->set_signal_valack_in (ACK); \ 37 } 38 #define ALLOC_ACK_OUT( sig) \ 39 { \ 40 sig = interface->set_signal_valack_out(ACK); \ 35 #define ALLOC_VALACK_OUT( sig, type) \ 36 { \ 37 sig = interface->set_signal_valack_out(type); \ 41 38 } 42 39 #define ALLOC_SIGNAL_IN( sig, name, type, size) \ … … 60 57 // -----[ ITERATION 1 ]-------------------------------------------------- 61 58 // ---------------------------------------------------------------------- 59 60 #define __ALLOC1_INTERFACE(name, it1) \ 61 const std::string interface_name = name; \ 62 const uint32_t iterator_1 = it1; 63 64 #define __ALLOC1_SIGNAL_IN( sig, name, type) \ 65 { \ 66 sig = new SC_IN(type) * [iterator_1]; \ 67 std::string separator="_"; \ 68 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 69 { \ 70 std::string str = "in_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \ 71 sig [alloc_signal_it1] = new SC_IN(type) (str.c_str()); \ 72 } \ 73 } 74 75 #define __ALLOC1_SIGNAL_OUT( sig, name, type) \ 76 { \ 77 sig = new SC_OUT(type) * [iterator_1]; \ 78 std::string separator="_"; \ 79 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 80 { \ 81 std::string str = "out_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \ 82 sig [alloc_signal_it1] = new SC_OUT(type) (str.c_str()); \ 83 } \ 84 } 62 85 63 86 #ifdef POSITION … … 66 89 Interface_fifo * interface [iterator_1]; \ 67 90 { \ 68 std::string separator="_";\69 for (uint32_t i=0; i<iterator_1; i++)\70 { \ 71 interface [ i] = _interfaces->set_interface( name+separator+toString(i), direction, localisation, str); \91 std::string separator="_"; \ 92 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ 93 { \ 94 interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1), direction, localisation, str); \ 72 95 } \ 73 96 } … … 77 100 Interface_fifo * interface [iterator_1]; \ 78 101 { \ 79 std::string separator="_";\80 for (uint32_t i=0; i<iterator_1; i++)\81 { \ 82 interface [ i] = _interfaces->set_interface( name+separator+toString(i)); \102 std::string separator="_"; \ 103 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ 104 { \ 105 interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)); \ 83 106 } \ 84 107 } 85 108 #endif 86 109 87 88 #define ALLOC1_VALACK_IN( sig, name, type) \ 110 #define ALLOC1_VAL_ACK_IN( sig, name, type) \ 89 111 { \ 90 112 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 91 for (uint32_t i=0; i<iterator_1; i++)\92 { \ 93 sig [ i] = interface[i]->set_signal_valack_in (name, type);\94 } \ 95 } 96 #define ALLOC1_VAL ACK_OUT(sig, name, type) \113 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 114 { \ 115 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (name, type); \ 116 } \ 117 } 118 #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ 97 119 { \ 98 120 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 99 for (uint32_t i=0; i<iterator_1; i++)\100 { \ 101 sig [ i] = interface[i]->set_signal_valack_out(name, type);\102 } \ 103 } 104 #define ALLOC1_VAL _IN( sig)\121 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 122 { \ 123 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(name, type); \ 124 } \ 125 } 126 #define ALLOC1_VALACK_IN( sig, type) \ 105 127 { \ 106 128 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 107 for (uint32_t i=0; i<iterator_1; i++)\108 { \ 109 sig [ i] = interface[i]->set_signal_valack_in (VAL);\110 } \ 111 } 112 #define ALLOC1_VAL _OUT( sig)\129 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 130 { \ 131 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (type); \ 132 } \ 133 } 134 #define ALLOC1_VALACK_OUT( sig, type) \ 113 135 { \ 114 136 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 115 for (uint32_t i=0; i<iterator_1; i++) \ 116 { \ 117 sig [i] = interface[i]->set_signal_valack_out(VAL); \ 118 } \ 119 } 120 #define ALLOC1_ACK_IN( sig) \ 121 { \ 122 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 123 for (uint32_t i=0; i<iterator_1; i++) \ 124 { \ 125 sig [i] = interface[i]->set_signal_valack_in (ACK); \ 126 } \ 127 } 128 #define ALLOC1_ACK_OUT( sig) \ 129 { \ 130 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 131 for (uint32_t i=0; i<iterator_1; i++) \ 132 { \ 133 sig [i] = interface[i]->set_signal_valack_out(ACK); \ 137 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 138 { \ 139 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(type); \ 134 140 } \ 135 141 } … … 138 144 { \ 139 145 sig = new SC_IN (type) * [iterator_1]; \ 140 for (uint32_t i=0; i<iterator_1; i++)\146 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 141 147 { \ 142 sig [ i] = interface[i]->set_signal_in <type> (name, size);\148 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_in <type> (name, size); \ 143 149 } \ 144 150 } … … 148 154 { \ 149 155 sig = new SC_OUT(type) * [iterator_1]; \ 150 for (uint32_t i=0; i<iterator_1; i++)\156 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 151 157 { \ 152 sig [ i] = interface[i]->set_signal_out<type> (name, size);\158 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_out<type> (name, size); \ 153 159 } \ 154 160 } … … 159 165 std::string separator="_"; \ 160 166 std::string str; \ 161 for (uint32_t i=0; i<it1; i++) \ 162 { \ 163 str = name+separator+toString(i); \ 164 sig [i] = new sc_signal<type> (str.c_str()); \ 165 } \ 166 } 167 168 #define INSTANCE1_SC_SIGNAL(component, sig, it1) \ 169 for (uint32_t i=0; i<it1; i++) \ 170 { \ 171 (*(component->sig[i])) (*(sig[i])); \ 172 } 173 167 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 168 { \ 169 str = name+separator+toString(alloc_signal_it1); \ 170 sig [alloc_signal_it1] = new sc_signal<type> (str.c_str()); \ 171 } \ 172 } 173 174 #define INSTANCE1_SC_SIGNAL(component, sig, it1) \ 175 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 176 { \ 177 (*(component->sig[alloc_signal_it1])) (*(sig[alloc_signal_it1])); \ 178 } 179 180 // ---------------------------------------------------------------------- 181 // -----[ ITERATION 2 ]-------------------------------------------------- 182 // ---------------------------------------------------------------------- 183 184 #ifdef POSITION 185 #define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \ 186 uint32_t iterator_1 = 0; \ 187 uint32_t iterator_2 = 0; \ 188 Interface_fifo *** interface; \ 189 { \ 190 std::string separator="_"; \ 191 iterator_1 = it1; \ 192 interface = new Interface_fifo ** [iterator_1]; \ 193 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ 194 { \ 195 iterator_2 = it2; \ 196 interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \ 197 for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \ 198 { \ 199 interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2), direction, localisation, str); \ 200 } \ 201 } \ 202 } 203 #else 204 #define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \ 205 uint32_t iterator_1 = 0; \ 206 uint32_t iterator_2 = 0; \ 207 Interface_fifo *** interface; \ 208 { \ 209 std::string separator="_"; \ 210 iterator_1 = it1; \ 211 interface = new Interface_fifo ** [iterator_1]; \ 212 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ 213 { \ 214 iterator_2 = it2; \ 215 interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \ 216 for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \ 217 { \ 218 interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2)); \ 219 } \ 220 } \ 221 } 174 222 #endif 223 224 #define _ALLOC2_VAL_ACK_IN( sig, name, type, it1, it2) \ 225 { \ 226 sig = new SC_IN (Tcontrol_t) ** [it1]; \ 227 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 228 { \ 229 sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2]; \ 230 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 231 { \ 232 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (name, type); \ 233 } \ 234 } \ 235 } 236 237 #define _ALLOC2_VAL_ACK_OUT( sig, name, type, it1, it2) \ 238 { \ 239 sig = new SC_OUT (Tcontrol_t) ** [it1]; \ 240 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 241 { \ 242 sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2]; \ 243 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 244 { \ 245 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (name, type); \ 246 } \ 247 } \ 248 } 249 250 #define _ALLOC2_VALACK_IN( sig,type, it1, it2) \ 251 { \ 252 sig = new SC_IN (Tcontrol_t) ** [it1]; \ 253 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 254 { \ 255 sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2]; \ 256 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 257 { \ 258 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (type); \ 259 } \ 260 } \ 261 } 262 263 #define _ALLOC2_VALACK_OUT( sig,type, it1, it2) \ 264 { \ 265 sig = new SC_OUT (Tcontrol_t) ** [it1]; \ 266 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 267 { \ 268 sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2]; \ 269 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 270 { \ 271 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (type); \ 272 } \ 273 } \ 274 } 275 276 #define _ALLOC2_SIGNAL_IN( sig, name, type, size, it1, it2) \ 277 if (size > 0) \ 278 { \ 279 sig = new SC_IN (type) ** [it1]; \ 280 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 281 { \ 282 sig [alloc_signal_it1] = new SC_IN (type) * [it2]; \ 283 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 284 { \ 285 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_in <type> (name, size); \ 286 } \ 287 } \ 288 } 289 290 #define _ALLOC2_SIGNAL_OUT( sig, name, type, size, it1, it2) \ 291 if (size > 0) \ 292 { \ 293 sig = new SC_OUT (type) ** [it1]; \ 294 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 295 { \ 296 sig [alloc_signal_it1] = new SC_OUT (type) * [it2]; \ 297 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 298 { \ 299 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_out <type> (name, size); \ 300 } \ 301 } \ 302 } 303 304 #define ALLOC2_VAL_ACK_IN( sig, name, type ) _ALLOC2_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2) 305 #define ALLOC2_VAL_ACK_OUT(sig, name, type ) _ALLOC2_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2) 306 #define ALLOC2_VALACK_IN( sig, type ) _ALLOC2_VALACK_IN( sig, type , iterator_1, iterator_2) 307 #define ALLOC2_VALACK_OUT( sig, type ) _ALLOC2_VALACK_OUT( sig, type , iterator_1, iterator_2) 308 #define ALLOC2_SIGNAL_IN( sig, name, type, size) _ALLOC2_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2) 309 #define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2) 310 311 #define ALLOC2_SC_SIGNAL( sig, name, type, it1, it2) \ 312 sc_signal<type> *** sig = new sc_signal<type> ** [it1]; \ 313 { \ 314 std::string separator="_"; \ 315 std::string str; \ 316 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 317 { \ 318 sig [alloc_signal_it1] = new sc_signal<type> * [it2]; \ 319 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 320 { \ 321 str = name+separator+toString(alloc_signal_it1)+separator+toString(alloc_signal_it2); \ 322 sig [alloc_signal_it1][alloc_signal_it2] = new sc_signal<type> (str.c_str()); \ 323 } \ 324 } \ 325 } 326 327 #define INSTANCE2_SC_SIGNAL(component, sig, it1, it2) \ 328 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 329 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 330 { \ 331 (*(component->sig[alloc_signal_it1][alloc_signal_it2])) (*(sig[alloc_signal_it1][alloc_signal_it2])); \ 332 } 333 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Component.h
r75 r78 25 25 namespace behavioural { 26 26 27 #ifdef DEBUG 28 # define PORT_MAP(x,a,b,c,d) \ 29 do \ 30 { \ 31 try \ 32 { \ 33 x->port_map(a,b,c,d); \ 34 } \ 35 catch (morpheo::ErrorMorpheo & error) \ 36 { \ 37 throw (ErrorMorpheo ("In file "+toString(__FILE__)+", at line "+toString(__LINE__)+"\n"+error.what ())); \ 38 } \ 39 } \ 40 while (0) 41 #else 42 # define PORT_MAP(x,a,b,c,d) \ 43 do \ 44 { \ 45 x->port_map(a,b,c,d); \ 46 } \ 47 while (0) 48 #endif 49 50 #define COMPONENT_MAP(x,a,b,c,d) \ 51 do \ 52 { \ 53 PORT_MAP(x,a,b,c,d); \ 54 PORT_MAP(x,c,d,a,b); \ 55 } \ 56 while (0) 57 58 27 59 typedef uint8_t Tinstance_t; 28 60 … … 35 67 typedef struct 36 68 { 37 public : Tinstance_t _instance; 38 public : Entity * _entity ; 69 //public : Component * _component; 70 public : Entity * _entity ; 71 public : Tinstance_t _instance ; 39 72 } Tcomponent_t; 40 73 … … 42 75 { 43 76 // -----[ fields ]---------------------------------------------------- 44 private : const Tusage_t _usage;45 private : Entity * _entity ;77 private : const Tusage_t _usage; 78 private : Entity * _entity ; 46 79 private : std::list<Tcomponent_t*> * _list_component; 47 80 … … 57 90 #endif 58 91 ); 59 private : std::string 92 private : std::string get_entity (void); 60 93 61 94 public : void set_component (Component * component … … 69 102 ); 70 103 71 private : std::string 104 private : std::string get_component (void); 72 105 73 106 private : Entity * find_entity (std::string name); … … 87 120 std::string component_dest, 88 121 std::string port_dest ); 89 public : void port_map (std::string component_src ,90 std::string port_src );91 122 92 public : bool test_map (void); 123 public : bool test_map (bool recursive=true); 124 private : bool test_map (uint32_t depth, bool recursive); 93 125 94 126 #ifdef POSITION … … 102 134 public : void generate_file (void); 103 135 #endif 104 public : friend std::ostream& 105 136 public : friend std::ostream& operator<< (std::ostream& output_stream, 137 morpheo::behavioural::Component & x); 106 138 }; 107 139 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Constants.h
r77 r78 161 161 # define OPERATION_FIND_L_FL1 0x2 // 000_0000 l.fl1 162 162 163 # define OPERATION_SPECIAL_L_MFSPR 0x1 // 000_0000 l.mfspr 164 # define OPERATION_SPECIAL_L_MTSPR 0x2 // 000_0000 l.mtspr 165 # define OPERATION_SPECIAL_L_MAC 0x4 // 000_0000 l.mac , l.maci 166 # define OPERATION_SPECIAL_L_MACRC 0x8 // 000_0000 l.macrc 167 # define OPERATION_SPECIAL_L_MSB 0x10 // 000_0000 l.msb 168 169 # define OPERATION_BRANCH_L_TEST_NF 0x1 // 000_0000 l.bnf 170 # define OPERATION_BRANCH_L_TEST_F 0x2 // 000_0000 l.bf 171 # define OPERATION_BRANCH_L_JALR 0x4 // 000_0000 l.jal , l.jalr , l.jr 163 # define OPERATION_SPECIAL_L_NOP 0xff // 000_0000 l.nop 164 # define OPERATION_SPECIAL_L_MFSPR 0x1 // 000_0001 l.mfspr 165 # define OPERATION_SPECIAL_L_MTSPR 0x2 // 000_0010 l.mtspr 166 # define OPERATION_SPECIAL_L_RFE 0x4 // 000_0100 l.rfe 167 # define OPERATION_SPECIAL_L_MAC 0x11 // 001_0001 l.mac , l.maci 168 # define OPERATION_SPECIAL_L_MACRC 0x12 // 001_0010 l.macrc 169 # define OPERATION_SPECIAL_L_MSB 0x14 // 001_0100 l.msb 170 # define OPERATION_SPECIAL_L_MSYNC 0x21 // 010_0001 l.msync 171 # define OPERATION_SPECIAL_L_PSYNC 0x22 // 010_0010 l.psync 172 # define OPERATION_SPECIAL_L_CSYNC 0x24 // 010_0100 l.csync 173 # define OPERATION_SPECIAL_L_SYS 0x41 // 100_0001 l.sys 174 # define OPERATION_SPECIAL_L_TRAP 0x42 // 100_0010 l.trap 175 176 177 # define OPERATION_BRANCH_NONE 0x1 // 000_0000 l.j 178 # define OPERATION_BRANCH_L_TEST_NF 0x2 // 000_0000 l.bnf 179 # define OPERATION_BRANCH_L_TEST_F 0x4 // 000_0000 l.bf 180 # define OPERATION_BRANCH_L_JALR 0x8 // 000_0000 l.jal , l.jalr , l.jr 172 181 173 182 //-------------------------------------------------------[ Custom ]----- … … 195 204 196 205 # define SIZE_EXCEPTION 5 206 # define SIZE_EXCEPTION_USE 4 207 # define SIZE_EXCEPTION_MEMORY 3 208 # define SIZE_EXCEPTION_CUSTOM 3 209 # define SIZE_EXCEPTION_ALU 2 210 # define SIZE_EXCEPTION_DECOD 2 211 # define SIZE_EXCEPTION_IFETCH 2 197 212 198 213 # define EXCEPTION_NONE 0x00 // none exception … … 229 244 # define EXCEPTION_CUSTOM_6 0x1f // Reserved for custom exceptions 230 245 246 231 247 #define exception_to_address(x) (x<<8) 232 248 … … 253 269 # define EXCEPTION_ALU_SPR_ACCESS_INVALID 0x2 // SPR present in ALU but not compatible privilege 254 270 # define EXCEPTION_ALU_SPR_ACCESS_NOT_COMPLETE 0x3 // SPR not present in ALU 271 272 # define EXCEPTION_DECOD_NONE 0x0 // none exception 273 # define EXCEPTION_DECOD_ILLEGAL_INSTRUCTION 0x1 // Instruction is illegal (no implemented) 274 # define EXCEPTION_DECOD_SYSCALL 0x2 // System Call 275 //#define EXCEPTION_DECOD_TRAP 0x4 // L.trap or debug unit (note : must read SR !) 276 277 # define EXCEPTION_IFETCH_NONE 0x0 // Fetch Unit generate none exception 278 # define EXCEPTION_IFETCH_INSTRUCTION_TLB 0x1 // ITLB miss 279 # define EXCEPTION_IFETCH_INSTRUCTION_PAGE 0x2 // No matching or page violation protection in pages tables 280 # define EXCEPTION_IFETCH_BUS_ERROR 0x3 // Access at a invalid physical address 281 282 # define EXCEPTION_USE_NONE 0x0 // 283 # define EXCEPTION_USE_ILLEGAL_INSTRUCTION 0x1 // illegal_instruction 284 # define EXCEPTION_USE_RANGE 0x2 // range 285 # define EXCEPTION_USE_MEMORY_WITH_ALIGNMENT 0x3 // TLB miss, page fault, bus error, alignment 286 # define EXCEPTION_USE_MEMORY_WITHOUT_ALIGNMENT 0x4 // TLB miss, page fault, bus error 287 # define EXCEPTION_USE_SYSCALL 0x5 // syscall 288 # define EXCEPTION_USE_TRAP 0x6 // trap 289 # define EXCEPTION_USE_CUSTOM_0 0x7 // 290 # define EXCEPTION_USE_CUSTOM_1 0x8 // 291 # define EXCEPTION_USE_CUSTOM_2 0x9 // 292 # define EXCEPTION_USE_CUSTOM_3 0xa // 293 # define EXCEPTION_USE_CUSTOM_4 0xb // 294 # define EXCEPTION_USE_CUSTOM_5 0xc // 295 # define EXCEPTION_USE_CUSTOM_6 0xd // 296 297 //=======================================================[ icache ]===== 298 299 //--------------------------------------------------[ icache_type ]----- 300 301 # define SIZE_ICACHE_TYPE 2 302 303 # define ICACHE_TYPE_LOAD 0x0 // 0000 304 # define ICACHE_TYPE_LOCK 0x1 // 0001 305 # define ICACHE_TYPE_INVALIDATE 0x2 // 0010 306 # define ICACHE_TYPE_PREFETCH 0x3 // 0011 307 308 // just take the 2 less significative bits. 309 #define operation_to_icache_type(x) (x&0x3) 310 311 //-------------------------------------------------[ icache_error ]----- 312 313 # define SIZE_ICACHE_ERROR 1 314 315 # define ICACHE_ERROR_NONE 0x0 316 # define ICACHE_ERROR_BUS_ERROR 0x1 255 317 256 318 //=======================================================[ dcache ]===== … … 377 439 # define SPR_MACHI 2 // MAC High 378 440 441 # define NB_SPR_LOGIC 2 442 # define LOG2_NB_SPR_LOGIC 1 443 // SPR_LOGIC[0] = F 444 // SPR_LOGIC[1] = Carry, Overflow 445 # define SPR_LOGIC_SR_F 0x0 // Status register bit F (size = 1) 446 # define SPR_LOGIC_SR_CY_OV 0x1 // Status register bit overflow and carry (size = 2) 447 379 448 //----------------------------------------------[ spr_mode_access ]----- 380 449 … … 385 454 # define SPR_ACCESS_MODE_READ_ONLY_COND 0x5 // 101 special read 386 455 456 //--------------------------------------------------------[ event ]----- 457 # define SIZE_EVENT_STATE 2 458 459 # define EVENT_STATE_NO_EVENT 0 // no event : current case 460 # define EVENT_STATE_EVENT 1 // Have a event : make necessary to manage the event 461 # define EVENT_STATE_WAITEND 2 // Wait end of manage event (restaure a good context) 462 # define EVENT_STATE_END 3 // CPU can continue 463 464 # define SIZE_EVENT_TYPE 3 465 466 # define EVENT_TYPE_NONE 0 // no event 467 # define EVENT_TYPE_MISS_SPECULATION 1 // miss of speculation (load or branch miss speculation) 468 # define EVENT_TYPE_EXCEPTION 2 // exception or interruption occure 469 # define EVENT_TYPE_BRANCH_NO_ACCURATE 3 // branch is no accurate (old speculation is a miss) 470 # define EVENT_TYPE_SPR_ACCESS 4 // decod a mtspr or mfspr instruction 471 # define EVENT_TYPE_MSYNC 5 // decod a memory synchronization 472 # define EVENT_TYPE_PSYNC 6 // decod a pipeline synchronization 473 # define EVENT_TYPE_CSYNC 7 // decod a context synchronization 474 475 //-------------------------------------------------[ branch_state ]----- 476 # define SIZE_BRANCH_STATE 2 477 478 # define BRANCH_STATE_NONE 0x0 // 0 0 479 # define BRANCH_STATE_NSPEC_TAKE 0x1 // 0 1 -> incondionnal 480 # define BRANCH_STATE_SPEC_NTAKE 0x2 // 1 0 481 # define BRANCH_STATE_SPEC_TAKE 0x3 // 1 1 482 483 //---------------------------------------------[ branch_condition ]----- 484 485 # define SIZE_BRANCH_CONDITION 4 486 487 # define BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK 0x0 // None condition (jump) 488 # define BRANCH_CONDITION_NONE_WITH_WRITE_STACK 0x8 // None condition (jump) 489 # define BRANCH_CONDITION_FLAG_UNSET 0x2 // Branch if Flag is clear 490 # define BRANCH_CONDITION_FLAG_SET 0x3 // Branch if Flag is set 491 # define BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK 0x4 // Branch if a register is read 492 # define BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK 0xc // Branch if a register is read 493 # define BRANCH_CONDITION_READ_STACK 0xf // Branch with pop in stack pointer 494 495 //--------------------------------------------------[ instruction ]----- 496 # define NB_INSTRUCTION 213 // 92 ORBIS, 30 ORFPX (15 simple, 15 double), 91 ORVDX (38 on byte, 41 on half, 12 independant format) 497 498 enum 499 { 500 // ORBIS 501 INSTRUCTION_L_ADD, 502 INSTRUCTION_L_ADDC, 503 INSTRUCTION_L_ADDI, 504 INSTRUCTION_L_ADDIC, 505 INSTRUCTION_L_AND, 506 INSTRUCTION_L_ANDI, 507 INSTRUCTION_L_BF, 508 INSTRUCTION_L_BNF, 509 INSTRUCTION_L_CMOV, 510 INSTRUCTION_L_CSYNC, 511 INSTRUCTION_L_CUST1, 512 INSTRUCTION_L_CUST2, 513 INSTRUCTION_L_CUST3, 514 INSTRUCTION_L_CUST4, 515 INSTRUCTION_L_CUST5, 516 INSTRUCTION_L_CUST6, 517 INSTRUCTION_L_CUST7, 518 INSTRUCTION_L_CUST8, 519 INSTRUCTION_L_DIV, 520 INSTRUCTION_L_DIVU, 521 INSTRUCTION_L_EXTBS, 522 INSTRUCTION_L_EXTBZ, 523 INSTRUCTION_L_EXTHS, 524 INSTRUCTION_L_EXTHZ, 525 INSTRUCTION_L_EXTWS, 526 INSTRUCTION_L_EXTWZ, 527 INSTRUCTION_L_FF1, 528 INSTRUCTION_L_FL1, 529 INSTRUCTION_L_J, 530 INSTRUCTION_L_JAL, 531 INSTRUCTION_L_JALR, 532 INSTRUCTION_L_JR, 533 INSTRUCTION_L_LBS, 534 INSTRUCTION_L_LBZ, 535 INSTRUCTION_L_LD, 536 INSTRUCTION_L_LHS, 537 INSTRUCTION_L_LHZ, 538 INSTRUCTION_L_LWS, 539 INSTRUCTION_L_LWZ, 540 INSTRUCTION_L_MAC, 541 INSTRUCTION_L_MACI, 542 INSTRUCTION_L_MACRC, 543 INSTRUCTION_L_MFSPR, 544 INSTRUCTION_L_MOVHI, 545 INSTRUCTION_L_MSB, 546 INSTRUCTION_L_MSYNC, 547 INSTRUCTION_L_MTSPR, 548 INSTRUCTION_L_MUL, 549 INSTRUCTION_L_MULI, 550 INSTRUCTION_L_MULU, 551 INSTRUCTION_L_NOP, 552 INSTRUCTION_L_OR, 553 INSTRUCTION_L_ORI, 554 INSTRUCTION_L_PSYNC, 555 INSTRUCTION_L_RFE, 556 INSTRUCTION_L_ROR, 557 INSTRUCTION_L_RORI, 558 INSTRUCTION_L_SB, 559 INSTRUCTION_L_SD, 560 INSTRUCTION_L_SFEQ, 561 INSTRUCTION_L_SFEQI, 562 INSTRUCTION_L_SFGES, 563 INSTRUCTION_L_SFGESI, 564 INSTRUCTION_L_SFGEU, 565 INSTRUCTION_L_SFGEUI, 566 INSTRUCTION_L_SFGTS, 567 INSTRUCTION_L_SFGTSI, 568 INSTRUCTION_L_SFGTU, 569 INSTRUCTION_L_SFGTUI, 570 INSTRUCTION_L_SFLES, 571 INSTRUCTION_L_SFLESI, 572 INSTRUCTION_L_SFLEU, 573 INSTRUCTION_L_SFLEUI, 574 INSTRUCTION_L_SFLTS, 575 INSTRUCTION_L_SFLTSI, 576 INSTRUCTION_L_SFLTU, 577 INSTRUCTION_L_SFLTUI, 578 INSTRUCTION_L_SFNE, 579 INSTRUCTION_L_SFNEI, 580 INSTRUCTION_L_SH, 581 INSTRUCTION_L_SLL, 582 INSTRUCTION_L_SLLI, 583 INSTRUCTION_L_SRA, 584 INSTRUCTION_L_SRAI, 585 INSTRUCTION_L_SRL, 586 INSTRUCTION_L_SRLI, 587 INSTRUCTION_L_SUB, 588 INSTRUCTION_L_SW, 589 INSTRUCTION_L_SYS, 590 INSTRUCTION_L_TRAP, 591 INSTRUCTION_L_XOR, 592 INSTRUCTION_L_XORI, 593 // ORFPX 594 INSTRUCTION_LF_ADD_D, 595 INSTRUCTION_LF_ADD_S, 596 INSTRUCTION_LF_CUST1_D, 597 INSTRUCTION_LF_CUST1_S, 598 INSTRUCTION_LF_DIV_D, 599 INSTRUCTION_LF_DIV_S, 600 INSTRUCTION_LF_FTOI_D, 601 INSTRUCTION_LF_FTOI_S, 602 INSTRUCTION_LF_ITOF_D, 603 INSTRUCTION_LF_ITOF_S, 604 INSTRUCTION_LF_MADD_D, 605 INSTRUCTION_LF_MADD_S, 606 INSTRUCTION_LF_MUL_D, 607 INSTRUCTION_LF_MUL_S, 608 INSTRUCTION_LF_REM_D, 609 INSTRUCTION_LF_REM_S, 610 INSTRUCTION_LF_SFEQ_D, 611 INSTRUCTION_LF_SFEQ_S, 612 INSTRUCTION_LF_SFGE_D, 613 INSTRUCTION_LF_SFGE_S, 614 INSTRUCTION_LF_SFGT_D, 615 INSTRUCTION_LF_SFGT_S, 616 INSTRUCTION_LF_SFLE_D, 617 INSTRUCTION_LF_SFLE_S, 618 INSTRUCTION_LF_SFLT_D, 619 INSTRUCTION_LF_SFLT_S, 620 INSTRUCTION_LF_SFNE_D, 621 INSTRUCTION_LF_SFNE_S, 622 INSTRUCTION_LF_SUB_D, 623 INSTRUCTION_LF_SUB_S, 624 // ORVDX 625 INSTRUCTION_LV_ADD_B, 626 INSTRUCTION_LV_ADD_H, 627 INSTRUCTION_LV_ADDS_B, 628 INSTRUCTION_LV_ADDS_H, 629 INSTRUCTION_LV_ADDU_B, 630 INSTRUCTION_LV_ADDU_H, 631 INSTRUCTION_LV_ADDUS_B, 632 INSTRUCTION_LV_ADDUS_H, 633 INSTRUCTION_LV_ALL_EQ_B, 634 INSTRUCTION_LV_ALL_EQ_H, 635 INSTRUCTION_LV_ALL_GE_B, 636 INSTRUCTION_LV_ALL_GE_H, 637 INSTRUCTION_LV_ALL_GT_B, 638 INSTRUCTION_LV_ALL_GT_H, 639 INSTRUCTION_LV_ALL_LE_B, 640 INSTRUCTION_LV_ALL_LE_H, 641 INSTRUCTION_LV_ALL_LT_B, 642 INSTRUCTION_LV_ALL_LT_H, 643 INSTRUCTION_LV_ALL_NE_B, 644 INSTRUCTION_LV_ALL_NE_H, 645 INSTRUCTION_LV_AND, 646 INSTRUCTION_LV_ANY_EQ_B, 647 INSTRUCTION_LV_ANY_EQ_H, 648 INSTRUCTION_LV_ANY_GE_B, 649 INSTRUCTION_LV_ANY_GE_H, 650 INSTRUCTION_LV_ANY_GT_B, 651 INSTRUCTION_LV_ANY_GT_H, 652 INSTRUCTION_LV_ANY_LE_B, 653 INSTRUCTION_LV_ANY_LE_H, 654 INSTRUCTION_LV_ANY_LT_B, 655 INSTRUCTION_LV_ANY_LT_H, 656 INSTRUCTION_LV_ANY_NE_B, 657 INSTRUCTION_LV_ANY_NE_H, 658 INSTRUCTION_LV_AVG_B, 659 INSTRUCTION_LV_AVG_H, 660 INSTRUCTION_LV_CMP_EQ_B, 661 INSTRUCTION_LV_CMP_EQ_H, 662 INSTRUCTION_LV_CMP_GE_B, 663 INSTRUCTION_LV_CMP_GE_H, 664 INSTRUCTION_LV_CMP_GT_B, 665 INSTRUCTION_LV_CMP_GT_H, 666 INSTRUCTION_LV_CMP_LE_B, 667 INSTRUCTION_LV_CMP_LE_H, 668 INSTRUCTION_LV_CMP_LT_B, 669 INSTRUCTION_LV_CMP_LT_H, 670 INSTRUCTION_LV_CMP_NE_B, 671 INSTRUCTION_LV_CMP_NE_H, 672 INSTRUCTION_LV_CUST1, 673 INSTRUCTION_LV_CUST2, 674 INSTRUCTION_LV_CUST3, 675 INSTRUCTION_LV_CUST4, 676 INSTRUCTION_LV_MADDS_H, 677 INSTRUCTION_LV_MAX_B, 678 INSTRUCTION_LV_MAX_H, 679 INSTRUCTION_LV_MERGE_B, 680 INSTRUCTION_LV_MERGE_H, 681 INSTRUCTION_LV_MIN_B, 682 INSTRUCTION_LV_MIN_H, 683 INSTRUCTION_LV_MSUBS_H, 684 INSTRUCTION_LV_MULS_H, 685 INSTRUCTION_LV_NAND, 686 INSTRUCTION_LV_NOR, 687 INSTRUCTION_LV_OR, 688 INSTRUCTION_LV_PACK_B, 689 INSTRUCTION_LV_PACK_H, 690 INSTRUCTION_LV_PACKS_B, 691 INSTRUCTION_LV_PACKS_H, 692 INSTRUCTION_LV_PACKUS_B, 693 INSTRUCTION_LV_PACKUS_H, 694 INSTRUCTION_LV_PERM_N, 695 INSTRUCTION_LV_RL_B, 696 INSTRUCTION_LV_RL_H, 697 INSTRUCTION_LV_SLL, 698 INSTRUCTION_LV_SLL_B, 699 INSTRUCTION_LV_SLL_H, 700 INSTRUCTION_LV_SRA_B, 701 INSTRUCTION_LV_SRA_H, 702 INSTRUCTION_LV_SRL, 703 INSTRUCTION_LV_SRL_B, 704 INSTRUCTION_LV_SRL_H, 705 INSTRUCTION_LV_SUB_B, 706 INSTRUCTION_LV_SUB_H, 707 INSTRUCTION_LV_SUBS_B, 708 INSTRUCTION_LV_SUBS_H, 709 INSTRUCTION_LV_SUBU_B, 710 INSTRUCTION_LV_SUBU_H, 711 INSTRUCTION_LV_SUBUS_B, 712 INSTRUCTION_LV_SUBUS_H, 713 INSTRUCTION_LV_UNPACK_B, 714 INSTRUCTION_LV_UNPACK_H, 715 INSTRUCTION_LV_XOR 716 }; 717 718 //-----------------------------------------------[ Code Operation ]----- 719 720 # define MAX_OPCOD_0 64 // Instructions with immediat 721 # define MAX_OPCOD_1 64 // Instruction ORFPX32/64 722 # define MAX_OPCOD_2 256 // Instruction ORVDX64 723 # define MAX_OPCOD_3 256 // Instructions Register-Register 724 # define MAX_OPCOD_4 32 // Instructions "set flag" with register 725 # define MAX_OPCOD_5 32 // Instructions "set flag" with immediat 726 # define MAX_OPCOD_6 4 // Instruction Shift/Rotate with immediat 727 # define MAX_OPCOD_7 16 // Instructions multiply with HI-LO 728 # define MAX_OPCOD_8 2 // Instructions acces at HI-LO 729 # define MAX_OPCOD_9 8 // Instructions special 730 # define MAX_OPCOD_10 4 // Instructions no operation 731 # define MAX_OPCOD_11 4 // Instruction Shift/Rotate with register 732 # define MAX_OPCOD_12 4 // Instructions extend 733 # define MAX_OPCOD_13 4 // Instructions extend (64b) 734 735 // OPCOD_0 - [31:26] Instructions with immediat 736 # define OPCOD_L_J 0x00 // 000_000 737 # define OPCOD_L_JAL 0x01 // 000_001 738 # define OPCOD_L_BNF 0x03 // 000_011 739 # define OPCOD_L_BF 0x04 // 000_100 740 # define OPCOD_L_RFE 0x09 // 001_001 741 # define OPCOD_L_JR 0x11 // 010_001 742 # define OPCOD_L_JALR 0x12 // 010_010 743 # define OPCOD_L_MACI 0x13 // 010_011 744 # define OPCOD_L_CUST1 0x1c // 011_100 745 # define OPCOD_L_CUST2 0x1d // 011_101 746 # define OPCOD_L_CUST3 0x1e // 011_110 747 # define OPCOD_L_CUST4 0x1f // 011_111 748 # define OPCOD_L_CUST5 0x3c // 111_100 749 # define OPCOD_L_CUST6 0x3d // 111_101 750 # define OPCOD_L_CUST7 0x3e // 111_110 751 # define OPCOD_L_CUST8 0x3f // 111_111 752 # define OPCOD_L_LD 0x20 // 100_000 753 # define OPCOD_L_LWZ 0x21 // 100_001 754 # define OPCOD_L_LWS 0x22 // 100_010 755 # define OPCOD_L_LBZ 0x23 // 100_011 756 # define OPCOD_L_LBS 0x24 // 100_100 757 # define OPCOD_L_LHZ 0x25 // 100_101 758 # define OPCOD_L_LHS 0x26 // 100_110 759 # define OPCOD_L_ADDI 0x27 // 100_111 760 # define OPCOD_L_ADDIC 0x28 // 101_000 761 # define OPCOD_L_ANDI 0x29 // 101_001 762 # define OPCOD_L_ORI 0x2a // 101_010 763 # define OPCOD_L_XORI 0x2b // 101_011 764 # define OPCOD_L_MULI 0x2c // 101_100 765 # define OPCOD_L_MFSPR 0x2d // 101_101 766 # define OPCOD_L_MTSPR 0x30 // 110_000 767 # define OPCOD_L_SD 0x34 // 110_100 768 # define OPCOD_L_SW 0x35 // 110_101 769 # define OPCOD_L_SB 0x36 // 110_110 770 # define OPCOD_L_SH 0x37 // 110_111 771 772 # define OPCOD_1 0x33 // 110_011 // Instruction ORFPX32/64 773 # define OPCOD_2 0x0a // 001_010 // Instruction ORVDX64 774 # define OPCOD_3 0x38 // 111_000 // Instructions Register-Register 775 # define OPCOD_4 0x39 // 111_001 // Instructions "set flag" with register 776 # define OPCOD_5 0x2f // 101_111 // Instructions "set flag" with immediat 777 # define OPCOD_6 0x2e // 101_110 // Instruction Shift/Rotate with immediat 778 # define OPCOD_7 0x31 // 110_001 // Instructions multiply with HI-LO 779 # define OPCOD_8 0x06 // 000_110 // Instructions acces at HI-LO 780 # define OPCOD_9 0x08 // 001_000 // Instructions special 781 # define OPCOD_10 0x05 // 000_101 // Instructions no operation 782 783 // OPCOD_3 instructions - [9:8] [3:0] Instructions Register-Register 784 # define OPCOD_L_ADD 0x00 // 00_0000 785 # define OPCOD_L_ADDC 0x01 // 00_0001 786 # define OPCOD_L_SUB 0x02 // 00_0010 787 # define OPCOD_L_AND 0x03 // 00_0011 788 # define OPCOD_L_OR 0x04 // 00_0100 789 # define OPCOD_L_XOR 0x05 // 00_0101 790 # define OPCOD_L_CMOV 0x0e // 00_1110 791 # define OPCOD_L_FF1 0x0f // 00_1111 792 # define OPCOD_L_FL1 0x1f // 01_1111 793 # define OPCOD_L_MUL 0x36 // 11_0110 794 # define OPCOD_L_DIV 0x39 // 11_1001 795 # define OPCOD_L_DIVU 0x3a // 11_1010 796 # define OPCOD_L_MULU 0x3b // 11_1011 797 798 # define OPCOD_11 0x8 // 1000 // Instruction Shift/Rotate with register 799 # define OPCOD_12 0xc // 1100 // Instructions extend 800 # define OPCOD_13 0xd // 1101 // Instructions extend (64b) 801 802 // OPCOD_4 instructions - [25:21] Instructions "set flag" with register 803 # define OPCOD_L_SFEQ 0x00 // 00000 804 # define OPCOD_L_SFNE 0x01 // 00001 805 # define OPCOD_L_SFGTU 0x02 // 00010 806 # define OPCOD_L_SFGEU 0x03 // 00011 807 # define OPCOD_L_SFLTU 0x04 // 00100 808 # define OPCOD_L_SFLEU 0x05 // 00101 809 # define OPCOD_L_SFGTS 0x0a // 01010 810 # define OPCOD_L_SFGES 0x0b // 01011 811 # define OPCOD_L_SFLTS 0x0c // 01100 812 # define OPCOD_L_SFLES 0x0d // 01101 813 814 // OPCOD_5 instructions - [25:21] Instructions "set flag" with immediat 815 # define OPCOD_L_SFEQI 0x00 // 00000 816 # define OPCOD_L_SFNEI 0x01 // 00001 817 # define OPCOD_L_SFGTUI 0x02 // 00010 818 # define OPCOD_L_SFGEUI 0x03 // 00011 819 # define OPCOD_L_SFLTUI 0x04 // 00100 820 # define OPCOD_L_SFLEUI 0x05 // 00101 821 # define OPCOD_L_SFGTSI 0x0a // 01010 822 # define OPCOD_L_SFGESI 0x0b // 01011 823 # define OPCOD_L_SFLTSI 0x0c // 01100 824 # define OPCOD_L_SFLESI 0x0d // 01101 825 826 // OPCOD_6 instructions - [7:6] Instruction Shift/Rotate with immediat 827 # define OPCOD_L_SLLI 0x0 // 00 828 # define OPCOD_L_SRLI 0x1 // 01 829 # define OPCOD_L_SRAI 0x2 // 10 830 # define OPCOD_L_RORI 0x3 // 11 831 832 // OPCOD_7 instructions - [3:0] Instructions multiply with HI-LO 833 # define OPCOD_L_MAC 0x1 // 0001 834 # define OPCOD_L_MSB 0x2 // 0010 835 836 // OPCOD_8 instructions - [17] Instructions acces at HI-LO 837 # define OPCOD_L_MOVHI 0x0 // 0 838 # define OPCOD_L_MACRC 0x1 // 1 839 840 // OPCOD_9 instructions - [25:23] Instruction special 841 # define OPCOD_L_SYS 0x0 // 000 842 # define OPCOD_L_TRAP 0x2 // 010 843 # define OPCOD_L_MSYNC 0x4 // 100 844 # define OPCOD_L_PSYNC 0x5 // 101 845 # define OPCOD_L_CSYNC 0x6 // 110 846 847 // OPCOD_10 instructions - [25:24] Instruction no operation 848 # define OPCOD_L_NOP 0x1 // 01 849 850 // OPCOD_11 instructions - [7:6] Instruction Shift/Rotate with register 851 # define OPCOD_L_SLL 0x0 // 00 852 # define OPCOD_L_SRL 0x1 // 01 853 # define OPCOD_L_SRA 0x2 // 10 854 # define OPCOD_L_ROR 0x3 // 11 855 856 // OPCOD_12 instructions - [9:6] Instructions extend 857 # define OPCOD_L_EXTHS 0x0 // 0000 858 # define OPCOD_L_EXTHZ 0x2 // 0010 859 # define OPCOD_L_EXTBS 0x1 // 0001 860 # define OPCOD_L_EXTBZ 0x3 // 0011 861 862 // OPCOD_13 instructions - [9:6] Instructions extend (64b) 863 # define OPCOD_L_EXTWS 0x0 // 0000 864 # define OPCOD_L_EXTWZ 0x1 // 0001 865 387 866 /* 388 #define _size_instruction 32389 #define _size_instruction_log2 5390 391 //----------------------------------------------------[ Operation ]-----392 // #define _nb_operation 32393 // #define _size_operation 5394 395 #define _operation_none 0x0396 #define _operation_l_adds 0x1397 #define _operation_l_addu 0x2398 #define _operation_l_subs 0x3399 #define _operation_l_and 0x4400 #define _operation_l_or 0x5401 #define _operation_l_xor 0x6402 #define _operation_l_cmove 0x7403 #define _operation_l_read_imm 0x8404 #define _operation_l_movhi 0x9405 #define _operation_l_muls 0xa406 #define _operation_l_mulu 0xb407 #define _operation_l_divs 0xc408 #define _operation_l_divu 0xd409 #define _operation_l_exts 0xe410 #define _operation_l_extz 0xf411 #define _operation_l_ff1 0x10412 #define _operation_l_fl1 0x11413 #define _operation_l_sll 0x12414 #define _operation_l_sla 0x13415 #define _operation_l_srl 0x14416 #define _operation_l_ror 0x15417 #define _operation_l_cmp_eq 0x16418 #define _operation_l_cmp_ne 0x17419 #define _operation_l_cmp_ges 0x18420 #define _operation_l_cmp_geu 0x19421 #define _operation_l_cmp_gts 0x1a422 #define _operation_l_cmp_gtu 0x1b423 #define _operation_l_cmp_les 0x1c424 #define _operation_l_cmp_leu 0x1d425 #define _operation_l_cmp_lts 0x1e426 #define _operation_l_cmp_ltu 0x1f427 867 428 868 //--------------------------------------------------[ destination ]----- … … 466 906 #define mask_CONDITION_STACK 0x8 // Branch with pop in stack pointer 467 907 468 //-------------------------------------------------[ branch_state ]-----469 #define cst_BRANCH_STATE_NONE 0x0 // 0 0470 #define cst_BRANCH_STATE_NSPEC_TAKE 0x1 // 0 1 -> incondionnal471 #define cst_BRANCH_STATE_SPEC_NTAKE 0x2 // 1 0472 #define cst_BRANCH_STATE_SPEC_TAKE 0x3 // 1 1473 908 */ 474 909 … … 620 1055 621 1056 /* 622 //----------------------------------------------------623 // Code Operation (before decode)624 //----------------------------------------------------625 626 // Codop - [31:26] Instructions with immediat627 #define OPCOD_L_J 0x00 // 000_000628 #define OPCOD_L_JAL 0x01 // 000_001629 #define OPCOD_L_BNF 0x03 // 000_011630 #define OPCOD_L_BF 0x04 // 000_100631 #define OPCOD_L_RFE 0x09 // 001_001632 #define OPCOD_L_JR 0x11 // 010_001633 #define OPCOD_L_JALR 0x12 // 010_010634 #define OPCOD_L_MACI 0x13 // 010_011635 #define OPCOD_L_CUST1 0x1c // 011_100636 #define OPCOD_L_CUST2 0x1d // 011_101637 #define OPCOD_L_CUST3 0x1e // 011_110638 #define OPCOD_L_CUST4 0x1f // 011_111639 #define OPCOD_L_CUST5 0x3c // 111_100640 #define OPCOD_L_CUST6 0x3d // 111_101641 #define OPCOD_L_CUST7 0x3e // 111_110642 #define OPCOD_L_CUST8 0x3f // 111_111643 #define OPCOD_L_LD 0x20 // 100_000644 #define OPCOD_L_LWZ 0x21 // 100_001645 #define OPCOD_L_LWS 0x22 // 100_010646 #define OPCOD_L_LBZ 0x23 // 100_011647 #define OPCOD_L_LBS 0x24 // 100_100648 #define OPCOD_L_LHZ 0x25 // 100_101649 #define OPCOD_L_LHS 0x26 // 100_110650 #define OPCOD_L_ADDI 0x27 // 100_111651 #define OPCOD_L_ADDIC 0x28 // 101_000652 #define OPCOD_L_ANDI 0x29 // 101_001653 #define OPCOD_L_ORI 0x2a // 101_010654 #define OPCOD_L_XORI 0x2b // 101_011655 #define OPCOD_L_MULI 0x2c // 101_100656 #define OPCOD_L_MFSPR 0x2d // 101_101657 #define OPCOD_L_MTSPR 0x30 // 110_000658 #define OPCOD_L_SD 0x32 // 110_010659 #define OPCOD_L_SW 0x35 // 110_101660 #define OPCOD_L_SB 0x36 // 110_110661 #define OPCOD_L_SH 0x37 // 110_111662 663 #define OPCOD_INST_LV 0x0a // 001_010 // Instruction ORVDX64664 #define OPCOD_INST_LF 0x33 // 110_011 // Instruction ORFPX32/64665 666 #define OPCOD_SPECIAL 0x38 // 111_000 // Instructions Register-Register667 #define OPCOD_SPECIAL_1 0x39 // 111_001 // Instructions "set flag" with register668 #define OPCOD_SPECIAL_2 0x2f // 101_111 // Instructions "set flag" with immediat669 #define OPCOD_SPECIAL_6 0x2e // 101_110 // Instruction Shift/Rotate with immediat670 #define OPCOD_SPECIAL_7 0x31 // 110_001 // Instructions multiply with HI-LO671 #define OPCOD_SPECIAL_8 0x06 // 000_110 // Instructions acces at HI-LO672 673 // OPCOD_SPECIAL instructions - [9:8] [3:0] Instructions Register-Register674 #define OPCOD_L_ADD 0x00 // 00_0000675 #define OPCOD_L_ADDC 0x01 // 00_0001676 #define OPCOD_L_SUB 0x02 // 00_0010677 #define OPCOD_L_AND 0x03 // 00_0011678 #define OPCOD_L_OR 0x04 // 00_0100679 #define OPCOD_L_XOR 0x05 // 00_0101680 #define OPCOD_L_CMOV 0x0e // 00_1110681 #define OPCOD_L_FF1 0x0f // 00_1111682 #define OPCOD_L_FL1 0x1f // 01_1111683 #define OPCOD_L_MUL 0x36 // 11_0110684 #define OPCOD_L_DIV 0x39 // 11_1001685 #define OPCOD_L_DIVU 0x3a // 11_1010686 #define OPCOD_L_MULU 0x3b // 11_1011687 688 #define OPCOD_SPECIAL_3 0xc // 1100 // Instructions extend689 #define OPCOD_SPECIAL_4 0xd // 1101 // Instructions extend (64b)690 #define OPCOD_SPECIAL_5 0x8 // 1000 // Instruction Shift/Rotate with register691 692 // OPCOD_SPECIAL_1 instructions - [25:21] Instructions "set flag" with register693 #define OPCOD_L_SFEQ 0x00 // 00000694 #define OPCOD_L_SFNE 0x01 // 00001695 #define OPCOD_L_SFGTU 0x02 // 00010696 #define OPCOD_L_SFGEU 0x03 // 00011697 #define OPCOD_L_SFLTU 0x04 // 00100698 #define OPCOD_L_SFLEU 0x05 // 00101699 #define OPCOD_L_SFGTS 0x0a // 01010700 #define OPCOD_L_SFGES 0x0b // 01011701 #define OPCOD_L_SFLTS 0x0c // 01100702 #define OPCOD_L_SFLES 0x0d // 01101703 704 // OPCOD_SPECIAL_2 instructions - [25:21] Instructions "set flag" with immediat705 #define OPCOD_L_SFEQI 0x00 // 00000706 #define OPCOD_L_SFNEI 0x01 // 00001707 #define OPCOD_L_SFGTUI 0x02 // 00010708 #define OPCOD_L_SFGEUI 0x03 // 00011709 #define OPCOD_L_SFLTUI 0x04 // 00100710 #define OPCOD_L_SFLEUI 0x05 // 00101711 #define OPCOD_L_SFGTSI 0x0a // 01010712 #define OPCOD_L_SFGESI 0x0b // 01011713 #define OPCOD_L_SFLTSI 0x0c // 01100714 #define OPCOD_L_SFLESI 0x0d // 01101715 716 // OPCOD_SPECIAL_3 instructions - [9:6] Instructions extend717 #define OPCOD_L_EXTHS 0x0 // 0000718 #define OPCOD_L_EXTHZ 0x2 // 0010719 #define OPCOD_L_EXTBS 0x1 // 0001720 #define OPCOD_L_EXTBZ 0x3 // 0011721 722 // OPCOD_SPECIAL_4 instructions - [9:6] Instructions extend (64b)723 #define OPCOD_L_EXTWS 0x0 // 0000724 #define OPCOD_L_EXTWZ 0x1 // 0001725 726 // OPCOD_SPECIAL_5 instructions - [7:6] Instruction Shift/Rotate with register727 #define OPCOD_L_SLL 0x0 // 00728 #define OPCOD_L_SRL 0x1 // 01729 #define OPCOD_L_SRA 0x2 // 10730 #define OPCOD_L_ROR 0x3 // 11731 732 // OPCOD_SPECIAL_6 instructions - [7:6] Instruction Shift/Rotate with immediat733 #define OPCOD_L_SLLI 0x0 // 00734 #define OPCOD_L_SRLI 0x1 // 01735 #define OPCOD_L_SRAI 0x2 // 10736 #define OPCOD_L_RORI 0x3 // 11737 738 // OPCOD_SPECIAL_7 instructions - [3:0] Instructions multiply with HI-LO739 #define OPCOD_L_MAC 0x1 // 0001740 #define OPCOD_L_MSB 0x2 // 0010741 742 // OPCOD_SPECIAL_8 instructions - [17] Instructions acces at HI-LO743 #define OPCOD_L_MOVHI 0x0 // 0744 #define OPCOD_L_MACRC 0x1 // 1745 746 // Particular case Instructions systems747 #define OPCOD_L_MSYNC 0x22000000748 #define OPCOD_L_CSYNC 0x23000000749 #define OPCOD_L_PSYNC 0x22800000750 #define OPCOD_L_NOP 0x1500751 #define OPCOD_L_SYS 0x2000752 #define OPCOD_L_TRAP 0x2100753 754 //----------------------------------------------------755 // Code Operation (after decode)756 //----------------------------------------------------757 758 typedef enum759 {760 // ##### WARNING : This opcode must be the first#####761 INST_L_NO_IMPLEMENTED , // Operation is not implemented762 763 INST_L_ADD , // L.ADD , L.ADDI , L.ADDC , L.ADDIC764 INST_L_AND , // L.AND , L.ANDI765 INST_L_OR , // L.OR , L.ORI766 INST_L_XOR , // L.XOR , L.XORI767 INST_L_CMOV , // L.CMOV768 INST_L_SUB , // L.SUB769 INST_L_FF1 , // L.FF1770 INST_L_EXTBS , // L.EXTBS771 INST_L_EXTBZ , // L.EXTBZ772 INST_L_EXTHS , // L.EXTHS773 INST_L_EXTHZ , // L.EXTHZ774 INST_L_EXTWS , // L.EXTWS775 INST_L_EXTWZ , // L.EXTWZ776 INST_L_e , //777 INST_L_f , //778 INST_L_MUL , // L.MUL , L.MULI779 INST_L_MULU , // L.MULU780 INST_L_DIV , // L.DIV781 INST_L_DIVU , // L.DIVU782 INST_L_SLL , // L.SLL , L.SLLI783 INST_L_SRL , // L.SRL , L.SRLI784 INST_L_SRA , // L.SRA , L.SRAI785 INST_L_ROR , // L.ROR , L.RORI786 INST_L_SFGES , // L.SFGES , L.SFGESI787 INST_L_SFGEU , // L.SFGEU , L.SFGEUI788 INST_L_SFGTS , // L.SFGTS , L.SFGTSI789 INST_L_SFGTU , // L.SFGTU , L.SFGTUI790 INST_L_SFLES , // L.SFLES , L.SFLESI791 INST_L_SFLEU , // L.SFLEU , L.SFLEUI792 INST_L_SFLTS , // L.SFLTS , L.SFLTSI793 INST_L_SFLTU , // L.SFLTU , L.SFLTUI794 INST_L_SFEQ , // L.SFEQ , L.SFEQI795 INST_L_SFNE , // L.SFNE , L.SFNEI796 INST_L_READ , // L.BNF , L.BF , L.JR797 INST_L_MOVHI , // L.MOVI798 INST_L_CSYNC , // L.CSYNC799 INST_L_MSYNC , // L.MSYNC800 INST_L_PSYNC , // L.PSYNC801 INST_L_RFE , // L.RFE802 INST_L_MAC , // L.MAC , L.MACI803 INST_L_MSB , // L.MSB804 INST_L_MACRC , // L.MACRC805 INST_L_2b , //806 INST_L_MEMB , // L.LBS , L.LBZ , L.SB807 INST_L_MEMH , // L.LHS , L.LHZ , L.SH808 INST_L_MEMW , // L.LWS , L.LWZ , L.SW809 INST_L_MEMD , // L.LD , L.SD810 INST_L_CUST1 , // L.CUST1811 INST_L_CUST2 , // L.CUST2812 INST_L_CUST3 , // L.CUST3813 INST_L_CUST4 , // L.CUST4814 INST_L_CUST5 , // L.CUST5815 INST_L_CUST6 , // L.CUST6816 INST_L_CUST7 , // L.CUST7817 INST_L_CUST8 , // L.CUST8818 INST_L_38 , //819 INST_L_39 , //820 INST_L_3a , //821 INST_L_3b , //822 INST_L_3c , //823 INST_L_3d , //824 INST_L_3e , //825 INST_NOP // L.NOP826 } opcod_t;827 828 #define LOG2_NB_INST_L 6829 #define NB_INST_L 64 // +1 -> INST_L_NO_IMPLEMENTED830 //#define NB_INST_L (INST_L_NO_IMPLEMENTED+1)831 1057 */ 832 1058 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Debug_component.h
r77 r78 2 2 #define Debug_component_H 3 3 4 #define DEBUG_Behavioural false 5 #define DEBUG_Generic false 6 #define DEBUG_Counter false 7 #define DEBUG_Group false 8 #define DEBUG_Queue false 9 #define DEBUG_Queue_Control false 10 #define DEBUG_Shifter false 11 #define DEBUG_RegisterFile false 12 #define DEBUG_RegisterFile_Monolithic false 13 #define DEBUG_RegisterFile_Multi_Banked false 14 #define DEBUG_Select false 15 #define DEBUG_Select_Priority_Fixed false 16 #define Debug_Victim false 17 #define DEBUG_Victim_Pseudo_LRU false 18 #define DEBUG_Core false 19 #define DEBUG_Multi_Execute_loop false 20 #define DEBUG_Execute_loop false 21 #define DEBUG_Multi_Execute_unit false 22 #define DEBUG_Execute_unit false 23 #define DEBUG_Functionnal_unit false 24 #define DEBUG_Load_store_unit false 25 #define DEBUG_Multi_Read_unit false 26 #define DEBUG_Read_unit false 27 #define DEBUG_Read_queue false 28 #define DEBUG_Reservation_station false 29 #define DEBUG_Multi_Write_unit false 30 #define DEBUG_Write_unit false 31 #define DEBUG_Execute_queue false 32 #define DEBUG_Write_queue false 33 #define DEBUG_Network true 34 #define DEBUG_Execution_unit_to_Write_unit true 35 #define DEBUG_Read_unit_to_Execution_unit true 36 #define DEBUG_Register_unit false 37 #define DEBUG_Register_unit_Glue false 38 #define DEBUG_Multi_Front_end false 39 #define DEBUG_Front_end false 40 #define DEBUG_Prediction_unit false 41 #define DEBUG_Direction false 42 #define DEBUG_Meta_Predictor false 43 #define DEBUG_Meta_Predictor_Glue false 44 #define DEBUG_Two_Level_Branch_Predictor false 45 #define DEBUG_Two_Level_Branch_Predictor_Glue false 46 #define DEBUG_Branch_History_Table false 47 #define DEBUG_Pattern_History_Table false 4 # define DEBUG_true true 5 # define DEBUG_false false 48 6 7 # define DEBUG_Behavioural false 8 # define DEBUG_Generic false 9 # define DEBUG_Counter false 10 # define DEBUG_Queue false 11 # define DEBUG_Queue_Control false 12 # define DEBUG_RegisterFile false 13 # define DEBUG_RegisterFile_Monolithic false 14 # define DEBUG_RegisterFile_Multi_Banked false 15 # define DEBUG_Select false 16 # define DEBUG_Select_Priority_Fixed false 17 # define DEBUG_Shifter false 18 # define DEBUG_Sort false 19 # define DEBUG_Victim false 20 # define DEBUG_Victim_Pseudo_LRU false 21 # define DEBUG_Core false 22 # define DEBUG_Multi_Execute_loop false 23 # define DEBUG_Execute_loop false 24 # define DEBUG_Multi_Execute_unit false 25 # define DEBUG_Execute_unit false 26 # define DEBUG_Functionnal_unit false 27 # define DEBUG_Load_store_unit false 28 # define DEBUG_Multi_Read_unit false 29 # define DEBUG_Read_unit false 30 # define DEBUG_Read_queue false 31 # define DEBUG_Reservation_station false 32 # define DEBUG_Multi_Write_unit false 33 # define DEBUG_Write_unit false 34 # define DEBUG_Execute_queue false 35 # define DEBUG_Write_queue false 36 # define DEBUG_Network false 37 # define DEBUG_Execution_unit_to_Write_unit false 38 # define DEBUG_Read_unit_to_Execution_unit false 39 # define DEBUG_Register_unit false 40 # define DEBUG_Register_unit_Glue false 41 # define DEBUG_Multi_Front_end false 42 # define DEBUG_Front_end false 43 # define DEBUG_Decod_unit false 44 # define DEBUG_Decod false 45 # define DEBUG_Ifetch_unit false 46 # define DEBUG_Address_management false 47 # define DEBUG_Ifetch_queue false 48 # define DEBUG_Ifetch_unit_Glue false 49 # define DEBUG_Prediction_unit false 50 # define DEBUG_Branch_Target_Buffer false 51 # define DEBUG_Branch_Target_Buffer_Glue false 52 # define DEBUG_Branch_Target_Buffer_Register false 53 # define DEBUG_Direction false 54 # define DEBUG_Direction_Glue false 55 # define DEBUG_Meta_Predictor false 56 # define DEBUG_Meta_Predictor_Glue false 57 # define DEBUG_Two_Level_Branch_Predictor false 58 # define DEBUG_Two_Level_Branch_Predictor_Glue false 59 # define DEBUG_Branch_History_Table false 60 # define DEBUG_Pattern_History_Table false 61 # define DEBUG_Return_Address_Stack true 62 # define DEBUG_Update_Prediction_Table true 63 # define DEBUG_Multi_OOO_Engine false 64 # define DEBUG_OOO_Engine false 65 # define DEBUG_Rename_unit false 66 # define DEBUG_Load_Store_pointer_unit false 67 # define DEBUG_Register_translation_unit false 68 # define DEBUG_Dependency_checking_unit false 69 # define DEBUG_Free_List_unit false 70 # define DEBUG_Register_Address_Translation_unit false 71 # define DEBUG_Register_translation_unit_Glue false 72 # define DEBUG_Stat_List_unit false 73 //#define DEBUG_Rename_queue true 74 # define DEBUG_Rename_select false 49 75 #endif -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Entity.h
r75 r78 78 78 #endif 79 79 80 public : bool test_map ( bool top_level);80 public : bool test_map (uint32_t depth,bool top_level); 81 81 82 82 #ifdef POSITION -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Environnement.h
r71 r78 22 22 # define DEBUG_TEST 23 23 #endif 24 25 #define MORPHEO_HOME "MORPHEO_HOME" -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interface.h
r75 r78 229 229 #endif 230 230 231 public : bool test_map ( bool top_level);231 public : bool test_map (uint32_t depth, bool top_level); 232 232 233 233 #ifdef POSITION -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interfaces.h
r75 r78 80 80 #endif 81 81 82 public : bool test_map ( bool top_level);82 public : bool test_map (uint32_t depth, bool top_level); 83 83 84 84 public : friend std::ostream& operator<< (std::ostream& output_stream, -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Parameters.h
r77 r78 14 14 #include "Behavioural/include/Environnement.h" 15 15 #include "Behavioural/include/Constants.h" 16 #include "Behavioural/include/Test.h" 16 17 #include "Common/include/ErrorMorpheo.h" 17 18 #include "Common/include/ToString.h" … … 22 23 namespace behavioural { 23 24 25 class Parameters_test 26 { 27 private : std::string _component; 28 protected : std::string _error; 29 protected : std::string _warning; 30 protected : std::string _information; 31 32 public : Parameters_test (std::string component) 33 { 34 _component = component; 35 _error = ""; 36 _warning = ""; 37 }; 38 public : ~Parameters_test (void) {}; 39 40 public : bool have_error (void) { return (_error.length() != 0);}; 41 public : void error (std::string str) { _error += "[ ERROR ] <" + _component + "> " + str + "\n";} 42 public : void warning (std::string str) { _warning += "[ WARNING ] <" + _component + "> " + str + "\n";} 43 public : void information (std::string str) { _information += "[INFORMATION] <" + _component + "> " + str + "\n";} 44 public : std::string print (void) { return _error + _warning + _information;}; 45 }; 46 24 47 // Virtual Class - Interface of each component 25 48 class Parameters 26 49 { 27 50 // -----[ fields ]---------------------------------------------------- 28 public : static const uint32_t _nb_operation = MAX_OPERATION; 29 public : static const uint32_t _nb_type = MAX_TYPE; 30 public : static const uint32_t _size_operation = SIZE_OPERATION; 31 public : static const uint32_t _size_type = SIZE_TYPE; 32 public : static const uint32_t _size_exception = SIZE_EXCEPTION; 33 public : static const uint32_t _size_dcache_type = SIZE_DCACHE_TYPE; 34 public : static const uint32_t _size_dcache_error = SIZE_DCACHE_ERROR; 51 public : static const uint32_t _size_instruction = 32; 52 public : static const uint32_t _nb_operation = MAX_OPERATION; 53 public : static const uint32_t _nb_type = MAX_TYPE; 54 public : static const uint32_t _size_operation = SIZE_OPERATION; 55 public : static const uint32_t _size_type = SIZE_TYPE; 56 public : static const uint32_t _size_exception = SIZE_EXCEPTION; 57 public : static const uint32_t _size_exception_use = SIZE_EXCEPTION_USE; 58 public : static const uint32_t _size_exception_memory = SIZE_EXCEPTION_MEMORY; 59 public : static const uint32_t _size_exception_custom = SIZE_EXCEPTION_CUSTOM; 60 public : static const uint32_t _size_exception_alu = SIZE_EXCEPTION_ALU ; 61 public : static const uint32_t _size_exception_decod = SIZE_EXCEPTION_DECOD ; 62 public : static const uint32_t _size_exception_ifetch = SIZE_EXCEPTION_IFETCH; 63 public : static const uint32_t _size_icache_type = SIZE_ICACHE_TYPE; 64 public : static const uint32_t _size_icache_error = SIZE_ICACHE_ERROR; 65 public : static const uint32_t _size_dcache_type = SIZE_DCACHE_TYPE; 66 public : static const uint32_t _size_dcache_error = SIZE_DCACHE_ERROR; 67 public : static const uint32_t _nb_general_register_logic = 32; 68 public : static const uint32_t _nb_special_register_logic = NB_SPR_LOGIC; 69 public : static const uint32_t _size_general_register_logic = 5; 70 public : static const uint32_t _size_special_register_logic = LOG2_NB_SPR_LOGIC; 71 public : static const uint32_t _size_event_state = SIZE_EVENT_STATE; 72 public : static const uint32_t _size_event_type = SIZE_EVENT_TYPE; 73 public : static const uint32_t _size_branch_state = SIZE_BRANCH_STATE; 74 public : static const uint32_t _size_branch_condition = SIZE_BRANCH_CONDITION; 35 75 36 76 // -----[ methods ]--------------------------------------------------- 37 public : Parameters(void);38 public : virtual ~Parameters ();77 public : Parameters (void); 78 public : virtual ~Parameters (); 39 79 40 80 // methods to print and test parameters 41 public : virtual std::string print (uint32_t depth) = 0;42 public : virtual std::stringmsg_error (void) = 0;81 public : virtual std::string print (uint32_t depth) = 0; 82 public : virtual Parameters_test msg_error (void) = 0; 43 83 44 84 // methods to generate configuration file 45 46 85 47 86 // methods to test 48 public : void test (void); 49 public : bool is_natural (double val ); 50 public : bool is_positive (double val ); 51 public : bool is_multiple (uint32_t val1, 52 uint32_t val2); 53 public : bool is_between_inclusive (uint32_t val, 54 uint32_t min, 55 uint32_t max); 56 public : bool is_between_exclusive (uint32_t val, 57 uint32_t min, 58 uint32_t max); 87 public : void test (void); 59 88 }; 60 61 89 }; // end namespace behavioural 62 90 }; // end namespace morpheo -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Signal.h
r75 r78 51 51 52 52 // -----[ fields ]---------------------------------------------------- 53 private : const std::string 53 private : const std::string _name ; 54 54 private : const direction_t _direction ; 55 55 private : const presence_port_t _presence_port ; 56 56 private : uint32_t _size ; 57 57 58 private : Signal * _connect_to_signal; // the actual implementaion, this signal link with one signal (but if signal is an output, it can be connect with many signal ...) 59 private : Signal * _connect_from_signal; // producter of signal. If NULL, then producteur is the current entity 60 private : bool _is_allocate ; // Have allocate a sc_in or sc_out port 61 private : void * _sc_signal ; // sc_in or sc_out associated at this signal 62 private : void * _sc_signal_map ; // sc_out generated this signal 63 private : bool _is_map_as_src ; 64 private : bool _is_map_as_dest; 65 private : type_info_t _type_info ; 58 private : Signal * _connect_to_signal ; // the actual implementaion, this signal link with one signal (but if signal is an output, it can be connect with many signal ...) 59 private : Signal * _connect_from_signal ; // producter of signal. If NULL, then producteur is the current entity 60 private : bool _is_allocate ; // Have allocate a sc_in or sc_out port 61 private : void * _sc_signal ; // sc_in or sc_out associated at this signal 62 private : void * _sc_signal_map ; // sc_out generated this signal 63 private : bool _is_map_as_toplevel_dest ; 64 private : bool _is_map_as_component_src ; 65 private : bool _is_map_as_component_dest; 66 private : type_info_t _type_info ; 66 67 67 68 #ifdef VHDL_TESTBENCH … … 90 91 public : bool presence_testbench (void); 91 92 92 public : bool test_map ( bool top_level);93 public : bool test_map (uint32_t depth, bool top_level); 93 94 94 95 public : void link (Signal * signal_dest, -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Stat.h
r75 r78 60 60 bool _generate_file; 61 61 62 public : Stat (std::string name_instance, 63 std::string name_component, 64 Parameters_Statistics * param); 62 public : Stat (std::string name_instance, 63 std::string name_component, 64 Parameters_Statistics * param); 65 public : Stat (std::string name_instance, 66 std::string name_component, 67 cycle_t nb_cycle_before_begin=0, 68 cycle_t period=0); 69 public : ~Stat (void); 65 70 66 public : Stat (std::string name_instance, 67 std::string name_component, 68 cycle_t nb_cycle_before_begin=0, 69 cycle_t period=0); 70 public : ~Stat (void); 71 72 public : counter_t * create_variable (std::string varname); 73 public : counter_t * create_counter (std::string varname, 74 std::string unit, 75 std::string description); 76 private : counter_t * alloc_operand (counter_type_t type, 77 std::string varname, 78 std::string unit, 79 std::string description); 80 public : void create_expr (std::string varname, 81 std::string expr, 82 bool each_cycle=true); 71 public : counter_t * create_variable (std::string varname); 72 public : counter_t * create_counter (std::string varname, 73 std::string unit, 74 std::string description); 75 private : counter_t * alloc_operand (counter_type_t type, 76 std::string varname, 77 std::string unit, 78 std::string description); 83 79 84 private : Stat_binary_tree * string2tree (std::string expr); 80 public : void create_expr (std::string varname, 81 std::string expr, 82 bool each_cycle=false); 83 public : void create_expr_average (std::string varname, 84 std::string expr_sum, 85 std::string expr_deps, 86 std::string unit, 87 std::string description); 85 88 86 public : void end_cycle (void); 87 private : void end_simulation (void); 88 private : void test_and_save (bool force_save=false); 89 private : void eval_exprs (bool only_each_cycle=true); 90 private : void eval_expr (expr_t expr); 91 92 private : bool is_valid_var (std::string expr); 89 public : void create_expr_average_by_cycle (std::string varname, 90 std::string expr_sum, 91 std::string unit, 92 std::string description); 93 93 94 private : void generate_file (void); 94 public : void create_expr_percent (std::string varname, 95 std::string expr_sum, 96 std::string expr_max, 97 std::string description); 95 98 96 private : bool have_counter (void);99 private : Stat_binary_tree * string2tree (std::string expr); 97 100 98 public : void add_stat (Stat * stat); 101 public : void end_cycle (void); 102 private : void end_simulation (void); 99 103 100 public : std::string print (uint32_t depth=0); 104 private : void test_and_save (bool force_save=false); 105 106 private : void eval_exprs (bool only_each_cycle=true); 107 private : void eval_expr (expr_t expr); 108 109 private : bool is_valid_var (std::string expr); 110 111 private : void generate_file (void); 112 113 private : bool have_counter (void); 114 115 public : void add_stat (Stat * stat); 116 117 public : std::string print (uint32_t depth=0); 101 118 }; 102 119 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Types.h
r77 r78 4 4 #include "Common/include/Types.h" 5 5 #include "Common/include/ToString.h" 6 #include "Common/include/FromString.h" 7 #include "Common/include/ErrorMorpheo.h" 6 8 #include "Behavioural/include/Constants.h" 7 9 … … 14 16 15 17 // ***** general 16 typedef bool Tcontrol_t; 17 typedef uint32_t Toperation_t; 18 //typedef uint32_t Tdestination1_t; 19 //typedef uint32_t Tdestination2_t; 20 //typedef uint32_t Texec_flag_t; 21 //typedef bool Texec_excep_t; 22 //typedef uint32_t Tcondition_t; 23 //typedef uint32_t Tbranch_state_t; 24 25 typedef uint32_t Texception_t; 26 typedef uint32_t Tcontext_t; 27 typedef uint32_t Tpacket_t; 28 typedef uint32_t Ttype_t; 29 30 // ***** Register 31 typedef uint32_t Tgeneral_address_t; 32 typedef uint32_t Tgeneral_data_t; 33 typedef uint32_t Tspecial_address_t; 34 typedef uint32_t Tspecial_data_t; 18 typedef uint32_t Tinstruction_t; 19 typedef bool Tcontrol_t; 20 typedef uint8_t Toperation_t; 21 //typedef uint32_t Tdestination1_t; 22 //typedef uint32_t Tdestination2_t; 23 //typedef uint32_t Texec_flag_t; 24 //typedef bool Texec_excep_t; 25 26 typedef uint8_t Texception_t; 27 typedef uint8_t Tcontext_t; 28 typedef uint8_t Tpacket_t; 29 typedef uint8_t Ttype_t; 30 typedef uint8_t Tevent_state_t; 31 typedef uint8_t Tevent_type_t; 32 typedef uint8_t Tcounter_t; // universal counter 33 typedef uint8_t Tptr_t; // universal pointer 34 35 // ***** Register 36 typedef uint32_t Tgeneral_address_t; 37 typedef uint32_t Tgeneral_data_t; 38 typedef uint32_t Tspecial_address_t; 39 typedef uint32_t Tspecial_data_t; 35 40 36 41 // ***** component dependant 37 // ~~~~~ load store queue 38 typedef uint32_t Taccess_t; 39 typedef uint32_t Tlsq_ptr_t; 40 typedef uint32_t Tdcache_address_t; 41 typedef uint32_t Tdcache_data_t; 42 typedef bool Tdcache_error_t; 43 typedef uint32_t Tdcache_type_t; 42 // ~~~~~ load store queue 43 typedef uint8_t Taccess_t; 44 typedef uint8_t Tlsq_ptr_t; 45 typedef uint32_t Tdcache_address_t; 46 typedef uint32_t Tdcache_data_t; 47 typedef bool Tdcache_error_t; 48 typedef uint8_t Tdcache_type_t; 49 50 // ~~~~~ prediction_unit 51 typedef uint8_t Thistory_t; 52 typedef uint8_t Tprediction_ptr_t; 53 typedef uint8_t Tbranch_state_t; 54 typedef uint8_t Tbranch_condition_t; 55 typedef uint8_t Tdepth_t; 56 typedef Tgeneral_data_t Taddress_t; 57 58 59 // ~~~~~ ifetch 60 typedef uint8_t Tinst_ifetch_ptr_t; 61 typedef uint8_t Tifetch_queue_ptr_t; 62 typedef uint32_t Ticache_address_t; 63 typedef uint32_t Ticache_instruction_t; 64 typedef bool Ticache_error_t; 65 typedef uint8_t Ticache_type_t; 66 67 typedef enum 68 { 69 PRIORITY_STATIC, 70 PRIORITY_ROUND_ROBIN 71 } Tpriority_t; 72 73 typedef enum 74 { 75 LOAD_BALANCING_BALANCE, 76 LOAD_BALANCING_MAXIMUM_FOR_PRIORITY 77 } Tload_balancing_t; 78 79 typedef enum 80 { 81 VICTIM_RANDOM , // Random 82 VICTIM_ROUND_ROBIN, // Round Robin 83 VICTIM_NLU , // Not Last Used 84 VICTIM_PSEUDO_LRU , // Pseudo Least Recently Used 85 VICTIM_LRU , // Least Recently Used 86 VICTIM_FIFO // First IN First OUT 87 } Tvictim_t; 88 89 typedef enum 90 { 91 PREDICTOR_NEVER_TAKE , // Branch is never Take 92 PREDICTOR_ALWAYS_TAKE , // Branch is always Take 93 PREDICTOR_STATIC , // If the adress of destination is previous, then the branch is take 94 PREDICTOR_LAST_TAKE , // The direction is as the last time (if is the first time : static) 95 PREDICTOR_COUNTER , // Counter table 96 PREDICTOR_LOCAL , // Counter bank indexed with history bank 97 PREDICTOR_GLOBAL , // Counter bank indexed with history table 98 PREDICTOR_META , // A meta_predictor choose between 2 predictor : the local or the global 99 PREDICTOR_CUSTOM // Note predefined scheme 100 } Tpredictor_t; 44 101 45 102 //----------------------------------------------[ spr_mode_access ]----- … … 56 113 } 57 114 }; 58 59 inline Tcontext_t get_num_thread (Tcontext_t num_context_id , uint32_t size_context_id ,60 Tcontext_t num_front_end_id , uint32_t size_front_end_id ,61 Tcontext_t num_ooo_engine_id, uint32_t size_ooo_engine_id)62 {63 return ((num_ooo_engine_id << (size_context_id + size_front_end_id)) |64 (num_front_end_id << (size_context_id)) |65 (num_context_id));66 }67 68 inline uint32_t get_nb_thread (uint32_t nb_context ,69 uint32_t nb_front_end ,70 uint32_t nb_ooo_engine )71 {72 return (nb_ooo_engine *73 nb_front_end *74 nb_context) ;75 }76 115 77 116 }; // end namespace behavioural … … 96 135 }; 97 136 137 template<> inline std::string toString<morpheo::behavioural::Tpriority_t>(const morpheo::behavioural::Tpriority_t& x) 138 { 139 switch (x) 140 { 141 case morpheo::behavioural::PRIORITY_STATIC : return "priority_static"; break; 142 case morpheo::behavioural::PRIORITY_ROUND_ROBIN : return "priority_round_robin"; break; 143 default : return "" ; break; 144 } 145 }; 146 147 template<> inline morpheo::behavioural::Tpriority_t fromString<morpheo::behavioural::Tpriority_t>(const std::string& x) 148 { 149 if ( (x.compare("0") == 0) or 150 (x.compare("priority_static") == 0)) 151 return morpheo::behavioural::PRIORITY_STATIC; 152 if ( (x.compare("1") == 0) or 153 (x.compare("priority_round_robin") == 0)) 154 return morpheo::behavioural::PRIORITY_ROUND_ROBIN; 155 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 156 }; 157 158 template<> inline std::string toString<morpheo::behavioural::Tload_balancing_t>(const morpheo::behavioural::Tload_balancing_t& x) 159 { 160 switch (x) 161 { 162 case morpheo::behavioural::LOAD_BALANCING_BALANCE : return "load_balancing_balance"; break; 163 case morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY : return "load_balancing_maximum_for_priority"; break; 164 default : return "" ; break; 165 } 166 }; 167 168 template<> inline morpheo::behavioural::Tload_balancing_t fromString<morpheo::behavioural::Tload_balancing_t>(const std::string& x) 169 { 170 if ( (x.compare("0") == 0) or 171 (x.compare("load_balancing_balance") == 0)) 172 return morpheo::behavioural::LOAD_BALANCING_BALANCE; 173 if ( (x.compare("1") == 0) or 174 (x.compare("load_balancing_maximum_for_priority") == 0)) 175 return morpheo::behavioural::LOAD_BALANCING_MAXIMUM_FOR_PRIORITY; 176 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 177 }; 178 179 template<> inline std::string toString<morpheo::behavioural::Tvictim_t>(const morpheo::behavioural::Tvictim_t& x) 180 { 181 switch (x) 182 { 183 case morpheo::behavioural::VICTIM_RANDOM : return "victim_random" ; break; 184 case morpheo::behavioural::VICTIM_ROUND_ROBIN : return "victim_round_robin"; break; 185 case morpheo::behavioural::VICTIM_NLU : return "victim_nlu" ; break; 186 case morpheo::behavioural::VICTIM_PSEUDO_LRU : return "victim_pseudo_lru" ; break; 187 case morpheo::behavioural::VICTIM_LRU : return "victim_lru" ; break; 188 case morpheo::behavioural::VICTIM_FIFO : return "victim_fifo" ; break; 189 default : return "" ; break; 190 } 191 }; 192 193 template<> inline morpheo::behavioural::Tvictim_t fromString<morpheo::behavioural::Tvictim_t>(const std::string& x) 194 { 195 if ( (x.compare("0") == 0) or 196 (x.compare("victim_random") == 0)) 197 return morpheo::behavioural::VICTIM_RANDOM; 198 if ( (x.compare("1") == 0) or 199 (x.compare("victim_round_robin") == 0)) 200 return morpheo::behavioural::VICTIM_ROUND_ROBIN; 201 if ( (x.compare("2") == 0) or 202 (x.compare("victim_nlu") == 0)) 203 return morpheo::behavioural::VICTIM_NLU; 204 if ( (x.compare("3") == 0) or 205 (x.compare("victim_pseudo_lru") == 0)) 206 return morpheo::behavioural::VICTIM_PSEUDO_LRU; 207 if ( (x.compare("4") == 0) or 208 (x.compare("victim_lru") == 0)) 209 return morpheo::behavioural::VICTIM_LRU; 210 if ( (x.compare("5") == 0) or 211 (x.compare("victim_fifo") == 0)) 212 return morpheo::behavioural::VICTIM_FIFO; 213 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 214 }; 215 216 template<> inline std::string toString<morpheo::behavioural::Tpredictor_t>(const morpheo::behavioural::Tpredictor_t& x) 217 { 218 switch (x) 219 { 220 case morpheo::behavioural::PREDICTOR_NEVER_TAKE : return "predictor_never_take" ; break; 221 case morpheo::behavioural::PREDICTOR_ALWAYS_TAKE : return "predictor_always_take"; break; 222 case morpheo::behavioural::PREDICTOR_STATIC : return "predictor_static" ; break; 223 case morpheo::behavioural::PREDICTOR_LAST_TAKE : return "predictor_last_take" ; break; 224 case morpheo::behavioural::PREDICTOR_COUNTER : return "predictor_counter" ; break; 225 case morpheo::behavioural::PREDICTOR_LOCAL : return "predictor_local" ; break; 226 case morpheo::behavioural::PREDICTOR_GLOBAL : return "predictor_global" ; break; 227 case morpheo::behavioural::PREDICTOR_META : return "predictor_meta" ; break; 228 case morpheo::behavioural::PREDICTOR_CUSTOM : return "predictor_custom" ; break; 229 default : return "" ; break; 230 } 231 }; 232 233 template<> inline morpheo::behavioural::Tpredictor_t fromString<morpheo::behavioural::Tpredictor_t>(const std::string& x) 234 { 235 if ( (x.compare("0") == 0) or 236 (x.compare("predictor_never_take") == 0)) 237 return morpheo::behavioural::PREDICTOR_NEVER_TAKE; 238 if ( (x.compare("1") == 0) or 239 (x.compare("predictor_always_take") == 0)) 240 return morpheo::behavioural::PREDICTOR_ALWAYS_TAKE; 241 if ( (x.compare("2") == 0) or 242 (x.compare("predictor_static") == 0)) 243 return morpheo::behavioural::PREDICTOR_STATIC; 244 if ( (x.compare("3") == 0) or 245 (x.compare("predictor_last_take") == 0)) 246 return morpheo::behavioural::PREDICTOR_LAST_TAKE; 247 if ( (x.compare("4") == 0) or 248 (x.compare("predictor_counter") == 0)) 249 return morpheo::behavioural::PREDICTOR_COUNTER; 250 if ( (x.compare("5") == 0) or 251 (x.compare("predictor_local") == 0)) 252 return morpheo::behavioural::PREDICTOR_LOCAL; 253 if ( (x.compare("6") == 0) or 254 (x.compare("predictor_global") == 0)) 255 return morpheo::behavioural::PREDICTOR_GLOBAL; 256 if ( (x.compare("7") == 0) or 257 (x.compare("predictor_meta") == 0)) 258 return morpheo::behavioural::PREDICTOR_META; 259 if ( (x.compare("8") == 0) or 260 (x.compare("predictor_custom") == 0)) 261 return morpheo::behavioural::PREDICTOR_CUSTOM; 262 throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"")); 263 }; 264 98 265 }; // end namespace morpheo 99 100 266 #endif
Note: See TracChangeset
for help on using the changeset viewer.