1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
7 dnl Options available in this module
8 SIM_AC_OPTION_RESERVED_BITS(1)
12 # Instead of defining a `subtarget' macro, code should be checking
13 # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
17 mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
18 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
19 mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
20 mips*-mti-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
21 mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
22 mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
25 AC_SUBST(SIM_SUBTARGET)
30 # Select the bitsize of the target
34 mips*-sde-elf*) mips_bitsize=64 ; mips_msb=63 ;;
35 mips*-mti-elf*) mips_bitsize=64 ; mips_msb=63 ;;
36 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
37 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
38 mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
39 mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
40 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
41 *) mips_bitsize=64 ; mips_msb=63 ;;
43 SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
48 # Select the floating hardware support of the target
50 mips_fpu=HARDWARE_FLOATING_POINT
53 mips*tx39*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
54 mips*-sde-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
55 mips*-mti-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
56 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
57 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
58 mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
59 mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
60 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
61 *) mips_fpu=HARD_FLOATING_POINT ;;
63 SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
68 # Select the IGEN architecture
71 sim_igen_machine="-M mipsIV"
72 sim_m16_machine="-M mips16,mipsIII"
73 sim_igen_filter="32,64,f"
75 sim_mach_default="mips8000"
78 mips*tx39*) sim_gen=IGEN
79 sim_igen_filter="32,f"
80 sim_igen_machine="-M r3900"
82 mips64vr43*-*-*) sim_gen=IGEN
83 sim_igen_machine="-M mipsIV"
84 sim_mach_default="mips8000"
86 mips64vr5*-*-*) sim_gen=IGEN
87 sim_igen_machine="-M vr5000"
88 sim_mach_default="mips5000"
90 mips64vr41*) sim_gen=M16
91 sim_igen_machine="-M vr4100"
92 sim_m16_machine="-M vr4100"
93 sim_igen_filter="32,64,f"
95 sim_mach_default="mips4100"
97 mips64vr-*-* | mips64vrel-*-*)
100 vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
101 vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
102 vr5000:mipsIV:32,64,f:mips4300,mips5000\
103 vr5400:mipsIV,vr5400:32,64,f:mips5400\
104 vr5500:mipsIV,vr5500:32,64,f:mips5500"
105 sim_multi_default=mips5000
107 mips*-sde-elf* | mips*-mti-elf*)
110 micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
111 mips64r2:mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,64,f:mipsisa64r2"
112 sim_multi_default=mipsisa64r2
114 mips64*-*-*) sim_igen_filter="32,64,f"
117 mips16*-*-*) sim_gen=M16
118 sim_igen_filter="32,64,f"
121 mipsisa32r2*-*-*) sim_gen=MULTI
123 micromips:micromips32,micromipsdsp:32,f:mips_micromips\
124 mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
125 sim_multi_default=mipsisa32r2
127 mipsisa32*-*-*) sim_gen=M16
128 sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
129 sim_m16_machine="-M mips16,mips16e,mips32"
130 sim_igen_filter="32,f"
131 sim_mach_default="mipsisa32"
133 mipsisa64r2*-*-*) sim_gen=M16
134 sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
135 sim_m16_machine="-M mips16,mips16e,mips64r2"
136 sim_igen_filter="32,64,f"
137 sim_mach_default="mipsisa64r2"
139 mipsisa64sb1*-*-*) sim_gen=IGEN
140 sim_igen_machine="-M mips64,mips3d,sb1"
141 sim_igen_filter="32,64,f"
142 sim_mach_default="mips_sb1"
144 mipsisa64*-*-*) sim_gen=M16
145 sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
146 sim_m16_machine="-M mips16,mips16e,mips64"
147 sim_igen_filter="32,64,f"
148 sim_mach_default="mipsisa64"
150 mips*lsi*) sim_gen=M16
151 sim_igen_machine="-M mipsIII,mips16"
152 sim_m16_machine="-M mips16,mipsIII"
153 sim_igen_filter="32,f"
155 sim_mach_default="mips4000"
157 mips*-*-*) sim_gen=IGEN
158 sim_igen_filter="32,f"
162 # The MULTI generator can combine several simulation engines into one.
163 # executable. A configuration which uses the MULTI should set two
164 # variables: ${sim_multi_configs} and ${sim_multi_default}.
166 # ${sim_multi_configs} is the list of engines to build. Each
167 # space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
170 # - NAME is a C-compatible prefix for the engine,
171 # - MACHINE is a -M argument,
172 # - FILTER is a -F argument, and
173 # - BFDMACHS is a comma-separated list of bfd machines that the
176 # Each entry will have a separate simulation engine whose prefix is
177 # m32<NAME>. If the machine list includes "mips16", there will also
178 # be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
179 # generated using the same machine list as the 32-bit version,
180 # but the filter will be "16" instead of FILTER.
182 # The simulator compares the bfd mach against BFDMACHS to decide
183 # which engine to use. Entries in BFDMACHS should be bfd_mach
184 # values with "bfd_mach_" removed. ${sim_multi_default} says
185 # which entry should be the default.
186 if test ${sim_gen} = MULTI; then
188 # Simple sanity check.
189 if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
190 AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)
193 # Start in a known state.
194 rm -f multi-include.h multi-run.c
198 sim_multi_igen_configs=
201 cat << __EOF__ > multi-run.c
202 /* Main entry point for MULTI simulators.
203 Copyright (C) 2003-2021 Free Software Foundation, Inc.
205 This program is free software; you can redistribute it and/or modify
206 it under the terms of the GNU General Public License as published by
207 the Free Software Foundation; either version 3 of the License, or
208 (at your option) any later version.
210 This program is distributed in the hope that it will be useful,
211 but WITHOUT ANY WARRANTY; without even the implied warranty of
212 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
213 GNU General Public License for more details.
215 You should have received a copy of the GNU General Public License
216 along with this program. If not, see <http://www.gnu.org/licenses/>.
220 This file was generated by sim/mips/configure. */
222 #include "sim-main.h"
223 #include "multi-include.h"
225 #include "elf/mips.h"
231 sim_engine_run (SIM_DESC sd,
234 int signal) /* ignore */
238 if (STATE_ARCHITECTURE (sd) == NULL)
239 mach = bfd_mach_${sim_multi_default};
240 else if (elf_elfheader (STATE_PROG_BFD (sd))->e_flags
241 & EF_MIPS_ARCH_ASE_MICROMIPS)
242 mach = bfd_mach_mips_micromips;
244 mach = STATE_ARCHITECTURE (SD)->mach;
250 for fc in ${sim_multi_configs}; do
252 # Split up the entry. ${c} contains the first three elements.
253 # Note: outer sqaure brackets are m4 quotes.
254 c=`echo ${fc} | sed ['s/:[^:]*$//']`
255 bfdmachs=`echo ${fc} | sed 's/.*://'`
256 name=`echo ${c} | sed 's/:.*//'`
257 machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
258 filter=`echo ${c} | sed 's/.*://'`
260 # Build the following lists:
262 # sim_multi_flags: all -M and -F flags used by the simulator
263 # sim_multi_src: all makefile-generated source files
264 # sim_multi_obj: the objects for ${sim_multi_src}
265 # sim_multi_igen_configs: igen configuration strings.
267 # Each entry in ${sim_multi_igen_configs} is a prefix (m32
268 # or m16) followed by the NAME, MACHINE and FILTER part of
269 # the ${sim_multi_configs} entry.
270 sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
272 # Check whether special handling is needed.
275 # Run igen twice, once for normal mode and once for mips16.
278 # The top-level function for the mips16 simulator is
279 # in a file m16${name}_run.c, generated by the
280 # tmp-run-multi Makefile rule.
281 sim_multi_src="${sim_multi_src} m16${name}_run.c"
282 sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
283 sim_multi_flags="${sim_multi_flags} -F 16"
286 # Run igen thrice, once for micromips32, once for micromips16,
288 ws="micromips_m32 micromips16 micromips32"
290 # The top-level function for the micromips simulator is
291 # in a file micromips${name}_run.c, generated by the
292 # tmp-run-multi Makefile rule.
293 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
294 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
295 sim_multi_flags="${sim_multi_flags} -F 16,32"
298 # Run igen thrice, once for micromips64, once for micromips16,
300 ws="micromips_m64 micromips16 micromips64"
302 # The top-level function for the micromips simulator is
303 # in a file micromips${name}_run.c, generated by the
304 # tmp-run-multi Makefile rule.
305 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
306 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
307 sim_multi_flags="${sim_multi_flags} -F 16,32,64"
314 # Now add the list of igen-generated files to ${sim_multi_src}
315 # and ${sim_multi_obj}.
317 for base in engine icache idecode model semantics support; do
318 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
319 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
320 sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
322 sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
325 # Add an include for the engine.h file. This file declares the
326 # top-level foo_engine_run() function.
327 echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
329 # Add case statements for this engine to sim_engine_run().
330 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
331 echo " case bfd_mach_${mach}:" >> multi-run.c
332 if test ${mach} = ${sim_multi_default}; then
333 echo " default:" >> multi-run.c
337 echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
339 echo " break;" >> multi-run.c
342 # Check whether we added a 'default:' label.
343 if test ${sim_seen_default} = no; then
344 AC_MSG_ERROR(Error in configure.ac: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
347 cat << __EOF__ >> multi-run.c
352 mips_mach_multi (SIM_DESC sd)
354 if (STATE_ARCHITECTURE (sd) == NULL)
355 return bfd_mach_${sim_multi_default};
357 switch (STATE_ARCHITECTURE (SD)->mach)
361 # Add case statements for this engine to mips_mach_multi().
362 for fc in ${sim_multi_configs}; do
364 # Split up the entry. ${c} contains the first three elements.
365 # Note: outer sqaure brackets are m4 quotes.
366 c=`echo ${fc} | sed ['s/:[^:]*$//']`
367 bfdmachs=`echo ${fc} | sed 's/.*://'`
369 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
370 echo " case bfd_mach_${mach}:" >> multi-run.c
374 cat << __EOF__ >> multi-run.c
375 return (STATE_ARCHITECTURE (SD)->mach);
377 return bfd_mach_${sim_multi_default};
382 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
385 sim_multi_src=doesnt-exist.c
387 if test x"${sim_mach_default}" = x""; then
388 AC_MSG_ERROR(Error in configure.ac: \${sim_mach_default} not defined)
390 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
392 sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
393 sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
394 sim_micromips16_flags=" -F ${sim_micromips16_filter} ${sim_micromips16_machine} ${sim_igen_smp}"
395 sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${sim_igen_smp}"
396 AC_SUBST(sim_igen_flags)
397 AC_SUBST(sim_m16_flags)
398 AC_SUBST(sim_micromips_flags)
399 AC_SUBST(sim_micromips16_flags)
401 AC_SUBST(sim_multi_flags)
402 AC_SUBST(sim_multi_igen_configs)
403 AC_SUBST(sim_multi_src)
404 AC_SUBST(sim_multi_obj)
406 # Add simulated hardware devices
408 SIM_AC_OPTION_HARDWARE(tx3904cpu tx3904irc tx3904tmr tx3904sio)