📄 profile-fr550.c
字号:
/* FNER has a latency of 14 cycles. */ update_SPR_ptime (cpu, FNER_FOR_FR (out_FRk), 14); update_SPR_ptime (cpu, FNER_FOR_FR (out_FRdoublek), 14); } /* The latency of the sqrt unit will be the latency of the other inputs plus 14 cycles. */ update_fsqrt_resource_latency (cpu, slot, ps->post_wait + 14); fr550_reset_fr_flags (cpu, out_FRk); if (out_FRdoublek != -1) { fr550_reset_fr_flags (cpu, out_FRdoublek); fr550_reset_fr_flags (cpu, out_FRdoublek + 1); } /* the media point unit resource has a latency of 16 cycles */ update_media_resource_latency (cpu, slot, cycles + 16); return cycles;}intfrvbf_model_fr550_u_float_compare (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_FRi, INT in_FRj, INT in_FRdoublei, INT in_FRdoublej, INT out_FCCi_2){ int cycles; FRV_PROFILE_STATE *ps; FRV_VLIW *vliw; int slot; if (model_insn == FRV_INSN_MODEL_PASS_1) return 0; /* The preprocessing can execute right away. */ cycles = idesc->timing->units[unit_num].done; /* The post processing must wait if there is a dependency on a FR which is not ready yet. */ adjust_float_register_busy (cpu, in_FRi, 1, in_FRj, 1, -1, 1); adjust_float_register_busy (cpu, in_FRdoublei, 2, in_FRdoublej, 2, -1, 1); ps = CPU_PROFILE_STATE (cpu); ps->post_wait = cycles; vliw = CPU_VLIW (cpu); slot = vliw->next_slot - 1; slot = (*vliw->current_vliw)[slot] - UNIT_FM0; post_wait_for_float (cpu, slot); post_wait_for_FR (cpu, in_FRi); post_wait_for_FR (cpu, in_FRj); post_wait_for_FRdouble (cpu, in_FRdoublei); post_wait_for_FRdouble (cpu, in_FRdoublej); post_wait_for_CCR (cpu, out_FCCi_2); restore_float_register_busy (cpu, in_FRi, 1, in_FRj, 1, -1, 1); restore_float_register_busy (cpu, in_FRdoublei, 2, in_FRdoublej, 2, -1, 1); /* The latency of FCCi_2 will be the latency of the other inputs plus 2 cycles. */ update_CCR_latency (cpu, out_FCCi_2, ps->post_wait + 2); /* the media point unit resource has a latency of 4 cycles */ update_media_resource_latency (cpu, slot, cycles + 4); set_use_is_ccr_complex (cpu, out_FCCi_2); return cycles;}intfrvbf_model_fr550_u_float_dual_compare (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_FRi, INT in_FRj, INT out_FCCi_2){ int cycles; INT dual_FRi; INT dual_FRj; INT dual_FCCi_2; FRV_PROFILE_STATE *ps; FRV_VLIW *vliw; int slot; if (model_insn == FRV_INSN_MODEL_PASS_1) return 0; /* The preprocessing can execute right away. */ cycles = idesc->timing->units[unit_num].done; /* The post processing must wait if there is a dependency on a FR which is not ready yet. */ ps = CPU_PROFILE_STATE (cpu); ps->post_wait = cycles; dual_FRi = DUAL_REG (in_FRi); dual_FRj = DUAL_REG (in_FRj); dual_FCCi_2 = out_FCCi_2 + 1; adjust_float_register_busy (cpu, in_FRi, 2, in_FRj, 2, -1, 1); vliw = CPU_VLIW (cpu); slot = vliw->next_slot - 1; slot = (*vliw->current_vliw)[slot] - UNIT_FM0; post_wait_for_float (cpu, slot); post_wait_for_FR (cpu, in_FRi); post_wait_for_FR (cpu, in_FRj); post_wait_for_FR (cpu, dual_FRi); post_wait_for_FR (cpu, dual_FRj); post_wait_for_CCR (cpu, out_FCCi_2); post_wait_for_CCR (cpu, dual_FCCi_2); restore_float_register_busy (cpu, in_FRi, 2, in_FRj, 2, -1, 1); /* The latency of FCCi_2 will be the latency of the other inputs plus 3 cycles. */ update_CCR_latency (cpu, out_FCCi_2, ps->post_wait + 3); update_CCR_latency (cpu, dual_FCCi_2, ps->post_wait + 3); set_use_is_ccr_complex (cpu, out_FCCi_2); if (dual_FCCi_2 >= 0) set_use_is_ccr_complex (cpu, dual_FCCi_2); /* the media point unit resource has a latency of 5 cycles */ update_media_resource_latency (cpu, slot, cycles + 5); return cycles;}intfrvbf_model_fr550_u_float_convert (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_FRj, INT in_FRintj, INT in_FRdoublej, INT out_FRk, INT out_FRintk, INT out_FRdoublek){ int cycles; FRV_PROFILE_STATE *ps; FRV_VLIW *vliw; int slot; if (model_insn == FRV_INSN_MODEL_PASS_1) return 0; /* The preprocessing can execute right away. */ cycles = idesc->timing->units[unit_num].done; /* The post processing must wait if there is a dependency on a FR which is not ready yet. */ ps = CPU_PROFILE_STATE (cpu); ps->post_wait = cycles; adjust_float_register_busy (cpu, -1, 1, in_FRj, 1, out_FRk, 1); adjust_float_register_busy (cpu, -1, 1, in_FRintj, 1, out_FRintk, 1); adjust_float_register_busy (cpu, -1, 1, in_FRdoublej, 2, out_FRdoublek, 2); vliw = CPU_VLIW (cpu); slot = vliw->next_slot - 1; slot = (*vliw->current_vliw)[slot] - UNIT_FM0; post_wait_for_float (cpu, slot); post_wait_for_FR (cpu, in_FRj); post_wait_for_FR (cpu, in_FRintj); post_wait_for_FRdouble (cpu, in_FRdoublej); post_wait_for_FR (cpu, out_FRk); post_wait_for_FR (cpu, out_FRintk); post_wait_for_FRdouble (cpu, out_FRdoublek); if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING)) { post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRk)); post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRintk)); post_wait_for_SPR (cpu, FNER_FOR_FR (out_FRdoublek)); } restore_float_register_busy (cpu, -1, 1, in_FRj, 1, out_FRk, 1); restore_float_register_busy (cpu, -1, 1, in_FRintj, 1, out_FRintk, 1); restore_float_register_busy (cpu, -1, 1, in_FRdoublej, 2, out_FRdoublek, 2); /* The latency of FRk will be at least the latency of the other inputs. */ update_FR_latency (cpu, out_FRk, ps->post_wait); update_FR_latency (cpu, out_FRintk, ps->post_wait); update_FRdouble_latency (cpu, out_FRdoublek, ps->post_wait); if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING)) { update_SPR_latency (cpu, FNER_FOR_FR (out_FRk), ps->post_wait); update_SPR_latency (cpu, FNER_FOR_FR (out_FRintk), ps->post_wait); update_SPR_latency (cpu, FNER_FOR_FR (out_FRdoublek), ps->post_wait); } /* Once initiated, post-processing will take 2 cycles. */ update_FR_ptime (cpu, out_FRk, 2); update_FR_ptime (cpu, out_FRintk, 2); update_FRdouble_ptime (cpu, out_FRdoublek, 2); if (CGEN_ATTR_VALUE(idesc, idesc->attrs, CGEN_INSN_NON_EXCEPTING)) { update_SPR_ptime (cpu, FNER_FOR_FR (out_FRk), 2); update_SPR_ptime (cpu, FNER_FOR_FR (out_FRintk), 2); update_SPR_ptime (cpu, FNER_FOR_FR (out_FRdoublek), 2); } /* Mark this use of the register as a floating point op. */ if (out_FRk >= 0) set_use_is_fr_complex_2 (cpu, out_FRk); if (out_FRintk >= 0) set_use_is_fr_complex_2 (cpu, out_FRintk); if (out_FRdoublek >= 0) { set_use_is_fr_complex_2 (cpu, out_FRdoublek); set_use_is_fr_complex_2 (cpu, out_FRdoublek + 1); } /* the media point unit resource has a latency of 4 cycles */ update_media_resource_latency (cpu, slot, cycles + 4); return cycles;}intfrvbf_model_fr550_u_spr2gr (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_spr, INT out_GRj){ /* Modelling for this unit is the same as for fr500. */ return frvbf_model_fr500_u_spr2gr (cpu, idesc, unit_num, referenced, in_spr, out_GRj);}intfrvbf_model_fr550_u_gr2spr (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_GRj, INT out_spr){ int cycles; if (model_insn == FRV_INSN_MODEL_PASS_1) { /* The entire VLIW insn must wait if there is a dependency on a register which is not ready yet. */ vliw_wait_for_GR (cpu, in_GRj); vliw_wait_for_SPR (cpu, out_spr); handle_resource_wait (cpu); load_wait_for_GR (cpu, in_GRj); trace_vliw_wait_cycles (cpu); return 0; } cycles = idesc->timing->units[unit_num].done;#if 0 /* The latency of spr is ? cycles. */ update_SPR_latency (cpu, out_spr, cycles + ?);#endif return cycles;}intfrvbf_model_fr550_u_gr2fr (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_GRj, INT out_FRk){ int cycles; if (model_insn == FRV_INSN_MODEL_PASS_1) { /* The entire VLIW insn must wait if there is a dependency on a register which is not ready yet. The latency of the registers may be less than previously recorded, depending on how they were used previously. See Table 14-15 in the LSI. */ adjust_float_register_busy (cpu, -1, 1, -1, 1, out_FRk, 1); vliw_wait_for_GR (cpu, in_GRj); vliw_wait_for_FR (cpu, out_FRk); handle_resource_wait (cpu); load_wait_for_GR (cpu, in_GRj); load_wait_for_FR (cpu, out_FRk); trace_vliw_wait_cycles (cpu); return 0; } /* The latency of FRk is 1 cycles. */ cycles = idesc->timing->units[unit_num].done; update_FR_latency (cpu, out_FRk, cycles + 1); set_use_is_fr_complex_1 (cpu, out_FRk); return cycles;}intfrvbf_model_fr550_u_swap (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_GRi, INT in_GRj, INT out_GRk){ int cycles; if (model_insn == FRV_INSN_MODEL_PASS_1) { /* The entire VLIW insn must wait if there is a dependency on a register which is not ready yet. */ vliw_wait_for_GR (cpu, in_GRi); vliw_wait_for_GR (cpu, in_GRj); vliw_wait_for_GR (cpu, out_GRk); handle_resource_wait (cpu); load_wait_for_GR (cpu, in_GRi); load_wait_for_GR (cpu, in_GRj); load_wait_for_GR (cpu, out_GRk); trace_vliw_wait_cycles (cpu); return 0; } cycles = idesc->timing->units[unit_num].done; /* The latency of GRk will depend on how long it takes to swap the the data from the cache or memory. */ update_GR_latency_for_swap (cpu, out_GRk, cycles); return cycles;}intfrvbf_model_fr550_u_fr2fr (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_FRj, INT out_FRk){ int cycles; if (model_insn == FRV_INSN_MODEL_PASS_1) { /* The entire VLIW insn must wait if there is a dependency on a register which is not ready yet. The latency of the registers may be less than previously recorded, depending on how they were used previously. See Table 14-15 in the LSI. */ adjust_float_register_busy (cpu, -1, 1, in_FRj, 1, out_FRk, 1); vliw_wait_for_FR (cpu, in_FRj); vliw_wait_for_FR (cpu, out_FRk); handle_resource_wait (cpu); load_wait_for_FR (cpu, in_FRj); load_wait_for_FR (cpu, out_FRk); trace_vliw_wait_cycles (cpu); return 0; } /* The latency of FRj is 2 cycles. */ cycles = idesc->timing->units[unit_num].done; update_FR_latency (cpu, out_FRk, cycles + 2); set_use_is_fr_complex_2 (cpu, out_FRk); return cycles;}intfrvbf_model_fr550_u_fr2gr (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_FRk, INT out_GRj){ int cycles; if (model_insn == FRV_INSN_MODEL_PASS_1) { /* The entire VLIW insn must wait if there is a dependency on a register which is not ready yet. The latency of the registers may be less than previously recorded, depending on how they were used previously. See Table 14-15 in the LSI. */ adjust_float_register_busy (cpu, in_FRk, 1, -1, 1, -1, 1); vliw_wait_for_FR (cpu, in_FRk); vliw_wait_for_GR (cpu, out_GRj); handle_resource_wait (cpu); load_wait_for_FR (cpu, in_FRk); load_wait_for_GR (cpu, out_GRj); trace_vliw_wait_cycles (cpu); return 0; } /* The latency of GRj is 1 cycle. */ cycles = idesc->timing->units[unit_num].done; update_GR_latency (cpu, out_GRj, cycles + 1); return cycles;}intfrvbf_model_fr550_u_clrgr (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_GRk){ /* Modelling for this unit is the same as for fr500. */ return frvbf_model_fr500_u_clrgr (cpu, idesc, unit_num, referenced, in_GRk);}intfrvbf_model_fr550_u_clrfr (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_FRk){ /* Modelling for this unit is the same as for fr500. */ return frvbf_model_fr500_u_clrfr (cpu, idesc, unit_num, referenced, in_FRk);}intfrvbf_model_fr550_u_commit (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_GRk, INT in_FRk){ /* Modelling for this unit is the same as for fr500. */ return frvbf_model_fr500_u_commit (cpu, idesc, unit_num, referenced, in_GRk, in_FRk);}intfrvbf_model_fr550_u_media (SIM_CPU *cpu, const IDESC *idesc, int unit_num, int referenced, INT in_FRi, INT in_FRj, INT out_FRk){ int cycles; FRV_PROFILE_STATE *ps; FRV_VLIW *vliw; int slot; if (model_insn == FRV_INSN_MODEL_PASS_1) return 0; /* The preprocessing can execute right away. */ cycles = idesc->timing->units[unit_num].done; /* If the previous use of the registers was a media op, then their latency may be less than previously recorded. See Table 14-15 in the LSI. */ adjust_float_register_busy_for_media (cpu, in_FRi, 1, in_FRj, 1, out_FRk, 1); /* The post processing must wait if there is a dependency on a FR which is not ready yet. */ ps = CPU_PROFILE_STATE (cpu); ps->post_wait = cycles; vliw = CPU_VLIW (cpu); slot = vliw->next_slot - 1; slot = (*vliw->current_vliw)[slot] - UNIT_FM0; post_wait_for_media (cpu, slot); post_wait_for_FR (cpu, in_FRi); post_wait_for_FR (cpu, in_FRj); post_wait_for_FR (cpu, out_FRk);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -