[72] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Operation.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
[78] | 9 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Functionnal_unit/Operation/include/Operation.h" |
---|
[72] | 10 | |
---|
| 11 | #define neg(data) (~(data)+1) |
---|
| 12 | #define sign(data) ((data)>>(param->_size_data-1)) |
---|
| 13 | #define unsigned(data) (data) |
---|
| 14 | #define signed(data) ((sign(data)==0)?(data):neg(data)) |
---|
| 15 | #define ovf(op1, op2, res) ((sign(op1) == sign(op2))?(sign(op1) xor sign(res)):0) |
---|
| 16 | #define carry(op1, op2, res) (((res)<(op1)) or ((res)<(op2))) |
---|
| 17 | #define set_flag(data,flag,is_set) (((is_set)==1)?((data)|(flag)):((data)&~(flag))) |
---|
| 18 | #define get_flag(data,flag) (((data)&(flag))!=0) |
---|
| 19 | #define concatenation_bool(a,b) (((a)<<1) | (b)) |
---|
| 20 | |
---|
| 21 | namespace morpheo { |
---|
| 22 | namespace behavioural { |
---|
| 23 | namespace core { |
---|
| 24 | namespace multi_execute_loop { |
---|
| 25 | namespace execute_loop { |
---|
| 26 | namespace multi_execute_unit { |
---|
| 27 | namespace execute_unit { |
---|
| 28 | namespace functionnal_unit { |
---|
| 29 | |
---|
| 30 | #undef FUNCTION |
---|
| 31 | #define FUNCTION "Functionnal_unit::operation_unimplemented" |
---|
| 32 | void operation_unimplemented (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 33 | { |
---|
| 34 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : unimplemented"); |
---|
| 35 | |
---|
| 36 | throw ERRORMORPHEO(FUNCTION,"The operation '"+toString(op->_operation)+"' is not implemented in this Functionnal_unit"); |
---|
| 37 | }; |
---|
| 38 | |
---|
| 39 | #undef FUNCTION |
---|
| 40 | #define FUNCTION "Functionnal_unit::operation_l_add" |
---|
| 41 | void operation_l_add (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 42 | { |
---|
| 43 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_add"); |
---|
| 44 | |
---|
| 45 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 46 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 47 | |
---|
| 48 | Tgeneral_data_t gpr3 = param->_mask_data & (gpr1 + gpr2); |
---|
| 49 | |
---|
| 50 | bool overflow = ovf (gpr1,gpr2,gpr3); |
---|
| 51 | bool carry_out = carry(gpr1,gpr2,gpr3); |
---|
| 52 | |
---|
| 53 | // Result |
---|
[76] | 54 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 55 | op->_data_rd = gpr3; |
---|
| 56 | op->_data_re = 0; |
---|
| 57 | op->_data_re = set_flag(op->_data_re,FLAG_OV,overflow ); |
---|
| 58 | op->_data_re = set_flag(op->_data_re,FLAG_CY,carry_out); |
---|
| 59 | op->_exception = (overflow==1)?EXCEPTION_ALU_RANGE:EXCEPTION_ALU_NONE; |
---|
| 60 | op->_no_sequence = 0; |
---|
| 61 | //op->_address = 0; |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | #undef FUNCTION |
---|
| 65 | #define FUNCTION "Functionnal_unit::operation_l_addc" |
---|
| 66 | void operation_l_addc (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 67 | { |
---|
| 68 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_addc"); |
---|
| 69 | |
---|
| 70 | Tgeneral_data_t carry_in = get_flag(op->_data_rc,FLAG_CY); |
---|
| 71 | |
---|
| 72 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 73 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 74 | Tgeneral_data_t gpr3 = param->_mask_data & (gpr1 + gpr2 + carry_in); |
---|
| 75 | |
---|
| 76 | bool overflow = ovf (gpr1,gpr2,gpr3); |
---|
| 77 | bool carry_out = carry(gpr1,gpr2,gpr3); |
---|
| 78 | |
---|
| 79 | // Result |
---|
[76] | 80 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 81 | op->_data_rd = gpr3; |
---|
| 82 | op->_data_re = 0; |
---|
| 83 | op->_data_re = set_flag(op->_data_re,FLAG_OV,overflow ); |
---|
| 84 | op->_data_re = set_flag(op->_data_re,FLAG_CY,carry_out); |
---|
| 85 | op->_exception = (overflow==1)?EXCEPTION_ALU_RANGE:EXCEPTION_ALU_NONE; |
---|
| 86 | op->_no_sequence = 0; |
---|
| 87 | //op->_address = 0; |
---|
| 88 | }; |
---|
| 89 | |
---|
| 90 | #undef FUNCTION |
---|
| 91 | #define FUNCTION "Functionnal_unit::operation_l_sub" |
---|
| 92 | void operation_l_sub (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 93 | { |
---|
| 94 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sub"); |
---|
| 95 | |
---|
| 96 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 97 | Tgeneral_data_t gpr2 = neg(unsigned(op->_data_rb)); |
---|
| 98 | Tgeneral_data_t gpr3 = param->_mask_data & (gpr1 + gpr2); |
---|
| 99 | |
---|
| 100 | bool overflow = ovf (gpr1,gpr2,gpr3); |
---|
| 101 | bool carry_out = carry(gpr1,gpr2,gpr3); |
---|
| 102 | |
---|
| 103 | // Result |
---|
[76] | 104 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 105 | op->_data_rd = gpr3; |
---|
| 106 | op->_data_re = 0; |
---|
| 107 | op->_data_re = set_flag(op->_data_re,FLAG_OV,overflow ); |
---|
| 108 | op->_data_re = set_flag(op->_data_re,FLAG_CY,carry_out); |
---|
| 109 | op->_exception = (overflow==1)?EXCEPTION_ALU_RANGE:EXCEPTION_ALU_NONE; |
---|
| 110 | op->_no_sequence = 0; |
---|
| 111 | //op->_address = 0; |
---|
| 112 | }; |
---|
| 113 | |
---|
| 114 | #undef FUNCTION |
---|
| 115 | #define FUNCTION "Functionnal_unit::operation_l_and" |
---|
| 116 | void operation_l_and (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 117 | { |
---|
| 118 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_and"); |
---|
| 119 | |
---|
| 120 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 121 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 122 | Tgeneral_data_t gpr3 = (gpr1 & gpr2); |
---|
| 123 | |
---|
| 124 | // Result |
---|
[76] | 125 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 126 | op->_data_rd = gpr3; |
---|
| 127 | //op->_data_re = 0; |
---|
| 128 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 129 | op->_no_sequence = 0; |
---|
| 130 | //op->_address = 0; |
---|
| 131 | }; |
---|
| 132 | |
---|
| 133 | #undef FUNCTION |
---|
| 134 | #define FUNCTION "Functionnal_unit::operation_l_or" |
---|
| 135 | void operation_l_or (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 136 | { |
---|
| 137 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_or"); |
---|
| 138 | |
---|
| 139 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 140 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 141 | Tgeneral_data_t gpr3 = (gpr1 | gpr2); |
---|
| 142 | |
---|
| 143 | // Result |
---|
[76] | 144 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 145 | op->_data_rd = gpr3; |
---|
| 146 | //op->_data_re = 0; |
---|
| 147 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 148 | op->_no_sequence = 0; |
---|
| 149 | //op->_address = 0; |
---|
| 150 | }; |
---|
| 151 | |
---|
| 152 | #undef FUNCTION |
---|
| 153 | #define FUNCTION "Functionnal_unit::operation_l_xor" |
---|
| 154 | void operation_l_xor (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 155 | { |
---|
| 156 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_xor"); |
---|
| 157 | |
---|
| 158 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 159 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 160 | Tgeneral_data_t gpr3 = (gpr1 ^ gpr2); |
---|
| 161 | |
---|
| 162 | // Result |
---|
[76] | 163 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 164 | op->_data_rd = gpr3; |
---|
| 165 | //op->_data_re = 0; |
---|
| 166 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 167 | op->_no_sequence = 0; |
---|
| 168 | //op->_address = 0; |
---|
| 169 | }; |
---|
| 170 | |
---|
| 171 | #undef FUNCTION |
---|
| 172 | #define FUNCTION "Functionnal_unit::operation_l_movhi" |
---|
| 173 | void operation_l_movhi (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 174 | { |
---|
| 175 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_movhi"); |
---|
| 176 | |
---|
| 177 | Tgeneral_data_t gpr1 = unsigned(op->_immediat); |
---|
| 178 | Tgeneral_data_t gpr2 = param->_mask_data & (gpr1<<16); |
---|
| 179 | |
---|
| 180 | // Result |
---|
[76] | 181 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 182 | op->_data_rd = gpr2; |
---|
| 183 | //op->_data_re = 0; |
---|
| 184 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 185 | op->_no_sequence = 0; |
---|
| 186 | //op->_address = 0; |
---|
| 187 | }; |
---|
| 188 | |
---|
| 189 | #undef FUNCTION |
---|
| 190 | #define FUNCTION "Functionnal_unit::operation_l_cmov" |
---|
| 191 | void operation_l_cmov (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 192 | { |
---|
| 193 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_cmov"); |
---|
| 194 | |
---|
| 195 | Tgeneral_data_t f_in = get_flag(op->_data_rc,FLAG_F); |
---|
| 196 | |
---|
| 197 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 198 | Tgeneral_data_t gpr2 = unsigned(op->_data_rb); |
---|
| 199 | Tgeneral_data_t gpr3 = ((f_in==0)?gpr2:gpr1); |
---|
| 200 | |
---|
| 201 | // Result |
---|
[76] | 202 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 203 | op->_data_rd = gpr3; |
---|
| 204 | //op->_data_re = 0; |
---|
| 205 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 206 | op->_no_sequence = 0; |
---|
| 207 | //op->_address = 0; |
---|
| 208 | }; |
---|
| 209 | |
---|
| 210 | #undef FUNCTION |
---|
| 211 | #define FUNCTION "Functionnal_unit::operation_l_test_f" |
---|
| 212 | void operation_l_test_f (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 213 | { |
---|
| 214 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_test_f"); |
---|
| 215 | |
---|
| 216 | Tgeneral_data_t f_in = get_flag(op->_data_rc,FLAG_F); |
---|
| 217 | Tgeneral_data_t imm = unsigned(op->_immediat); |
---|
| 218 | |
---|
| 219 | // Result |
---|
[76] | 220 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 221 | //op->_data_rd = 0; |
---|
| 222 | //op->_data_re = 0; |
---|
| 223 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 224 | op->_no_sequence = f_in != 0; |
---|
| 225 | op->_address = imm; |
---|
| 226 | }; |
---|
| 227 | |
---|
| 228 | #undef FUNCTION |
---|
| 229 | #define FUNCTION "Functionnal_unit::operation_l_test_nf" |
---|
| 230 | void operation_l_test_nf (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 231 | { |
---|
| 232 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_test_nf"); |
---|
| 233 | |
---|
| 234 | Tgeneral_data_t f_in = get_flag(op->_data_rc,FLAG_F); |
---|
| 235 | Tgeneral_data_t imm = unsigned(op->_immediat); |
---|
| 236 | |
---|
| 237 | // Result |
---|
[76] | 238 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 239 | //op->_data_rd = 0; |
---|
| 240 | //op->_data_re = 0; |
---|
| 241 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 242 | op->_no_sequence = f_in == 0; |
---|
| 243 | op->_address = imm; |
---|
| 244 | }; |
---|
| 245 | |
---|
| 246 | #undef FUNCTION |
---|
| 247 | #define FUNCTION "Functionnal_unit::operation_l_jalr" |
---|
| 248 | void operation_l_jalr (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 249 | { |
---|
| 250 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_jalr"); |
---|
| 251 | // jal : has_imm = 1, write_rd = 1, read_rb = 0 |
---|
| 252 | // jalr : has_imm = 1, write_rd = 1, read_rb = 1 |
---|
| 253 | // jr : has_imm = 0, write_rd = 0, read_rb = 1 |
---|
| 254 | |
---|
| 255 | |
---|
| 256 | Tgeneral_data_t gpr = unsigned(op->_data_rb); |
---|
| 257 | Tgeneral_data_t imm = unsigned(op->_immediat); |
---|
| 258 | |
---|
| 259 | // Result |
---|
[76] | 260 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 261 | op->_data_rd = imm; |
---|
| 262 | //op->_data_re = 0; |
---|
| 263 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 264 | op->_no_sequence = 1; |
---|
| 265 | op->_address = gpr; |
---|
| 266 | }; |
---|
| 267 | |
---|
| 268 | #undef FUNCTION |
---|
| 269 | #define FUNCTION "Functionnal_unit::operation_l_extend_s" |
---|
| 270 | void operation_l_extend_s (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 271 | { |
---|
| 272 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_extend_s"); |
---|
| 273 | |
---|
| 274 | Tgeneral_data_t imm = unsigned(op->_immediat); |
---|
| 275 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 276 | Tgeneral_data_t gpr2 = extend<Tgeneral_data_t>(param->_size_data, gpr1, true , imm); |
---|
| 277 | |
---|
| 278 | // Result |
---|
[76] | 279 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 280 | op->_data_rd = gpr2; |
---|
| 281 | //op->_data_re = 0; |
---|
| 282 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 283 | op->_no_sequence = 0; |
---|
| 284 | //op->_address = 0; |
---|
| 285 | }; |
---|
| 286 | |
---|
| 287 | #undef FUNCTION |
---|
| 288 | #define FUNCTION "Functionnal_unit::operation_l_extend_z" |
---|
| 289 | void operation_l_extend_z (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 290 | { |
---|
| 291 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_extend_z"); |
---|
| 292 | |
---|
| 293 | Tgeneral_data_t imm = unsigned(op->_immediat); |
---|
| 294 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 295 | Tgeneral_data_t gpr2 = extend<Tgeneral_data_t>(param->_size_data, gpr1, false , imm); |
---|
| 296 | |
---|
| 297 | // Result |
---|
[76] | 298 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 299 | op->_data_rd = gpr2; |
---|
| 300 | //op->_data_re = 0; |
---|
| 301 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 302 | op->_no_sequence = 0; |
---|
| 303 | //op->_address = 0; |
---|
| 304 | }; |
---|
| 305 | |
---|
| 306 | #undef FUNCTION |
---|
| 307 | #define FUNCTION "Functionnal_unit::operation_l_sll" |
---|
| 308 | void operation_l_sll (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 309 | { |
---|
| 310 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sll"); |
---|
| 311 | |
---|
| 312 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 313 | Tgeneral_data_t gpr2 = param->_mask_shift & unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 314 | Tgeneral_data_t gpr3 = shift_logic_left<Tgeneral_data_t>(param->_size_data, gpr1, gpr2); |
---|
| 315 | |
---|
| 316 | // Result |
---|
[76] | 317 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 318 | op->_data_rd = gpr3; |
---|
| 319 | //op->_data_re = 0; |
---|
| 320 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 321 | op->_no_sequence = 0; |
---|
| 322 | //op->_address = 0; |
---|
| 323 | }; |
---|
| 324 | |
---|
| 325 | #undef FUNCTION |
---|
| 326 | #define FUNCTION "Functionnal_unit::operation_l_srl" |
---|
| 327 | void operation_l_srl (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 328 | { |
---|
| 329 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_srl"); |
---|
| 330 | |
---|
| 331 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 332 | Tgeneral_data_t gpr2 = param->_mask_shift & unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 333 | Tgeneral_data_t gpr3 = shift_logic_right<Tgeneral_data_t>(param->_size_data, gpr1, gpr2); |
---|
| 334 | |
---|
| 335 | // Result |
---|
[76] | 336 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 337 | op->_data_rd = gpr3; |
---|
| 338 | //op->_data_re = 0; |
---|
| 339 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 340 | op->_no_sequence = 0; |
---|
| 341 | //op->_address = 0; |
---|
| 342 | }; |
---|
| 343 | |
---|
| 344 | #undef FUNCTION |
---|
| 345 | #define FUNCTION "Functionnal_unit::operation_l_sra" |
---|
| 346 | void operation_l_sra (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 347 | { |
---|
| 348 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sra"); |
---|
| 349 | |
---|
| 350 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 351 | Tgeneral_data_t gpr2 = param->_mask_shift & unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 352 | Tgeneral_data_t gpr3 = shift_arithmetic_right<Tgeneral_data_t>(param->_size_data, gpr1, gpr2); |
---|
| 353 | |
---|
| 354 | // Result |
---|
[76] | 355 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 356 | op->_data_rd = gpr3; |
---|
| 357 | //op->_data_re = 0; |
---|
| 358 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 359 | op->_no_sequence = 0; |
---|
| 360 | //op->_address = 0; |
---|
| 361 | }; |
---|
| 362 | |
---|
| 363 | #undef FUNCTION |
---|
| 364 | #define FUNCTION "Functionnal_unit::operation_l_ror" |
---|
| 365 | void operation_l_ror (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 366 | { |
---|
| 367 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_ror"); |
---|
| 368 | |
---|
| 369 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 370 | Tgeneral_data_t gpr2 = param->_mask_shift & unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 371 | Tgeneral_data_t gpr3 = rotate_right<Tgeneral_data_t>(param->_size_data, gpr1, gpr2); |
---|
| 372 | |
---|
| 373 | // Result |
---|
[76] | 374 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 375 | op->_data_rd = gpr3; |
---|
| 376 | //op->_data_re = 0; |
---|
| 377 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 378 | op->_no_sequence = 0; |
---|
| 379 | //op->_address = 0; |
---|
| 380 | }; |
---|
| 381 | |
---|
| 382 | #undef FUNCTION |
---|
| 383 | #define FUNCTION "Functionnal_unit::operation_l_ff1" |
---|
| 384 | void operation_l_ff1 (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 385 | { |
---|
| 386 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_ff1"); |
---|
| 387 | |
---|
| 388 | Tgeneral_data_t gpr = unsigned(op->_data_ra); |
---|
| 389 | Tgeneral_data_t index; |
---|
| 390 | |
---|
| 391 | for (index=0; (index<param->_size_data) and (((gpr>>index)&1)!= 1); index++); |
---|
| 392 | |
---|
| 393 | // Result |
---|
[76] | 394 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 395 | op->_data_rd = (index==param->_size_data)?0:(index+1); |
---|
| 396 | //op->_data_re = 0; |
---|
| 397 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 398 | op->_no_sequence = 0; |
---|
| 399 | //op->_address = 0; |
---|
| 400 | }; |
---|
| 401 | |
---|
| 402 | #undef FUNCTION |
---|
| 403 | #define FUNCTION "Functionnal_unit::operation_l_fl1" |
---|
| 404 | void operation_l_fl1 (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 405 | { |
---|
| 406 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_fl1"); |
---|
| 407 | |
---|
| 408 | Tgeneral_data_t gpr = unsigned(op->_data_ra); |
---|
| 409 | Tgeneral_data_t index; |
---|
| 410 | |
---|
| 411 | for (index=param->_size_data; (index>0) and (((gpr>>(index-1))&1)!= 1); index--); |
---|
| 412 | |
---|
| 413 | // Result |
---|
[76] | 414 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 415 | op->_data_rd = index; |
---|
| 416 | //op->_data_re = 0; |
---|
| 417 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 418 | op->_no_sequence = 0; |
---|
| 419 | //op->_address = 0; |
---|
| 420 | }; |
---|
| 421 | |
---|
| 422 | #undef FUNCTION |
---|
| 423 | #define FUNCTION "Functionnal_unit::operation_l_sfeq" |
---|
| 424 | void operation_l_sfeq (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 425 | { |
---|
| 426 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sfeq"); |
---|
| 427 | |
---|
| 428 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 429 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 430 | |
---|
| 431 | bool f_out = (gpr1 == gpr2); |
---|
| 432 | |
---|
| 433 | // Result |
---|
[76] | 434 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 435 | //op->_data_rd = 0; |
---|
| 436 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 437 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 438 | op->_no_sequence = 0; |
---|
| 439 | //op->_address = 0; |
---|
| 440 | }; |
---|
| 441 | |
---|
| 442 | #undef FUNCTION |
---|
| 443 | #define FUNCTION "Functionnal_unit::operation_l_sfne" |
---|
| 444 | void operation_l_sfne (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 445 | { |
---|
| 446 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sfne"); |
---|
| 447 | |
---|
| 448 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 449 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 450 | |
---|
| 451 | bool f_out = (gpr1 != gpr2); |
---|
| 452 | |
---|
| 453 | // Result |
---|
[76] | 454 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 455 | //op->_data_rd = 0; |
---|
| 456 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 457 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 458 | op->_no_sequence = 0; |
---|
| 459 | //op->_address = 0; |
---|
| 460 | }; |
---|
| 461 | |
---|
| 462 | #undef FUNCTION |
---|
| 463 | #define FUNCTION "Functionnal_unit::operation_l_sfgeu" |
---|
| 464 | void operation_l_sfgeu (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 465 | { |
---|
| 466 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sfgeu"); |
---|
| 467 | |
---|
| 468 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 469 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 470 | |
---|
| 471 | bool f_out = (gpr1 >= gpr2); |
---|
| 472 | |
---|
| 473 | // Result |
---|
[76] | 474 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 475 | //op->_data_rd = 0; |
---|
| 476 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 477 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 478 | op->_no_sequence = 0; |
---|
| 479 | //op->_address = 0; |
---|
| 480 | }; |
---|
| 481 | |
---|
| 482 | #undef FUNCTION |
---|
| 483 | #define FUNCTION "Functionnal_unit::operation_l_sfgtu" |
---|
| 484 | void operation_l_sfgtu (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 485 | { |
---|
| 486 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sfgtu"); |
---|
| 487 | |
---|
| 488 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 489 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 490 | |
---|
| 491 | bool f_out = (gpr1 > gpr2); |
---|
| 492 | |
---|
| 493 | // Result |
---|
[76] | 494 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 495 | //op->_data_rd = 0; |
---|
| 496 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 497 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 498 | op->_no_sequence = 0; |
---|
| 499 | //op->_address = 0; |
---|
| 500 | }; |
---|
| 501 | |
---|
| 502 | #undef FUNCTION |
---|
| 503 | #define FUNCTION "Functionnal_unit::operation_l_sfleu" |
---|
| 504 | void operation_l_sfleu (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 505 | { |
---|
| 506 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sfleu"); |
---|
| 507 | |
---|
| 508 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 509 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 510 | |
---|
| 511 | bool f_out = (gpr1 <= gpr2); |
---|
| 512 | |
---|
| 513 | // Result |
---|
[76] | 514 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 515 | //op->_data_rd = 0; |
---|
| 516 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 517 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 518 | op->_no_sequence = 0; |
---|
| 519 | //op->_address = 0; |
---|
| 520 | }; |
---|
| 521 | |
---|
| 522 | #undef FUNCTION |
---|
| 523 | #define FUNCTION "Functionnal_unit::operation_l_sfltu" |
---|
| 524 | void operation_l_sfltu (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 525 | { |
---|
| 526 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sfltu"); |
---|
| 527 | |
---|
| 528 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 529 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 530 | |
---|
| 531 | bool f_out = (gpr1 < gpr2); |
---|
| 532 | |
---|
| 533 | // Result |
---|
[76] | 534 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 535 | //op->_data_rd = 0; |
---|
| 536 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 537 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 538 | op->_no_sequence = 0; |
---|
| 539 | //op->_address = 0; |
---|
| 540 | }; |
---|
| 541 | |
---|
| 542 | #undef FUNCTION |
---|
| 543 | #define FUNCTION "Functionnal_unit::operation_l_sfges" |
---|
| 544 | void operation_l_sfges (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 545 | { |
---|
| 546 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sfges"); |
---|
| 547 | |
---|
| 548 | Tgeneral_data_t gpr1 = op->_data_ra; |
---|
| 549 | Tgeneral_data_t gpr2 = (op->_has_immediat==1)?op->_immediat:op->_data_rb; |
---|
| 550 | |
---|
| 551 | log_printf(TRACE,Functionnal_unit,FUNCTION," * data_ra : %.8x",unsigned(op->_data_ra)); |
---|
| 552 | log_printf(TRACE,Functionnal_unit,FUNCTION," * data_ras : %.8x", signed(op->_data_ra)); |
---|
| 553 | log_printf(TRACE,Functionnal_unit,FUNCTION," * data_rb : %.8x",unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb)); |
---|
| 554 | log_printf(TRACE,Functionnal_unit,FUNCTION," * data_rbs : %.8x", signed((op->_has_immediat==1)?op->_immediat:op->_data_rb)); |
---|
| 555 | |
---|
| 556 | bool f_out; |
---|
| 557 | |
---|
| 558 | switch (concatenation_bool(sign(gpr1),sign(gpr2))) |
---|
| 559 | { |
---|
| 560 | case 1 /*b01*/ : f_out = 1 ; break; |
---|
| 561 | case 2 /*b10*/ : f_out = 0 ; break; |
---|
| 562 | default : f_out = signed(gpr1) >= signed(gpr2); break; |
---|
| 563 | } |
---|
| 564 | |
---|
| 565 | log_printf(TRACE,Functionnal_unit,FUNCTION," * f_out : %.8x",f_out); |
---|
| 566 | |
---|
| 567 | // Result |
---|
[76] | 568 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 569 | //op->_data_rd = 0; |
---|
| 570 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 571 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 572 | op->_no_sequence = 0; |
---|
| 573 | //op->_address = 0; |
---|
| 574 | }; |
---|
| 575 | |
---|
| 576 | #undef FUNCTION |
---|
| 577 | #define FUNCTION "Functionnal_unit::operation_l_sfgts" |
---|
| 578 | void operation_l_sfgts (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 579 | { |
---|
| 580 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sfgts"); |
---|
| 581 | |
---|
| 582 | Tgeneral_data_t gpr1 = op->_data_ra ; |
---|
| 583 | Tgeneral_data_t gpr2 = (op->_has_immediat==1)?op->_immediat:op->_data_rb ; |
---|
| 584 | |
---|
| 585 | bool f_out; |
---|
| 586 | |
---|
| 587 | switch (concatenation_bool(sign(gpr1),sign(gpr2))) |
---|
| 588 | { |
---|
| 589 | case 1 /*b01*/ : f_out = 1; break; |
---|
| 590 | case 2 /*b10*/ : f_out = 0; break; |
---|
| 591 | default : f_out = signed(gpr1) > signed(gpr2); break; |
---|
| 592 | } |
---|
| 593 | |
---|
| 594 | // Result |
---|
[76] | 595 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 596 | //op->_data_rd = 0; |
---|
| 597 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 598 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 599 | op->_no_sequence = 0; |
---|
| 600 | //op->_address = 0; |
---|
| 601 | }; |
---|
| 602 | |
---|
| 603 | #undef FUNCTION |
---|
| 604 | #define FUNCTION "Functionnal_unit::operation_l_sfles" |
---|
| 605 | void operation_l_sfles (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 606 | { |
---|
| 607 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sfles"); |
---|
| 608 | |
---|
| 609 | Tgeneral_data_t gpr1 = op->_data_ra ; |
---|
| 610 | Tgeneral_data_t gpr2 = (op->_has_immediat==1)?op->_immediat:op->_data_rb ; |
---|
| 611 | |
---|
| 612 | bool f_out; |
---|
| 613 | |
---|
| 614 | switch (concatenation_bool(sign(gpr1),sign(gpr2))) |
---|
| 615 | { |
---|
| 616 | case 1 /*b01*/ : f_out = 0; break; |
---|
| 617 | case 2 /*b10*/ : f_out = 1; break; |
---|
| 618 | default : f_out = signed(gpr1) <= signed(gpr2); break; |
---|
| 619 | } |
---|
| 620 | |
---|
| 621 | // Result |
---|
[76] | 622 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 623 | //op->_data_rd = 0; |
---|
| 624 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 625 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 626 | op->_no_sequence = 0; |
---|
| 627 | //op->_address = 0; |
---|
| 628 | }; |
---|
| 629 | |
---|
| 630 | #undef FUNCTION |
---|
| 631 | #define FUNCTION "Functionnal_unit::operation_l_sflts" |
---|
| 632 | void operation_l_sflts (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 633 | { |
---|
| 634 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_sflts"); |
---|
| 635 | |
---|
| 636 | Tgeneral_data_t gpr1 = op->_data_ra ; |
---|
| 637 | Tgeneral_data_t gpr2 = (op->_has_immediat==1)?op->_immediat:op->_data_rb; |
---|
| 638 | |
---|
| 639 | bool f_out; |
---|
| 640 | |
---|
| 641 | switch (concatenation_bool(sign(gpr1),sign(gpr2))) |
---|
| 642 | { |
---|
| 643 | case 1 /*b01*/ : f_out = 0; break; |
---|
| 644 | case 2 /*b10*/ : f_out = 1; break; |
---|
| 645 | default : f_out = signed(gpr1) < signed(gpr2); break; |
---|
| 646 | } |
---|
| 647 | |
---|
| 648 | // Result |
---|
[76] | 649 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 650 | //op->_data_rd = 0; |
---|
| 651 | op->_data_re = set_flag(op->_data_re,FLAG_F,f_out); |
---|
| 652 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 653 | op->_no_sequence = 0; |
---|
| 654 | //op->_address = 0; |
---|
| 655 | }; |
---|
| 656 | |
---|
| 657 | #undef FUNCTION |
---|
| 658 | #define FUNCTION "Functionnal_unit::operation_l_mtspr" |
---|
| 659 | void operation_l_mtspr (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 660 | { |
---|
| 661 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_mtspr"); |
---|
| 662 | |
---|
| 663 | Tgeneral_data_t imm = unsigned(op->_immediat); |
---|
| 664 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 665 | Tgeneral_data_t gpr2 = unsigned(op->_data_rb); |
---|
| 666 | Tgeneral_data_t addr = range<Tgeneral_data_t>(gpr1|imm,16); |
---|
| 667 | |
---|
| 668 | Texception_t exception; |
---|
| 669 | |
---|
| 670 | // HACK : use the field num_reg_re to pass the SM and SUMRA flag. |
---|
| 671 | Tcontrol_t flag_SM = get_flag(op->_num_reg_re, 0x1); |
---|
| 672 | Tcontrol_t flag_SUMRA = get_flag(op->_num_reg_re, 0x2); |
---|
| 673 | |
---|
| 674 | spr_address_t spr_addr = reg->_spr_access_mode->translate_address(addr); |
---|
| 675 | |
---|
| 676 | // Test if this group is implemented in this functionnal_unit |
---|
| 677 | if (reg->_spr_access_mode->valid(spr_addr)) |
---|
| 678 | { |
---|
| 679 | if (reg->_spr_access_mode->write(spr_addr, flag_SM, flag_SUMRA)) |
---|
| 680 | { |
---|
| 681 | reg->_i_write_spr = true; |
---|
| 682 | reg->_access_num_group = spr_addr._group; |
---|
| 683 | reg->_access_num_register = spr_addr._register; |
---|
| 684 | reg->_spr_old = reg->_spr[spr_addr._group][spr_addr._register]; |
---|
| 685 | reg->_spr[spr_addr._group][spr_addr._register] = gpr2; |
---|
| 686 | |
---|
| 687 | exception = EXCEPTION_ALU_NONE; |
---|
| 688 | } |
---|
| 689 | else |
---|
| 690 | { |
---|
| 691 | exception = EXCEPTION_ALU_SPR_ACCESS_INVALID; |
---|
| 692 | } |
---|
| 693 | } |
---|
| 694 | else |
---|
| 695 | { |
---|
| 696 | exception = EXCEPTION_ALU_SPR_ACCESS_NOT_COMPLETE; |
---|
| 697 | } |
---|
| 698 | |
---|
| 699 | // Result |
---|
[76] | 700 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 701 | op->_data_rd = gpr2; // data_rb |
---|
| 702 | //op->_data_re = 0; |
---|
| 703 | op->_exception = exception; |
---|
| 704 | op->_no_sequence = 0; |
---|
| 705 | op->_address = addr; // data_ra or imm |
---|
| 706 | }; |
---|
| 707 | |
---|
| 708 | #undef FUNCTION |
---|
| 709 | #define FUNCTION "Functionnal_unit::operation_l_mfspr" |
---|
| 710 | void operation_l_mfspr (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 711 | { |
---|
| 712 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_mfspr"); |
---|
| 713 | |
---|
| 714 | Tgeneral_data_t imm = unsigned(op->_immediat); |
---|
| 715 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 716 | Tgeneral_data_t gpr2 = 0; |
---|
| 717 | Tgeneral_data_t addr = range<Tgeneral_data_t>(gpr1|imm,16); |
---|
| 718 | |
---|
| 719 | Texception_t exception; |
---|
| 720 | |
---|
| 721 | // HACK : use the field num_reg_re to pass the SM and SUMRA flag. |
---|
| 722 | Tcontrol_t flag_SM = get_flag(op->_num_reg_re, 0x1); |
---|
| 723 | Tcontrol_t flag_SUMRA = get_flag(op->_num_reg_re, 0x2); |
---|
| 724 | |
---|
| 725 | spr_address_t spr_addr = reg->_spr_access_mode->translate_address(addr); |
---|
| 726 | |
---|
| 727 | // Test if this group is implemented in this functionnal_unit |
---|
| 728 | if (reg->_spr_access_mode->valid(spr_addr)) |
---|
| 729 | { |
---|
| 730 | if (reg->_spr_access_mode->read(spr_addr, flag_SM, flag_SUMRA)) |
---|
| 731 | { |
---|
| 732 | reg->_i_read_spr = true; |
---|
| 733 | reg->_access_num_group = spr_addr._group; |
---|
| 734 | reg->_access_num_register = spr_addr._register; |
---|
| 735 | |
---|
| 736 | gpr2 = reg->_spr[spr_addr._group][spr_addr._register]; |
---|
| 737 | |
---|
| 738 | exception = EXCEPTION_ALU_NONE; |
---|
| 739 | } |
---|
| 740 | else |
---|
| 741 | { |
---|
| 742 | exception = EXCEPTION_ALU_SPR_ACCESS_INVALID; |
---|
| 743 | } |
---|
| 744 | } |
---|
| 745 | else |
---|
| 746 | { |
---|
| 747 | exception = EXCEPTION_ALU_SPR_ACCESS_NOT_COMPLETE; |
---|
| 748 | } |
---|
| 749 | |
---|
| 750 | // Result |
---|
[76] | 751 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 752 | op->_write_rd = (exception == EXCEPTION_ALU_NONE); |
---|
| 753 | op->_data_rd = gpr2; // spr |
---|
| 754 | //op->_data_re = 0; |
---|
| 755 | op->_exception = exception; |
---|
| 756 | op->_no_sequence = 0; |
---|
| 757 | op->_address = addr; // data_ra or imm |
---|
| 758 | }; |
---|
| 759 | |
---|
| 760 | #undef FUNCTION |
---|
| 761 | #define FUNCTION "Functionnal_unit::operation_l_macrc" |
---|
| 762 | void operation_l_macrc (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 763 | { |
---|
| 764 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_macrc"); |
---|
| 765 | |
---|
| 766 | Tgeneral_data_t gpr = static_cast<Tgeneral_data_t>(range<uint64_t>((static_cast<uint64_t>(reg->_spr[GROUP_MAC][SPR_MACHI]) << 32) | static_cast<uint64_t>(reg->_spr[GROUP_MAC][SPR_MACLO]), param->_size_data)); |
---|
| 767 | |
---|
| 768 | reg->_spr[GROUP_MAC][SPR_MACLO] = 0; |
---|
| 769 | reg->_spr[GROUP_MAC][SPR_MACHI] = 0; |
---|
| 770 | |
---|
| 771 | // Result |
---|
[76] | 772 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 773 | op->_data_rd = gpr; |
---|
| 774 | //op->_data_re = 0; |
---|
| 775 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 776 | op->_no_sequence = 0; |
---|
| 777 | //op->_address = 0; |
---|
| 778 | }; |
---|
| 779 | |
---|
| 780 | #undef FUNCTION |
---|
| 781 | #define FUNCTION "Functionnal_unit::operation_l_mac" |
---|
| 782 | void operation_l_mac (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 783 | { |
---|
| 784 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_mac"); |
---|
| 785 | |
---|
| 786 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 787 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 788 | uint64_t temp = range<uint64_t>(gpr1 * gpr2, 32); |
---|
| 789 | |
---|
| 790 | temp = ((static_cast<uint64_t>(reg->_spr[GROUP_MAC][SPR_MACHI]) << 32) | static_cast<uint64_t>(reg->_spr[GROUP_MAC][SPR_MACLO])) + temp; |
---|
| 791 | |
---|
| 792 | reg->_spr[GROUP_MAC][SPR_MACLO] = range<Tgeneral_data_t>(temp ,32); |
---|
| 793 | reg->_spr[GROUP_MAC][SPR_MACHI] = range<Tgeneral_data_t>(temp>>32,32); |
---|
| 794 | |
---|
| 795 | // Result |
---|
[76] | 796 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 797 | //op->_data_rd = 0; |
---|
| 798 | //op->_data_re = 0; |
---|
| 799 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 800 | op->_no_sequence = 0; |
---|
| 801 | //op->_address = 0; |
---|
| 802 | }; |
---|
| 803 | |
---|
| 804 | #undef FUNCTION |
---|
| 805 | #define FUNCTION "Functionnal_unit::operation_l_msb" |
---|
| 806 | void operation_l_msb (execute_operation_t * op, execute_register_t * reg, execute_param_t * param) |
---|
| 807 | { |
---|
| 808 | log_printf(TRACE,Functionnal_unit,FUNCTION,"Operation : l_msb"); |
---|
| 809 | |
---|
| 810 | Tgeneral_data_t gpr1 = unsigned(op->_data_ra); |
---|
| 811 | Tgeneral_data_t gpr2 = unsigned((op->_has_immediat==1)?op->_immediat:op->_data_rb); |
---|
| 812 | uint64_t temp = range<uint64_t>(gpr1 * gpr2, 32); |
---|
| 813 | |
---|
| 814 | temp = ((static_cast<uint64_t>(reg->_spr[GROUP_MAC][SPR_MACHI]) << 32) | static_cast<uint64_t>(reg->_spr[GROUP_MAC][SPR_MACLO])) - temp; |
---|
| 815 | |
---|
| 816 | reg->_spr[GROUP_MAC][SPR_MACLO] = range<Tgeneral_data_t>(temp ,32); |
---|
| 817 | reg->_spr[GROUP_MAC][SPR_MACHI] = range<Tgeneral_data_t>(temp>>32,32); |
---|
| 818 | |
---|
| 819 | // Result |
---|
[76] | 820 | op->_timing = param->_timing[op->_type][op->_operation]; |
---|
[72] | 821 | //op->_data_rd = 0; |
---|
| 822 | //op->_data_re = 0; |
---|
| 823 | op->_exception = EXCEPTION_ALU_NONE; |
---|
| 824 | op->_no_sequence = 0; |
---|
| 825 | //op->_address = 0; |
---|
| 826 | }; |
---|
| 827 | |
---|
| 828 | }; // end namespace functionnal_unit |
---|
| 829 | }; // end namespace execute_unit |
---|
| 830 | }; // end namespace multi_execute_unit |
---|
| 831 | }; // end namespace execute_loop |
---|
| 832 | }; // end namespace multi_execute_loop |
---|
| 833 | }; // end namespace core |
---|
| 834 | }; // end namespace behavioural |
---|
| 835 | }; // end namespace morpheo |
---|
| 836 | #endif |
---|