1 dnl Process this file with autoconf to produce a configure script.
4 AC_CONFIG_HEADER(config.h:config.in)
6 sinclude(../common/aclocal.m4)
8 # Bugs in autoconf 2.59 break the call to SIM_AC_COMMON, hack around
9 # it by inlining the macro's contents.
10 sinclude(../common/common.m4)
12 dnl Options available in this module
13 SIM_AC_OPTION_INLINE()
14 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
15 SIM_AC_OPTION_HOSTENDIAN
16 SIM_AC_OPTION_WARNINGS
17 SIM_AC_OPTION_RESERVED_BITS(1)
21 # Instead of defining a `subtarget' macro, code should be checking
22 # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
26 mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
27 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
28 mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
29 mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
32 AC_SUBST(SIM_SUBTARGET)
37 # Select the byte order of the target
42 mips64el*-*-*) mips_endian=LITTLE_ENDIAN ;;
43 mips64vr*el-*-*) default_endian=LITTLE_ENDIAN ;;
44 mips64*-*-*) default_endian=BIG_ENDIAN ;;
45 mips16*-*-*) default_endian=BIG_ENDIAN ;;
46 mipsisa32*-*-*) default_endian=BIG_ENDIAN ;;
47 mipsisa64*-*-*) default_endian=BIG_ENDIAN ;;
48 mips*-*-*) default_endian=BIG_ENDIAN ;;
49 *) default_endian=BIG_ENDIAN ;;
51 SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
56 # Select the bitsize of the target
60 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
61 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
62 mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
63 mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
64 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
65 *) mips_bitsize=64 ; mips_msb=63 ;;
67 SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
72 # Select the floating hardware support of the target
74 mips_fpu=HARDWARE_FLOATING_POINT
77 mips*tx39*) mips_fpu=HARD_FLOATING_POINT
80 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
81 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
82 mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
83 mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
84 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
85 *) mips_fpu=HARD_FLOATING_POINT ;;
87 SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
92 # Select the level of SMP support
97 SIM_AC_OPTION_SMP($mips_smp)
102 # Select the IGEN architecture
105 sim_igen_machine="-M mipsIV"
106 sim_m16_machine="-M mips16,mipsIII"
107 sim_igen_filter="32,64,f"
109 sim_mach_default="mips8000"
112 mips*tx39*) sim_gen=IGEN
113 sim_igen_filter="32,f"
114 sim_igen_machine="-M r3900"
116 mips64vr43*-*-*) sim_gen=IGEN
117 sim_igen_machine="-M mipsIV"
118 sim_mach_default="mips8000"
120 mips64vr5*-*-*) sim_gen=IGEN
121 sim_igen_machine="-M vr5000"
122 sim_mach_default="mips5000"
124 mips64vr41*) sim_gen=M16
125 sim_igen_machine="-M vr4100"
126 sim_m16_machine="-M vr4100"
127 sim_igen_filter="32,64,f"
129 sim_mach_default="mips4100"
131 mips64vr-*-* | mips64vrel-*-*)
134 vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
135 vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
136 vr5000:mipsIV:32,64,f:mips4300,mips5000\
137 vr5400:mipsIV,vr5400:32,64,f:mips5400\
138 vr5500:mipsIV,vr5500:32,64,f:mips5500"
139 sim_multi_default=mips5000
141 mips64*-*-*) sim_igen_filter="32,64,f"
144 mips16*-*-*) sim_gen=M16
145 sim_igen_filter="32,64,f"
148 mipsisa32r2*-*-*) sim_gen=M16
149 sim_igen_machine="-M mips32r2,mips16,mips16e"
150 sim_m16_machine="-M mips16,mips16e,mips32r2"
151 sim_igen_filter="32,f"
152 sim_mach_default="mipsisa32r2"
154 mipsisa32*-*-*) sim_gen=M16
155 sim_igen_machine="-M mips32,mips16,mips16e"
156 sim_m16_machine="-M mips16,mips16e,mips32"
157 sim_igen_filter="32,f"
158 sim_mach_default="mipsisa32"
160 mipsisa64r2*-*-*) sim_gen=M16
161 sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e"
162 sim_m16_machine="-M mips16,mips16e,mips64r2"
163 sim_igen_filter="32,64,f"
164 sim_mach_default="mipsisa64r2"
166 mipsisa64sb1*-*-*) sim_gen=IGEN
167 sim_igen_machine="-M mips64,mips3d,sb1"
168 sim_igen_filter="32,64,f"
169 sim_mach_default="mips_sb1"
171 mipsisa64*-*-*) sim_gen=M16
172 sim_igen_machine="-M mips64,mips3d,mips16,mips16e"
173 sim_m16_machine="-M mips16,mips16e,mips64"
174 sim_igen_filter="32,64,f"
175 sim_mach_default="mipsisa64"
177 mips*lsi*) sim_gen=M16
178 sim_igen_machine="-M mipsIII,mips16"
179 sim_m16_machine="-M mips16,mipsIII"
180 sim_igen_filter="32,f"
182 sim_mach_default="mips4000"
184 mips*-*-*) sim_gen=IGEN
185 sim_igen_filter="32,f"
189 # The MULTI generator can combine several simulation engines into one.
190 # executable. A configuration which uses the MULTI should set two
191 # variables: ${sim_multi_configs} and ${sim_multi_default}.
193 # ${sim_multi_configs} is the list of engines to build. Each
194 # space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
197 # - NAME is a C-compatible prefix for the engine,
198 # - MACHINE is a -M argument,
199 # - FILTER is a -F argument, and
200 # - BFDMACHS is a comma-separated list of bfd machines that the
203 # Each entry will have a separate simulation engine whose prefix is
204 # m32<NAME>. If the machine list includes "mips16", there will also
205 # be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
206 # generated using the same machine list as the 32-bit version,
207 # but the filter will be "16" instead of FILTER.
209 # The simulator compares the bfd mach against BFDMACHS to decide
210 # which engine to use. Entries in BFDMACHS should be bfd_mach
211 # values with "bfd_mach_" removed. ${sim_multi_default} says
212 # which entry should be the default.
213 if test ${sim_gen} = MULTI; then
215 # Simple sanity check.
216 if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
217 AC_MSG_ERROR(Error in configure.in: MULTI simulator not set up correctly)
220 # Start in a known state.
221 rm -f multi-include.h multi-run.c
224 sim_multi_obj=multi-run.o
225 sim_multi_igen_configs=
228 cat << __EOF__ > multi-run.c
229 /* Main entry point for MULTI simulators.
230 Copyright (C) 2003 Free Software Foundation, Inc.
232 This program is free software; you can redistribute it and/or modify
233 it under the terms of the GNU General Public License as published by
234 the Free Software Foundation; either version 2 of the License, or
235 (at your option) any later version.
237 This program is distributed in the hope that it will be useful,
238 but WITHOUT ANY WARRANTY; without even the implied warranty of
239 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
240 GNU General Public License for more details.
242 You should have received a copy of the GNU General Public License
243 along with this program; if not, write to the Free Software
244 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
248 This file was generated by sim/mips/configure. */
250 #include "sim-main.h"
251 #include "multi-include.h"
257 sim_engine_run (SIM_DESC sd,
260 int signal) /* ignore */
264 if (STATE_ARCHITECTURE (sd) == NULL)
265 mach = bfd_mach_${sim_multi_default};
267 mach = STATE_ARCHITECTURE (SD)->mach;
273 for fc in ${sim_multi_configs}; do
275 # Split up the entry. ${c} contains the first three elements.
276 # Note: outer sqaure brackets are m4 quotes.
277 c=`echo ${fc} | sed ['s/:[^:]*$//']`
278 bfdmachs=`echo ${fc} | sed 's/.*://'`
279 name=`echo ${c} | sed 's/:.*//'`
280 machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
281 filter=`echo ${c} | sed 's/.*://'`
283 # Build the following lists:
285 # sim_multi_flags: all -M and -F flags used by the simulator
286 # sim_multi_src: all makefile-generated source files
287 # sim_multi_obj: the objects for ${sim_multi_src}
288 # sim_multi_igen_configs: igen configuration strings.
290 # Each entry in ${sim_multi_igen_configs} is a prefix (m32
291 # or m16) followed by the NAME, MACHINE and FILTER part of
292 # the ${sim_multi_configs} entry.
293 sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
295 # Check whether mips16 handling is needed.
298 # Run igen twice, once for normal mode and once for mips16.
301 # The top-level function for the mips16 simulator is
302 # in a file m16${name}_run.c, generated by the
303 # tmp-run-multi Makefile rule.
304 sim_multi_src="${sim_multi_src} m16${name}_run.c"
305 sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
306 sim_multi_flags="${sim_multi_flags} -F 16"
313 # Now add the list of igen-generated files to ${sim_multi_src}
314 # and ${sim_multi_obj}.
316 for base in engine icache idecode model semantics support; do
317 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
318 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
319 sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
321 sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
324 # Add an include for the engine.h file. This file declares the
325 # top-level foo_engine_run() function.
326 echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
328 # Add case statements for this engine to sim_engine_run().
329 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
330 echo " case bfd_mach_${mach}:" >> multi-run.c
331 if test ${mach} = ${sim_multi_default}; then
332 echo " default:" >> multi-run.c
336 echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
338 echo " break;" >> multi-run.c
341 # Check whether we added a 'default:' label.
342 if test ${sim_seen_default} = no; then
343 AC_MSG_ERROR(Error in configure.in: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
346 cat << __EOF__ >> multi-run.c
351 mips_mach_multi (SIM_DESC sd)
353 if (STATE_ARCHITECTURE (sd) == NULL)
354 return bfd_mach_${sim_multi_default};
356 switch (STATE_ARCHITECTURE (SD)->mach)
360 # Add case statements for this engine to mips_mach_multi().
361 for fc in ${sim_multi_configs}; do
363 # Split up the entry. ${c} contains the first three elements.
364 # Note: outer sqaure brackets are m4 quotes.
365 c=`echo ${fc} | sed ['s/:[^:]*$//']`
366 bfdmachs=`echo ${fc} | sed 's/.*://'`
368 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
369 echo " case bfd_mach_${mach}:" >> multi-run.c
373 cat << __EOF__ >> multi-run.c
374 return (STATE_ARCHITECTURE (SD)->mach);
376 return bfd_mach_${sim_multi_default};
381 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
384 sim_multi_src=doesnt-exist.c
386 if test x"${sim_mach_default}" = x""; then
387 AC_MSG_ERROR(Error in configure.in: \${sim_mach_default} not defined)
389 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
391 sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
392 sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
393 AC_SUBST(sim_igen_flags)
394 AC_SUBST(sim_m16_flags)
396 AC_SUBST(sim_multi_flags)
397 AC_SUBST(sim_multi_igen_configs)
398 AC_SUBST(sim_multi_src)
399 AC_SUBST(sim_multi_obj)
403 # Add simulated hardware devices
409 hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
410 mips_extra_objs="dv-sockser.o"
411 SIM_SUBTARGET="$SIM_SUBTARGET -DTARGET_TX3904=1"
417 SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
418 AC_SUBST(mips_extra_objs)
421 # Choose simulator engine
423 *) mips_igen_engine="engine.o"
426 AC_SUBST(mips_igen_engine)
431 AC_SUBST(mips_extra_libs)
433 AC_CHECK_HEADERS(string.h strings.h stdlib.h stdlib.h)
434 AC_CHECK_LIB(m, fabs)
435 AC_CHECK_FUNCS(aint anint sqrt)