/* Simulator model support for xstormy16. THIS FILE IS MACHINE GENERATED WITH CGEN. Copyright (C) 2000, 2001, 2002, 2003 Red Hat, Inc. This file is part of the Red Hat simulators. */ #ifndef XSTORMY16_MODEL_H #define XSTORMY16_MODEL_H #include "cgen-cpu.h" #include "cgen-model.h" namespace xstormy16 { using namespace cgen; class xstormy16_xstormy16_model : public cgen_model { public: xstormy16_xstormy16_model (xstormy16_cpu *cpu); // Call the proper unit modelling function for the given insn. UINT model_before (xstormy16_cpu *current_cpu, xstormy16_scache* sem) { return (this->*(timing[sem->idesc->sem_index].model_before)) (current_cpu, sem); } UINT model_after (xstormy16_cpu *current_cpu, xstormy16_scache* sem) { return (this->*(timing[sem->idesc->sem_index].model_after)) (current_cpu, sem); } // Function unit handlers // To be overridden as needed. virtual UINT model_u_exec_before (xstormy16_cpu *cpu, const struct xstormy16_idesc *idesc, int unit_num) { return 0; } virtual UINT model_u_exec_after (xstormy16_cpu *cpu, const struct xstormy16_idesc *idesc, int unit_num, unsigned long long referenced) { return timing[idesc->sem_index].units[unit_num].done; } protected: // These methods call the appropriate unit modeller(s) for each insn. UINT model_movlmemimm_before (xstormy16_cpu *current_cpu, xstormy16_scache *sem); UINT model_movlmemimm_after (xstormy16_cpu *current_cpu, xstormy16_scache *sem); UINT model_movhmemimm_before (xstormy16_cpu *current_cpu, xstormy16_scache *sem); UINT model_movhmemimm_after (xstormy16_cpu *current_cpu, xstormy16_scache *sem); // --------------------------------------------------------- // [snip] ... two functions for each insn as above ... // --------------------------------------------------------- /* Enum declaration for unit types. */ typedef enum unit_number { UNIT_NONE, UNIT_U_EXEC, UNIT_MAX } UNIT_NUMBER; struct unit { unit_number unit; UINT issue; UINT done; }; #define MAX_UNITS (1) typedef UINT (xstormy16_xstormy16_model::*model_function) (xstormy16_cpu* current_cpu, xstormy16_scache* sem); struct insn_timing { // This is an integer that identifies this insn. UINT num; // Functions to handle insn-specific profiling. model_function model_before; model_function model_after; // Array of function units used by this insn. unit units[MAX_UNITS]; }; static const insn_timing timing[]; }; } // namespace xstormy16 #endif // XSTORMY16_MODEL_H