X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=sid%2Fcomponent%2Fcgen-cpu%2Fsh%2Fsh3_model.h;fp=sid%2Fcomponent%2Fcgen-cpu%2Fsh%2Fsh3_model.h;h=bbde85d6af91e9de2a1db68a47495d2e10416923;hb=ae4bf010374a9320497af260fa90af3fe8e2c5a5;hp=0000000000000000000000000000000000000000;hpb=3cc729069938336ea54d399c4bbbe7d197295f9a;p=pf3gnuchains%2Fpf3gnuchains3x.git diff --git a/sid/component/cgen-cpu/sh/sh3_model.h b/sid/component/cgen-cpu/sh/sh3_model.h new file mode 100644 index 0000000000..bbde85d6af --- /dev/null +++ b/sid/component/cgen-cpu/sh/sh3_model.h @@ -0,0 +1,69 @@ +// sh3_model.h - Hand-written code for sh modelling. -*- C++ -*- + +// Common insn modelling functions for all sh models. + +// Copyright (C) 2006 Red Hat. +// This file is part of SID and is licensed under the GPL. +// See the file COPYING.SID for conditions for redistribution. + +#ifndef SH3_MODEL_IMPL_H +#define SH3_MODEL_IMPL_H + +#include "common_model.h" + +namespace sh3 +{ + class sh3_idesc; +}; + +namespace sh3e +{ + class sh3e_idesc; +}; + +// Model for sh3 +// +template +class sh3_model : public BASE +{ +public: + sh3_model (CPU* cpu); + + virtual UINT model_u_use_tbit_before (CPU *cpu, const IDESC *idesc, int unit_num); + + virtual UINT model_u_set_sr_bit_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + virtual UINT model_u_ldc_sr_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + virtual UINT model_u_macw_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + virtual UINT model_u_macl_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + virtual UINT model_u_dmul_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + virtual UINT model_u_mull_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + virtual UINT model_u_ldcl_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + virtual UINT model_u_trap_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + + virtual void step_latency (sid::host_int_4 cycles = 0); + +protected: + void advance_latency (sid::host_int_4 latency); + void set_sr_busy (sid::signed_host_int_4 cycles); + + bool insn_is_tstb (const sh3::sh3_idesc *idesc); + bool insn_is_tstb (const sh3e::sh3e_idesc *idesc); + +protected: + sid::host_int_4 sr_busy; +}; + +// Model for sh3e +// +template +class sh3e_model : public sh3_model +{ +public: + sh3e_model (CPU* cpu); + + virtual UINT model_u_fpu_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + virtual UINT model_u_fcnv_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced); + virtual UINT model_u_fsqrt_after (CPU *cpu, const IDESC *idesc, int unit_num, unsigned long long referenced, INT loadreg); +}; + +#endif // SH3_MODEL_IMPL_H