1 dnl Process this file with autoconf to produce a configure script.
3 sinclude(../common/acinclude.m4)
7 dnl Options available in this module
8 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
10 SIM_AC_OPTION_RESERVED_BITS(1)
14 # Instead of defining a `subtarget' macro, code should be checking
15 # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
19 mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
20 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
21 mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
22 mips*-mti-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
23 mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
24 mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
27 AC_SUBST(SIM_SUBTARGET)
32 # Select the byte order of the target
37 mips64el*-*-*) mips_endian=LITTLE ;;
38 mips64vr*el-*-*) default_endian=LITTLE ;;
39 mips64*-*-*) default_endian=BIG ;;
40 mips16*-*-*) default_endian=BIG ;;
41 mipsisa32*-*-*) default_endian=BIG ;;
42 mipsisa64*-*-*) default_endian=BIG ;;
43 mips*-*-*) default_endian=BIG ;;
44 *) default_endian=BIG ;;
46 SIM_AC_OPTION_ENDIAN($mips_endian,$default_endian)
51 # Select the bitsize of the target
55 mips*-sde-elf*) mips_bitsize=64 ; mips_msb=63 ;;
56 mips*-mti-elf*) mips_bitsize=64 ; mips_msb=63 ;;
57 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
58 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
59 mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
60 mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
61 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
62 *) mips_bitsize=64 ; mips_msb=63 ;;
64 SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
69 # Select the floating hardware support of the target
71 mips_fpu=HARDWARE_FLOATING_POINT
74 mips*tx39*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
75 mips*-sde-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
76 mips*-mti-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
77 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
78 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
79 mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
80 mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
81 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
82 *) mips_fpu=HARD_FLOATING_POINT ;;
84 SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
89 # Select the IGEN architecture
92 sim_igen_machine="-M mipsIV"
93 sim_m16_machine="-M mips16,mipsIII"
94 sim_igen_filter="32,64,f"
96 sim_mach_default="mips8000"
99 mips*tx39*) sim_gen=IGEN
100 sim_igen_filter="32,f"
101 sim_igen_machine="-M r3900"
103 mips64vr43*-*-*) sim_gen=IGEN
104 sim_igen_machine="-M mipsIV"
105 sim_mach_default="mips8000"
107 mips64vr5*-*-*) sim_gen=IGEN
108 sim_igen_machine="-M vr5000"
109 sim_mach_default="mips5000"
111 mips64vr41*) sim_gen=M16
112 sim_igen_machine="-M vr4100"
113 sim_m16_machine="-M vr4100"
114 sim_igen_filter="32,64,f"
116 sim_mach_default="mips4100"
118 mips64vr-*-* | mips64vrel-*-*)
121 vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
122 vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
123 vr5000:mipsIV:32,64,f:mips4300,mips5000\
124 vr5400:mipsIV,vr5400:32,64,f:mips5400\
125 vr5500:mipsIV,vr5500:32,64,f:mips5500"
126 sim_multi_default=mips5000
128 mips*-sde-elf* | mips*-mti-elf*)
131 micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
132 mips64r2:mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,64,f:mipsisa64r2"
133 sim_multi_default=mipsisa64r2
135 mips64*-*-*) sim_igen_filter="32,64,f"
138 mips16*-*-*) sim_gen=M16
139 sim_igen_filter="32,64,f"
142 mipsisa32r2*-*-*) sim_gen=MULTI
144 micromips:micromips32,micromipsdsp:32,f:mips_micromips\
145 mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
146 sim_multi_default=mipsisa32r2
148 mipsisa32*-*-*) sim_gen=M16
149 sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
150 sim_m16_machine="-M mips16,mips16e,mips32"
151 sim_igen_filter="32,f"
152 sim_mach_default="mipsisa32"
154 mipsisa64r2*-*-*) sim_gen=M16
155 sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
156 sim_m16_machine="-M mips16,mips16e,mips64r2"
157 sim_igen_filter="32,64,f"
158 sim_mach_default="mipsisa64r2"
160 mipsisa64sb1*-*-*) sim_gen=IGEN
161 sim_igen_machine="-M mips64,mips3d,sb1"
162 sim_igen_filter="32,64,f"
163 sim_mach_default="mips_sb1"
165 mipsisa64*-*-*) sim_gen=M16
166 sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
167 sim_m16_machine="-M mips16,mips16e,mips64"
168 sim_igen_filter="32,64,f"
169 sim_mach_default="mipsisa64"
171 mips*lsi*) sim_gen=M16
172 sim_igen_machine="-M mipsIII,mips16"
173 sim_m16_machine="-M mips16,mipsIII"
174 sim_igen_filter="32,f"
176 sim_mach_default="mips4000"
178 mips*-*-*) sim_gen=IGEN
179 sim_igen_filter="32,f"
183 # The MULTI generator can combine several simulation engines into one.
184 # executable. A configuration which uses the MULTI should set two
185 # variables: ${sim_multi_configs} and ${sim_multi_default}.
187 # ${sim_multi_configs} is the list of engines to build. Each
188 # space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
191 # - NAME is a C-compatible prefix for the engine,
192 # - MACHINE is a -M argument,
193 # - FILTER is a -F argument, and
194 # - BFDMACHS is a comma-separated list of bfd machines that the
197 # Each entry will have a separate simulation engine whose prefix is
198 # m32<NAME>. If the machine list includes "mips16", there will also
199 # be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
200 # generated using the same machine list as the 32-bit version,
201 # but the filter will be "16" instead of FILTER.
203 # The simulator compares the bfd mach against BFDMACHS to decide
204 # which engine to use. Entries in BFDMACHS should be bfd_mach
205 # values with "bfd_mach_" removed. ${sim_multi_default} says
206 # which entry should be the default.
207 if test ${sim_gen} = MULTI; then
209 # Simple sanity check.
210 if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
211 AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)
214 # Start in a known state.
215 rm -f multi-include.h multi-run.c
219 sim_multi_igen_configs=
222 cat << __EOF__ > multi-run.c
223 /* Main entry point for MULTI simulators.
224 Copyright (C) 2003-2018 Free Software Foundation, Inc.
226 This program is free software; you can redistribute it and/or modify
227 it under the terms of the GNU General Public License as published by
228 the Free Software Foundation; either version 3 of the License, or
229 (at your option) any later version.
231 This program is distributed in the hope that it will be useful,
232 but WITHOUT ANY WARRANTY; without even the implied warranty of
233 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
234 GNU General Public License for more details.
236 You should have received a copy of the GNU General Public License
237 along with this program. If not, see <http://www.gnu.org/licenses/>.
241 This file was generated by sim/mips/configure. */
243 #include "sim-main.h"
244 #include "multi-include.h"
246 #include "elf/mips.h"
252 sim_engine_run (SIM_DESC sd,
255 int signal) /* ignore */
259 if (STATE_ARCHITECTURE (sd) == NULL)
260 mach = bfd_mach_${sim_multi_default};
261 else if (elf_elfheader (STATE_PROG_BFD (sd))->e_flags
262 & EF_MIPS_ARCH_ASE_MICROMIPS)
263 mach = bfd_mach_mips_micromips;
265 mach = STATE_ARCHITECTURE (SD)->mach;
271 for fc in ${sim_multi_configs}; do
273 # Split up the entry. ${c} contains the first three elements.
274 # Note: outer sqaure brackets are m4 quotes.
275 c=`echo ${fc} | sed ['s/:[^:]*$//']`
276 bfdmachs=`echo ${fc} | sed 's/.*://'`
277 name=`echo ${c} | sed 's/:.*//'`
278 machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
279 filter=`echo ${c} | sed 's/.*://'`
281 # Build the following lists:
283 # sim_multi_flags: all -M and -F flags used by the simulator
284 # sim_multi_src: all makefile-generated source files
285 # sim_multi_obj: the objects for ${sim_multi_src}
286 # sim_multi_igen_configs: igen configuration strings.
288 # Each entry in ${sim_multi_igen_configs} is a prefix (m32
289 # or m16) followed by the NAME, MACHINE and FILTER part of
290 # the ${sim_multi_configs} entry.
291 sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
293 # Check whether special handling is needed.
296 # Run igen twice, once for normal mode and once for mips16.
299 # The top-level function for the mips16 simulator is
300 # in a file m16${name}_run.c, generated by the
301 # tmp-run-multi Makefile rule.
302 sim_multi_src="${sim_multi_src} m16${name}_run.c"
303 sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
304 sim_multi_flags="${sim_multi_flags} -F 16"
307 # Run igen thrice, once for micromips32, once for micromips16,
309 ws="micromips_m32 micromips16 micromips32"
311 # The top-level function for the micromips simulator is
312 # in a file micromips${name}_run.c, generated by the
313 # tmp-run-multi Makefile rule.
314 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
315 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
316 sim_multi_flags="${sim_multi_flags} -F 16,32"
319 # Run igen thrice, once for micromips64, once for micromips16,
321 ws="micromips_m64 micromips16 micromips64"
323 # The top-level function for the micromips simulator is
324 # in a file micromips${name}_run.c, generated by the
325 # tmp-run-multi Makefile rule.
326 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
327 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
328 sim_multi_flags="${sim_multi_flags} -F 16,32,64"
335 # Now add the list of igen-generated files to ${sim_multi_src}
336 # and ${sim_multi_obj}.
338 for base in engine icache idecode model semantics support; do
339 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
340 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
341 sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
343 sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
346 # Add an include for the engine.h file. This file declares the
347 # top-level foo_engine_run() function.
348 echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
350 # Add case statements for this engine to sim_engine_run().
351 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
352 echo " case bfd_mach_${mach}:" >> multi-run.c
353 if test ${mach} = ${sim_multi_default}; then
354 echo " default:" >> multi-run.c
358 echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
360 echo " break;" >> multi-run.c
363 # Check whether we added a 'default:' label.
364 if test ${sim_seen_default} = no; then
365 AC_MSG_ERROR(Error in configure.ac: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
368 cat << __EOF__ >> multi-run.c
373 mips_mach_multi (SIM_DESC sd)
375 if (STATE_ARCHITECTURE (sd) == NULL)
376 return bfd_mach_${sim_multi_default};
378 switch (STATE_ARCHITECTURE (SD)->mach)
382 # Add case statements for this engine to mips_mach_multi().
383 for fc in ${sim_multi_configs}; do
385 # Split up the entry. ${c} contains the first three elements.
386 # Note: outer sqaure brackets are m4 quotes.
387 c=`echo ${fc} | sed ['s/:[^:]*$//']`
388 bfdmachs=`echo ${fc} | sed 's/.*://'`
390 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
391 echo " case bfd_mach_${mach}:" >> multi-run.c
395 cat << __EOF__ >> multi-run.c
396 return (STATE_ARCHITECTURE (SD)->mach);
398 return bfd_mach_${sim_multi_default};
403 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
406 sim_multi_src=doesnt-exist.c
408 if test x"${sim_mach_default}" = x""; then
409 AC_MSG_ERROR(Error in configure.ac: \${sim_mach_default} not defined)
411 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
413 sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
414 sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
415 sim_micromips16_flags=" -F ${sim_micromips16_filter} ${sim_micromips16_machine} ${sim_igen_smp}"
416 sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${sim_igen_smp}"
417 AC_SUBST(sim_igen_flags)
418 AC_SUBST(sim_m16_flags)
419 AC_SUBST(sim_micromips_flags)
420 AC_SUBST(sim_micromips16_flags)
422 AC_SUBST(sim_multi_flags)
423 AC_SUBST(sim_multi_igen_configs)
424 AC_SUBST(sim_multi_src)
425 AC_SUBST(sim_multi_obj)
427 # Add simulated hardware devices
433 hw_extra_devices="tx3904cpu tx3904irc tx3904tmr tx3904sio"
438 SIM_AC_OPTION_HARDWARE($hw_enabled,$hw_devices,$hw_extra_devices)
441 # Choose simulator engine
443 *) mips_igen_engine="engine.o"
446 AC_SUBST(mips_igen_engine)
451 AC_SUBST(mips_extra_libs)
453 AC_CHECK_LIB(m, fabs)
454 AC_CHECK_FUNCS(aint anint sqrt)