1 /* frv simulator fr550 dependent profiling code.
3 Copyright (C) 2003 Free Software Foundation, Inc.
6 This file is part of the GNU simulators.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #define WANT_CPU_FRVBF
29 #if WITH_PROFILE_MODEL_P
32 #include "profile-fr550.h"
34 /* Initialize cycle counting for an insn.
35 FIRST_P is non-zero if this is the first insn in a set of parallel
38 fr550_model_insn_before (SIM_CPU
*cpu
, int first_p
)
42 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
43 d
->cur_fr_load
= d
->prev_fr_load
;
44 d
->cur_fr_complex_1
= d
->prev_fr_complex_1
;
45 d
->cur_fr_complex_2
= d
->prev_fr_complex_2
;
46 d
->cur_ccr_complex
= d
->prev_ccr_complex
;
47 d
->cur_acc_mmac
= d
->prev_acc_mmac
;
51 /* Record the cycles computed for an insn.
52 LAST_P is non-zero if this is the last insn in a set of parallel insns,
53 and we update the total cycle count.
54 CYCLES is the cycle count of the insn. */
56 fr550_model_insn_after (SIM_CPU
*cpu
, int last_p
, int cycles
)
60 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
61 d
->prev_fr_load
= d
->cur_fr_load
;
62 d
->prev_fr_complex_1
= d
->cur_fr_complex_1
;
63 d
->prev_fr_complex_2
= d
->cur_fr_complex_2
;
64 d
->prev_ccr_complex
= d
->cur_ccr_complex
;
65 d
->prev_acc_mmac
= d
->cur_acc_mmac
;
69 static void fr550_reset_fr_flags (SIM_CPU
*cpu
, INT fr
);
70 static void fr550_reset_ccr_flags (SIM_CPU
*cpu
, INT ccr
);
71 static void fr550_reset_acc_flags (SIM_CPU
*cpu
, INT acc
);
74 set_use_is_fr_load (SIM_CPU
*cpu
, INT fr
)
76 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
77 fr550_reset_fr_flags (cpu
, (fr
));
78 d
->cur_fr_load
|= (((DI
)1) << (fr
));
82 set_use_not_fr_load (SIM_CPU
*cpu
, INT fr
)
84 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
85 d
->cur_fr_load
&= ~(((DI
)1) << (fr
));
89 use_is_fr_load (SIM_CPU
*cpu
, INT fr
)
91 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
92 return d
->prev_fr_load
& (((DI
)1) << (fr
));
96 set_use_is_fr_complex_1 (SIM_CPU
*cpu
, INT fr
)
98 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
99 fr550_reset_fr_flags (cpu
, (fr
));
100 d
->cur_fr_complex_1
|= (((DI
)1) << (fr
));
104 set_use_not_fr_complex_1 (SIM_CPU
*cpu
, INT fr
)
106 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
107 d
->cur_fr_complex_1
&= ~(((DI
)1) << (fr
));
111 use_is_fr_complex_1 (SIM_CPU
*cpu
, INT fr
)
113 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
114 return d
->prev_fr_complex_1
& (((DI
)1) << (fr
));
118 set_use_is_fr_complex_2 (SIM_CPU
*cpu
, INT fr
)
120 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
121 fr550_reset_fr_flags (cpu
, (fr
));
122 d
->cur_fr_complex_2
|= (((DI
)1) << (fr
));
126 set_use_not_fr_complex_2 (SIM_CPU
*cpu
, INT fr
)
128 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
129 d
->cur_fr_complex_2
&= ~(((DI
)1) << (fr
));
133 use_is_fr_complex_2 (SIM_CPU
*cpu
, INT fr
)
135 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
136 return d
->prev_fr_complex_2
& (((DI
)1) << (fr
));
140 set_use_is_ccr_complex (SIM_CPU
*cpu
, INT ccr
)
142 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
143 fr550_reset_ccr_flags (cpu
, (ccr
));
144 d
->cur_ccr_complex
|= (((SI
)1) << (ccr
));
148 set_use_not_ccr_complex (SIM_CPU
*cpu
, INT ccr
)
150 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
151 d
->cur_ccr_complex
&= ~(((SI
)1) << (ccr
));
155 use_is_ccr_complex (SIM_CPU
*cpu
, INT ccr
)
157 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
158 return d
->prev_ccr_complex
& (((SI
)1) << (ccr
));
162 set_use_is_acc_mmac (SIM_CPU
*cpu
, INT acc
)
164 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
165 fr550_reset_acc_flags (cpu
, (acc
));
166 d
->cur_acc_mmac
|= (((DI
)1) << (acc
));
170 set_use_not_acc_mmac (SIM_CPU
*cpu
, INT acc
)
172 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
173 d
->cur_acc_mmac
&= ~(((DI
)1) << (acc
));
177 use_is_acc_mmac (SIM_CPU
*cpu
, INT acc
)
179 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
180 return d
->prev_acc_mmac
& (((DI
)1) << (acc
));
184 fr550_reset_fr_flags (SIM_CPU
*cpu
, INT fr
)
186 set_use_not_fr_load (cpu
, fr
);
187 set_use_not_fr_complex_1 (cpu
, fr
);
188 set_use_not_fr_complex_2 (cpu
, fr
);
192 fr550_reset_ccr_flags (SIM_CPU
*cpu
, INT ccr
)
194 set_use_not_ccr_complex (cpu
, ccr
);
198 fr550_reset_acc_flags (SIM_CPU
*cpu
, INT acc
)
200 set_use_not_acc_mmac (cpu
, acc
);
203 /* Detect overlap between two register ranges. Works if one of the registers
204 is -1 with width 1 (i.e. undefined), but not both. */
205 #define REG_OVERLAP(r1, w1, r2, w2) ( \
206 (r1) + (w1) - 1 >= (r2) && (r2) + (w2) - 1 >= (r1) \
209 /* Latency of floating point registers may be less than recorded when followed
210 by another floating point insn. */
212 adjust_float_register_busy (SIM_CPU
*cpu
,
213 INT in_FRi
, int iwidth
,
214 INT in_FRj
, int jwidth
,
215 INT out_FRk
, int kwidth
)
218 /* The latency of FRk may be less than previously recorded.
219 See Table 14-15 in the LSI. */
222 for (i
= 0; i
< iwidth
; ++i
)
224 if (! REG_OVERLAP (in_FRi
+ i
, 1, out_FRk
, kwidth
))
225 if (use_is_fr_load (cpu
, in_FRi
+ i
))
226 decrease_FR_busy (cpu
, in_FRi
+ i
, 1);
228 enforce_full_fr_latency (cpu
, in_FRi
+ i
);
234 for (i
= 0; i
< jwidth
; ++i
)
236 if (! REG_OVERLAP (in_FRj
+ i
, 1, in_FRi
, iwidth
)
237 && ! REG_OVERLAP (in_FRj
+ i
, 1, out_FRk
, kwidth
))
238 if (use_is_fr_load (cpu
, in_FRj
+ i
))
239 decrease_FR_busy (cpu
, in_FRj
+ i
, 1);
241 enforce_full_fr_latency (cpu
, in_FRj
+ i
);
247 for (i
= 0; i
< kwidth
; ++i
)
249 if (! REG_OVERLAP (out_FRk
+ i
, 1, in_FRi
, iwidth
)
250 && ! REG_OVERLAP (out_FRk
+ i
, 1, in_FRj
, jwidth
))
252 if (use_is_fr_complex_1 (cpu
, out_FRk
+ i
))
253 decrease_FR_busy (cpu
, out_FRk
+ i
, 1);
254 else if (use_is_fr_complex_2 (cpu
, out_FRk
+ i
))
255 decrease_FR_busy (cpu
, out_FRk
+ i
, 2);
257 enforce_full_fr_latency (cpu
, out_FRk
+ i
);
264 restore_float_register_busy (SIM_CPU
*cpu
,
265 INT in_FRi
, int iwidth
,
266 INT in_FRj
, int jwidth
,
267 INT out_FRk
, int kwidth
)
270 /* The latency of FRk may be less than previously recorded.
271 See Table 14-15 in the LSI. */
274 for (i
= 0; i
< iwidth
; ++i
)
276 if (! REG_OVERLAP (in_FRi
+ i
, 1, out_FRk
, kwidth
))
277 if (use_is_fr_load (cpu
, in_FRi
+ i
))
278 increase_FR_busy (cpu
, in_FRi
+ i
, 1);
284 for (i
= 0; i
< jwidth
; ++i
)
286 if (! REG_OVERLAP (in_FRj
+ i
, 1, in_FRi
, iwidth
)
287 && ! REG_OVERLAP (in_FRj
+ i
, 1, out_FRk
, kwidth
))
288 if (use_is_fr_load (cpu
, in_FRj
+ i
))
289 increase_FR_busy (cpu
, in_FRj
+ i
, 1);
295 for (i
= 0; i
< kwidth
; ++i
)
297 if (! REG_OVERLAP (out_FRk
+ i
, 1, in_FRi
, iwidth
)
298 && ! REG_OVERLAP (out_FRk
+ i
, 1, in_FRj
, jwidth
))
300 if (use_is_fr_complex_1 (cpu
, out_FRk
+ i
))
301 increase_FR_busy (cpu
, out_FRk
+ i
, 1);
302 else if (use_is_fr_complex_2 (cpu
, out_FRk
+ i
))
303 increase_FR_busy (cpu
, out_FRk
+ i
, 2);
309 /* Latency of floating point registers may be less than recorded when used in a
310 media insns and followed by another media insn. */
312 adjust_float_register_busy_for_media (SIM_CPU
*cpu
,
313 INT in_FRi
, int iwidth
,
314 INT in_FRj
, int jwidth
,
315 INT out_FRk
, int kwidth
)
318 /* The latency of FRk may be less than previously recorded.
319 See Table 14-15 in the LSI. */
322 for (i
= 0; i
< kwidth
; ++i
)
324 if (! REG_OVERLAP (out_FRk
+ i
, 1, in_FRi
, iwidth
)
325 && ! REG_OVERLAP (out_FRk
+ i
, 1, in_FRj
, jwidth
))
327 if (use_is_fr_complex_1 (cpu
, out_FRk
+ i
))
328 decrease_FR_busy (cpu
, out_FRk
+ i
, 1);
330 enforce_full_fr_latency (cpu
, out_FRk
+ i
);
337 restore_float_register_busy_for_media (SIM_CPU
*cpu
,
338 INT in_FRi
, int iwidth
,
339 INT in_FRj
, int jwidth
,
340 INT out_FRk
, int kwidth
)
345 for (i
= 0; i
< kwidth
; ++i
)
347 if (! REG_OVERLAP (out_FRk
+ i
, 1, in_FRi
, iwidth
)
348 && ! REG_OVERLAP (out_FRk
+ i
, 1, in_FRj
, jwidth
))
350 if (use_is_fr_complex_1 (cpu
, out_FRk
+ i
))
351 increase_FR_busy (cpu
, out_FRk
+ i
, 1);
357 /* Latency of accumulator registers may be less than recorded when used in a
358 media insns and followed by another media insn. */
360 adjust_acc_busy_for_mmac (SIM_CPU
*cpu
,
361 INT in_ACC
, int inwidth
,
362 INT out_ACC
, int outwidth
)
365 /* The latency of an accumulator may be less than previously recorded.
366 See Table 14-15 in the LSI. */
369 for (i
= 0; i
< inwidth
; ++i
)
371 if (use_is_acc_mmac (cpu
, in_ACC
+ i
))
372 decrease_ACC_busy (cpu
, in_ACC
+ i
, 1);
374 enforce_full_acc_latency (cpu
, in_ACC
+ i
);
379 for (i
= 0; i
< outwidth
; ++i
)
381 if (! REG_OVERLAP (out_ACC
+ i
, 1, in_ACC
, inwidth
))
383 if (use_is_acc_mmac (cpu
, out_ACC
+ i
))
384 decrease_ACC_busy (cpu
, out_ACC
+ i
, 1);
386 enforce_full_acc_latency (cpu
, out_ACC
+ i
);
393 restore_acc_busy_for_mmac (SIM_CPU
*cpu
,
394 INT in_ACC
, int inwidth
,
395 INT out_ACC
, int outwidth
)
400 for (i
= 0; i
< inwidth
; ++i
)
402 if (use_is_acc_mmac (cpu
, in_ACC
+ i
))
403 increase_ACC_busy (cpu
, in_ACC
+ i
, 1);
408 for (i
= 0; i
< outwidth
; ++i
)
410 if (! REG_OVERLAP (out_ACC
+ i
, 1, in_ACC
, inwidth
))
412 if (use_is_acc_mmac (cpu
, out_ACC
+ i
))
413 increase_ACC_busy (cpu
, out_ACC
+ i
, 1);
420 frvbf_model_fr550_u_exec (SIM_CPU
*cpu
, const IDESC
*idesc
,
421 int unit_num
, int referenced
)
423 return idesc
->timing
->units
[unit_num
].done
;
427 frvbf_model_fr550_u_integer (SIM_CPU
*cpu
, const IDESC
*idesc
,
428 int unit_num
, int referenced
,
429 INT in_GRi
, INT in_GRj
, INT out_GRk
,
434 /* icc0-icc4 are the upper 4 fields of the CCR. */
438 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
440 /* The entire VLIW insn must wait if there is a dependency on a register
441 which is not ready yet. */
442 vliw_wait_for_GR (cpu
, in_GRi
);
443 vliw_wait_for_GR (cpu
, in_GRj
);
444 vliw_wait_for_GR (cpu
, out_GRk
);
445 vliw_wait_for_CCR (cpu
, out_ICCi_1
);
446 handle_resource_wait (cpu
);
447 load_wait_for_GR (cpu
, in_GRi
);
448 load_wait_for_GR (cpu
, in_GRj
);
449 load_wait_for_GR (cpu
, out_GRk
);
450 trace_vliw_wait_cycles (cpu
);
454 fr550_reset_ccr_flags (cpu
, out_ICCi_1
);
456 /* GRk is available immediately to the next VLIW insn as is ICCi_1. */
457 cycles
= idesc
->timing
->units
[unit_num
].done
;
462 frvbf_model_fr550_u_imul (SIM_CPU
*cpu
, const IDESC
*idesc
,
463 int unit_num
, int referenced
,
464 INT in_GRi
, INT in_GRj
, INT out_GRk
, INT out_ICCi_1
)
467 /* icc0-icc4 are the upper 4 fields of the CCR. */
471 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
473 /* The entire VLIW insn must wait if there is a dependency on a register
474 which is not ready yet. */
475 vliw_wait_for_GR (cpu
, in_GRi
);
476 vliw_wait_for_GR (cpu
, in_GRj
);
477 vliw_wait_for_GRdouble (cpu
, out_GRk
);
478 vliw_wait_for_CCR (cpu
, out_ICCi_1
);
479 handle_resource_wait (cpu
);
480 load_wait_for_GR (cpu
, in_GRi
);
481 load_wait_for_GR (cpu
, in_GRj
);
482 load_wait_for_GRdouble (cpu
, out_GRk
);
483 trace_vliw_wait_cycles (cpu
);
487 /* GRk has a latency of 1 cycles. */
488 cycles
= idesc
->timing
->units
[unit_num
].done
;
489 update_GRdouble_latency (cpu
, out_GRk
, cycles
+ 1);
491 /* ICCi_1 has a latency of 1 cycle. */
492 update_CCR_latency (cpu
, out_ICCi_1
, cycles
+ 1);
494 fr550_reset_ccr_flags (cpu
, out_ICCi_1
);
500 frvbf_model_fr550_u_idiv (SIM_CPU
*cpu
, const IDESC
*idesc
,
501 int unit_num
, int referenced
,
502 INT in_GRi
, INT in_GRj
, INT out_GRk
, INT out_ICCi_1
)
508 /* icc0-icc4 are the upper 4 fields of the CCR. */
512 vliw
= CPU_VLIW (cpu
);
513 slot
= vliw
->next_slot
- 1;
514 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_I0
;
516 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
518 /* The entire VLIW insn must wait if there is a dependency on a register
519 which is not ready yet. */
520 vliw_wait_for_GR (cpu
, in_GRi
);
521 vliw_wait_for_GR (cpu
, in_GRj
);
522 vliw_wait_for_GR (cpu
, out_GRk
);
523 vliw_wait_for_CCR (cpu
, out_ICCi_1
);
524 vliw_wait_for_idiv_resource (cpu
, slot
);
525 handle_resource_wait (cpu
);
526 load_wait_for_GR (cpu
, in_GRi
);
527 load_wait_for_GR (cpu
, in_GRj
);
528 load_wait_for_GR (cpu
, out_GRk
);
529 trace_vliw_wait_cycles (cpu
);
533 /* GRk has a latency of 18 cycles! */
534 cycles
= idesc
->timing
->units
[unit_num
].done
;
535 update_GR_latency (cpu
, out_GRk
, cycles
+ 18);
537 /* ICCi_1 has a latency of 18 cycles. */
538 update_CCR_latency (cpu
, out_ICCi_1
, cycles
+ 18);
540 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
542 /* GNER has a latency of 18 cycles. */
543 update_SPR_latency (cpu
, GNER_FOR_GR (out_GRk
), cycles
+ 18);
546 /* the idiv resource has a latency of 18 cycles! */
547 update_idiv_resource_latency (cpu
, slot
, cycles
+ 18);
549 fr550_reset_ccr_flags (cpu
, out_ICCi_1
);
555 frvbf_model_fr550_u_branch (SIM_CPU
*cpu
, const IDESC
*idesc
,
556 int unit_num
, int referenced
,
557 INT in_GRi
, INT in_GRj
,
558 INT in_ICCi_2
, INT in_FCCi_2
)
561 FRV_PROFILE_STATE
*ps
;
563 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
565 /* icc0-icc4 are the upper 4 fields of the CCR. */
569 /* The entire VLIW insn must wait if there is a dependency on a register
570 which is not ready yet. */
571 vliw_wait_for_GR (cpu
, in_GRi
);
572 vliw_wait_for_GR (cpu
, in_GRj
);
573 vliw_wait_for_CCR (cpu
, in_ICCi_2
);
574 vliw_wait_for_CCR (cpu
, in_FCCi_2
);
575 handle_resource_wait (cpu
);
576 load_wait_for_GR (cpu
, in_GRi
);
577 load_wait_for_GR (cpu
, in_GRj
);
578 trace_vliw_wait_cycles (cpu
);
582 /* When counting branches taken or not taken, don't consider branches after
583 the first taken branch in a vliw insn. */
584 ps
= CPU_PROFILE_STATE (cpu
);
585 if (! ps
->vliw_branch_taken
)
587 /* (1 << 4): The pc is the 5th element in inputs, outputs.
588 ??? can be cleaned up */
589 PROFILE_DATA
*p
= CPU_PROFILE_DATA (cpu
);
590 int taken
= (referenced
& (1 << 4)) != 0;
593 ++PROFILE_MODEL_TAKEN_COUNT (p
);
594 ps
->vliw_branch_taken
= 1;
597 ++PROFILE_MODEL_UNTAKEN_COUNT (p
);
600 cycles
= idesc
->timing
->units
[unit_num
].done
;
605 frvbf_model_fr550_u_trap (SIM_CPU
*cpu
, const IDESC
*idesc
,
606 int unit_num
, int referenced
,
607 INT in_GRi
, INT in_GRj
,
608 INT in_ICCi_2
, INT in_FCCi_2
)
612 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
614 /* icc0-icc4 are the upper 4 fields of the CCR. */
618 /* The entire VLIW insn must wait if there is a dependency on a register
619 which is not ready yet. */
620 vliw_wait_for_GR (cpu
, in_GRi
);
621 vliw_wait_for_GR (cpu
, in_GRj
);
622 vliw_wait_for_CCR (cpu
, in_ICCi_2
);
623 vliw_wait_for_CCR (cpu
, in_FCCi_2
);
624 handle_resource_wait (cpu
);
625 load_wait_for_GR (cpu
, in_GRi
);
626 load_wait_for_GR (cpu
, in_GRj
);
627 trace_vliw_wait_cycles (cpu
);
631 cycles
= idesc
->timing
->units
[unit_num
].done
;
636 frvbf_model_fr550_u_check (SIM_CPU
*cpu
, const IDESC
*idesc
,
637 int unit_num
, int referenced
,
638 INT in_ICCi_3
, INT in_FCCi_3
)
640 /* Modelling for this unit is the same as for fr500. */
641 return frvbf_model_fr500_u_check (cpu
, idesc
, unit_num
, referenced
,
642 in_ICCi_3
, in_FCCi_3
);
646 frvbf_model_fr550_u_set_hilo (SIM_CPU
*cpu
, const IDESC
*idesc
,
647 int unit_num
, int referenced
,
648 INT out_GRkhi
, INT out_GRklo
)
652 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
654 /* The entire VLIW insn must wait if there is a dependency on a GR
655 which is not ready yet. */
656 vliw_wait_for_GR (cpu
, out_GRkhi
);
657 vliw_wait_for_GR (cpu
, out_GRklo
);
658 handle_resource_wait (cpu
);
659 load_wait_for_GR (cpu
, out_GRkhi
);
660 load_wait_for_GR (cpu
, out_GRklo
);
661 trace_vliw_wait_cycles (cpu
);
665 /* GRk is available immediately to the next VLIW insn. */
666 cycles
= idesc
->timing
->units
[unit_num
].done
;
672 frvbf_model_fr550_u_gr_load (SIM_CPU
*cpu
, const IDESC
*idesc
,
673 int unit_num
, int referenced
,
674 INT in_GRi
, INT in_GRj
,
675 INT out_GRk
, INT out_GRdoublek
)
679 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
681 /* The entire VLIW insn must wait if there is a dependency on a register
682 which is not ready yet. */
683 vliw_wait_for_GR (cpu
, in_GRi
);
684 vliw_wait_for_GR (cpu
, in_GRj
);
685 vliw_wait_for_GR (cpu
, out_GRk
);
686 vliw_wait_for_GRdouble (cpu
, out_GRdoublek
);
687 handle_resource_wait (cpu
);
688 load_wait_for_GR (cpu
, in_GRi
);
689 load_wait_for_GR (cpu
, in_GRj
);
690 load_wait_for_GR (cpu
, out_GRk
);
691 load_wait_for_GRdouble (cpu
, out_GRdoublek
);
692 trace_vliw_wait_cycles (cpu
);
696 cycles
= idesc
->timing
->units
[unit_num
].done
;
698 /* The latency of GRk for a load will depend on how long it takes to retrieve
699 the the data from the cache or memory. */
700 update_GR_latency_for_load (cpu
, out_GRk
, cycles
);
701 update_GRdouble_latency_for_load (cpu
, out_GRdoublek
, cycles
);
703 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
705 /* GNER has a latency of 2 cycles. */
706 update_SPR_latency (cpu
, GNER_FOR_GR (out_GRk
), cycles
+ 2);
707 update_SPR_latency (cpu
, GNER_FOR_GR (out_GRdoublek
), cycles
+ 2);
714 frvbf_model_fr550_u_gr_store (SIM_CPU
*cpu
, const IDESC
*idesc
,
715 int unit_num
, int referenced
,
716 INT in_GRi
, INT in_GRj
,
717 INT in_GRk
, INT in_GRdoublek
)
721 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
723 /* The entire VLIW insn must wait if there is a dependency on a register
724 which is not ready yet. */
725 vliw_wait_for_GR (cpu
, in_GRi
);
726 vliw_wait_for_GR (cpu
, in_GRj
);
727 vliw_wait_for_GR (cpu
, in_GRk
);
728 vliw_wait_for_GRdouble (cpu
, in_GRdoublek
);
729 handle_resource_wait (cpu
);
730 load_wait_for_GR (cpu
, in_GRi
);
731 load_wait_for_GR (cpu
, in_GRj
);
732 load_wait_for_GR (cpu
, in_GRk
);
733 load_wait_for_GRdouble (cpu
, in_GRdoublek
);
734 trace_vliw_wait_cycles (cpu
);
738 /* The target register is available immediately. */
739 cycles
= idesc
->timing
->units
[unit_num
].done
;
745 frvbf_model_fr550_u_fr_load (SIM_CPU
*cpu
, const IDESC
*idesc
,
746 int unit_num
, int referenced
,
747 INT in_GRi
, INT in_GRj
,
748 INT out_FRk
, INT out_FRdoublek
)
751 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
753 /* The entire VLIW insn must wait if there is a dependency on a register
754 which is not ready yet.
755 The latency of the registers may be less than previously recorded,
756 depending on how they were used previously.
757 See Table 13-8 in the LSI. */
758 adjust_float_register_busy (cpu
, -1, 1, -1, 1, out_FRk
, 1);
759 adjust_float_register_busy (cpu
, -1, 1, -1, 1, out_FRdoublek
, 2);
760 vliw_wait_for_GR (cpu
, in_GRi
);
761 vliw_wait_for_GR (cpu
, in_GRj
);
762 vliw_wait_for_FR (cpu
, out_FRk
);
763 vliw_wait_for_FRdouble (cpu
, out_FRdoublek
);
764 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
766 vliw_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
767 vliw_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
769 handle_resource_wait (cpu
);
770 load_wait_for_GR (cpu
, in_GRi
);
771 load_wait_for_GR (cpu
, in_GRj
);
772 load_wait_for_FR (cpu
, out_FRk
);
773 load_wait_for_FRdouble (cpu
, out_FRdoublek
);
774 trace_vliw_wait_cycles (cpu
);
778 cycles
= idesc
->timing
->units
[unit_num
].done
;
780 /* The latency of FRk for a load will depend on how long it takes to retrieve
781 the the data from the cache or memory. */
782 update_FR_latency_for_load (cpu
, out_FRk
, cycles
);
783 update_FRdouble_latency_for_load (cpu
, out_FRdoublek
, cycles
);
785 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
787 /* FNER has a latency of 3 cycles. */
788 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), cycles
+ 3);
789 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), cycles
+ 3);
793 set_use_is_fr_load (cpu
, out_FRk
);
794 if (out_FRdoublek
>= 0)
796 set_use_is_fr_load (cpu
, out_FRdoublek
);
797 set_use_is_fr_load (cpu
, out_FRdoublek
+ 1);
804 frvbf_model_fr550_u_fr_store (SIM_CPU
*cpu
, const IDESC
*idesc
,
805 int unit_num
, int referenced
,
806 INT in_GRi
, INT in_GRj
,
807 INT in_FRk
, INT in_FRdoublek
)
811 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
813 /* The entire VLIW insn must wait if there is a dependency on a register
814 which is not ready yet. */
815 adjust_float_register_busy (cpu
, in_FRk
, 1, -1, 1, -1, 1);
816 adjust_float_register_busy (cpu
, in_FRdoublek
, 2, -1, 1, -1, 1);
817 vliw_wait_for_GR (cpu
, in_GRi
);
818 vliw_wait_for_GR (cpu
, in_GRj
);
819 vliw_wait_for_FR (cpu
, in_FRk
);
820 vliw_wait_for_FRdouble (cpu
, in_FRdoublek
);
821 handle_resource_wait (cpu
);
822 load_wait_for_GR (cpu
, in_GRi
);
823 load_wait_for_GR (cpu
, in_GRj
);
824 load_wait_for_FR (cpu
, in_FRk
);
825 load_wait_for_FRdouble (cpu
, in_FRdoublek
);
826 trace_vliw_wait_cycles (cpu
);
830 /* The target register is available immediately. */
831 cycles
= idesc
->timing
->units
[unit_num
].done
;
837 frvbf_model_fr550_u_ici (SIM_CPU
*cpu
, const IDESC
*idesc
,
838 int unit_num
, int referenced
,
839 INT in_GRi
, INT in_GRj
)
843 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
845 /* The entire VLIW insn must wait if there is a dependency on a register
846 which is not ready yet. */
847 vliw_wait_for_GR (cpu
, in_GRi
);
848 vliw_wait_for_GR (cpu
, in_GRj
);
849 handle_resource_wait (cpu
);
850 load_wait_for_GR (cpu
, in_GRi
);
851 load_wait_for_GR (cpu
, in_GRj
);
852 trace_vliw_wait_cycles (cpu
);
856 cycles
= idesc
->timing
->units
[unit_num
].done
;
857 request_cache_invalidate (cpu
, CPU_INSN_CACHE (cpu
), cycles
);
862 frvbf_model_fr550_u_dci (SIM_CPU
*cpu
, const IDESC
*idesc
,
863 int unit_num
, int referenced
,
864 INT in_GRi
, INT in_GRj
)
868 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
870 /* The entire VLIW insn must wait if there is a dependency on a register
871 which is not ready yet. */
872 vliw_wait_for_GR (cpu
, in_GRi
);
873 vliw_wait_for_GR (cpu
, in_GRj
);
874 handle_resource_wait (cpu
);
875 load_wait_for_GR (cpu
, in_GRi
);
876 load_wait_for_GR (cpu
, in_GRj
);
877 trace_vliw_wait_cycles (cpu
);
881 cycles
= idesc
->timing
->units
[unit_num
].done
;
882 request_cache_invalidate (cpu
, CPU_DATA_CACHE (cpu
), cycles
);
887 frvbf_model_fr550_u_dcf (SIM_CPU
*cpu
, const IDESC
*idesc
,
888 int unit_num
, int referenced
,
889 INT in_GRi
, INT in_GRj
)
893 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
895 /* The entire VLIW insn must wait if there is a dependency on a register
896 which is not ready yet. */
897 vliw_wait_for_GR (cpu
, in_GRi
);
898 vliw_wait_for_GR (cpu
, in_GRj
);
899 handle_resource_wait (cpu
);
900 load_wait_for_GR (cpu
, in_GRi
);
901 load_wait_for_GR (cpu
, in_GRj
);
902 trace_vliw_wait_cycles (cpu
);
906 cycles
= idesc
->timing
->units
[unit_num
].done
;
907 request_cache_flush (cpu
, CPU_DATA_CACHE (cpu
), cycles
);
912 frvbf_model_fr550_u_icpl (SIM_CPU
*cpu
, const IDESC
*idesc
,
913 int unit_num
, int referenced
,
914 INT in_GRi
, INT in_GRj
)
918 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
920 /* The entire VLIW insn must wait if there is a dependency on a register
921 which is not ready yet. */
922 vliw_wait_for_GR (cpu
, in_GRi
);
923 vliw_wait_for_GR (cpu
, in_GRj
);
924 handle_resource_wait (cpu
);
925 load_wait_for_GR (cpu
, in_GRi
);
926 load_wait_for_GR (cpu
, in_GRj
);
927 trace_vliw_wait_cycles (cpu
);
931 cycles
= idesc
->timing
->units
[unit_num
].done
;
932 request_cache_preload (cpu
, CPU_INSN_CACHE (cpu
), cycles
);
937 frvbf_model_fr550_u_dcpl (SIM_CPU
*cpu
, const IDESC
*idesc
,
938 int unit_num
, int referenced
,
939 INT in_GRi
, INT in_GRj
)
943 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
945 /* The entire VLIW insn must wait if there is a dependency on a register
946 which is not ready yet. */
947 vliw_wait_for_GR (cpu
, in_GRi
);
948 vliw_wait_for_GR (cpu
, in_GRj
);
949 handle_resource_wait (cpu
);
950 load_wait_for_GR (cpu
, in_GRi
);
951 load_wait_for_GR (cpu
, in_GRj
);
952 trace_vliw_wait_cycles (cpu
);
956 cycles
= idesc
->timing
->units
[unit_num
].done
;
957 request_cache_preload (cpu
, CPU_DATA_CACHE (cpu
), cycles
);
962 frvbf_model_fr550_u_icul (SIM_CPU
*cpu
, const IDESC
*idesc
,
963 int unit_num
, int referenced
,
964 INT in_GRi
, INT in_GRj
)
968 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
970 /* The entire VLIW insn must wait if there is a dependency on a register
971 which is not ready yet. */
972 vliw_wait_for_GR (cpu
, in_GRi
);
973 vliw_wait_for_GR (cpu
, in_GRj
);
974 handle_resource_wait (cpu
);
975 load_wait_for_GR (cpu
, in_GRi
);
976 load_wait_for_GR (cpu
, in_GRj
);
977 trace_vliw_wait_cycles (cpu
);
981 cycles
= idesc
->timing
->units
[unit_num
].done
;
982 request_cache_unlock (cpu
, CPU_INSN_CACHE (cpu
), cycles
);
987 frvbf_model_fr550_u_dcul (SIM_CPU
*cpu
, const IDESC
*idesc
,
988 int unit_num
, int referenced
,
989 INT in_GRi
, INT in_GRj
)
993 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
995 /* The entire VLIW insn must wait if there is a dependency on a register
996 which is not ready yet. */
997 vliw_wait_for_GR (cpu
, in_GRi
);
998 vliw_wait_for_GR (cpu
, in_GRj
);
999 handle_resource_wait (cpu
);
1000 load_wait_for_GR (cpu
, in_GRi
);
1001 load_wait_for_GR (cpu
, in_GRj
);
1002 trace_vliw_wait_cycles (cpu
);
1006 cycles
= idesc
->timing
->units
[unit_num
].done
;
1007 request_cache_unlock (cpu
, CPU_DATA_CACHE (cpu
), cycles
);
1012 frvbf_model_fr550_u_float_arith (SIM_CPU
*cpu
, const IDESC
*idesc
,
1013 int unit_num
, int referenced
,
1014 INT in_FRi
, INT in_FRj
,
1015 INT in_FRdoublei
, INT in_FRdoublej
,
1016 INT out_FRk
, INT out_FRdoublek
)
1019 FRV_PROFILE_STATE
*ps
;
1023 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1026 /* The preprocessing can execute right away. */
1027 cycles
= idesc
->timing
->units
[unit_num
].done
;
1029 /* The post processing must wait if there is a dependency on a FR
1030 which is not ready yet. */
1031 adjust_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1032 adjust_float_register_busy (cpu
, in_FRdoublei
, 2, in_FRdoublej
, 2, out_FRdoublek
, 2);
1033 ps
= CPU_PROFILE_STATE (cpu
);
1034 ps
->post_wait
= cycles
;
1035 vliw
= CPU_VLIW (cpu
);
1036 slot
= vliw
->next_slot
- 1;
1037 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1038 post_wait_for_float (cpu
, slot
);
1039 post_wait_for_FR (cpu
, in_FRi
);
1040 post_wait_for_FR (cpu
, in_FRj
);
1041 post_wait_for_FR (cpu
, out_FRk
);
1042 post_wait_for_FRdouble (cpu
, in_FRdoublei
);
1043 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1044 post_wait_for_FRdouble (cpu
, out_FRdoublek
);
1045 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1047 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1048 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
1050 restore_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1051 restore_float_register_busy (cpu
, in_FRdoublei
, 2, in_FRdoublej
, 2, out_FRdoublek
, 2);
1053 /* The latency of FRk will be at least the latency of the other inputs. */
1054 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1055 update_FRdouble_latency (cpu
, out_FRdoublek
, ps
->post_wait
);
1057 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1059 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1060 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), ps
->post_wait
);
1063 /* Once initiated, post-processing will take 2 cycles. */
1064 update_FR_ptime (cpu
, out_FRk
, 2);
1065 update_FRdouble_ptime (cpu
, out_FRdoublek
, 2);
1066 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1068 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 2);
1069 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRdoublek
), 2);
1072 /* Mark this use of the register as a floating point op. */
1074 set_use_is_fr_complex_2 (cpu
, out_FRk
);
1075 if (out_FRdoublek
>= 0)
1077 set_use_is_fr_complex_2 (cpu
, out_FRdoublek
);
1078 if (out_FRdoublek
< 63)
1079 set_use_is_fr_complex_2 (cpu
, out_FRdoublek
+ 1);
1082 /* the media point unit resource has a latency of 4 cycles */
1083 update_media_resource_latency (cpu
, slot
, cycles
+ 4);
1089 frvbf_model_fr550_u_float_dual_arith (SIM_CPU
*cpu
, const IDESC
*idesc
,
1090 int unit_num
, int referenced
,
1091 INT in_FRi
, INT in_FRj
,
1092 INT in_FRdoublei
, INT in_FRdoublej
,
1093 INT out_FRk
, INT out_FRdoublek
)
1102 FRV_PROFILE_STATE
*ps
;
1106 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1109 /* The preprocessing can execute right away. */
1110 cycles
= idesc
->timing
->units
[unit_num
].done
;
1112 /* The post processing must wait if there is a dependency on a FR
1113 which is not ready yet. */
1114 dual_FRi
= DUAL_REG (in_FRi
);
1115 dual_FRj
= DUAL_REG (in_FRj
);
1116 dual_FRk
= DUAL_REG (out_FRk
);
1117 dual_FRdoublei
= DUAL_DOUBLE (in_FRdoublei
);
1118 dual_FRdoublej
= DUAL_DOUBLE (in_FRdoublej
);
1119 dual_FRdoublek
= DUAL_DOUBLE (out_FRdoublek
);
1121 adjust_float_register_busy (cpu
, in_FRi
, 2, in_FRj
, 2, out_FRk
, 2);
1122 adjust_float_register_busy (cpu
, in_FRdoublei
, 4, in_FRdoublej
, 4, out_FRdoublek
, 4);
1123 ps
= CPU_PROFILE_STATE (cpu
);
1124 ps
->post_wait
= cycles
;
1125 vliw
= CPU_VLIW (cpu
);
1126 slot
= vliw
->next_slot
- 1;
1127 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1128 post_wait_for_float (cpu
, slot
);
1129 post_wait_for_FR (cpu
, in_FRi
);
1130 post_wait_for_FR (cpu
, in_FRj
);
1131 post_wait_for_FR (cpu
, out_FRk
);
1132 post_wait_for_FR (cpu
, dual_FRi
);
1133 post_wait_for_FR (cpu
, dual_FRj
);
1134 post_wait_for_FR (cpu
, dual_FRk
);
1135 post_wait_for_FRdouble (cpu
, in_FRdoublei
);
1136 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1137 post_wait_for_FRdouble (cpu
, out_FRdoublek
);
1138 post_wait_for_FRdouble (cpu
, dual_FRdoublei
);
1139 post_wait_for_FRdouble (cpu
, dual_FRdoublej
);
1140 post_wait_for_FRdouble (cpu
, dual_FRdoublek
);
1141 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1143 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1144 post_wait_for_SPR (cpu
, FNER_FOR_FR (dual_FRk
));
1145 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
1146 post_wait_for_SPR (cpu
, FNER_FOR_FR (dual_FRdoublek
));
1148 restore_float_register_busy (cpu
, in_FRi
, 2, in_FRj
, 2, out_FRk
, 2);
1149 restore_float_register_busy (cpu
, in_FRdoublei
, 4, in_FRdoublej
, 4, out_FRdoublek
, 4);
1151 /* The latency of FRk will be at least the latency of the other inputs. */
1152 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1153 update_FR_latency (cpu
, dual_FRk
, ps
->post_wait
);
1154 update_FRdouble_latency (cpu
, out_FRdoublek
, ps
->post_wait
);
1155 update_FRdouble_latency (cpu
, dual_FRdoublek
, ps
->post_wait
);
1157 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1159 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1160 update_SPR_latency (cpu
, FNER_FOR_FR (dual_FRk
), ps
->post_wait
);
1161 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), ps
->post_wait
);
1162 update_SPR_latency (cpu
, FNER_FOR_FR (dual_FRdoublek
), ps
->post_wait
);
1165 /* Once initiated, post-processing will take 3 cycles. */
1166 update_FR_ptime (cpu
, out_FRk
, 3);
1167 update_FR_ptime (cpu
, dual_FRk
, 3);
1168 update_FRdouble_ptime (cpu
, out_FRdoublek
, 3);
1169 update_FRdouble_ptime (cpu
, dual_FRdoublek
, 3);
1171 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1173 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 3);
1174 update_SPR_ptime (cpu
, FNER_FOR_FR (dual_FRk
), 3);
1175 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRdoublek
), 3);
1176 update_SPR_ptime (cpu
, FNER_FOR_FR (dual_FRdoublek
), 3);
1179 /* Mark this use of the register as a floating point op. */
1181 fr550_reset_fr_flags (cpu
, out_FRk
);
1183 fr550_reset_fr_flags (cpu
, dual_FRk
);
1184 if (out_FRdoublek
>= 0)
1186 fr550_reset_fr_flags (cpu
, out_FRdoublek
);
1187 if (out_FRdoublek
< 63)
1188 fr550_reset_fr_flags (cpu
, out_FRdoublek
+ 1);
1190 if (dual_FRdoublek
>= 0)
1192 fr550_reset_fr_flags (cpu
, dual_FRdoublek
);
1193 if (dual_FRdoublek
< 63)
1194 fr550_reset_fr_flags (cpu
, dual_FRdoublek
+ 1);
1197 /* the media point unit resource has a latency of 5 cycles */
1198 update_media_resource_latency (cpu
, slot
, cycles
+ 5);
1204 frvbf_model_fr550_u_float_div (SIM_CPU
*cpu
, const IDESC
*idesc
,
1205 int unit_num
, int referenced
,
1206 INT in_FRi
, INT in_FRj
, INT out_FRk
)
1211 FRV_PROFILE_STATE
*ps
;
1213 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1216 cycles
= idesc
->timing
->units
[unit_num
].done
;
1218 /* The post processing must wait if there is a dependency on a FR
1219 which is not ready yet. */
1220 adjust_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1221 ps
= CPU_PROFILE_STATE (cpu
);
1222 ps
->post_wait
= cycles
;
1223 vliw
= CPU_VLIW (cpu
);
1224 slot
= vliw
->next_slot
- 1;
1225 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1226 post_wait_for_float (cpu
, slot
);
1227 post_wait_for_fdiv (cpu
, slot
);
1228 post_wait_for_FR (cpu
, in_FRi
);
1229 post_wait_for_FR (cpu
, in_FRj
);
1230 post_wait_for_FR (cpu
, out_FRk
);
1231 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1232 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1233 restore_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1235 /* The latency of FRk will be at least the latency of the other inputs. */
1236 /* Once initiated, post-processing will take 9 cycles. */
1237 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1238 update_FR_ptime (cpu
, out_FRk
, 9);
1240 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1242 /* FNER has a latency of 9 cycles. */
1243 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1244 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 9);
1247 /* The latency of the fdiv unit will be at least the latency of the other
1248 inputs. Once initiated, post-processing will take 9 cycles. */
1249 update_fdiv_resource_latency (cpu
, slot
, ps
->post_wait
+ 9);
1251 /* the media point unit resource has a latency of 11 cycles */
1252 update_media_resource_latency (cpu
, slot
, cycles
+ 11);
1254 fr550_reset_fr_flags (cpu
, out_FRk
);
1260 frvbf_model_fr550_u_float_sqrt (SIM_CPU
*cpu
, const IDESC
*idesc
,
1261 int unit_num
, int referenced
,
1262 INT in_FRj
, INT in_FRdoublej
,
1263 INT out_FRk
, INT out_FRdoublek
)
1268 FRV_PROFILE_STATE
*ps
;
1270 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1273 cycles
= idesc
->timing
->units
[unit_num
].done
;
1275 /* The post processing must wait if there is a dependency on a FR
1276 which is not ready yet. */
1277 adjust_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1278 adjust_float_register_busy (cpu
, -1, 1, in_FRdoublej
, 2, out_FRdoublek
, 2);
1279 ps
= CPU_PROFILE_STATE (cpu
);
1280 ps
->post_wait
= cycles
;
1281 vliw
= CPU_VLIW (cpu
);
1282 slot
= vliw
->next_slot
- 1;
1283 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1284 post_wait_for_float (cpu
, slot
);
1285 post_wait_for_fsqrt (cpu
, slot
);
1286 post_wait_for_FR (cpu
, in_FRj
);
1287 post_wait_for_FR (cpu
, out_FRk
);
1288 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1289 post_wait_for_FRdouble (cpu
, out_FRdoublek
);
1290 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1292 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1293 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
1295 restore_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1296 restore_float_register_busy (cpu
, -1, 1, in_FRdoublej
, 2, out_FRdoublek
, 2);
1298 /* The latency of FRk will be at least the latency of the other inputs. */
1299 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1300 update_FRdouble_latency (cpu
, out_FRdoublek
, ps
->post_wait
);
1302 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1304 /* FNER has a latency of 14 cycles. */
1305 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1306 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), ps
->post_wait
);
1309 /* Once initiated, post-processing will take 14 cycles. */
1310 update_FR_ptime (cpu
, out_FRk
, 14);
1311 update_FRdouble_ptime (cpu
, out_FRdoublek
, 14);
1313 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1315 /* FNER has a latency of 14 cycles. */
1316 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 14);
1317 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRdoublek
), 14);
1320 /* The latency of the sqrt unit will be the latency of the other
1321 inputs plus 14 cycles. */
1322 update_fsqrt_resource_latency (cpu
, slot
, ps
->post_wait
+ 14);
1324 fr550_reset_fr_flags (cpu
, out_FRk
);
1325 if (out_FRdoublek
!= -1)
1327 fr550_reset_fr_flags (cpu
, out_FRdoublek
);
1328 fr550_reset_fr_flags (cpu
, out_FRdoublek
+ 1);
1331 /* the media point unit resource has a latency of 16 cycles */
1332 update_media_resource_latency (cpu
, slot
, cycles
+ 16);
1338 frvbf_model_fr550_u_float_compare (SIM_CPU
*cpu
, const IDESC
*idesc
,
1339 int unit_num
, int referenced
,
1340 INT in_FRi
, INT in_FRj
,
1341 INT in_FRdoublei
, INT in_FRdoublej
,
1345 FRV_PROFILE_STATE
*ps
;
1349 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1352 /* The preprocessing can execute right away. */
1353 cycles
= idesc
->timing
->units
[unit_num
].done
;
1355 /* The post processing must wait if there is a dependency on a FR
1356 which is not ready yet. */
1357 adjust_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, -1, 1);
1358 adjust_float_register_busy (cpu
, in_FRdoublei
, 2, in_FRdoublej
, 2, -1, 1);
1359 ps
= CPU_PROFILE_STATE (cpu
);
1360 ps
->post_wait
= cycles
;
1361 vliw
= CPU_VLIW (cpu
);
1362 slot
= vliw
->next_slot
- 1;
1363 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1364 post_wait_for_float (cpu
, slot
);
1365 post_wait_for_FR (cpu
, in_FRi
);
1366 post_wait_for_FR (cpu
, in_FRj
);
1367 post_wait_for_FRdouble (cpu
, in_FRdoublei
);
1368 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1369 post_wait_for_CCR (cpu
, out_FCCi_2
);
1370 restore_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, -1, 1);
1371 restore_float_register_busy (cpu
, in_FRdoublei
, 2, in_FRdoublej
, 2, -1, 1);
1373 /* The latency of FCCi_2 will be the latency of the other inputs plus 2
1375 update_CCR_latency (cpu
, out_FCCi_2
, ps
->post_wait
+ 2);
1377 /* the media point unit resource has a latency of 4 cycles */
1378 update_media_resource_latency (cpu
, slot
, cycles
+ 4);
1380 set_use_is_ccr_complex (cpu
, out_FCCi_2
);
1386 frvbf_model_fr550_u_float_dual_compare (SIM_CPU
*cpu
, const IDESC
*idesc
,
1387 int unit_num
, int referenced
,
1388 INT in_FRi
, INT in_FRj
,
1395 FRV_PROFILE_STATE
*ps
;
1399 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1402 /* The preprocessing can execute right away. */
1403 cycles
= idesc
->timing
->units
[unit_num
].done
;
1405 /* The post processing must wait if there is a dependency on a FR
1406 which is not ready yet. */
1407 ps
= CPU_PROFILE_STATE (cpu
);
1408 ps
->post_wait
= cycles
;
1409 dual_FRi
= DUAL_REG (in_FRi
);
1410 dual_FRj
= DUAL_REG (in_FRj
);
1411 dual_FCCi_2
= out_FCCi_2
+ 1;
1412 adjust_float_register_busy (cpu
, in_FRi
, 2, in_FRj
, 2, -1, 1);
1413 vliw
= CPU_VLIW (cpu
);
1414 slot
= vliw
->next_slot
- 1;
1415 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1416 post_wait_for_float (cpu
, slot
);
1417 post_wait_for_FR (cpu
, in_FRi
);
1418 post_wait_for_FR (cpu
, in_FRj
);
1419 post_wait_for_FR (cpu
, dual_FRi
);
1420 post_wait_for_FR (cpu
, dual_FRj
);
1421 post_wait_for_CCR (cpu
, out_FCCi_2
);
1422 post_wait_for_CCR (cpu
, dual_FCCi_2
);
1423 restore_float_register_busy (cpu
, in_FRi
, 2, in_FRj
, 2, -1, 1);
1425 /* The latency of FCCi_2 will be the latency of the other inputs plus 3
1427 update_CCR_latency (cpu
, out_FCCi_2
, ps
->post_wait
+ 3);
1428 update_CCR_latency (cpu
, dual_FCCi_2
, ps
->post_wait
+ 3);
1430 set_use_is_ccr_complex (cpu
, out_FCCi_2
);
1431 if (dual_FCCi_2
>= 0)
1432 set_use_is_ccr_complex (cpu
, dual_FCCi_2
);
1434 /* the media point unit resource has a latency of 5 cycles */
1435 update_media_resource_latency (cpu
, slot
, cycles
+ 5);
1441 frvbf_model_fr550_u_float_convert (SIM_CPU
*cpu
, const IDESC
*idesc
,
1442 int unit_num
, int referenced
,
1443 INT in_FRj
, INT in_FRintj
, INT in_FRdoublej
,
1444 INT out_FRk
, INT out_FRintk
,
1448 FRV_PROFILE_STATE
*ps
;
1452 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1455 /* The preprocessing can execute right away. */
1456 cycles
= idesc
->timing
->units
[unit_num
].done
;
1458 /* The post processing must wait if there is a dependency on a FR
1459 which is not ready yet. */
1460 ps
= CPU_PROFILE_STATE (cpu
);
1461 ps
->post_wait
= cycles
;
1462 adjust_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1463 adjust_float_register_busy (cpu
, -1, 1, in_FRintj
, 1, out_FRintk
, 1);
1464 adjust_float_register_busy (cpu
, -1, 1, in_FRdoublej
, 2, out_FRdoublek
, 2);
1465 vliw
= CPU_VLIW (cpu
);
1466 slot
= vliw
->next_slot
- 1;
1467 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1468 post_wait_for_float (cpu
, slot
);
1469 post_wait_for_FR (cpu
, in_FRj
);
1470 post_wait_for_FR (cpu
, in_FRintj
);
1471 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1472 post_wait_for_FR (cpu
, out_FRk
);
1473 post_wait_for_FR (cpu
, out_FRintk
);
1474 post_wait_for_FRdouble (cpu
, out_FRdoublek
);
1475 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1477 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1478 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRintk
));
1479 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
1481 restore_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1482 restore_float_register_busy (cpu
, -1, 1, in_FRintj
, 1, out_FRintk
, 1);
1483 restore_float_register_busy (cpu
, -1, 1, in_FRdoublej
, 2, out_FRdoublek
, 2);
1485 /* The latency of FRk will be at least the latency of the other inputs. */
1486 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1487 update_FR_latency (cpu
, out_FRintk
, ps
->post_wait
);
1488 update_FRdouble_latency (cpu
, out_FRdoublek
, ps
->post_wait
);
1490 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1492 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1493 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRintk
), ps
->post_wait
);
1494 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), ps
->post_wait
);
1497 /* Once initiated, post-processing will take 2 cycles. */
1498 update_FR_ptime (cpu
, out_FRk
, 2);
1499 update_FR_ptime (cpu
, out_FRintk
, 2);
1500 update_FRdouble_ptime (cpu
, out_FRdoublek
, 2);
1502 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1504 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 2);
1505 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRintk
), 2);
1506 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRdoublek
), 2);
1509 /* Mark this use of the register as a floating point op. */
1511 set_use_is_fr_complex_2 (cpu
, out_FRk
);
1512 if (out_FRintk
>= 0)
1513 set_use_is_fr_complex_2 (cpu
, out_FRintk
);
1514 if (out_FRdoublek
>= 0)
1516 set_use_is_fr_complex_2 (cpu
, out_FRdoublek
);
1517 set_use_is_fr_complex_2 (cpu
, out_FRdoublek
+ 1);
1520 /* the media point unit resource has a latency of 4 cycles */
1521 update_media_resource_latency (cpu
, slot
, cycles
+ 4);
1527 frvbf_model_fr550_u_spr2gr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1528 int unit_num
, int referenced
,
1529 INT in_spr
, INT out_GRj
)
1531 /* Modelling for this unit is the same as for fr500. */
1532 return frvbf_model_fr500_u_spr2gr (cpu
, idesc
, unit_num
, referenced
,
1537 frvbf_model_fr550_u_gr2spr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1538 int unit_num
, int referenced
,
1539 INT in_GRj
, INT out_spr
)
1543 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1545 /* The entire VLIW insn must wait if there is a dependency on a register
1546 which is not ready yet. */
1547 vliw_wait_for_GR (cpu
, in_GRj
);
1548 vliw_wait_for_SPR (cpu
, out_spr
);
1549 handle_resource_wait (cpu
);
1550 load_wait_for_GR (cpu
, in_GRj
);
1551 trace_vliw_wait_cycles (cpu
);
1555 cycles
= idesc
->timing
->units
[unit_num
].done
;
1558 /* The latency of spr is ? cycles. */
1559 update_SPR_latency (cpu
, out_spr
, cycles
+ ?);
1566 frvbf_model_fr550_u_gr2fr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1567 int unit_num
, int referenced
,
1568 INT in_GRj
, INT out_FRk
)
1572 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1574 /* The entire VLIW insn must wait if there is a dependency on a register
1575 which is not ready yet.
1576 The latency of the registers may be less than previously recorded,
1577 depending on how they were used previously.
1578 See Table 14-15 in the LSI. */
1579 adjust_float_register_busy (cpu
, -1, 1, -1, 1, out_FRk
, 1);
1580 vliw_wait_for_GR (cpu
, in_GRj
);
1581 vliw_wait_for_FR (cpu
, out_FRk
);
1582 handle_resource_wait (cpu
);
1583 load_wait_for_GR (cpu
, in_GRj
);
1584 load_wait_for_FR (cpu
, out_FRk
);
1585 trace_vliw_wait_cycles (cpu
);
1589 /* The latency of FRk is 1 cycles. */
1590 cycles
= idesc
->timing
->units
[unit_num
].done
;
1591 update_FR_latency (cpu
, out_FRk
, cycles
+ 1);
1593 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1599 frvbf_model_fr550_u_swap (SIM_CPU
*cpu
, const IDESC
*idesc
,
1600 int unit_num
, int referenced
,
1601 INT in_GRi
, INT in_GRj
, INT out_GRk
)
1605 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1607 /* The entire VLIW insn must wait if there is a dependency on a register
1608 which is not ready yet. */
1609 vliw_wait_for_GR (cpu
, in_GRi
);
1610 vliw_wait_for_GR (cpu
, in_GRj
);
1611 vliw_wait_for_GR (cpu
, out_GRk
);
1612 handle_resource_wait (cpu
);
1613 load_wait_for_GR (cpu
, in_GRi
);
1614 load_wait_for_GR (cpu
, in_GRj
);
1615 load_wait_for_GR (cpu
, out_GRk
);
1616 trace_vliw_wait_cycles (cpu
);
1620 cycles
= idesc
->timing
->units
[unit_num
].done
;
1622 /* The latency of GRk will depend on how long it takes to swap
1623 the the data from the cache or memory. */
1624 update_GR_latency_for_swap (cpu
, out_GRk
, cycles
);
1630 frvbf_model_fr550_u_fr2fr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1631 int unit_num
, int referenced
,
1632 INT in_FRj
, INT out_FRk
)
1636 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1638 /* The entire VLIW insn must wait if there is a dependency on a register
1639 which is not ready yet.
1640 The latency of the registers may be less than previously recorded,
1641 depending on how they were used previously.
1642 See Table 14-15 in the LSI. */
1643 adjust_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1644 vliw_wait_for_FR (cpu
, in_FRj
);
1645 vliw_wait_for_FR (cpu
, out_FRk
);
1646 handle_resource_wait (cpu
);
1647 load_wait_for_FR (cpu
, in_FRj
);
1648 load_wait_for_FR (cpu
, out_FRk
);
1649 trace_vliw_wait_cycles (cpu
);
1653 /* The latency of FRj is 2 cycles. */
1654 cycles
= idesc
->timing
->units
[unit_num
].done
;
1655 update_FR_latency (cpu
, out_FRk
, cycles
+ 2);
1657 set_use_is_fr_complex_2 (cpu
, out_FRk
);
1663 frvbf_model_fr550_u_fr2gr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1664 int unit_num
, int referenced
,
1665 INT in_FRk
, INT out_GRj
)
1669 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1671 /* The entire VLIW insn must wait if there is a dependency on a register
1672 which is not ready yet.
1673 The latency of the registers may be less than previously recorded,
1674 depending on how they were used previously.
1675 See Table 14-15 in the LSI. */
1676 adjust_float_register_busy (cpu
, in_FRk
, 1, -1, 1, -1, 1);
1677 vliw_wait_for_FR (cpu
, in_FRk
);
1678 vliw_wait_for_GR (cpu
, out_GRj
);
1679 handle_resource_wait (cpu
);
1680 load_wait_for_FR (cpu
, in_FRk
);
1681 load_wait_for_GR (cpu
, out_GRj
);
1682 trace_vliw_wait_cycles (cpu
);
1686 /* The latency of GRj is 1 cycle. */
1687 cycles
= idesc
->timing
->units
[unit_num
].done
;
1688 update_GR_latency (cpu
, out_GRj
, cycles
+ 1);
1694 frvbf_model_fr550_u_clrgr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1695 int unit_num
, int referenced
,
1698 /* Modelling for this unit is the same as for fr500. */
1699 return frvbf_model_fr500_u_clrgr (cpu
, idesc
, unit_num
, referenced
, in_GRk
);
1703 frvbf_model_fr550_u_clrfr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1704 int unit_num
, int referenced
,
1707 /* Modelling for this unit is the same as for fr500. */
1708 return frvbf_model_fr500_u_clrfr (cpu
, idesc
, unit_num
, referenced
, in_FRk
);
1712 frvbf_model_fr550_u_commit (SIM_CPU
*cpu
, const IDESC
*idesc
,
1713 int unit_num
, int referenced
,
1714 INT in_GRk
, INT in_FRk
)
1716 /* Modelling for this unit is the same as for fr500. */
1717 return frvbf_model_fr500_u_commit (cpu
, idesc
, unit_num
, referenced
,
1722 frvbf_model_fr550_u_media (SIM_CPU
*cpu
, const IDESC
*idesc
,
1723 int unit_num
, int referenced
,
1724 INT in_FRi
, INT in_FRj
, INT out_FRk
)
1727 FRV_PROFILE_STATE
*ps
;
1731 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1734 /* The preprocessing can execute right away. */
1735 cycles
= idesc
->timing
->units
[unit_num
].done
;
1737 /* If the previous use of the registers was a media op,
1738 then their latency may be less than previously recorded.
1739 See Table 14-15 in the LSI. */
1740 adjust_float_register_busy_for_media (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1742 /* The post processing must wait if there is a dependency on a FR
1743 which is not ready yet. */
1744 ps
= CPU_PROFILE_STATE (cpu
);
1745 ps
->post_wait
= cycles
;
1746 vliw
= CPU_VLIW (cpu
);
1747 slot
= vliw
->next_slot
- 1;
1748 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1749 post_wait_for_media (cpu
, slot
);
1750 post_wait_for_FR (cpu
, in_FRi
);
1751 post_wait_for_FR (cpu
, in_FRj
);
1752 post_wait_for_FR (cpu
, out_FRk
);
1754 /* Restore the busy cycles of the registers we used. */
1755 restore_float_register_busy_for_media (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1757 /* The latency of tht output register will be at least the latency of the
1758 other inputs. Once initiated, post-processing will take 1 cycle. */
1761 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1762 update_FR_ptime (cpu
, out_FRk
, 1);
1763 /* Mark this use of the register as a media op. */
1764 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1767 /* the floating point unit resource has a latency of 3 cycles */
1768 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
1774 frvbf_model_fr550_u_media_quad (SIM_CPU
*cpu
, const IDESC
*idesc
,
1775 int unit_num
, int referenced
,
1776 INT in_FRi
, INT in_FRj
,
1783 FRV_PROFILE_STATE
*ps
;
1787 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1790 /* The preprocessing can execute right away. */
1791 cycles
= idesc
->timing
->units
[unit_num
].done
;
1793 dual_FRi
= DUAL_REG (in_FRi
);
1794 dual_FRj
= DUAL_REG (in_FRj
);
1795 dual_FRk
= DUAL_REG (out_FRk
);
1797 /* The latency of the registers may be less than previously recorded,
1798 depending on how they were used previously.
1799 See Table 14-15 in the LSI. */
1800 adjust_float_register_busy_for_media (cpu
, in_FRi
, 2, in_FRj
, 2, out_FRk
, 2);
1802 /* The post processing must wait if there is a dependency on a FR
1803 which is not ready yet. */
1804 ps
= CPU_PROFILE_STATE (cpu
);
1805 ps
->post_wait
= cycles
;
1806 vliw
= CPU_VLIW (cpu
);
1807 slot
= vliw
->next_slot
- 1;
1808 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1809 post_wait_for_media (cpu
, slot
);
1810 post_wait_for_FR (cpu
, in_FRi
);
1811 post_wait_for_FR (cpu
, dual_FRi
);
1812 post_wait_for_FR (cpu
, in_FRj
);
1813 post_wait_for_FR (cpu
, dual_FRj
);
1814 post_wait_for_FR (cpu
, out_FRk
);
1815 post_wait_for_FR (cpu
, dual_FRk
);
1817 /* Restore the busy cycles of the registers we used. */
1818 restore_float_register_busy_for_media (cpu
, in_FRi
, 2, in_FRj
, 2, out_FRk
, 2);
1820 /* The latency of the output register will be at least the latency of the
1821 other inputs. Once initiated, post-processing take 1 cycle. */
1822 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1823 update_FR_ptime (cpu
, out_FRk
, 1);
1824 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1828 update_FR_latency (cpu
, dual_FRk
, ps
->post_wait
);
1829 update_FR_ptime (cpu
, dual_FRk
, 1);
1830 set_use_is_fr_complex_1 (cpu
, dual_FRk
);
1833 /* the floating point unit resource has a latency of 3 cycles */
1834 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
1840 frvbf_model_fr550_u_media_dual_expand (SIM_CPU
*cpu
, const IDESC
*idesc
,
1841 int unit_num
, int referenced
,
1842 INT in_FRi
, INT out_FRk
)
1846 FRV_PROFILE_STATE
*ps
;
1850 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1853 /* The preprocessing can execute right away. */
1854 cycles
= idesc
->timing
->units
[unit_num
].done
;
1856 /* If the previous use of the registers was a media op,
1857 then their latency will be less than previously recorded.
1858 See Table 14-15 in the LSI. */
1859 dual_FRk
= DUAL_REG (out_FRk
);
1860 adjust_float_register_busy_for_media (cpu
, in_FRi
, 1, -1, 1, out_FRk
, 2);
1862 /* The post processing must wait if there is a dependency on a FR
1863 which is not ready yet. */
1864 ps
= CPU_PROFILE_STATE (cpu
);
1865 ps
->post_wait
= cycles
;
1866 vliw
= CPU_VLIW (cpu
);
1867 slot
= vliw
->next_slot
- 1;
1868 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1869 post_wait_for_media (cpu
, slot
);
1870 post_wait_for_FR (cpu
, in_FRi
);
1871 post_wait_for_FR (cpu
, out_FRk
);
1872 post_wait_for_FR (cpu
, dual_FRk
);
1874 /* Restore the busy cycles of the registers we used. */
1875 restore_float_register_busy_for_media (cpu
, in_FRi
, 1, -1, 1, out_FRk
, 2);
1877 /* The latency of the output register will be at least the latency of the
1878 other inputs. Once initiated, post-processing will take 1 cycle. */
1879 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1880 update_FR_ptime (cpu
, out_FRk
, 1);
1881 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1885 update_FR_latency (cpu
, dual_FRk
, ps
->post_wait
);
1886 update_FR_ptime (cpu
, dual_FRk
, 1);
1887 set_use_is_fr_complex_1 (cpu
, dual_FRk
);
1890 /* the floating point unit resource has a latency of 3 cycles */
1891 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
1897 frvbf_model_fr550_u_media_3_dual (SIM_CPU
*cpu
, const IDESC
*idesc
,
1898 int unit_num
, int referenced
,
1899 INT in_FRi
, INT out_FRk
)
1903 FRV_PROFILE_STATE
*ps
;
1907 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1910 /* The preprocessing can execute right away. */
1911 cycles
= idesc
->timing
->units
[unit_num
].done
;
1913 dual_FRi
= DUAL_REG (in_FRi
);
1915 /* The latency of the registers may be less than previously recorded,
1916 depending on how they were used previously.
1917 See Table 14-15 in the LSI. */
1918 adjust_float_register_busy_for_media (cpu
, in_FRi
, 2, -1, 1, out_FRk
, 1);
1920 /* The post processing must wait if there is a dependency on a FR
1921 which is not ready yet. */
1922 ps
= CPU_PROFILE_STATE (cpu
);
1923 ps
->post_wait
= cycles
;
1924 vliw
= CPU_VLIW (cpu
);
1925 slot
= vliw
->next_slot
- 1;
1926 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1927 post_wait_for_media (cpu
, slot
);
1928 post_wait_for_FR (cpu
, in_FRi
);
1929 post_wait_for_FR (cpu
, dual_FRi
);
1930 post_wait_for_FR (cpu
, out_FRk
);
1932 /* Restore the busy cycles of the registers we used. */
1933 restore_float_register_busy_for_media (cpu
, in_FRi
, 2, -1, 1, out_FRk
, 1);
1935 /* The latency of the output register will be at least the latency of the
1936 other inputs. Once initiated, post-processing takes 1 cycle. */
1937 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1938 update_FR_ptime (cpu
, out_FRk
, 1);
1940 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1942 /* the floating point unit resource has a latency of 3 cycles */
1943 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
1949 frvbf_model_fr550_u_media_3_acc (SIM_CPU
*cpu
, const IDESC
*idesc
,
1950 int unit_num
, int referenced
,
1951 INT in_FRj
, INT in_ACC40Si
,
1955 FRV_PROFILE_STATE
*ps
;
1959 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1962 /* The preprocessing can execute right away. */
1963 cycles
= idesc
->timing
->units
[unit_num
].done
;
1965 /* If the previous use of the registers was a media op,
1966 then their latency will be less than previously recorded.
1967 See Table 14-15 in the LSI. */
1968 adjust_float_register_busy_for_media (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1970 /* The post processing must wait if there is a dependency on a FR
1971 which is not ready yet. */
1972 ps
= CPU_PROFILE_STATE (cpu
);
1973 ps
->post_wait
= cycles
;
1974 vliw
= CPU_VLIW (cpu
);
1975 slot
= vliw
->next_slot
- 1;
1976 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1977 post_wait_for_media (cpu
, slot
);
1978 post_wait_for_FR (cpu
, in_FRj
);
1979 post_wait_for_FR (cpu
, out_FRk
);
1980 post_wait_for_ACC (cpu
, in_ACC40Si
);
1982 /* Restore the busy cycles of the registers we used. */
1983 restore_float_register_busy_for_media (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1985 /* The latency of tht output register will be at least the latency of the
1986 other inputs. Once initiated, post-processing will take 1 cycle. */
1987 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1988 update_FR_ptime (cpu
, out_FRk
, 1);
1990 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1992 /* the floating point unit resource has a latency of 3 cycles */
1993 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
1999 frvbf_model_fr550_u_media_3_acc_dual (SIM_CPU
*cpu
, const IDESC
*idesc
,
2000 int unit_num
, int referenced
,
2001 INT in_ACC40Si
, INT out_FRk
)
2004 FRV_PROFILE_STATE
*ps
;
2010 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2013 /* The preprocessing can execute right away. */
2014 cycles
= idesc
->timing
->units
[unit_num
].done
;
2016 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2017 dual_FRk
= DUAL_REG (out_FRk
);
2019 /* If the previous use of the registers was a media op,
2020 then their latency will be less than previously recorded.
2021 See Table 14-15 in the LSI. */
2022 adjust_float_register_busy_for_media (cpu
, -1, 1, -1, 1, out_FRk
, 2);
2024 /* The post processing must wait if there is a dependency on a FR
2025 which is not ready yet. */
2026 ps
= CPU_PROFILE_STATE (cpu
);
2027 ps
->post_wait
= cycles
;
2028 vliw
= CPU_VLIW (cpu
);
2029 slot
= vliw
->next_slot
- 1;
2030 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2031 post_wait_for_media (cpu
, slot
);
2032 post_wait_for_ACC (cpu
, in_ACC40Si
);
2033 post_wait_for_ACC (cpu
, ACC40Si_1
);
2034 post_wait_for_FR (cpu
, out_FRk
);
2035 post_wait_for_FR (cpu
, dual_FRk
);
2037 /* Restore the busy cycles of the registers we used. */
2038 restore_float_register_busy_for_media (cpu
, -1, 1, -1, 1, out_FRk
, 2);
2040 /* The latency of the output register will be at least the latency of the
2041 other inputs. Once initiated, post-processing will take 1 cycle. */
2042 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
2043 update_FR_ptime (cpu
, out_FRk
, 1);
2044 set_use_is_fr_complex_1 (cpu
, out_FRk
);
2047 update_FR_latency (cpu
, dual_FRk
, ps
->post_wait
);
2048 update_FR_ptime (cpu
, dual_FRk
, 1);
2049 set_use_is_fr_complex_1 (cpu
, dual_FRk
);
2052 /* the floating point unit resource has a latency of 3 cycles */
2053 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2059 frvbf_model_fr550_u_media_3_wtacc (SIM_CPU
*cpu
, const IDESC
*idesc
,
2060 int unit_num
, int referenced
,
2061 INT in_FRi
, INT out_ACC40Sk
)
2064 FRV_PROFILE_STATE
*ps
;
2068 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2071 /* The preprocessing can execute right away. */
2072 cycles
= idesc
->timing
->units
[unit_num
].done
;
2074 ps
= CPU_PROFILE_STATE (cpu
);
2076 /* The latency of the registers may be less than previously recorded,
2077 depending on how they were used previously.
2078 See Table 14-15 in the LSI. */
2079 adjust_float_register_busy_for_media (cpu
, in_FRi
, 1, -1, 1, -1, 1);
2081 /* The post processing must wait if there is a dependency on a FR
2082 which is not ready yet. */
2083 ps
->post_wait
= cycles
;
2084 vliw
= CPU_VLIW (cpu
);
2085 slot
= vliw
->next_slot
- 1;
2086 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2087 post_wait_for_media (cpu
, slot
);
2088 post_wait_for_FR (cpu
, in_FRi
);
2089 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2091 /* Restore the busy cycles of the registers we used. */
2092 restore_float_register_busy_for_media (cpu
, in_FRi
, 1, -1, 1, -1, 1);
2094 /* The latency of the output register will be at least the latency of the
2095 other inputs. Once initiated, post-processing will take 1 cycle. */
2096 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
);
2097 update_ACC_ptime (cpu
, out_ACC40Sk
, 1);
2098 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2100 /* the floating point unit resource has a latency of 3 cycles */
2101 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2107 frvbf_model_fr550_u_media_3_mclracc (SIM_CPU
*cpu
, const IDESC
*idesc
,
2108 int unit_num
, int referenced
)
2111 FRV_PROFILE_STATE
*ps
;
2116 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2119 /* The preprocessing can execute right away. */
2120 cycles
= idesc
->timing
->units
[unit_num
].done
;
2122 ps
= CPU_PROFILE_STATE (cpu
);
2124 /* The post processing must wait if there is a dependency on a FR
2125 which is not ready yet. */
2126 ps
->post_wait
= cycles
;
2127 vliw
= CPU_VLIW (cpu
);
2128 slot
= vliw
->next_slot
- 1;
2129 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2130 post_wait_for_media (cpu
, slot
);
2132 /* If A was 1 and the accumulator was ACC0, then we must check all
2133 accumulators. Otherwise just wait for the specified accumulator. */
2134 if (ps
->mclracc_A
&& ps
->mclracc_acc
== 0)
2136 for (i
= 0; i
< 8; ++i
)
2137 post_wait_for_ACC (cpu
, i
);
2140 post_wait_for_ACC (cpu
, ps
->mclracc_acc
);
2142 /* The latency of the output registers will be at least the latency of the
2143 other inputs. Once initiated, post-processing will take 1 cycle. */
2144 if (ps
->mclracc_A
&& ps
->mclracc_acc
== 0)
2146 for (i
= 0; i
< 8; ++i
)
2148 update_ACC_latency (cpu
, i
, ps
->post_wait
);
2149 update_ACC_ptime (cpu
, i
, 1);
2150 set_use_is_acc_mmac (cpu
, i
);
2155 update_ACC_latency (cpu
, ps
->mclracc_acc
, ps
->post_wait
);
2156 update_ACC_ptime (cpu
, ps
->mclracc_acc
, 1);
2157 set_use_is_acc_mmac (cpu
, ps
->mclracc_acc
);
2160 /* the floating point unit resource has a latency of 3 cycles */
2161 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2167 frvbf_model_fr550_u_media_set (SIM_CPU
*cpu
, const IDESC
*idesc
,
2168 int unit_num
, int referenced
,
2172 FRV_PROFILE_STATE
*ps
;
2176 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2179 /* The preprocessing can execute right away. */
2180 cycles
= idesc
->timing
->units
[unit_num
].done
;
2182 /* If the previous use of the registers was a media op,
2183 then their latency will be less than previously recorded.
2184 See Table 14-15 in the LSI. */
2185 adjust_float_register_busy_for_media (cpu
, -1, 1, -1, 1, out_FRk
, 1);
2187 /* The post processing must wait if there is a dependency on a FR
2188 which is not ready yet. */
2189 ps
= CPU_PROFILE_STATE (cpu
);
2190 ps
->post_wait
= cycles
;
2191 vliw
= CPU_VLIW (cpu
);
2192 slot
= vliw
->next_slot
- 1;
2193 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2194 post_wait_for_media (cpu
, slot
);
2195 post_wait_for_FR (cpu
, out_FRk
);
2197 /* Restore the busy cycles of the registers we used. */
2198 restore_float_register_busy_for_media (cpu
, -1, 1, -1, 1, out_FRk
, 1);
2200 /* The latency of the output register will be at least the latency of the
2201 other inputs. Once initiated, post-processing takes 1 cycle. */
2202 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
2203 update_FR_ptime (cpu
, out_FRk
, 1);
2204 fr550_reset_acc_flags (cpu
, out_FRk
);
2206 /* the floating point unit resource has a latency of 3 cycles */
2207 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2213 frvbf_model_fr550_u_media_4 (SIM_CPU
*cpu
, const IDESC
*idesc
,
2214 int unit_num
, int referenced
,
2215 INT in_FRi
, INT in_FRj
,
2216 INT out_ACC40Sk
, INT out_ACC40Uk
)
2221 FRV_PROFILE_STATE
*ps
;
2225 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2228 /* The preprocessing can execute right away. */
2229 cycles
= idesc
->timing
->units
[unit_num
].done
;
2231 ps
= CPU_PROFILE_STATE (cpu
);
2232 dual_ACC40Sk
= DUAL_REG (out_ACC40Sk
);
2233 dual_ACC40Uk
= DUAL_REG (out_ACC40Uk
);
2235 /* The latency of the registers may be less than previously recorded,
2236 depending on how they were used previously.
2237 See Table 14-15 in the LSI. */
2238 adjust_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Sk
, 2);
2239 adjust_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Uk
, 2);
2241 /* The post processing must wait if there is a dependency on a FR
2242 which is not ready yet. */
2243 ps
->post_wait
= cycles
;
2244 vliw
= CPU_VLIW (cpu
);
2245 slot
= vliw
->next_slot
- 1;
2246 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2247 post_wait_for_media (cpu
, slot
);
2248 post_wait_for_FR (cpu
, in_FRi
);
2249 post_wait_for_FR (cpu
, in_FRj
);
2250 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2251 post_wait_for_ACC (cpu
, dual_ACC40Sk
);
2252 post_wait_for_ACC (cpu
, out_ACC40Uk
);
2253 post_wait_for_ACC (cpu
, dual_ACC40Uk
);
2255 /* Restore the busy cycles of the registers we used. */
2256 restore_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Sk
, 2);
2257 restore_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Uk
, 2);
2259 /* The latency of the output register will be at least the latency of the
2260 other inputs. Once initiated, post-processing will take 1 cycles. */
2261 if (out_ACC40Sk
>= 0)
2263 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2264 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2266 if (dual_ACC40Sk
>= 0)
2268 update_ACC_latency (cpu
, dual_ACC40Sk
, ps
->post_wait
+ 1);
2269 set_use_is_acc_mmac (cpu
, dual_ACC40Sk
);
2271 if (out_ACC40Uk
>= 0)
2273 update_ACC_latency (cpu
, out_ACC40Uk
, ps
->post_wait
+ 1);
2274 set_use_is_acc_mmac (cpu
, out_ACC40Uk
);
2276 if (dual_ACC40Uk
>= 0)
2278 update_ACC_latency (cpu
, dual_ACC40Uk
, ps
->post_wait
+ 1);
2279 set_use_is_acc_mmac (cpu
, dual_ACC40Uk
);
2282 /* the floating point unit resource has a latency of 3 cycles */
2283 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2289 frvbf_model_fr550_u_media_4_acc (SIM_CPU
*cpu
, const IDESC
*idesc
,
2290 int unit_num
, int referenced
,
2291 INT in_ACC40Si
, INT out_ACC40Sk
)
2295 FRV_PROFILE_STATE
*ps
;
2299 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2302 /* The preprocessing can execute right away. */
2303 cycles
= idesc
->timing
->units
[unit_num
].done
;
2305 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2307 ps
= CPU_PROFILE_STATE (cpu
);
2308 /* The latency of the registers may be less than previously recorded,
2309 depending on how they were used previously.
2310 See Table 14-15 in the LSI. */
2311 adjust_acc_busy_for_mmac (cpu
, in_ACC40Si
, 2, out_ACC40Sk
, 1);
2313 /* The post processing must wait if there is a dependency on a register
2314 which is not ready yet. */
2315 ps
->post_wait
= cycles
;
2316 vliw
= CPU_VLIW (cpu
);
2317 slot
= vliw
->next_slot
- 1;
2318 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2319 post_wait_for_media (cpu
, slot
);
2320 post_wait_for_ACC (cpu
, in_ACC40Si
);
2321 post_wait_for_ACC (cpu
, ACC40Si_1
);
2322 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2324 /* Restore the busy cycles of the registers we used. */
2325 restore_acc_busy_for_mmac (cpu
, in_ACC40Si
, 2, out_ACC40Sk
, 1);
2327 /* The latency of the output register will be at least the latency of the
2328 other inputs. Once initiated, post-processing will take 1 cycle. */
2329 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2330 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2332 /* the floating point unit resource has a latency of 3 cycles */
2333 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2339 frvbf_model_fr550_u_media_4_acc_dual (SIM_CPU
*cpu
, const IDESC
*idesc
,
2340 int unit_num
, int referenced
,
2341 INT in_ACC40Si
, INT out_ACC40Sk
)
2348 FRV_PROFILE_STATE
*ps
;
2352 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2355 /* The preprocessing can execute right away. */
2356 cycles
= idesc
->timing
->units
[unit_num
].done
;
2358 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2359 ACC40Si_2
= DUAL_REG (ACC40Si_1
);
2360 ACC40Si_3
= DUAL_REG (ACC40Si_2
);
2361 ACC40Sk_1
= DUAL_REG (out_ACC40Sk
);
2363 ps
= CPU_PROFILE_STATE (cpu
);
2364 /* The latency of the registers may be less than previously recorded,
2365 depending on how they were used previously.
2366 See Table 14-15 in the LSI. */
2367 adjust_acc_busy_for_mmac (cpu
, in_ACC40Si
, 4, out_ACC40Sk
, 2);
2369 /* The post processing must wait if there is a dependency on a register
2370 which is not ready yet. */
2371 ps
->post_wait
= cycles
;
2372 vliw
= CPU_VLIW (cpu
);
2373 slot
= vliw
->next_slot
- 1;
2374 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2375 post_wait_for_media (cpu
, slot
);
2376 post_wait_for_ACC (cpu
, in_ACC40Si
);
2377 post_wait_for_ACC (cpu
, ACC40Si_1
);
2378 post_wait_for_ACC (cpu
, ACC40Si_2
);
2379 post_wait_for_ACC (cpu
, ACC40Si_3
);
2380 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2381 post_wait_for_ACC (cpu
, ACC40Sk_1
);
2383 /* Restore the busy cycles of the registers we used. */
2384 restore_acc_busy_for_mmac (cpu
, in_ACC40Si
, 4, out_ACC40Sk
, 2);
2386 /* The latency of the output register will be at least the latency of the
2387 other inputs. Once initiated, post-processing will take 1 cycle. */
2388 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2389 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2392 update_ACC_latency (cpu
, ACC40Sk_1
, ps
->post_wait
+ 1);
2393 set_use_is_acc_mmac (cpu
, ACC40Sk_1
);
2396 /* the floating point unit resource has a latency of 3 cycles */
2397 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2403 frvbf_model_fr550_u_media_4_add_sub (SIM_CPU
*cpu
, const IDESC
*idesc
,
2404 int unit_num
, int referenced
,
2405 INT in_ACC40Si
, INT out_ACC40Sk
)
2410 FRV_PROFILE_STATE
*ps
;
2414 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2417 /* The preprocessing can execute right away. */
2418 cycles
= idesc
->timing
->units
[unit_num
].done
;
2420 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2421 ACC40Sk_1
= DUAL_REG (out_ACC40Sk
);
2423 ps
= CPU_PROFILE_STATE (cpu
);
2424 /* The latency of the registers may be less than previously recorded,
2425 depending on how they were used previously.
2426 See Table 14-15 in the LSI. */
2427 adjust_acc_busy_for_mmac (cpu
, in_ACC40Si
, 2, out_ACC40Sk
, 2);
2429 /* The post processing must wait if there is a dependency on a register
2430 which is not ready yet. */
2431 ps
->post_wait
= cycles
;
2432 vliw
= CPU_VLIW (cpu
);
2433 slot
= vliw
->next_slot
- 1;
2434 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2435 post_wait_for_media (cpu
, slot
);
2436 post_wait_for_ACC (cpu
, in_ACC40Si
);
2437 post_wait_for_ACC (cpu
, ACC40Si_1
);
2438 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2439 post_wait_for_ACC (cpu
, ACC40Sk_1
);
2441 /* Restore the busy cycles of the registers we used. */
2442 restore_acc_busy_for_mmac (cpu
, in_ACC40Si
, 2, out_ACC40Sk
, 2);
2444 /* The latency of the output register will be at least the latency of the
2445 other inputs. Once initiated, post-processing will take 1 cycle. */
2446 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2447 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2450 update_ACC_latency (cpu
, ACC40Sk_1
, ps
->post_wait
+ 1);
2451 set_use_is_acc_mmac (cpu
, ACC40Sk_1
);
2454 /* the floating point unit resource has a latency of 3 cycles */
2455 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2461 frvbf_model_fr550_u_media_4_add_sub_dual (SIM_CPU
*cpu
, const IDESC
*idesc
,
2462 int unit_num
, int referenced
,
2463 INT in_ACC40Si
, INT out_ACC40Sk
)
2472 FRV_PROFILE_STATE
*ps
;
2476 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2479 /* The preprocessing can execute right away. */
2480 cycles
= idesc
->timing
->units
[unit_num
].done
;
2482 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2483 ACC40Si_2
= DUAL_REG (ACC40Si_1
);
2484 ACC40Si_3
= DUAL_REG (ACC40Si_2
);
2485 ACC40Sk_1
= DUAL_REG (out_ACC40Sk
);
2486 ACC40Sk_2
= DUAL_REG (ACC40Sk_1
);
2487 ACC40Sk_3
= DUAL_REG (ACC40Sk_2
);
2489 ps
= CPU_PROFILE_STATE (cpu
);
2490 /* The latency of the registers may be less than previously recorded,
2491 depending on how they were used previously.
2492 See Table 14-15 in the LSI. */
2493 adjust_acc_busy_for_mmac (cpu
, in_ACC40Si
, 4, out_ACC40Sk
, 4);
2495 /* The post processing must wait if there is a dependency on a register
2496 which is not ready yet. */
2497 ps
->post_wait
= cycles
;
2498 vliw
= CPU_VLIW (cpu
);
2499 slot
= vliw
->next_slot
- 1;
2500 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2501 post_wait_for_media (cpu
, slot
);
2502 post_wait_for_ACC (cpu
, in_ACC40Si
);
2503 post_wait_for_ACC (cpu
, ACC40Si_1
);
2504 post_wait_for_ACC (cpu
, ACC40Si_2
);
2505 post_wait_for_ACC (cpu
, ACC40Si_3
);
2506 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2507 post_wait_for_ACC (cpu
, ACC40Sk_1
);
2508 post_wait_for_ACC (cpu
, ACC40Sk_2
);
2509 post_wait_for_ACC (cpu
, ACC40Sk_3
);
2511 /* Restore the busy cycles of the registers we used. */
2512 restore_acc_busy_for_mmac (cpu
, in_ACC40Si
, 4, out_ACC40Sk
, 4);
2514 /* The latency of the output register will be at least the latency of the
2515 other inputs. Once initiated, post-processing will take 1 cycle. */
2516 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2517 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2520 update_ACC_latency (cpu
, ACC40Sk_1
, ps
->post_wait
+ 1);
2521 set_use_is_acc_mmac (cpu
, ACC40Sk_1
);
2525 update_ACC_latency (cpu
, ACC40Sk_2
, ps
->post_wait
+ 1);
2526 set_use_is_acc_mmac (cpu
, ACC40Sk_2
);
2530 update_ACC_latency (cpu
, ACC40Sk_3
, ps
->post_wait
+ 1);
2531 set_use_is_acc_mmac (cpu
, ACC40Sk_3
);
2534 /* the floating point unit resource has a latency of 3 cycles */
2535 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2541 frvbf_model_fr550_u_media_4_quad (SIM_CPU
*cpu
, const IDESC
*idesc
,
2542 int unit_num
, int referenced
,
2543 INT in_FRi
, INT in_FRj
,
2544 INT out_ACC40Sk
, INT out_ACC40Uk
)
2555 FRV_PROFILE_STATE
*ps
;
2559 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2562 /* The preprocessing can execute right away. */
2563 cycles
= idesc
->timing
->units
[unit_num
].done
;
2565 dual_FRi
= DUAL_REG (in_FRi
);
2566 dual_FRj
= DUAL_REG (in_FRj
);
2567 ACC40Sk_1
= DUAL_REG (out_ACC40Sk
);
2568 ACC40Sk_2
= DUAL_REG (ACC40Sk_1
);
2569 ACC40Sk_3
= DUAL_REG (ACC40Sk_2
);
2570 ACC40Uk_1
= DUAL_REG (out_ACC40Uk
);
2571 ACC40Uk_2
= DUAL_REG (ACC40Uk_1
);
2572 ACC40Uk_3
= DUAL_REG (ACC40Uk_2
);
2574 ps
= CPU_PROFILE_STATE (cpu
);
2575 /* The latency of the registers may be less than previously recorded,
2576 depending on how they were used previously.
2577 See Table 14-15 in the LSI. */
2578 adjust_float_register_busy_for_media (cpu
, in_FRi
, 2, in_FRj
, 2, -1, 1);
2579 adjust_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Sk
, 4);
2580 adjust_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Uk
, 4);
2582 /* The post processing must wait if there is a dependency on a FR
2583 which is not ready yet. */
2584 ps
->post_wait
= cycles
;
2585 vliw
= CPU_VLIW (cpu
);
2586 slot
= vliw
->next_slot
- 1;
2587 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2588 post_wait_for_media (cpu
, slot
);
2589 post_wait_for_FR (cpu
, in_FRi
);
2590 post_wait_for_FR (cpu
, dual_FRi
);
2591 post_wait_for_FR (cpu
, in_FRj
);
2592 post_wait_for_FR (cpu
, dual_FRj
);
2593 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2594 post_wait_for_ACC (cpu
, ACC40Sk_1
);
2595 post_wait_for_ACC (cpu
, ACC40Sk_2
);
2596 post_wait_for_ACC (cpu
, ACC40Sk_3
);
2597 post_wait_for_ACC (cpu
, out_ACC40Uk
);
2598 post_wait_for_ACC (cpu
, ACC40Uk_1
);
2599 post_wait_for_ACC (cpu
, ACC40Uk_2
);
2600 post_wait_for_ACC (cpu
, ACC40Uk_3
);
2602 /* Restore the busy cycles of the registers we used. */
2603 restore_float_register_busy_for_media (cpu
, in_FRi
, 2, in_FRj
, 2, -1, 1);
2604 restore_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Sk
, 4);
2605 restore_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Uk
, 4);
2607 /* The latency of the output register will be at least the latency of the
2608 other inputs. Once initiated, post-processing will take 1 cycle. */
2609 if (out_ACC40Sk
>= 0)
2611 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2613 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2616 update_ACC_latency (cpu
, ACC40Sk_1
, ps
->post_wait
+ 1);
2618 set_use_is_acc_mmac (cpu
, ACC40Sk_1
);
2622 update_ACC_latency (cpu
, ACC40Sk_2
, ps
->post_wait
+ 1);
2624 set_use_is_acc_mmac (cpu
, ACC40Sk_2
);
2628 update_ACC_latency (cpu
, ACC40Sk_3
, ps
->post_wait
+ 1);
2630 set_use_is_acc_mmac (cpu
, ACC40Sk_3
);
2633 else if (out_ACC40Uk
>= 0)
2635 update_ACC_latency (cpu
, out_ACC40Uk
, ps
->post_wait
+ 1);
2637 set_use_is_acc_mmac (cpu
, out_ACC40Uk
);
2640 update_ACC_latency (cpu
, ACC40Uk_1
, ps
->post_wait
+ 1);
2642 set_use_is_acc_mmac (cpu
, ACC40Uk_1
);
2646 update_ACC_latency (cpu
, ACC40Uk_2
, ps
->post_wait
+ 1);
2648 set_use_is_acc_mmac (cpu
, ACC40Uk_2
);
2652 update_ACC_latency (cpu
, ACC40Uk_3
, ps
->post_wait
+ 1);
2654 set_use_is_acc_mmac (cpu
, ACC40Uk_3
);
2658 /* the floating point unit resource has a latency of 3 cycles */
2659 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2664 #endif /* WITH_PROFILE_MODEL_P */
This page took 0.084967 seconds and 4 git commands to generate.