1 dnl Process this file with autoconf to produce a configure script.
5 sinclude(../common/common.m4)
6 sinclude(../common/aclocal.m4)
8 dnl Options available in this module
10 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
11 SIM_AC_OPTION_HOSTENDIAN
12 SIM_AC_OPTION_WARNINGS
13 SIM_AC_OPTION_RESERVED_BITS(1)
17 # Instead of defining a `subtarget' macro, code should be checking
18 # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
22 mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
23 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
24 mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
25 mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
28 AC_SUBST(SIM_SUBTARGET)
33 # Select the byte order of the target
38 mips64el*-*-*) mips_endian=LITTLE_ENDIAN ;;
39 mips64vr*el-*-*) default_endian=LITTLE_ENDIAN ;;
40 mips64*-*-*) default_endian=BIG_ENDIAN ;;
41 mips16*-*-*) default_endian=BIG_ENDIAN ;;
42 mipsisa32*-*-*) default_endian=BIG_ENDIAN ;;
43 mipsisa64*-*-*) default_endian=BIG_ENDIAN ;;
44 mips*-*-*) default_endian=BIG_ENDIAN ;;
45 *) default_endian=BIG_ENDIAN ;;
47 SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
52 # Select the bitsize of the target
56 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
57 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
58 mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
59 mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
60 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
61 *) mips_bitsize=64 ; mips_msb=63 ;;
63 SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
68 # Select the floating hardware support of the target
70 mips_fpu=HARDWARE_FLOATING_POINT
73 mips*tx39*) mips_fpu=HARD_FLOATING_POINT
76 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
77 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
78 mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
79 mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
80 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
81 *) mips_fpu=HARD_FLOATING_POINT ;;
83 SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
88 # Select the level of SMP support
93 SIM_AC_OPTION_SMP($mips_smp)
98 # Select the IGEN architecture
101 sim_igen_machine="-M mipsIV"
102 sim_m16_machine="-M mips16,mipsIII"
103 sim_igen_filter="32,64,f"
105 sim_mach_default="mips8000"
108 mips*tx39*) sim_gen=IGEN
109 sim_igen_filter="32,f"
110 sim_igen_machine="-M r3900"
112 mips64vr43*-*-*) sim_gen=IGEN
113 sim_igen_machine="-M mipsIV"
114 sim_mach_default="mips8000"
116 mips64vr5*-*-*) sim_gen=IGEN
117 sim_igen_machine="-M vr5000"
118 sim_mach_default="mips5000"
120 mips64vr41*) sim_gen=M16
121 sim_igen_machine="-M vr4100"
122 sim_m16_machine="-M vr4100"
123 sim_igen_filter="32,64,f"
125 sim_mach_default="mips4100"
127 mips64vr-*-* | mips64vrel-*-*)
130 vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
131 vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
132 vr5000:mipsIV:32,64,f:mips4300,mips5000\
133 vr5400:mipsIV,vr5400:32,64,f:mips5400\
134 vr5500:mipsIV,vr5500:32,64,f:mips5500"
135 sim_multi_default=mips5000
137 mips64*-*-*) sim_igen_filter="32,64,f"
140 mips16*-*-*) sim_gen=M16
141 sim_igen_filter="32,64,f"
144 mipsisa32*-*-*) sim_gen=IGEN
145 sim_igen_machine="-M mips32"
146 sim_igen_filter="32,f"
147 sim_mach_default="mipsisa32"
149 mipsisa64sb1*-*-*) sim_gen=IGEN
150 sim_igen_machine="-M mips64,mips3d,sb1"
151 sim_igen_filter="32,64,f"
152 sim_mach_default="mips_sb1"
154 mipsisa64*-*-*) sim_gen=IGEN
155 sim_igen_machine="-M mips64,mips3d"
156 sim_igen_filter="32,64,f"
157 sim_mach_default="mipsisa64"
159 mips*lsi*) sim_gen=M16
160 sim_igen_machine="-M mipsIII,mips16"
161 sim_m16_machine="-M mips16,mipsIII"
162 sim_igen_filter="32,f"
164 sim_mach_default="mips4000"
166 mips*-*-*) sim_gen=IGEN
167 sim_igen_filter="32,f"
171 # The MULTI generator can combine several simulation engines into one.
172 # executable. A configuration which uses the MULTI should set two
173 # variables: ${sim_multi_configs} and ${sim_multi_default}.
175 # ${sim_multi_configs} is the list of engines to build. Each
176 # space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
179 # - NAME is a C-compatible prefix for the engine,
180 # - MACHINE is a -M argument,
181 # - FILTER is a -F argument, and
182 # - BFDMACHS is a comma-separated list of bfd machines that the
185 # Each entry will have a separate simulation engine whose prefix is
186 # m32<NAME>. If the machine list includes "mips16", there will also
187 # be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
188 # generated using the same machine list as the 32-bit version,
189 # but the filter will be "16" instead of FILTER.
191 # The simulator compares the bfd mach against BFDMACHS to decide
192 # which engine to use. Entries in BFDMACHS should be bfd_mach
193 # values with "bfd_mach_" removed. ${sim_multi_default} says
194 # which entry should be the default.
195 if test ${sim_gen} = MULTI; then
197 # Simple sanity check.
198 if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
199 AC_MSG_ERROR(Error in configure.in: MULTI simulator not set up correctly)
202 # Start in a known state.
203 rm -f multi-include.h multi-run.c
206 sim_multi_obj=multi-run.o
207 sim_multi_igen_configs=
210 cat << __EOF__ > multi-run.c
211 /* Main entry point for MULTI simulators.
212 Copyright (C) 2003 Free Software Foundation, Inc.
214 This program is free software; you can redistribute it and/or modify
215 it under the terms of the GNU General Public License as published by
216 the Free Software Foundation; either version 2 of the License, or
217 (at your option) any later version.
219 This program is distributed in the hope that it will be useful,
220 but WITHOUT ANY WARRANTY; without even the implied warranty of
221 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
222 GNU General Public License for more details.
224 You should have received a copy of the GNU General Public License
225 along with this program; if not, write to the Free Software
226 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
230 This file was generated by sim/mips/configure. */
232 #include "sim-main.h"
233 #include "multi-include.h"
239 sim_engine_run (SIM_DESC sd,
242 int signal) /* ignore */
246 if (STATE_ARCHITECTURE (sd) == NULL)
247 mach = bfd_mach_${sim_multi_default};
249 mach = STATE_ARCHITECTURE (SD)->mach;
255 for fc in ${sim_multi_configs}; do
257 # Split up the entry. ${c} contains the first three elements.
258 # Note: outer sqaure brackets are m4 quotes.
259 c=`echo ${fc} | sed ['s/:[^:]*$//']`
260 bfdmachs=`echo ${fc} | sed 's/.*://'`
261 name=`echo ${c} | sed 's/:.*//'`
262 machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
263 filter=`echo ${c} | sed 's/.*://'`
265 # Build the following lists:
267 # sim_multi_flags: all -M and -F flags used by the simulator
268 # sim_multi_src: all makefile-generated source files
269 # sim_multi_obj: the objects for ${sim_multi_src}
270 # sim_multi_igen_configs: igen configuration strings.
272 # Each entry in ${sim_multi_igen_configs} is a prefix (m32
273 # or m16) followed by the NAME, MACHINE and FILTER part of
274 # the ${sim_multi_configs} entry.
275 sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
277 # Check whether mips16 handling is needed.
280 # Run igen twice, once for normal mode and once for mips16.
283 # The top-level function for the mips16 simulator is
284 # in a file m16${name}_run.c, generated by the
285 # tmp-run-multi Makefile rule.
286 sim_multi_src="${sim_multi_src} m16${name}_run.c"
287 sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
288 sim_multi_flags="${sim_multi_flags} -F 16"
295 # Now add the list of igen-generated files to ${sim_multi_src}
296 # and ${sim_multi_obj}.
298 for base in engine icache idecode model semantics support; do
299 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
300 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
301 sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
303 sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
306 # Add an include for the engine.h file. This file declares the
307 # top-level foo_engine_run() function.
308 echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
310 # Add case statements for this engine to sim_engine_run().
311 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
312 echo " case bfd_mach_${mach}:" >> multi-run.c
313 if test ${mach} = ${sim_multi_default}; then
314 echo " default:" >> multi-run.c
318 echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
320 echo " break;" >> multi-run.c
323 # Check whether we added a 'default:' label.
324 if test ${sim_seen_default} = no; then
325 AC_MSG_ERROR(Error in configure.in: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
328 cat << __EOF__ >> multi-run.c
333 mips_mach_multi (SIM_DESC sd)
335 if (STATE_ARCHITECTURE (sd) == NULL)
336 return bfd_mach_${sim_multi_default};
338 switch (STATE_ARCHITECTURE (SD)->mach)
342 # Add case statements for this engine to mips_mach_multi().
343 for fc in ${sim_multi_configs}; do
345 # Split up the entry. ${c} contains the first three elements.
346 # Note: outer sqaure brackets are m4 quotes.
347 c=`echo ${fc} | sed ['s/:[^:]*$//']`
348 bfdmachs=`echo ${fc} | sed 's/.*://'`
350 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
351 echo " case bfd_mach_${mach}:" >> multi-run.c
355 cat << __EOF__ >> multi-run.c
356 return (STATE_ARCHITECTURE (SD)->mach);
358 return bfd_mach_${sim_multi_default};
363 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
366 sim_multi_src=doesnt-exist.c
368 if test x"${sim_mach_default}" = x""; then
369 AC_MSG_ERROR(Error in configure.in: \${sim_mach_default} not defined)
371 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
373 sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
374 sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
375 AC_SUBST(sim_igen_flags)
376 AC_SUBST(sim_m16_flags)
378 AC_SUBST(sim_multi_flags)
379 AC_SUBST(sim_multi_igen_configs)
380 AC_SUBST(sim_multi_src)
381 AC_SUBST(sim_multi_obj)
385 # Add simulated hardware devices
391 hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
392 mips_extra_objs="dv-sockser.o"
393 SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_TX3904=1"
399 SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
400 AC_SUBST(mips_extra_objs)
403 # Choose simulator engine
405 *) mips_igen_engine="engine.o"
408 AC_SUBST(mips_igen_engine)
413 AC_SUBST(mips_extra_libs)
415 AC_CHECK_HEADERS(string.h strings.h stdlib.h stdlib.h)
416 AC_CHECK_LIB(m, fabs)
417 AC_CHECK_FUNCS(aint anint sqrt)