1 /* Architecture, machine, and model support.
2 Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
5 This file is part of GDB, the GNU debugger.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 architecture = one of sparc, mips, sh, etc.
23 in the sparc architecture, mach = one of v6, v7, v8, sparclite, etc.
24 in the v8 mach, model = one of supersparc, etc.
27 /* This file is intended to be included by sim-basics.h. */
32 /* Function unit and instruction timing support.
33 ??? This is obviously insufficiently general.
34 It's useful but it needs elaborating upon. */
37 unsigned char name
; /* actually a UNIT_TYPE enum */
46 typedef int (MODEL_FN
) (sim_cpu
*, void *);
49 /* This is an integer that identifies this insn.
50 How this works is up to the target. */
53 /* Function to handle insn-specific profiling. */
56 /* Array of function units used by this insn. */
57 UNIT units
[MAX_UNITS
];
60 /* Struct to describe various implementation properties of a cpu.
61 When multiple cpu variants are supported, the sizes of some structs
65 /* The size of the SIM_CPU struct. */
67 #define IMP_PROPS_SIM_CPU_SIZE(cpu_props) ((cpu_props)->sim_cpu_size)
68 /* An SCACHE element can vary in size, depending on the selected cpu.
69 This is zero if the SCACHE isn't in use for this variant. */
71 #define IMP_PROPS_SCACHE_ELM_SIZE(cpu_props) ((cpu_props)->scache_elm_size)
72 } MACH_IMP_PROPERTIES
;
74 /* A machine variant. */
78 #define MACH_NAME(m) ((m)->name)
79 /* This is the argument to bfd_scan_arch. */
81 #define MACH_BFD_NAME(m) ((m)->bfd_name)
83 #define MACH_NUM(m) ((m)->num)
86 #define MACH_WORD_BITSIZE(m) ((m)->word_bitsize)
88 #define MACH_ADDR_BITSIZE(m) ((m)->addr_bitsize)
90 /* Pointer to null-entry terminated table of models of this mach.
91 The default is the first one. */
92 const struct model
*models
;
93 #define MACH_MODELS(m) ((m)->models)
95 /* Pointer to the implementation properties of this mach. */
96 const MACH_IMP_PROPERTIES
*imp_props
;
97 #define MACH_IMP_PROPS(m) ((m)->imp_props)
99 /* Called by sim_model_set when the model of a cpu is set. */
100 void (* init_cpu
) (sim_cpu
*);
101 #define MACH_INIT_CPU(m) ((m)->init_cpu)
103 /* Initialize the simulator engine for this cpu.
104 Used by cgen simulators to initialize the insn descriptor table. */
105 void (* prepare_run
) (sim_cpu
*);
106 #define MACH_PREPARE_RUN(m) ((m)->prepare_run)
109 /* A model (implementation) of a machine. */
111 typedef struct model
{
113 #define MODEL_NAME(m) ((m)->name)
115 #define MODEL_MACH(m) ((m)->mach)
116 /* An enum that distinguished the model. */
118 #define MODEL_NUM(m) ((m)->num)
119 /* Pointer to timing table for this model. */
120 const INSN_TIMING
*timing
;
121 #define MODEL_TIMING(m) ((m)->timing)
122 void (* init
) (sim_cpu
*);
123 #define MODEL_INIT(m) ((m)->init)
126 /* Tables of supported machines. */
127 /* ??? In a simulator of multiple architectures, will need multiple copies of
128 this. Have an `archs' array that contains a pointer to the machs array
129 for each (which in turn has a pointer to the models array for each). */
130 extern const MACH
*sim_machs
[];
132 /* Model module handlers. */
133 extern MODULE_INSTALL_FN sim_model_install
;
135 /* Support routines. */
136 extern void sim_model_set (SIM_DESC sd_
, sim_cpu
*cpu_
, const MODEL
*model_
);
137 extern const MODEL
* sim_model_lookup (const char *name_
);
138 extern const MACH
* sim_mach_lookup (const char *name_
);
139 extern const MACH
* sim_mach_lookup_bfd_name (const char *bfd_name_
);
141 #endif /* SIM_MODEL_H */