1 /* frv simulator fr550 dependent profiling code.
3 Copyright (C) 2003-2024 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 3 of the License, or
11 (at your option) any later version.
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
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* This must come before any other includes. */
25 #define WANT_CPU_FRVBF
30 #if WITH_PROFILE_MODEL_P
33 #include "profile-fr550.h"
35 /* Initialize cycle counting for an insn.
36 FIRST_P is non-zero if this is the first insn in a set of parallel
39 fr550_model_insn_before (SIM_CPU
*cpu
, int first_p
)
43 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
44 d
->cur_fr_load
= d
->prev_fr_load
;
45 d
->cur_fr_complex_1
= d
->prev_fr_complex_1
;
46 d
->cur_fr_complex_2
= d
->prev_fr_complex_2
;
47 d
->cur_ccr_complex
= d
->prev_ccr_complex
;
48 d
->cur_acc_mmac
= d
->prev_acc_mmac
;
52 /* Record the cycles computed for an insn.
53 LAST_P is non-zero if this is the last insn in a set of parallel insns,
54 and we update the total cycle count.
55 CYCLES is the cycle count of the insn. */
57 fr550_model_insn_after (SIM_CPU
*cpu
, int last_p
, int cycles
)
61 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
62 d
->prev_fr_load
= d
->cur_fr_load
;
63 d
->prev_fr_complex_1
= d
->cur_fr_complex_1
;
64 d
->prev_fr_complex_2
= d
->cur_fr_complex_2
;
65 d
->prev_ccr_complex
= d
->cur_ccr_complex
;
66 d
->prev_acc_mmac
= d
->cur_acc_mmac
;
70 static void fr550_reset_fr_flags (SIM_CPU
*cpu
, INT fr
);
71 static void fr550_reset_ccr_flags (SIM_CPU
*cpu
, INT ccr
);
72 static void fr550_reset_acc_flags (SIM_CPU
*cpu
, INT acc
);
75 set_use_is_fr_load (SIM_CPU
*cpu
, INT fr
)
77 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
78 fr550_reset_fr_flags (cpu
, (fr
));
79 d
->cur_fr_load
|= (((DI
)1) << (fr
));
83 set_use_not_fr_load (SIM_CPU
*cpu
, INT fr
)
85 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
86 d
->cur_fr_load
&= ~(((DI
)1) << (fr
));
90 use_is_fr_load (SIM_CPU
*cpu
, INT fr
)
92 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
93 return d
->prev_fr_load
& (((DI
)1) << (fr
));
97 set_use_is_fr_complex_1 (SIM_CPU
*cpu
, INT fr
)
99 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
100 fr550_reset_fr_flags (cpu
, (fr
));
101 d
->cur_fr_complex_1
|= (((DI
)1) << (fr
));
105 set_use_not_fr_complex_1 (SIM_CPU
*cpu
, INT fr
)
107 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
108 d
->cur_fr_complex_1
&= ~(((DI
)1) << (fr
));
112 use_is_fr_complex_1 (SIM_CPU
*cpu
, INT fr
)
114 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
115 return d
->prev_fr_complex_1
& (((DI
)1) << (fr
));
119 set_use_is_fr_complex_2 (SIM_CPU
*cpu
, INT fr
)
121 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
122 fr550_reset_fr_flags (cpu
, (fr
));
123 d
->cur_fr_complex_2
|= (((DI
)1) << (fr
));
127 set_use_not_fr_complex_2 (SIM_CPU
*cpu
, INT fr
)
129 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
130 d
->cur_fr_complex_2
&= ~(((DI
)1) << (fr
));
134 use_is_fr_complex_2 (SIM_CPU
*cpu
, INT fr
)
136 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
137 return d
->prev_fr_complex_2
& (((DI
)1) << (fr
));
141 set_use_is_ccr_complex (SIM_CPU
*cpu
, INT ccr
)
143 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
144 fr550_reset_ccr_flags (cpu
, (ccr
));
145 d
->cur_ccr_complex
|= (((SI
)1) << (ccr
));
149 set_use_not_ccr_complex (SIM_CPU
*cpu
, INT ccr
)
151 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
152 d
->cur_ccr_complex
&= ~(((SI
)1) << (ccr
));
157 use_is_ccr_complex (SIM_CPU
*cpu
, INT ccr
)
159 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
160 return d
->prev_ccr_complex
& (((SI
)1) << (ccr
));
165 set_use_is_acc_mmac (SIM_CPU
*cpu
, INT acc
)
167 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
168 fr550_reset_acc_flags (cpu
, (acc
));
169 d
->cur_acc_mmac
|= (((DI
)1) << (acc
));
173 set_use_not_acc_mmac (SIM_CPU
*cpu
, INT acc
)
175 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
176 d
->cur_acc_mmac
&= ~(((DI
)1) << (acc
));
180 use_is_acc_mmac (SIM_CPU
*cpu
, INT acc
)
182 MODEL_FR550_DATA
*d
= CPU_MODEL_DATA (cpu
);
183 return d
->prev_acc_mmac
& (((DI
)1) << (acc
));
187 fr550_reset_fr_flags (SIM_CPU
*cpu
, INT fr
)
189 set_use_not_fr_load (cpu
, fr
);
190 set_use_not_fr_complex_1 (cpu
, fr
);
191 set_use_not_fr_complex_2 (cpu
, fr
);
195 fr550_reset_ccr_flags (SIM_CPU
*cpu
, INT ccr
)
197 set_use_not_ccr_complex (cpu
, ccr
);
201 fr550_reset_acc_flags (SIM_CPU
*cpu
, INT acc
)
203 set_use_not_acc_mmac (cpu
, acc
);
206 /* Detect overlap between two register ranges. Works if one of the registers
207 is -1 with width 1 (i.e. undefined), but not both. */
208 #define REG_OVERLAP(r1, w1, r2, w2) ( \
209 (r1) + (w1) - 1 >= (r2) && (r2) + (w2) - 1 >= (r1) \
212 /* Latency of floating point registers may be less than recorded when followed
213 by another floating point insn. */
215 adjust_float_register_busy (SIM_CPU
*cpu
,
216 INT in_FRi
, int iwidth
,
217 INT in_FRj
, int jwidth
,
218 INT out_FRk
, int kwidth
)
221 /* The latency of FRk may be less than previously recorded.
222 See Table 14-15 in the LSI. */
225 for (i
= 0; i
< iwidth
; ++i
)
227 if (! REG_OVERLAP (in_FRi
+ i
, 1, out_FRk
, kwidth
))
229 if (use_is_fr_load (cpu
, in_FRi
+ i
))
230 decrease_FR_busy (cpu
, in_FRi
+ i
, 1);
232 enforce_full_fr_latency (cpu
, in_FRi
+ i
);
239 for (i
= 0; i
< jwidth
; ++i
)
241 if (! REG_OVERLAP (in_FRj
+ i
, 1, in_FRi
, iwidth
)
242 && ! REG_OVERLAP (in_FRj
+ i
, 1, out_FRk
, kwidth
))
244 if (use_is_fr_load (cpu
, in_FRj
+ i
))
245 decrease_FR_busy (cpu
, in_FRj
+ i
, 1);
247 enforce_full_fr_latency (cpu
, in_FRj
+ i
);
254 for (i
= 0; i
< kwidth
; ++i
)
256 if (! REG_OVERLAP (out_FRk
+ i
, 1, in_FRi
, iwidth
)
257 && ! REG_OVERLAP (out_FRk
+ i
, 1, in_FRj
, jwidth
))
259 if (use_is_fr_complex_1 (cpu
, out_FRk
+ i
))
260 decrease_FR_busy (cpu
, out_FRk
+ i
, 1);
261 else if (use_is_fr_complex_2 (cpu
, out_FRk
+ i
))
262 decrease_FR_busy (cpu
, out_FRk
+ i
, 2);
264 enforce_full_fr_latency (cpu
, out_FRk
+ i
);
271 restore_float_register_busy (SIM_CPU
*cpu
,
272 INT in_FRi
, int iwidth
,
273 INT in_FRj
, int jwidth
,
274 INT out_FRk
, int kwidth
)
277 /* The latency of FRk may be less than previously recorded.
278 See Table 14-15 in the LSI. */
281 for (i
= 0; i
< iwidth
; ++i
)
283 if (! REG_OVERLAP (in_FRi
+ i
, 1, out_FRk
, kwidth
))
284 if (use_is_fr_load (cpu
, in_FRi
+ i
))
285 increase_FR_busy (cpu
, in_FRi
+ i
, 1);
291 for (i
= 0; i
< jwidth
; ++i
)
293 if (! REG_OVERLAP (in_FRj
+ i
, 1, in_FRi
, iwidth
)
294 && ! REG_OVERLAP (in_FRj
+ i
, 1, out_FRk
, kwidth
))
295 if (use_is_fr_load (cpu
, in_FRj
+ i
))
296 increase_FR_busy (cpu
, in_FRj
+ i
, 1);
302 for (i
= 0; i
< kwidth
; ++i
)
304 if (! REG_OVERLAP (out_FRk
+ i
, 1, in_FRi
, iwidth
)
305 && ! REG_OVERLAP (out_FRk
+ i
, 1, in_FRj
, jwidth
))
307 if (use_is_fr_complex_1 (cpu
, out_FRk
+ i
))
308 increase_FR_busy (cpu
, out_FRk
+ i
, 1);
309 else if (use_is_fr_complex_2 (cpu
, out_FRk
+ i
))
310 increase_FR_busy (cpu
, out_FRk
+ i
, 2);
316 /* Latency of floating point registers may be less than recorded when used in a
317 media insns and followed by another media insn. */
319 adjust_float_register_busy_for_media (SIM_CPU
*cpu
,
320 INT in_FRi
, int iwidth
,
321 INT in_FRj
, int jwidth
,
322 INT out_FRk
, int kwidth
)
325 /* The latency of FRk may be less than previously recorded.
326 See Table 14-15 in the LSI. */
329 for (i
= 0; i
< kwidth
; ++i
)
331 if (! REG_OVERLAP (out_FRk
+ i
, 1, in_FRi
, iwidth
)
332 && ! REG_OVERLAP (out_FRk
+ i
, 1, in_FRj
, jwidth
))
334 if (use_is_fr_complex_1 (cpu
, out_FRk
+ i
))
335 decrease_FR_busy (cpu
, out_FRk
+ i
, 1);
337 enforce_full_fr_latency (cpu
, out_FRk
+ i
);
344 restore_float_register_busy_for_media (SIM_CPU
*cpu
,
345 INT in_FRi
, int iwidth
,
346 INT in_FRj
, int jwidth
,
347 INT out_FRk
, int kwidth
)
352 for (i
= 0; i
< kwidth
; ++i
)
354 if (! REG_OVERLAP (out_FRk
+ i
, 1, in_FRi
, iwidth
)
355 && ! REG_OVERLAP (out_FRk
+ i
, 1, in_FRj
, jwidth
))
357 if (use_is_fr_complex_1 (cpu
, out_FRk
+ i
))
358 increase_FR_busy (cpu
, out_FRk
+ i
, 1);
364 /* Latency of accumulator registers may be less than recorded when used in a
365 media insns and followed by another media insn. */
367 adjust_acc_busy_for_mmac (SIM_CPU
*cpu
,
368 INT in_ACC
, int inwidth
,
369 INT out_ACC
, int outwidth
)
372 /* The latency of an accumulator may be less than previously recorded.
373 See Table 14-15 in the LSI. */
376 for (i
= 0; i
< inwidth
; ++i
)
378 if (use_is_acc_mmac (cpu
, in_ACC
+ i
))
379 decrease_ACC_busy (cpu
, in_ACC
+ i
, 1);
381 enforce_full_acc_latency (cpu
, in_ACC
+ i
);
386 for (i
= 0; i
< outwidth
; ++i
)
388 if (! REG_OVERLAP (out_ACC
+ i
, 1, in_ACC
, inwidth
))
390 if (use_is_acc_mmac (cpu
, out_ACC
+ i
))
391 decrease_ACC_busy (cpu
, out_ACC
+ i
, 1);
393 enforce_full_acc_latency (cpu
, out_ACC
+ i
);
400 restore_acc_busy_for_mmac (SIM_CPU
*cpu
,
401 INT in_ACC
, int inwidth
,
402 INT out_ACC
, int outwidth
)
407 for (i
= 0; i
< inwidth
; ++i
)
409 if (use_is_acc_mmac (cpu
, in_ACC
+ i
))
410 increase_ACC_busy (cpu
, in_ACC
+ i
, 1);
415 for (i
= 0; i
< outwidth
; ++i
)
417 if (! REG_OVERLAP (out_ACC
+ i
, 1, in_ACC
, inwidth
))
419 if (use_is_acc_mmac (cpu
, out_ACC
+ i
))
420 increase_ACC_busy (cpu
, out_ACC
+ i
, 1);
427 frvbf_model_fr550_u_exec (SIM_CPU
*cpu
, const IDESC
*idesc
,
428 int unit_num
, int referenced
)
430 return idesc
->timing
->units
[unit_num
].done
;
434 frvbf_model_fr550_u_integer (SIM_CPU
*cpu
, const IDESC
*idesc
,
435 int unit_num
, int referenced
,
436 INT in_GRi
, INT in_GRj
, INT out_GRk
,
441 /* icc0-icc4 are the upper 4 fields of the CCR. */
445 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
447 /* The entire VLIW insn must wait if there is a dependency on a register
448 which is not ready yet. */
449 vliw_wait_for_GR (cpu
, in_GRi
);
450 vliw_wait_for_GR (cpu
, in_GRj
);
451 vliw_wait_for_GR (cpu
, out_GRk
);
452 vliw_wait_for_CCR (cpu
, out_ICCi_1
);
453 handle_resource_wait (cpu
);
454 load_wait_for_GR (cpu
, in_GRi
);
455 load_wait_for_GR (cpu
, in_GRj
);
456 load_wait_for_GR (cpu
, out_GRk
);
457 trace_vliw_wait_cycles (cpu
);
461 fr550_reset_ccr_flags (cpu
, out_ICCi_1
);
463 /* GRk is available immediately to the next VLIW insn as is ICCi_1. */
464 cycles
= idesc
->timing
->units
[unit_num
].done
;
469 frvbf_model_fr550_u_imul (SIM_CPU
*cpu
, const IDESC
*idesc
,
470 int unit_num
, int referenced
,
471 INT in_GRi
, INT in_GRj
, INT out_GRk
, INT out_ICCi_1
)
474 /* icc0-icc4 are the upper 4 fields of the CCR. */
478 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
480 /* The entire VLIW insn must wait if there is a dependency on a register
481 which is not ready yet. */
482 vliw_wait_for_GR (cpu
, in_GRi
);
483 vliw_wait_for_GR (cpu
, in_GRj
);
484 vliw_wait_for_GRdouble (cpu
, out_GRk
);
485 vliw_wait_for_CCR (cpu
, out_ICCi_1
);
486 handle_resource_wait (cpu
);
487 load_wait_for_GR (cpu
, in_GRi
);
488 load_wait_for_GR (cpu
, in_GRj
);
489 load_wait_for_GRdouble (cpu
, out_GRk
);
490 trace_vliw_wait_cycles (cpu
);
494 /* GRk has a latency of 1 cycles. */
495 cycles
= idesc
->timing
->units
[unit_num
].done
;
496 update_GRdouble_latency (cpu
, out_GRk
, cycles
+ 1);
498 /* ICCi_1 has a latency of 1 cycle. */
499 update_CCR_latency (cpu
, out_ICCi_1
, cycles
+ 1);
501 fr550_reset_ccr_flags (cpu
, out_ICCi_1
);
507 frvbf_model_fr550_u_idiv (SIM_CPU
*cpu
, const IDESC
*idesc
,
508 int unit_num
, int referenced
,
509 INT in_GRi
, INT in_GRj
, INT out_GRk
, INT out_ICCi_1
)
515 /* icc0-icc4 are the upper 4 fields of the CCR. */
519 vliw
= CPU_VLIW (cpu
);
520 slot
= vliw
->next_slot
- 1;
521 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_I0
;
523 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
525 /* The entire VLIW insn must wait if there is a dependency on a register
526 which is not ready yet. */
527 vliw_wait_for_GR (cpu
, in_GRi
);
528 vliw_wait_for_GR (cpu
, in_GRj
);
529 vliw_wait_for_GR (cpu
, out_GRk
);
530 vliw_wait_for_CCR (cpu
, out_ICCi_1
);
531 vliw_wait_for_idiv_resource (cpu
, slot
);
532 handle_resource_wait (cpu
);
533 load_wait_for_GR (cpu
, in_GRi
);
534 load_wait_for_GR (cpu
, in_GRj
);
535 load_wait_for_GR (cpu
, out_GRk
);
536 trace_vliw_wait_cycles (cpu
);
540 /* GRk has a latency of 18 cycles! */
541 cycles
= idesc
->timing
->units
[unit_num
].done
;
542 update_GR_latency (cpu
, out_GRk
, cycles
+ 18);
544 /* ICCi_1 has a latency of 18 cycles. */
545 update_CCR_latency (cpu
, out_ICCi_1
, cycles
+ 18);
547 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
549 /* GNER has a latency of 18 cycles. */
550 update_SPR_latency (cpu
, GNER_FOR_GR (out_GRk
), cycles
+ 18);
553 /* the idiv resource has a latency of 18 cycles! */
554 update_idiv_resource_latency (cpu
, slot
, cycles
+ 18);
556 fr550_reset_ccr_flags (cpu
, out_ICCi_1
);
562 frvbf_model_fr550_u_branch (SIM_CPU
*cpu
, const IDESC
*idesc
,
563 int unit_num
, int referenced
,
564 INT in_GRi
, INT in_GRj
,
565 INT in_ICCi_2
, INT in_FCCi_2
)
568 FRV_PROFILE_STATE
*ps
;
570 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
572 /* icc0-icc4 are the upper 4 fields of the CCR. */
576 /* The entire VLIW insn must wait if there is a dependency on a register
577 which is not ready yet. */
578 vliw_wait_for_GR (cpu
, in_GRi
);
579 vliw_wait_for_GR (cpu
, in_GRj
);
580 vliw_wait_for_CCR (cpu
, in_ICCi_2
);
581 vliw_wait_for_CCR (cpu
, in_FCCi_2
);
582 handle_resource_wait (cpu
);
583 load_wait_for_GR (cpu
, in_GRi
);
584 load_wait_for_GR (cpu
, in_GRj
);
585 trace_vliw_wait_cycles (cpu
);
589 /* When counting branches taken or not taken, don't consider branches after
590 the first taken branch in a vliw insn. */
591 ps
= CPU_PROFILE_STATE (cpu
);
592 if (! ps
->vliw_branch_taken
)
594 /* (1 << 4): The pc is the 5th element in inputs, outputs.
595 ??? can be cleaned up */
596 PROFILE_DATA
*p
= CPU_PROFILE_DATA (cpu
);
597 int taken
= (referenced
& (1 << 4)) != 0;
600 ++PROFILE_MODEL_TAKEN_COUNT (p
);
601 ps
->vliw_branch_taken
= 1;
604 ++PROFILE_MODEL_UNTAKEN_COUNT (p
);
607 cycles
= idesc
->timing
->units
[unit_num
].done
;
612 frvbf_model_fr550_u_trap (SIM_CPU
*cpu
, const IDESC
*idesc
,
613 int unit_num
, int referenced
,
614 INT in_GRi
, INT in_GRj
,
615 INT in_ICCi_2
, INT in_FCCi_2
)
619 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
621 /* icc0-icc4 are the upper 4 fields of the CCR. */
625 /* The entire VLIW insn must wait if there is a dependency on a register
626 which is not ready yet. */
627 vliw_wait_for_GR (cpu
, in_GRi
);
628 vliw_wait_for_GR (cpu
, in_GRj
);
629 vliw_wait_for_CCR (cpu
, in_ICCi_2
);
630 vliw_wait_for_CCR (cpu
, in_FCCi_2
);
631 handle_resource_wait (cpu
);
632 load_wait_for_GR (cpu
, in_GRi
);
633 load_wait_for_GR (cpu
, in_GRj
);
634 trace_vliw_wait_cycles (cpu
);
638 cycles
= idesc
->timing
->units
[unit_num
].done
;
643 frvbf_model_fr550_u_check (SIM_CPU
*cpu
, const IDESC
*idesc
,
644 int unit_num
, int referenced
,
645 INT in_ICCi_3
, INT in_FCCi_3
)
647 /* Modelling for this unit is the same as for fr500. */
648 return frvbf_model_fr500_u_check (cpu
, idesc
, unit_num
, referenced
,
649 in_ICCi_3
, in_FCCi_3
);
653 frvbf_model_fr550_u_set_hilo (SIM_CPU
*cpu
, const IDESC
*idesc
,
654 int unit_num
, int referenced
,
655 INT out_GRkhi
, INT out_GRklo
)
659 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
661 /* The entire VLIW insn must wait if there is a dependency on a GR
662 which is not ready yet. */
663 vliw_wait_for_GR (cpu
, out_GRkhi
);
664 vliw_wait_for_GR (cpu
, out_GRklo
);
665 handle_resource_wait (cpu
);
666 load_wait_for_GR (cpu
, out_GRkhi
);
667 load_wait_for_GR (cpu
, out_GRklo
);
668 trace_vliw_wait_cycles (cpu
);
672 /* GRk is available immediately to the next VLIW insn. */
673 cycles
= idesc
->timing
->units
[unit_num
].done
;
679 frvbf_model_fr550_u_gr_load (SIM_CPU
*cpu
, const IDESC
*idesc
,
680 int unit_num
, int referenced
,
681 INT in_GRi
, INT in_GRj
,
682 INT out_GRk
, INT out_GRdoublek
)
686 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
688 /* The entire VLIW insn must wait if there is a dependency on a register
689 which is not ready yet. */
690 vliw_wait_for_GR (cpu
, in_GRi
);
691 vliw_wait_for_GR (cpu
, in_GRj
);
692 vliw_wait_for_GR (cpu
, out_GRk
);
693 vliw_wait_for_GRdouble (cpu
, out_GRdoublek
);
694 handle_resource_wait (cpu
);
695 load_wait_for_GR (cpu
, in_GRi
);
696 load_wait_for_GR (cpu
, in_GRj
);
697 load_wait_for_GR (cpu
, out_GRk
);
698 load_wait_for_GRdouble (cpu
, out_GRdoublek
);
699 trace_vliw_wait_cycles (cpu
);
703 cycles
= idesc
->timing
->units
[unit_num
].done
;
705 /* The latency of GRk for a load will depend on how long it takes to retrieve
706 the the data from the cache or memory. */
707 update_GR_latency_for_load (cpu
, out_GRk
, cycles
);
708 update_GRdouble_latency_for_load (cpu
, out_GRdoublek
, cycles
);
710 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
712 /* GNER has a latency of 2 cycles. */
713 update_SPR_latency (cpu
, GNER_FOR_GR (out_GRk
), cycles
+ 2);
714 update_SPR_latency (cpu
, GNER_FOR_GR (out_GRdoublek
), cycles
+ 2);
721 frvbf_model_fr550_u_gr_store (SIM_CPU
*cpu
, const IDESC
*idesc
,
722 int unit_num
, int referenced
,
723 INT in_GRi
, INT in_GRj
,
724 INT in_GRk
, INT in_GRdoublek
)
728 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
730 /* The entire VLIW insn must wait if there is a dependency on a register
731 which is not ready yet. */
732 vliw_wait_for_GR (cpu
, in_GRi
);
733 vliw_wait_for_GR (cpu
, in_GRj
);
734 vliw_wait_for_GR (cpu
, in_GRk
);
735 vliw_wait_for_GRdouble (cpu
, in_GRdoublek
);
736 handle_resource_wait (cpu
);
737 load_wait_for_GR (cpu
, in_GRi
);
738 load_wait_for_GR (cpu
, in_GRj
);
739 load_wait_for_GR (cpu
, in_GRk
);
740 load_wait_for_GRdouble (cpu
, in_GRdoublek
);
741 trace_vliw_wait_cycles (cpu
);
745 /* The target register is available immediately. */
746 cycles
= idesc
->timing
->units
[unit_num
].done
;
752 frvbf_model_fr550_u_fr_load (SIM_CPU
*cpu
, const IDESC
*idesc
,
753 int unit_num
, int referenced
,
754 INT in_GRi
, INT in_GRj
,
755 INT out_FRk
, INT out_FRdoublek
)
758 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
760 /* The entire VLIW insn must wait if there is a dependency on a register
761 which is not ready yet.
762 The latency of the registers may be less than previously recorded,
763 depending on how they were used previously.
764 See Table 13-8 in the LSI. */
765 adjust_float_register_busy (cpu
, -1, 1, -1, 1, out_FRk
, 1);
766 adjust_float_register_busy (cpu
, -1, 1, -1, 1, out_FRdoublek
, 2);
767 vliw_wait_for_GR (cpu
, in_GRi
);
768 vliw_wait_for_GR (cpu
, in_GRj
);
769 vliw_wait_for_FR (cpu
, out_FRk
);
770 vliw_wait_for_FRdouble (cpu
, out_FRdoublek
);
771 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
773 vliw_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
774 vliw_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
776 handle_resource_wait (cpu
);
777 load_wait_for_GR (cpu
, in_GRi
);
778 load_wait_for_GR (cpu
, in_GRj
);
779 load_wait_for_FR (cpu
, out_FRk
);
780 load_wait_for_FRdouble (cpu
, out_FRdoublek
);
781 trace_vliw_wait_cycles (cpu
);
785 cycles
= idesc
->timing
->units
[unit_num
].done
;
787 /* The latency of FRk for a load will depend on how long it takes to retrieve
788 the the data from the cache or memory. */
789 update_FR_latency_for_load (cpu
, out_FRk
, cycles
);
790 update_FRdouble_latency_for_load (cpu
, out_FRdoublek
, cycles
);
792 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
794 /* FNER has a latency of 3 cycles. */
795 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), cycles
+ 3);
796 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), cycles
+ 3);
800 set_use_is_fr_load (cpu
, out_FRk
);
801 if (out_FRdoublek
>= 0)
803 set_use_is_fr_load (cpu
, out_FRdoublek
);
804 set_use_is_fr_load (cpu
, out_FRdoublek
+ 1);
811 frvbf_model_fr550_u_fr_store (SIM_CPU
*cpu
, const IDESC
*idesc
,
812 int unit_num
, int referenced
,
813 INT in_GRi
, INT in_GRj
,
814 INT in_FRk
, INT in_FRdoublek
)
818 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
820 /* The entire VLIW insn must wait if there is a dependency on a register
821 which is not ready yet. */
822 adjust_float_register_busy (cpu
, in_FRk
, 1, -1, 1, -1, 1);
823 adjust_float_register_busy (cpu
, in_FRdoublek
, 2, -1, 1, -1, 1);
824 vliw_wait_for_GR (cpu
, in_GRi
);
825 vliw_wait_for_GR (cpu
, in_GRj
);
826 vliw_wait_for_FR (cpu
, in_FRk
);
827 vliw_wait_for_FRdouble (cpu
, in_FRdoublek
);
828 handle_resource_wait (cpu
);
829 load_wait_for_GR (cpu
, in_GRi
);
830 load_wait_for_GR (cpu
, in_GRj
);
831 load_wait_for_FR (cpu
, in_FRk
);
832 load_wait_for_FRdouble (cpu
, in_FRdoublek
);
833 trace_vliw_wait_cycles (cpu
);
837 /* The target register is available immediately. */
838 cycles
= idesc
->timing
->units
[unit_num
].done
;
844 frvbf_model_fr550_u_ici (SIM_CPU
*cpu
, const IDESC
*idesc
,
845 int unit_num
, int referenced
,
846 INT in_GRi
, INT in_GRj
)
850 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
852 /* The entire VLIW insn must wait if there is a dependency on a register
853 which is not ready yet. */
854 vliw_wait_for_GR (cpu
, in_GRi
);
855 vliw_wait_for_GR (cpu
, in_GRj
);
856 handle_resource_wait (cpu
);
857 load_wait_for_GR (cpu
, in_GRi
);
858 load_wait_for_GR (cpu
, in_GRj
);
859 trace_vliw_wait_cycles (cpu
);
863 cycles
= idesc
->timing
->units
[unit_num
].done
;
864 request_cache_invalidate (cpu
, CPU_INSN_CACHE (cpu
), cycles
);
869 frvbf_model_fr550_u_dci (SIM_CPU
*cpu
, const IDESC
*idesc
,
870 int unit_num
, int referenced
,
871 INT in_GRi
, INT in_GRj
)
875 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
877 /* The entire VLIW insn must wait if there is a dependency on a register
878 which is not ready yet. */
879 vliw_wait_for_GR (cpu
, in_GRi
);
880 vliw_wait_for_GR (cpu
, in_GRj
);
881 handle_resource_wait (cpu
);
882 load_wait_for_GR (cpu
, in_GRi
);
883 load_wait_for_GR (cpu
, in_GRj
);
884 trace_vliw_wait_cycles (cpu
);
888 cycles
= idesc
->timing
->units
[unit_num
].done
;
889 request_cache_invalidate (cpu
, CPU_DATA_CACHE (cpu
), cycles
);
894 frvbf_model_fr550_u_dcf (SIM_CPU
*cpu
, const IDESC
*idesc
,
895 int unit_num
, int referenced
,
896 INT in_GRi
, INT in_GRj
)
900 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
902 /* The entire VLIW insn must wait if there is a dependency on a register
903 which is not ready yet. */
904 vliw_wait_for_GR (cpu
, in_GRi
);
905 vliw_wait_for_GR (cpu
, in_GRj
);
906 handle_resource_wait (cpu
);
907 load_wait_for_GR (cpu
, in_GRi
);
908 load_wait_for_GR (cpu
, in_GRj
);
909 trace_vliw_wait_cycles (cpu
);
913 cycles
= idesc
->timing
->units
[unit_num
].done
;
914 request_cache_flush (cpu
, CPU_DATA_CACHE (cpu
), cycles
);
919 frvbf_model_fr550_u_icpl (SIM_CPU
*cpu
, const IDESC
*idesc
,
920 int unit_num
, int referenced
,
921 INT in_GRi
, INT in_GRj
)
925 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
927 /* The entire VLIW insn must wait if there is a dependency on a register
928 which is not ready yet. */
929 vliw_wait_for_GR (cpu
, in_GRi
);
930 vliw_wait_for_GR (cpu
, in_GRj
);
931 handle_resource_wait (cpu
);
932 load_wait_for_GR (cpu
, in_GRi
);
933 load_wait_for_GR (cpu
, in_GRj
);
934 trace_vliw_wait_cycles (cpu
);
938 cycles
= idesc
->timing
->units
[unit_num
].done
;
939 request_cache_preload (cpu
, CPU_INSN_CACHE (cpu
), cycles
);
944 frvbf_model_fr550_u_dcpl (SIM_CPU
*cpu
, const IDESC
*idesc
,
945 int unit_num
, int referenced
,
946 INT in_GRi
, INT in_GRj
)
950 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
952 /* The entire VLIW insn must wait if there is a dependency on a register
953 which is not ready yet. */
954 vliw_wait_for_GR (cpu
, in_GRi
);
955 vliw_wait_for_GR (cpu
, in_GRj
);
956 handle_resource_wait (cpu
);
957 load_wait_for_GR (cpu
, in_GRi
);
958 load_wait_for_GR (cpu
, in_GRj
);
959 trace_vliw_wait_cycles (cpu
);
963 cycles
= idesc
->timing
->units
[unit_num
].done
;
964 request_cache_preload (cpu
, CPU_DATA_CACHE (cpu
), cycles
);
969 frvbf_model_fr550_u_icul (SIM_CPU
*cpu
, const IDESC
*idesc
,
970 int unit_num
, int referenced
,
971 INT in_GRi
, INT in_GRj
)
975 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
977 /* The entire VLIW insn must wait if there is a dependency on a register
978 which is not ready yet. */
979 vliw_wait_for_GR (cpu
, in_GRi
);
980 vliw_wait_for_GR (cpu
, in_GRj
);
981 handle_resource_wait (cpu
);
982 load_wait_for_GR (cpu
, in_GRi
);
983 load_wait_for_GR (cpu
, in_GRj
);
984 trace_vliw_wait_cycles (cpu
);
988 cycles
= idesc
->timing
->units
[unit_num
].done
;
989 request_cache_unlock (cpu
, CPU_INSN_CACHE (cpu
), cycles
);
994 frvbf_model_fr550_u_dcul (SIM_CPU
*cpu
, const IDESC
*idesc
,
995 int unit_num
, int referenced
,
996 INT in_GRi
, INT in_GRj
)
1000 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1002 /* The entire VLIW insn must wait if there is a dependency on a register
1003 which is not ready yet. */
1004 vliw_wait_for_GR (cpu
, in_GRi
);
1005 vliw_wait_for_GR (cpu
, in_GRj
);
1006 handle_resource_wait (cpu
);
1007 load_wait_for_GR (cpu
, in_GRi
);
1008 load_wait_for_GR (cpu
, in_GRj
);
1009 trace_vliw_wait_cycles (cpu
);
1013 cycles
= idesc
->timing
->units
[unit_num
].done
;
1014 request_cache_unlock (cpu
, CPU_DATA_CACHE (cpu
), cycles
);
1019 frvbf_model_fr550_u_float_arith (SIM_CPU
*cpu
, const IDESC
*idesc
,
1020 int unit_num
, int referenced
,
1021 INT in_FRi
, INT in_FRj
,
1022 INT in_FRdoublei
, INT in_FRdoublej
,
1023 INT out_FRk
, INT out_FRdoublek
)
1026 FRV_PROFILE_STATE
*ps
;
1030 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1033 /* The preprocessing can execute right away. */
1034 cycles
= idesc
->timing
->units
[unit_num
].done
;
1036 /* The post processing must wait if there is a dependency on a FR
1037 which is not ready yet. */
1038 adjust_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1039 adjust_float_register_busy (cpu
, in_FRdoublei
, 2, in_FRdoublej
, 2, out_FRdoublek
, 2);
1040 ps
= CPU_PROFILE_STATE (cpu
);
1041 ps
->post_wait
= cycles
;
1042 vliw
= CPU_VLIW (cpu
);
1043 slot
= vliw
->next_slot
- 1;
1044 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1045 post_wait_for_float (cpu
, slot
);
1046 post_wait_for_FR (cpu
, in_FRi
);
1047 post_wait_for_FR (cpu
, in_FRj
);
1048 post_wait_for_FR (cpu
, out_FRk
);
1049 post_wait_for_FRdouble (cpu
, in_FRdoublei
);
1050 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1051 post_wait_for_FRdouble (cpu
, out_FRdoublek
);
1052 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1054 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1055 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
1057 restore_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1058 restore_float_register_busy (cpu
, in_FRdoublei
, 2, in_FRdoublej
, 2, out_FRdoublek
, 2);
1060 /* The latency of FRk will be at least the latency of the other inputs. */
1061 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1062 update_FRdouble_latency (cpu
, out_FRdoublek
, ps
->post_wait
);
1064 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1066 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1067 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), ps
->post_wait
);
1070 /* Once initiated, post-processing will take 2 cycles. */
1071 update_FR_ptime (cpu
, out_FRk
, 2);
1072 update_FRdouble_ptime (cpu
, out_FRdoublek
, 2);
1073 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1075 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 2);
1076 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRdoublek
), 2);
1079 /* Mark this use of the register as a floating point op. */
1081 set_use_is_fr_complex_2 (cpu
, out_FRk
);
1082 if (out_FRdoublek
>= 0)
1084 set_use_is_fr_complex_2 (cpu
, out_FRdoublek
);
1085 if (out_FRdoublek
< 63)
1086 set_use_is_fr_complex_2 (cpu
, out_FRdoublek
+ 1);
1089 /* the media point unit resource has a latency of 4 cycles */
1090 update_media_resource_latency (cpu
, slot
, cycles
+ 4);
1096 frvbf_model_fr550_u_float_dual_arith (SIM_CPU
*cpu
, const IDESC
*idesc
,
1097 int unit_num
, int referenced
,
1098 INT in_FRi
, INT in_FRj
,
1099 INT in_FRdoublei
, INT in_FRdoublej
,
1100 INT out_FRk
, INT out_FRdoublek
)
1109 FRV_PROFILE_STATE
*ps
;
1113 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1116 /* The preprocessing can execute right away. */
1117 cycles
= idesc
->timing
->units
[unit_num
].done
;
1119 /* The post processing must wait if there is a dependency on a FR
1120 which is not ready yet. */
1121 dual_FRi
= DUAL_REG (in_FRi
);
1122 dual_FRj
= DUAL_REG (in_FRj
);
1123 dual_FRk
= DUAL_REG (out_FRk
);
1124 dual_FRdoublei
= DUAL_DOUBLE (in_FRdoublei
);
1125 dual_FRdoublej
= DUAL_DOUBLE (in_FRdoublej
);
1126 dual_FRdoublek
= DUAL_DOUBLE (out_FRdoublek
);
1128 adjust_float_register_busy (cpu
, in_FRi
, 2, in_FRj
, 2, out_FRk
, 2);
1129 adjust_float_register_busy (cpu
, in_FRdoublei
, 4, in_FRdoublej
, 4, out_FRdoublek
, 4);
1130 ps
= CPU_PROFILE_STATE (cpu
);
1131 ps
->post_wait
= cycles
;
1132 vliw
= CPU_VLIW (cpu
);
1133 slot
= vliw
->next_slot
- 1;
1134 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1135 post_wait_for_float (cpu
, slot
);
1136 post_wait_for_FR (cpu
, in_FRi
);
1137 post_wait_for_FR (cpu
, in_FRj
);
1138 post_wait_for_FR (cpu
, out_FRk
);
1139 post_wait_for_FR (cpu
, dual_FRi
);
1140 post_wait_for_FR (cpu
, dual_FRj
);
1141 post_wait_for_FR (cpu
, dual_FRk
);
1142 post_wait_for_FRdouble (cpu
, in_FRdoublei
);
1143 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1144 post_wait_for_FRdouble (cpu
, out_FRdoublek
);
1145 post_wait_for_FRdouble (cpu
, dual_FRdoublei
);
1146 post_wait_for_FRdouble (cpu
, dual_FRdoublej
);
1147 post_wait_for_FRdouble (cpu
, dual_FRdoublek
);
1148 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1150 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1151 post_wait_for_SPR (cpu
, FNER_FOR_FR (dual_FRk
));
1152 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
1153 post_wait_for_SPR (cpu
, FNER_FOR_FR (dual_FRdoublek
));
1155 restore_float_register_busy (cpu
, in_FRi
, 2, in_FRj
, 2, out_FRk
, 2);
1156 restore_float_register_busy (cpu
, in_FRdoublei
, 4, in_FRdoublej
, 4, out_FRdoublek
, 4);
1158 /* The latency of FRk will be at least the latency of the other inputs. */
1159 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1160 update_FR_latency (cpu
, dual_FRk
, ps
->post_wait
);
1161 update_FRdouble_latency (cpu
, out_FRdoublek
, ps
->post_wait
);
1162 update_FRdouble_latency (cpu
, dual_FRdoublek
, ps
->post_wait
);
1164 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1166 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1167 update_SPR_latency (cpu
, FNER_FOR_FR (dual_FRk
), ps
->post_wait
);
1168 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), ps
->post_wait
);
1169 update_SPR_latency (cpu
, FNER_FOR_FR (dual_FRdoublek
), ps
->post_wait
);
1172 /* Once initiated, post-processing will take 3 cycles. */
1173 update_FR_ptime (cpu
, out_FRk
, 3);
1174 update_FR_ptime (cpu
, dual_FRk
, 3);
1175 update_FRdouble_ptime (cpu
, out_FRdoublek
, 3);
1176 update_FRdouble_ptime (cpu
, dual_FRdoublek
, 3);
1178 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1180 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 3);
1181 update_SPR_ptime (cpu
, FNER_FOR_FR (dual_FRk
), 3);
1182 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRdoublek
), 3);
1183 update_SPR_ptime (cpu
, FNER_FOR_FR (dual_FRdoublek
), 3);
1186 /* Mark this use of the register as a floating point op. */
1188 fr550_reset_fr_flags (cpu
, out_FRk
);
1190 fr550_reset_fr_flags (cpu
, dual_FRk
);
1191 if (out_FRdoublek
>= 0)
1193 fr550_reset_fr_flags (cpu
, out_FRdoublek
);
1194 if (out_FRdoublek
< 63)
1195 fr550_reset_fr_flags (cpu
, out_FRdoublek
+ 1);
1197 if (dual_FRdoublek
>= 0)
1199 fr550_reset_fr_flags (cpu
, dual_FRdoublek
);
1200 if (dual_FRdoublek
< 63)
1201 fr550_reset_fr_flags (cpu
, dual_FRdoublek
+ 1);
1204 /* the media point unit resource has a latency of 5 cycles */
1205 update_media_resource_latency (cpu
, slot
, cycles
+ 5);
1211 frvbf_model_fr550_u_float_div (SIM_CPU
*cpu
, const IDESC
*idesc
,
1212 int unit_num
, int referenced
,
1213 INT in_FRi
, INT in_FRj
, INT out_FRk
)
1218 FRV_PROFILE_STATE
*ps
;
1220 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1223 cycles
= idesc
->timing
->units
[unit_num
].done
;
1225 /* The post processing must wait if there is a dependency on a FR
1226 which is not ready yet. */
1227 adjust_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1228 ps
= CPU_PROFILE_STATE (cpu
);
1229 ps
->post_wait
= cycles
;
1230 vliw
= CPU_VLIW (cpu
);
1231 slot
= vliw
->next_slot
- 1;
1232 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1233 post_wait_for_float (cpu
, slot
);
1234 post_wait_for_fdiv (cpu
, slot
);
1235 post_wait_for_FR (cpu
, in_FRi
);
1236 post_wait_for_FR (cpu
, in_FRj
);
1237 post_wait_for_FR (cpu
, out_FRk
);
1238 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1239 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1240 restore_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1242 /* The latency of FRk will be at least the latency of the other inputs. */
1243 /* Once initiated, post-processing will take 9 cycles. */
1244 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1245 update_FR_ptime (cpu
, out_FRk
, 9);
1247 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1249 /* FNER has a latency of 9 cycles. */
1250 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1251 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 9);
1254 /* The latency of the fdiv unit will be at least the latency of the other
1255 inputs. Once initiated, post-processing will take 9 cycles. */
1256 update_fdiv_resource_latency (cpu
, slot
, ps
->post_wait
+ 9);
1258 /* the media point unit resource has a latency of 11 cycles */
1259 update_media_resource_latency (cpu
, slot
, cycles
+ 11);
1261 fr550_reset_fr_flags (cpu
, out_FRk
);
1267 frvbf_model_fr550_u_float_sqrt (SIM_CPU
*cpu
, const IDESC
*idesc
,
1268 int unit_num
, int referenced
,
1269 INT in_FRj
, INT in_FRdoublej
,
1270 INT out_FRk
, INT out_FRdoublek
)
1275 FRV_PROFILE_STATE
*ps
;
1277 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1280 cycles
= idesc
->timing
->units
[unit_num
].done
;
1282 /* The post processing must wait if there is a dependency on a FR
1283 which is not ready yet. */
1284 adjust_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1285 adjust_float_register_busy (cpu
, -1, 1, in_FRdoublej
, 2, out_FRdoublek
, 2);
1286 ps
= CPU_PROFILE_STATE (cpu
);
1287 ps
->post_wait
= cycles
;
1288 vliw
= CPU_VLIW (cpu
);
1289 slot
= vliw
->next_slot
- 1;
1290 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1291 post_wait_for_float (cpu
, slot
);
1292 post_wait_for_fsqrt (cpu
, slot
);
1293 post_wait_for_FR (cpu
, in_FRj
);
1294 post_wait_for_FR (cpu
, out_FRk
);
1295 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1296 post_wait_for_FRdouble (cpu
, out_FRdoublek
);
1297 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1299 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1300 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
1302 restore_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1303 restore_float_register_busy (cpu
, -1, 1, in_FRdoublej
, 2, out_FRdoublek
, 2);
1305 /* The latency of FRk will be at least the latency of the other inputs. */
1306 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1307 update_FRdouble_latency (cpu
, out_FRdoublek
, ps
->post_wait
);
1309 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1311 /* FNER has a latency of 14 cycles. */
1312 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1313 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), ps
->post_wait
);
1316 /* Once initiated, post-processing will take 14 cycles. */
1317 update_FR_ptime (cpu
, out_FRk
, 14);
1318 update_FRdouble_ptime (cpu
, out_FRdoublek
, 14);
1320 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1322 /* FNER has a latency of 14 cycles. */
1323 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 14);
1324 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRdoublek
), 14);
1327 /* The latency of the sqrt unit will be the latency of the other
1328 inputs plus 14 cycles. */
1329 update_fsqrt_resource_latency (cpu
, slot
, ps
->post_wait
+ 14);
1331 fr550_reset_fr_flags (cpu
, out_FRk
);
1332 if (out_FRdoublek
!= -1)
1334 fr550_reset_fr_flags (cpu
, out_FRdoublek
);
1335 fr550_reset_fr_flags (cpu
, out_FRdoublek
+ 1);
1338 /* the media point unit resource has a latency of 16 cycles */
1339 update_media_resource_latency (cpu
, slot
, cycles
+ 16);
1345 frvbf_model_fr550_u_float_compare (SIM_CPU
*cpu
, const IDESC
*idesc
,
1346 int unit_num
, int referenced
,
1347 INT in_FRi
, INT in_FRj
,
1348 INT in_FRdoublei
, INT in_FRdoublej
,
1352 FRV_PROFILE_STATE
*ps
;
1356 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1359 /* The preprocessing can execute right away. */
1360 cycles
= idesc
->timing
->units
[unit_num
].done
;
1362 /* The post processing must wait if there is a dependency on a FR
1363 which is not ready yet. */
1364 adjust_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, -1, 1);
1365 adjust_float_register_busy (cpu
, in_FRdoublei
, 2, in_FRdoublej
, 2, -1, 1);
1366 ps
= CPU_PROFILE_STATE (cpu
);
1367 ps
->post_wait
= cycles
;
1368 vliw
= CPU_VLIW (cpu
);
1369 slot
= vliw
->next_slot
- 1;
1370 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1371 post_wait_for_float (cpu
, slot
);
1372 post_wait_for_FR (cpu
, in_FRi
);
1373 post_wait_for_FR (cpu
, in_FRj
);
1374 post_wait_for_FRdouble (cpu
, in_FRdoublei
);
1375 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1376 post_wait_for_CCR (cpu
, out_FCCi_2
);
1377 restore_float_register_busy (cpu
, in_FRi
, 1, in_FRj
, 1, -1, 1);
1378 restore_float_register_busy (cpu
, in_FRdoublei
, 2, in_FRdoublej
, 2, -1, 1);
1380 /* The latency of FCCi_2 will be the latency of the other inputs plus 2
1382 update_CCR_latency (cpu
, out_FCCi_2
, ps
->post_wait
+ 2);
1384 /* the media point unit resource has a latency of 4 cycles */
1385 update_media_resource_latency (cpu
, slot
, cycles
+ 4);
1387 set_use_is_ccr_complex (cpu
, out_FCCi_2
);
1393 frvbf_model_fr550_u_float_dual_compare (SIM_CPU
*cpu
, const IDESC
*idesc
,
1394 int unit_num
, int referenced
,
1395 INT in_FRi
, INT in_FRj
,
1402 FRV_PROFILE_STATE
*ps
;
1406 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1409 /* The preprocessing can execute right away. */
1410 cycles
= idesc
->timing
->units
[unit_num
].done
;
1412 /* The post processing must wait if there is a dependency on a FR
1413 which is not ready yet. */
1414 ps
= CPU_PROFILE_STATE (cpu
);
1415 ps
->post_wait
= cycles
;
1416 dual_FRi
= DUAL_REG (in_FRi
);
1417 dual_FRj
= DUAL_REG (in_FRj
);
1418 dual_FCCi_2
= out_FCCi_2
+ 1;
1419 adjust_float_register_busy (cpu
, in_FRi
, 2, in_FRj
, 2, -1, 1);
1420 vliw
= CPU_VLIW (cpu
);
1421 slot
= vliw
->next_slot
- 1;
1422 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1423 post_wait_for_float (cpu
, slot
);
1424 post_wait_for_FR (cpu
, in_FRi
);
1425 post_wait_for_FR (cpu
, in_FRj
);
1426 post_wait_for_FR (cpu
, dual_FRi
);
1427 post_wait_for_FR (cpu
, dual_FRj
);
1428 post_wait_for_CCR (cpu
, out_FCCi_2
);
1429 post_wait_for_CCR (cpu
, dual_FCCi_2
);
1430 restore_float_register_busy (cpu
, in_FRi
, 2, in_FRj
, 2, -1, 1);
1432 /* The latency of FCCi_2 will be the latency of the other inputs plus 3
1434 update_CCR_latency (cpu
, out_FCCi_2
, ps
->post_wait
+ 3);
1435 update_CCR_latency (cpu
, dual_FCCi_2
, ps
->post_wait
+ 3);
1437 set_use_is_ccr_complex (cpu
, out_FCCi_2
);
1438 if (dual_FCCi_2
>= 0)
1439 set_use_is_ccr_complex (cpu
, dual_FCCi_2
);
1441 /* the media point unit resource has a latency of 5 cycles */
1442 update_media_resource_latency (cpu
, slot
, cycles
+ 5);
1448 frvbf_model_fr550_u_float_convert (SIM_CPU
*cpu
, const IDESC
*idesc
,
1449 int unit_num
, int referenced
,
1450 INT in_FRj
, INT in_FRintj
, INT in_FRdoublej
,
1451 INT out_FRk
, INT out_FRintk
,
1455 FRV_PROFILE_STATE
*ps
;
1459 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1462 /* The preprocessing can execute right away. */
1463 cycles
= idesc
->timing
->units
[unit_num
].done
;
1465 /* The post processing must wait if there is a dependency on a FR
1466 which is not ready yet. */
1467 ps
= CPU_PROFILE_STATE (cpu
);
1468 ps
->post_wait
= cycles
;
1469 adjust_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1470 adjust_float_register_busy (cpu
, -1, 1, in_FRintj
, 1, out_FRintk
, 1);
1471 adjust_float_register_busy (cpu
, -1, 1, in_FRdoublej
, 2, out_FRdoublek
, 2);
1472 vliw
= CPU_VLIW (cpu
);
1473 slot
= vliw
->next_slot
- 1;
1474 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1475 post_wait_for_float (cpu
, slot
);
1476 post_wait_for_FR (cpu
, in_FRj
);
1477 post_wait_for_FR (cpu
, in_FRintj
);
1478 post_wait_for_FRdouble (cpu
, in_FRdoublej
);
1479 post_wait_for_FR (cpu
, out_FRk
);
1480 post_wait_for_FR (cpu
, out_FRintk
);
1481 post_wait_for_FRdouble (cpu
, out_FRdoublek
);
1482 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1484 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRk
));
1485 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRintk
));
1486 post_wait_for_SPR (cpu
, FNER_FOR_FR (out_FRdoublek
));
1488 restore_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1489 restore_float_register_busy (cpu
, -1, 1, in_FRintj
, 1, out_FRintk
, 1);
1490 restore_float_register_busy (cpu
, -1, 1, in_FRdoublej
, 2, out_FRdoublek
, 2);
1492 /* The latency of FRk will be at least the latency of the other inputs. */
1493 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1494 update_FR_latency (cpu
, out_FRintk
, ps
->post_wait
);
1495 update_FRdouble_latency (cpu
, out_FRdoublek
, ps
->post_wait
);
1497 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1499 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRk
), ps
->post_wait
);
1500 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRintk
), ps
->post_wait
);
1501 update_SPR_latency (cpu
, FNER_FOR_FR (out_FRdoublek
), ps
->post_wait
);
1504 /* Once initiated, post-processing will take 2 cycles. */
1505 update_FR_ptime (cpu
, out_FRk
, 2);
1506 update_FR_ptime (cpu
, out_FRintk
, 2);
1507 update_FRdouble_ptime (cpu
, out_FRdoublek
, 2);
1509 if (CGEN_ATTR_VALUE(idesc
, idesc
->attrs
, CGEN_INSN_NON_EXCEPTING
))
1511 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRk
), 2);
1512 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRintk
), 2);
1513 update_SPR_ptime (cpu
, FNER_FOR_FR (out_FRdoublek
), 2);
1516 /* Mark this use of the register as a floating point op. */
1518 set_use_is_fr_complex_2 (cpu
, out_FRk
);
1519 if (out_FRintk
>= 0)
1520 set_use_is_fr_complex_2 (cpu
, out_FRintk
);
1521 if (out_FRdoublek
>= 0)
1523 set_use_is_fr_complex_2 (cpu
, out_FRdoublek
);
1524 set_use_is_fr_complex_2 (cpu
, out_FRdoublek
+ 1);
1527 /* the media point unit resource has a latency of 4 cycles */
1528 update_media_resource_latency (cpu
, slot
, cycles
+ 4);
1534 frvbf_model_fr550_u_spr2gr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1535 int unit_num
, int referenced
,
1536 INT in_spr
, INT out_GRj
)
1538 /* Modelling for this unit is the same as for fr500. */
1539 return frvbf_model_fr500_u_spr2gr (cpu
, idesc
, unit_num
, referenced
,
1544 frvbf_model_fr550_u_gr2spr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1545 int unit_num
, int referenced
,
1546 INT in_GRj
, INT out_spr
)
1550 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1552 /* The entire VLIW insn must wait if there is a dependency on a register
1553 which is not ready yet. */
1554 vliw_wait_for_GR (cpu
, in_GRj
);
1555 vliw_wait_for_SPR (cpu
, out_spr
);
1556 handle_resource_wait (cpu
);
1557 load_wait_for_GR (cpu
, in_GRj
);
1558 trace_vliw_wait_cycles (cpu
);
1562 cycles
= idesc
->timing
->units
[unit_num
].done
;
1565 /* The latency of spr is ? cycles. */
1566 update_SPR_latency (cpu
, out_spr
, cycles
+ ?);
1573 frvbf_model_fr550_u_gr2fr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1574 int unit_num
, int referenced
,
1575 INT in_GRj
, INT out_FRk
)
1579 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1581 /* The entire VLIW insn must wait if there is a dependency on a register
1582 which is not ready yet.
1583 The latency of the registers may be less than previously recorded,
1584 depending on how they were used previously.
1585 See Table 14-15 in the LSI. */
1586 adjust_float_register_busy (cpu
, -1, 1, -1, 1, out_FRk
, 1);
1587 vliw_wait_for_GR (cpu
, in_GRj
);
1588 vliw_wait_for_FR (cpu
, out_FRk
);
1589 handle_resource_wait (cpu
);
1590 load_wait_for_GR (cpu
, in_GRj
);
1591 load_wait_for_FR (cpu
, out_FRk
);
1592 trace_vliw_wait_cycles (cpu
);
1596 /* The latency of FRk is 1 cycles. */
1597 cycles
= idesc
->timing
->units
[unit_num
].done
;
1598 update_FR_latency (cpu
, out_FRk
, cycles
+ 1);
1600 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1606 frvbf_model_fr550_u_swap (SIM_CPU
*cpu
, const IDESC
*idesc
,
1607 int unit_num
, int referenced
,
1608 INT in_GRi
, INT in_GRj
, INT out_GRk
)
1612 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1614 /* The entire VLIW insn must wait if there is a dependency on a register
1615 which is not ready yet. */
1616 vliw_wait_for_GR (cpu
, in_GRi
);
1617 vliw_wait_for_GR (cpu
, in_GRj
);
1618 vliw_wait_for_GR (cpu
, out_GRk
);
1619 handle_resource_wait (cpu
);
1620 load_wait_for_GR (cpu
, in_GRi
);
1621 load_wait_for_GR (cpu
, in_GRj
);
1622 load_wait_for_GR (cpu
, out_GRk
);
1623 trace_vliw_wait_cycles (cpu
);
1627 cycles
= idesc
->timing
->units
[unit_num
].done
;
1629 /* The latency of GRk will depend on how long it takes to swap
1630 the the data from the cache or memory. */
1631 update_GR_latency_for_swap (cpu
, out_GRk
, cycles
);
1637 frvbf_model_fr550_u_fr2fr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1638 int unit_num
, int referenced
,
1639 INT in_FRj
, INT out_FRk
)
1643 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1645 /* The entire VLIW insn must wait if there is a dependency on a register
1646 which is not ready yet.
1647 The latency of the registers may be less than previously recorded,
1648 depending on how they were used previously.
1649 See Table 14-15 in the LSI. */
1650 adjust_float_register_busy (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1651 vliw_wait_for_FR (cpu
, in_FRj
);
1652 vliw_wait_for_FR (cpu
, out_FRk
);
1653 handle_resource_wait (cpu
);
1654 load_wait_for_FR (cpu
, in_FRj
);
1655 load_wait_for_FR (cpu
, out_FRk
);
1656 trace_vliw_wait_cycles (cpu
);
1660 /* The latency of FRj is 2 cycles. */
1661 cycles
= idesc
->timing
->units
[unit_num
].done
;
1662 update_FR_latency (cpu
, out_FRk
, cycles
+ 2);
1664 set_use_is_fr_complex_2 (cpu
, out_FRk
);
1670 frvbf_model_fr550_u_fr2gr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1671 int unit_num
, int referenced
,
1672 INT in_FRk
, INT out_GRj
)
1676 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1678 /* The entire VLIW insn must wait if there is a dependency on a register
1679 which is not ready yet.
1680 The latency of the registers may be less than previously recorded,
1681 depending on how they were used previously.
1682 See Table 14-15 in the LSI. */
1683 adjust_float_register_busy (cpu
, in_FRk
, 1, -1, 1, -1, 1);
1684 vliw_wait_for_FR (cpu
, in_FRk
);
1685 vliw_wait_for_GR (cpu
, out_GRj
);
1686 handle_resource_wait (cpu
);
1687 load_wait_for_FR (cpu
, in_FRk
);
1688 load_wait_for_GR (cpu
, out_GRj
);
1689 trace_vliw_wait_cycles (cpu
);
1693 /* The latency of GRj is 1 cycle. */
1694 cycles
= idesc
->timing
->units
[unit_num
].done
;
1695 update_GR_latency (cpu
, out_GRj
, cycles
+ 1);
1701 frvbf_model_fr550_u_clrgr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1702 int unit_num
, int referenced
,
1705 /* Modelling for this unit is the same as for fr500. */
1706 return frvbf_model_fr500_u_clrgr (cpu
, idesc
, unit_num
, referenced
, in_GRk
);
1710 frvbf_model_fr550_u_clrfr (SIM_CPU
*cpu
, const IDESC
*idesc
,
1711 int unit_num
, int referenced
,
1714 /* Modelling for this unit is the same as for fr500. */
1715 return frvbf_model_fr500_u_clrfr (cpu
, idesc
, unit_num
, referenced
, in_FRk
);
1719 frvbf_model_fr550_u_commit (SIM_CPU
*cpu
, const IDESC
*idesc
,
1720 int unit_num
, int referenced
,
1721 INT in_GRk
, INT in_FRk
)
1723 /* Modelling for this unit is the same as for fr500. */
1724 return frvbf_model_fr500_u_commit (cpu
, idesc
, unit_num
, referenced
,
1729 frvbf_model_fr550_u_media (SIM_CPU
*cpu
, const IDESC
*idesc
,
1730 int unit_num
, int referenced
,
1731 INT in_FRi
, INT in_FRj
, INT out_FRk
)
1734 FRV_PROFILE_STATE
*ps
;
1738 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1741 /* The preprocessing can execute right away. */
1742 cycles
= idesc
->timing
->units
[unit_num
].done
;
1744 /* If the previous use of the registers was a media op,
1745 then their latency may be less than previously recorded.
1746 See Table 14-15 in the LSI. */
1747 adjust_float_register_busy_for_media (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1749 /* The post processing must wait if there is a dependency on a FR
1750 which is not ready yet. */
1751 ps
= CPU_PROFILE_STATE (cpu
);
1752 ps
->post_wait
= cycles
;
1753 vliw
= CPU_VLIW (cpu
);
1754 slot
= vliw
->next_slot
- 1;
1755 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1756 post_wait_for_media (cpu
, slot
);
1757 post_wait_for_FR (cpu
, in_FRi
);
1758 post_wait_for_FR (cpu
, in_FRj
);
1759 post_wait_for_FR (cpu
, out_FRk
);
1761 /* Restore the busy cycles of the registers we used. */
1762 restore_float_register_busy_for_media (cpu
, in_FRi
, 1, in_FRj
, 1, out_FRk
, 1);
1764 /* The latency of tht output register will be at least the latency of the
1765 other inputs. Once initiated, post-processing will take 1 cycle. */
1768 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1769 update_FR_ptime (cpu
, out_FRk
, 1);
1770 /* Mark this use of the register as a media op. */
1771 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1774 /* the floating point unit resource has a latency of 3 cycles */
1775 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
1781 frvbf_model_fr550_u_media_quad (SIM_CPU
*cpu
, const IDESC
*idesc
,
1782 int unit_num
, int referenced
,
1783 INT in_FRi
, INT in_FRj
,
1790 FRV_PROFILE_STATE
*ps
;
1794 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1797 /* The preprocessing can execute right away. */
1798 cycles
= idesc
->timing
->units
[unit_num
].done
;
1800 dual_FRi
= DUAL_REG (in_FRi
);
1801 dual_FRj
= DUAL_REG (in_FRj
);
1802 dual_FRk
= DUAL_REG (out_FRk
);
1804 /* The latency of the registers may be less than previously recorded,
1805 depending on how they were used previously.
1806 See Table 14-15 in the LSI. */
1807 adjust_float_register_busy_for_media (cpu
, in_FRi
, 2, in_FRj
, 2, out_FRk
, 2);
1809 /* The post processing must wait if there is a dependency on a FR
1810 which is not ready yet. */
1811 ps
= CPU_PROFILE_STATE (cpu
);
1812 ps
->post_wait
= cycles
;
1813 vliw
= CPU_VLIW (cpu
);
1814 slot
= vliw
->next_slot
- 1;
1815 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1816 post_wait_for_media (cpu
, slot
);
1817 post_wait_for_FR (cpu
, in_FRi
);
1818 post_wait_for_FR (cpu
, dual_FRi
);
1819 post_wait_for_FR (cpu
, in_FRj
);
1820 post_wait_for_FR (cpu
, dual_FRj
);
1821 post_wait_for_FR (cpu
, out_FRk
);
1822 post_wait_for_FR (cpu
, dual_FRk
);
1824 /* Restore the busy cycles of the registers we used. */
1825 restore_float_register_busy_for_media (cpu
, in_FRi
, 2, in_FRj
, 2, out_FRk
, 2);
1827 /* The latency of the output register will be at least the latency of the
1828 other inputs. Once initiated, post-processing take 1 cycle. */
1829 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1830 update_FR_ptime (cpu
, out_FRk
, 1);
1831 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1835 update_FR_latency (cpu
, dual_FRk
, ps
->post_wait
);
1836 update_FR_ptime (cpu
, dual_FRk
, 1);
1837 set_use_is_fr_complex_1 (cpu
, dual_FRk
);
1840 /* the floating point unit resource has a latency of 3 cycles */
1841 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
1847 frvbf_model_fr550_u_media_dual_expand (SIM_CPU
*cpu
, const IDESC
*idesc
,
1848 int unit_num
, int referenced
,
1849 INT in_FRi
, INT out_FRk
)
1853 FRV_PROFILE_STATE
*ps
;
1857 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1860 /* The preprocessing can execute right away. */
1861 cycles
= idesc
->timing
->units
[unit_num
].done
;
1863 /* If the previous use of the registers was a media op,
1864 then their latency will be less than previously recorded.
1865 See Table 14-15 in the LSI. */
1866 dual_FRk
= DUAL_REG (out_FRk
);
1867 adjust_float_register_busy_for_media (cpu
, in_FRi
, 1, -1, 1, out_FRk
, 2);
1869 /* The post processing must wait if there is a dependency on a FR
1870 which is not ready yet. */
1871 ps
= CPU_PROFILE_STATE (cpu
);
1872 ps
->post_wait
= cycles
;
1873 vliw
= CPU_VLIW (cpu
);
1874 slot
= vliw
->next_slot
- 1;
1875 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1876 post_wait_for_media (cpu
, slot
);
1877 post_wait_for_FR (cpu
, in_FRi
);
1878 post_wait_for_FR (cpu
, out_FRk
);
1879 post_wait_for_FR (cpu
, dual_FRk
);
1881 /* Restore the busy cycles of the registers we used. */
1882 restore_float_register_busy_for_media (cpu
, in_FRi
, 1, -1, 1, out_FRk
, 2);
1884 /* The latency of the output register will be at least the latency of the
1885 other inputs. Once initiated, post-processing will take 1 cycle. */
1886 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1887 update_FR_ptime (cpu
, out_FRk
, 1);
1888 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1892 update_FR_latency (cpu
, dual_FRk
, ps
->post_wait
);
1893 update_FR_ptime (cpu
, dual_FRk
, 1);
1894 set_use_is_fr_complex_1 (cpu
, dual_FRk
);
1897 /* the floating point unit resource has a latency of 3 cycles */
1898 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
1904 frvbf_model_fr550_u_media_3_dual (SIM_CPU
*cpu
, const IDESC
*idesc
,
1905 int unit_num
, int referenced
,
1906 INT in_FRi
, INT out_FRk
)
1910 FRV_PROFILE_STATE
*ps
;
1914 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1917 /* The preprocessing can execute right away. */
1918 cycles
= idesc
->timing
->units
[unit_num
].done
;
1920 dual_FRi
= DUAL_REG (in_FRi
);
1922 /* The latency of the registers may be less than previously recorded,
1923 depending on how they were used previously.
1924 See Table 14-15 in the LSI. */
1925 adjust_float_register_busy_for_media (cpu
, in_FRi
, 2, -1, 1, out_FRk
, 1);
1927 /* The post processing must wait if there is a dependency on a FR
1928 which is not ready yet. */
1929 ps
= CPU_PROFILE_STATE (cpu
);
1930 ps
->post_wait
= cycles
;
1931 vliw
= CPU_VLIW (cpu
);
1932 slot
= vliw
->next_slot
- 1;
1933 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1934 post_wait_for_media (cpu
, slot
);
1935 post_wait_for_FR (cpu
, in_FRi
);
1936 post_wait_for_FR (cpu
, dual_FRi
);
1937 post_wait_for_FR (cpu
, out_FRk
);
1939 /* Restore the busy cycles of the registers we used. */
1940 restore_float_register_busy_for_media (cpu
, in_FRi
, 2, -1, 1, out_FRk
, 1);
1942 /* The latency of the output register will be at least the latency of the
1943 other inputs. Once initiated, post-processing takes 1 cycle. */
1944 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1945 update_FR_ptime (cpu
, out_FRk
, 1);
1947 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1949 /* the floating point unit resource has a latency of 3 cycles */
1950 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
1956 frvbf_model_fr550_u_media_3_acc (SIM_CPU
*cpu
, const IDESC
*idesc
,
1957 int unit_num
, int referenced
,
1958 INT in_FRj
, INT in_ACC40Si
,
1962 FRV_PROFILE_STATE
*ps
;
1966 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
1969 /* The preprocessing can execute right away. */
1970 cycles
= idesc
->timing
->units
[unit_num
].done
;
1972 /* If the previous use of the registers was a media op,
1973 then their latency will be less than previously recorded.
1974 See Table 14-15 in the LSI. */
1975 adjust_float_register_busy_for_media (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1977 /* The post processing must wait if there is a dependency on a FR
1978 which is not ready yet. */
1979 ps
= CPU_PROFILE_STATE (cpu
);
1980 ps
->post_wait
= cycles
;
1981 vliw
= CPU_VLIW (cpu
);
1982 slot
= vliw
->next_slot
- 1;
1983 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
1984 post_wait_for_media (cpu
, slot
);
1985 post_wait_for_FR (cpu
, in_FRj
);
1986 post_wait_for_FR (cpu
, out_FRk
);
1987 post_wait_for_ACC (cpu
, in_ACC40Si
);
1989 /* Restore the busy cycles of the registers we used. */
1990 restore_float_register_busy_for_media (cpu
, -1, 1, in_FRj
, 1, out_FRk
, 1);
1992 /* The latency of tht output register will be at least the latency of the
1993 other inputs. Once initiated, post-processing will take 1 cycle. */
1994 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
1995 update_FR_ptime (cpu
, out_FRk
, 1);
1997 set_use_is_fr_complex_1 (cpu
, out_FRk
);
1999 /* the floating point unit resource has a latency of 3 cycles */
2000 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2006 frvbf_model_fr550_u_media_3_acc_dual (SIM_CPU
*cpu
, const IDESC
*idesc
,
2007 int unit_num
, int referenced
,
2008 INT in_ACC40Si
, INT out_FRk
)
2011 FRV_PROFILE_STATE
*ps
;
2017 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2020 /* The preprocessing can execute right away. */
2021 cycles
= idesc
->timing
->units
[unit_num
].done
;
2023 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2024 dual_FRk
= DUAL_REG (out_FRk
);
2026 /* If the previous use of the registers was a media op,
2027 then their latency will be less than previously recorded.
2028 See Table 14-15 in the LSI. */
2029 adjust_float_register_busy_for_media (cpu
, -1, 1, -1, 1, out_FRk
, 2);
2031 /* The post processing must wait if there is a dependency on a FR
2032 which is not ready yet. */
2033 ps
= CPU_PROFILE_STATE (cpu
);
2034 ps
->post_wait
= cycles
;
2035 vliw
= CPU_VLIW (cpu
);
2036 slot
= vliw
->next_slot
- 1;
2037 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2038 post_wait_for_media (cpu
, slot
);
2039 post_wait_for_ACC (cpu
, in_ACC40Si
);
2040 post_wait_for_ACC (cpu
, ACC40Si_1
);
2041 post_wait_for_FR (cpu
, out_FRk
);
2042 post_wait_for_FR (cpu
, dual_FRk
);
2044 /* Restore the busy cycles of the registers we used. */
2045 restore_float_register_busy_for_media (cpu
, -1, 1, -1, 1, out_FRk
, 2);
2047 /* The latency of the output register will be at least the latency of the
2048 other inputs. Once initiated, post-processing will take 1 cycle. */
2049 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
2050 update_FR_ptime (cpu
, out_FRk
, 1);
2051 set_use_is_fr_complex_1 (cpu
, out_FRk
);
2054 update_FR_latency (cpu
, dual_FRk
, ps
->post_wait
);
2055 update_FR_ptime (cpu
, dual_FRk
, 1);
2056 set_use_is_fr_complex_1 (cpu
, dual_FRk
);
2059 /* the floating point unit resource has a latency of 3 cycles */
2060 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2066 frvbf_model_fr550_u_media_3_wtacc (SIM_CPU
*cpu
, const IDESC
*idesc
,
2067 int unit_num
, int referenced
,
2068 INT in_FRi
, INT out_ACC40Sk
)
2071 FRV_PROFILE_STATE
*ps
;
2075 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2078 /* The preprocessing can execute right away. */
2079 cycles
= idesc
->timing
->units
[unit_num
].done
;
2081 ps
= CPU_PROFILE_STATE (cpu
);
2083 /* The latency of the registers may be less than previously recorded,
2084 depending on how they were used previously.
2085 See Table 14-15 in the LSI. */
2086 adjust_float_register_busy_for_media (cpu
, in_FRi
, 1, -1, 1, -1, 1);
2088 /* The post processing must wait if there is a dependency on a FR
2089 which is not ready yet. */
2090 ps
->post_wait
= cycles
;
2091 vliw
= CPU_VLIW (cpu
);
2092 slot
= vliw
->next_slot
- 1;
2093 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2094 post_wait_for_media (cpu
, slot
);
2095 post_wait_for_FR (cpu
, in_FRi
);
2096 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2098 /* Restore the busy cycles of the registers we used. */
2099 restore_float_register_busy_for_media (cpu
, in_FRi
, 1, -1, 1, -1, 1);
2101 /* The latency of the output register will be at least the latency of the
2102 other inputs. Once initiated, post-processing will take 1 cycle. */
2103 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
);
2104 update_ACC_ptime (cpu
, out_ACC40Sk
, 1);
2105 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2107 /* the floating point unit resource has a latency of 3 cycles */
2108 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2114 frvbf_model_fr550_u_media_3_mclracc (SIM_CPU
*cpu
, const IDESC
*idesc
,
2115 int unit_num
, int referenced
)
2118 FRV_PROFILE_STATE
*ps
;
2123 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2126 /* The preprocessing can execute right away. */
2127 cycles
= idesc
->timing
->units
[unit_num
].done
;
2129 ps
= CPU_PROFILE_STATE (cpu
);
2131 /* The post processing must wait if there is a dependency on a FR
2132 which is not ready yet. */
2133 ps
->post_wait
= cycles
;
2134 vliw
= CPU_VLIW (cpu
);
2135 slot
= vliw
->next_slot
- 1;
2136 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2137 post_wait_for_media (cpu
, slot
);
2139 /* If A was 1 and the accumulator was ACC0, then we must check all
2140 accumulators. Otherwise just wait for the specified accumulator. */
2141 if (ps
->mclracc_A
&& ps
->mclracc_acc
== 0)
2143 for (i
= 0; i
< 8; ++i
)
2144 post_wait_for_ACC (cpu
, i
);
2147 post_wait_for_ACC (cpu
, ps
->mclracc_acc
);
2149 /* The latency of the output registers will be at least the latency of the
2150 other inputs. Once initiated, post-processing will take 1 cycle. */
2151 if (ps
->mclracc_A
&& ps
->mclracc_acc
== 0)
2153 for (i
= 0; i
< 8; ++i
)
2155 update_ACC_latency (cpu
, i
, ps
->post_wait
);
2156 update_ACC_ptime (cpu
, i
, 1);
2157 set_use_is_acc_mmac (cpu
, i
);
2162 update_ACC_latency (cpu
, ps
->mclracc_acc
, ps
->post_wait
);
2163 update_ACC_ptime (cpu
, ps
->mclracc_acc
, 1);
2164 set_use_is_acc_mmac (cpu
, ps
->mclracc_acc
);
2167 /* the floating point unit resource has a latency of 3 cycles */
2168 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2174 frvbf_model_fr550_u_media_set (SIM_CPU
*cpu
, const IDESC
*idesc
,
2175 int unit_num
, int referenced
,
2179 FRV_PROFILE_STATE
*ps
;
2183 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2186 /* The preprocessing can execute right away. */
2187 cycles
= idesc
->timing
->units
[unit_num
].done
;
2189 /* If the previous use of the registers was a media op,
2190 then their latency will be less than previously recorded.
2191 See Table 14-15 in the LSI. */
2192 adjust_float_register_busy_for_media (cpu
, -1, 1, -1, 1, out_FRk
, 1);
2194 /* The post processing must wait if there is a dependency on a FR
2195 which is not ready yet. */
2196 ps
= CPU_PROFILE_STATE (cpu
);
2197 ps
->post_wait
= cycles
;
2198 vliw
= CPU_VLIW (cpu
);
2199 slot
= vliw
->next_slot
- 1;
2200 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2201 post_wait_for_media (cpu
, slot
);
2202 post_wait_for_FR (cpu
, out_FRk
);
2204 /* Restore the busy cycles of the registers we used. */
2205 restore_float_register_busy_for_media (cpu
, -1, 1, -1, 1, out_FRk
, 1);
2207 /* The latency of the output register will be at least the latency of the
2208 other inputs. Once initiated, post-processing takes 1 cycle. */
2209 update_FR_latency (cpu
, out_FRk
, ps
->post_wait
);
2210 update_FR_ptime (cpu
, out_FRk
, 1);
2211 fr550_reset_acc_flags (cpu
, out_FRk
);
2213 /* the floating point unit resource has a latency of 3 cycles */
2214 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2220 frvbf_model_fr550_u_media_4 (SIM_CPU
*cpu
, const IDESC
*idesc
,
2221 int unit_num
, int referenced
,
2222 INT in_FRi
, INT in_FRj
,
2223 INT out_ACC40Sk
, INT out_ACC40Uk
)
2228 FRV_PROFILE_STATE
*ps
;
2232 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2235 /* The preprocessing can execute right away. */
2236 cycles
= idesc
->timing
->units
[unit_num
].done
;
2238 ps
= CPU_PROFILE_STATE (cpu
);
2239 dual_ACC40Sk
= DUAL_REG (out_ACC40Sk
);
2240 dual_ACC40Uk
= DUAL_REG (out_ACC40Uk
);
2242 /* The latency of the registers may be less than previously recorded,
2243 depending on how they were used previously.
2244 See Table 14-15 in the LSI. */
2245 adjust_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Sk
, 2);
2246 adjust_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Uk
, 2);
2248 /* The post processing must wait if there is a dependency on a FR
2249 which is not ready yet. */
2250 ps
->post_wait
= cycles
;
2251 vliw
= CPU_VLIW (cpu
);
2252 slot
= vliw
->next_slot
- 1;
2253 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2254 post_wait_for_media (cpu
, slot
);
2255 post_wait_for_FR (cpu
, in_FRi
);
2256 post_wait_for_FR (cpu
, in_FRj
);
2257 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2258 post_wait_for_ACC (cpu
, dual_ACC40Sk
);
2259 post_wait_for_ACC (cpu
, out_ACC40Uk
);
2260 post_wait_for_ACC (cpu
, dual_ACC40Uk
);
2262 /* Restore the busy cycles of the registers we used. */
2263 restore_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Sk
, 2);
2264 restore_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Uk
, 2);
2266 /* The latency of the output register will be at least the latency of the
2267 other inputs. Once initiated, post-processing will take 1 cycles. */
2268 if (out_ACC40Sk
>= 0)
2270 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2271 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2273 if (dual_ACC40Sk
>= 0)
2275 update_ACC_latency (cpu
, dual_ACC40Sk
, ps
->post_wait
+ 1);
2276 set_use_is_acc_mmac (cpu
, dual_ACC40Sk
);
2278 if (out_ACC40Uk
>= 0)
2280 update_ACC_latency (cpu
, out_ACC40Uk
, ps
->post_wait
+ 1);
2281 set_use_is_acc_mmac (cpu
, out_ACC40Uk
);
2283 if (dual_ACC40Uk
>= 0)
2285 update_ACC_latency (cpu
, dual_ACC40Uk
, ps
->post_wait
+ 1);
2286 set_use_is_acc_mmac (cpu
, dual_ACC40Uk
);
2289 /* the floating point unit resource has a latency of 3 cycles */
2290 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2296 frvbf_model_fr550_u_media_4_acc (SIM_CPU
*cpu
, const IDESC
*idesc
,
2297 int unit_num
, int referenced
,
2298 INT in_ACC40Si
, INT out_ACC40Sk
)
2302 FRV_PROFILE_STATE
*ps
;
2306 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2309 /* The preprocessing can execute right away. */
2310 cycles
= idesc
->timing
->units
[unit_num
].done
;
2312 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2314 ps
= CPU_PROFILE_STATE (cpu
);
2315 /* The latency of the registers may be less than previously recorded,
2316 depending on how they were used previously.
2317 See Table 14-15 in the LSI. */
2318 adjust_acc_busy_for_mmac (cpu
, in_ACC40Si
, 2, out_ACC40Sk
, 1);
2320 /* The post processing must wait if there is a dependency on a register
2321 which is not ready yet. */
2322 ps
->post_wait
= cycles
;
2323 vliw
= CPU_VLIW (cpu
);
2324 slot
= vliw
->next_slot
- 1;
2325 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2326 post_wait_for_media (cpu
, slot
);
2327 post_wait_for_ACC (cpu
, in_ACC40Si
);
2328 post_wait_for_ACC (cpu
, ACC40Si_1
);
2329 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2331 /* Restore the busy cycles of the registers we used. */
2332 restore_acc_busy_for_mmac (cpu
, in_ACC40Si
, 2, out_ACC40Sk
, 1);
2334 /* The latency of the output register will be at least the latency of the
2335 other inputs. Once initiated, post-processing will take 1 cycle. */
2336 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2337 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2339 /* the floating point unit resource has a latency of 3 cycles */
2340 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2346 frvbf_model_fr550_u_media_4_acc_dual (SIM_CPU
*cpu
, const IDESC
*idesc
,
2347 int unit_num
, int referenced
,
2348 INT in_ACC40Si
, INT out_ACC40Sk
)
2355 FRV_PROFILE_STATE
*ps
;
2359 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2362 /* The preprocessing can execute right away. */
2363 cycles
= idesc
->timing
->units
[unit_num
].done
;
2365 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2366 ACC40Si_2
= DUAL_REG (ACC40Si_1
);
2367 ACC40Si_3
= DUAL_REG (ACC40Si_2
);
2368 ACC40Sk_1
= DUAL_REG (out_ACC40Sk
);
2370 ps
= CPU_PROFILE_STATE (cpu
);
2371 /* The latency of the registers may be less than previously recorded,
2372 depending on how they were used previously.
2373 See Table 14-15 in the LSI. */
2374 adjust_acc_busy_for_mmac (cpu
, in_ACC40Si
, 4, out_ACC40Sk
, 2);
2376 /* The post processing must wait if there is a dependency on a register
2377 which is not ready yet. */
2378 ps
->post_wait
= cycles
;
2379 vliw
= CPU_VLIW (cpu
);
2380 slot
= vliw
->next_slot
- 1;
2381 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2382 post_wait_for_media (cpu
, slot
);
2383 post_wait_for_ACC (cpu
, in_ACC40Si
);
2384 post_wait_for_ACC (cpu
, ACC40Si_1
);
2385 post_wait_for_ACC (cpu
, ACC40Si_2
);
2386 post_wait_for_ACC (cpu
, ACC40Si_3
);
2387 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2388 post_wait_for_ACC (cpu
, ACC40Sk_1
);
2390 /* Restore the busy cycles of the registers we used. */
2391 restore_acc_busy_for_mmac (cpu
, in_ACC40Si
, 4, out_ACC40Sk
, 2);
2393 /* The latency of the output register will be at least the latency of the
2394 other inputs. Once initiated, post-processing will take 1 cycle. */
2395 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2396 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2399 update_ACC_latency (cpu
, ACC40Sk_1
, ps
->post_wait
+ 1);
2400 set_use_is_acc_mmac (cpu
, ACC40Sk_1
);
2403 /* the floating point unit resource has a latency of 3 cycles */
2404 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2410 frvbf_model_fr550_u_media_4_add_sub (SIM_CPU
*cpu
, const IDESC
*idesc
,
2411 int unit_num
, int referenced
,
2412 INT in_ACC40Si
, INT out_ACC40Sk
)
2417 FRV_PROFILE_STATE
*ps
;
2421 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2424 /* The preprocessing can execute right away. */
2425 cycles
= idesc
->timing
->units
[unit_num
].done
;
2427 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2428 ACC40Sk_1
= DUAL_REG (out_ACC40Sk
);
2430 ps
= CPU_PROFILE_STATE (cpu
);
2431 /* The latency of the registers may be less than previously recorded,
2432 depending on how they were used previously.
2433 See Table 14-15 in the LSI. */
2434 adjust_acc_busy_for_mmac (cpu
, in_ACC40Si
, 2, out_ACC40Sk
, 2);
2436 /* The post processing must wait if there is a dependency on a register
2437 which is not ready yet. */
2438 ps
->post_wait
= cycles
;
2439 vliw
= CPU_VLIW (cpu
);
2440 slot
= vliw
->next_slot
- 1;
2441 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2442 post_wait_for_media (cpu
, slot
);
2443 post_wait_for_ACC (cpu
, in_ACC40Si
);
2444 post_wait_for_ACC (cpu
, ACC40Si_1
);
2445 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2446 post_wait_for_ACC (cpu
, ACC40Sk_1
);
2448 /* Restore the busy cycles of the registers we used. */
2449 restore_acc_busy_for_mmac (cpu
, in_ACC40Si
, 2, out_ACC40Sk
, 2);
2451 /* The latency of the output register will be at least the latency of the
2452 other inputs. Once initiated, post-processing will take 1 cycle. */
2453 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2454 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2457 update_ACC_latency (cpu
, ACC40Sk_1
, ps
->post_wait
+ 1);
2458 set_use_is_acc_mmac (cpu
, ACC40Sk_1
);
2461 /* the floating point unit resource has a latency of 3 cycles */
2462 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2468 frvbf_model_fr550_u_media_4_add_sub_dual (SIM_CPU
*cpu
, const IDESC
*idesc
,
2469 int unit_num
, int referenced
,
2470 INT in_ACC40Si
, INT out_ACC40Sk
)
2479 FRV_PROFILE_STATE
*ps
;
2483 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2486 /* The preprocessing can execute right away. */
2487 cycles
= idesc
->timing
->units
[unit_num
].done
;
2489 ACC40Si_1
= DUAL_REG (in_ACC40Si
);
2490 ACC40Si_2
= DUAL_REG (ACC40Si_1
);
2491 ACC40Si_3
= DUAL_REG (ACC40Si_2
);
2492 ACC40Sk_1
= DUAL_REG (out_ACC40Sk
);
2493 ACC40Sk_2
= DUAL_REG (ACC40Sk_1
);
2494 ACC40Sk_3
= DUAL_REG (ACC40Sk_2
);
2496 ps
= CPU_PROFILE_STATE (cpu
);
2497 /* The latency of the registers may be less than previously recorded,
2498 depending on how they were used previously.
2499 See Table 14-15 in the LSI. */
2500 adjust_acc_busy_for_mmac (cpu
, in_ACC40Si
, 4, out_ACC40Sk
, 4);
2502 /* The post processing must wait if there is a dependency on a register
2503 which is not ready yet. */
2504 ps
->post_wait
= cycles
;
2505 vliw
= CPU_VLIW (cpu
);
2506 slot
= vliw
->next_slot
- 1;
2507 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2508 post_wait_for_media (cpu
, slot
);
2509 post_wait_for_ACC (cpu
, in_ACC40Si
);
2510 post_wait_for_ACC (cpu
, ACC40Si_1
);
2511 post_wait_for_ACC (cpu
, ACC40Si_2
);
2512 post_wait_for_ACC (cpu
, ACC40Si_3
);
2513 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2514 post_wait_for_ACC (cpu
, ACC40Sk_1
);
2515 post_wait_for_ACC (cpu
, ACC40Sk_2
);
2516 post_wait_for_ACC (cpu
, ACC40Sk_3
);
2518 /* Restore the busy cycles of the registers we used. */
2519 restore_acc_busy_for_mmac (cpu
, in_ACC40Si
, 4, out_ACC40Sk
, 4);
2521 /* The latency of the output register will be at least the latency of the
2522 other inputs. Once initiated, post-processing will take 1 cycle. */
2523 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2524 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2527 update_ACC_latency (cpu
, ACC40Sk_1
, ps
->post_wait
+ 1);
2528 set_use_is_acc_mmac (cpu
, ACC40Sk_1
);
2532 update_ACC_latency (cpu
, ACC40Sk_2
, ps
->post_wait
+ 1);
2533 set_use_is_acc_mmac (cpu
, ACC40Sk_2
);
2537 update_ACC_latency (cpu
, ACC40Sk_3
, ps
->post_wait
+ 1);
2538 set_use_is_acc_mmac (cpu
, ACC40Sk_3
);
2541 /* the floating point unit resource has a latency of 3 cycles */
2542 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2548 frvbf_model_fr550_u_media_4_quad (SIM_CPU
*cpu
, const IDESC
*idesc
,
2549 int unit_num
, int referenced
,
2550 INT in_FRi
, INT in_FRj
,
2551 INT out_ACC40Sk
, INT out_ACC40Uk
)
2562 FRV_PROFILE_STATE
*ps
;
2566 if (model_insn
== FRV_INSN_MODEL_PASS_1
)
2569 /* The preprocessing can execute right away. */
2570 cycles
= idesc
->timing
->units
[unit_num
].done
;
2572 dual_FRi
= DUAL_REG (in_FRi
);
2573 dual_FRj
= DUAL_REG (in_FRj
);
2574 ACC40Sk_1
= DUAL_REG (out_ACC40Sk
);
2575 ACC40Sk_2
= DUAL_REG (ACC40Sk_1
);
2576 ACC40Sk_3
= DUAL_REG (ACC40Sk_2
);
2577 ACC40Uk_1
= DUAL_REG (out_ACC40Uk
);
2578 ACC40Uk_2
= DUAL_REG (ACC40Uk_1
);
2579 ACC40Uk_3
= DUAL_REG (ACC40Uk_2
);
2581 ps
= CPU_PROFILE_STATE (cpu
);
2582 /* The latency of the registers may be less than previously recorded,
2583 depending on how they were used previously.
2584 See Table 14-15 in the LSI. */
2585 adjust_float_register_busy_for_media (cpu
, in_FRi
, 2, in_FRj
, 2, -1, 1);
2586 adjust_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Sk
, 4);
2587 adjust_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Uk
, 4);
2589 /* The post processing must wait if there is a dependency on a FR
2590 which is not ready yet. */
2591 ps
->post_wait
= cycles
;
2592 vliw
= CPU_VLIW (cpu
);
2593 slot
= vliw
->next_slot
- 1;
2594 slot
= (*vliw
->current_vliw
)[slot
] - UNIT_FM0
;
2595 post_wait_for_media (cpu
, slot
);
2596 post_wait_for_FR (cpu
, in_FRi
);
2597 post_wait_for_FR (cpu
, dual_FRi
);
2598 post_wait_for_FR (cpu
, in_FRj
);
2599 post_wait_for_FR (cpu
, dual_FRj
);
2600 post_wait_for_ACC (cpu
, out_ACC40Sk
);
2601 post_wait_for_ACC (cpu
, ACC40Sk_1
);
2602 post_wait_for_ACC (cpu
, ACC40Sk_2
);
2603 post_wait_for_ACC (cpu
, ACC40Sk_3
);
2604 post_wait_for_ACC (cpu
, out_ACC40Uk
);
2605 post_wait_for_ACC (cpu
, ACC40Uk_1
);
2606 post_wait_for_ACC (cpu
, ACC40Uk_2
);
2607 post_wait_for_ACC (cpu
, ACC40Uk_3
);
2609 /* Restore the busy cycles of the registers we used. */
2610 restore_float_register_busy_for_media (cpu
, in_FRi
, 2, in_FRj
, 2, -1, 1);
2611 restore_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Sk
, 4);
2612 restore_acc_busy_for_mmac (cpu
, -1, 1, out_ACC40Uk
, 4);
2614 /* The latency of the output register will be at least the latency of the
2615 other inputs. Once initiated, post-processing will take 1 cycle. */
2616 if (out_ACC40Sk
>= 0)
2618 update_ACC_latency (cpu
, out_ACC40Sk
, ps
->post_wait
+ 1);
2620 set_use_is_acc_mmac (cpu
, out_ACC40Sk
);
2623 update_ACC_latency (cpu
, ACC40Sk_1
, ps
->post_wait
+ 1);
2625 set_use_is_acc_mmac (cpu
, ACC40Sk_1
);
2629 update_ACC_latency (cpu
, ACC40Sk_2
, ps
->post_wait
+ 1);
2631 set_use_is_acc_mmac (cpu
, ACC40Sk_2
);
2635 update_ACC_latency (cpu
, ACC40Sk_3
, ps
->post_wait
+ 1);
2637 set_use_is_acc_mmac (cpu
, ACC40Sk_3
);
2640 else if (out_ACC40Uk
>= 0)
2642 update_ACC_latency (cpu
, out_ACC40Uk
, ps
->post_wait
+ 1);
2644 set_use_is_acc_mmac (cpu
, out_ACC40Uk
);
2647 update_ACC_latency (cpu
, ACC40Uk_1
, ps
->post_wait
+ 1);
2649 set_use_is_acc_mmac (cpu
, ACC40Uk_1
);
2653 update_ACC_latency (cpu
, ACC40Uk_2
, ps
->post_wait
+ 1);
2655 set_use_is_acc_mmac (cpu
, ACC40Uk_2
);
2659 update_ACC_latency (cpu
, ACC40Uk_3
, ps
->post_wait
+ 1);
2661 set_use_is_acc_mmac (cpu
, ACC40Uk_3
);
2665 /* the floating point unit resource has a latency of 3 cycles */
2666 update_float_resource_latency (cpu
, slot
, cycles
+ 3);
2671 #endif /* WITH_PROFILE_MODEL_P */