Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / sim / mips / configure.ac
CommitLineData
c906108c 1dnl Process this file with autoconf to produce a configure script.
c906108c 2AC_INIT(Makefile.in)
760b3e8b 3AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
c906108c 4
c906108c
SS
5# DEPRECATED
6#
7# Instead of defining a `subtarget' macro, code should be checking
8# the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
9# in question.
10#
11case "${target}" in
4c54fc26 12 mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
c906108c 13 mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
109ad085 14 mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
cc220243 15 mips*-mti-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
1e799e28
CD
16 mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
17 mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
c906108c
SS
18 *) SIM_SUBTARGET="";;
19esac
20AC_SUBST(SIM_SUBTARGET)
21
22
23
c906108c
SS
24#
25# Select the bitsize of the target
26#
27mips_addr_bitsize=
28case "${target}" in
4b5d35ee 29 mips*-sde-elf*) mips_bitsize=64 ; mips_msb=63 ;;
cc220243 30 mips*-mti-elf*) mips_bitsize=64 ; mips_msb=63 ;;
c906108c
SS
31 mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
32 mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
1e799e28
CD
33 mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
34 mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
c906108c
SS
35 mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
36 *) mips_bitsize=64 ; mips_msb=63 ;;
37esac
38SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb,$mips_addr_bitsize)
39
40
41
42#
43# Select the floating hardware support of the target
44#
45mips_fpu=HARDWARE_FLOATING_POINT
46mips_fpu_bitsize=
47case "${target}" in
4b5d35ee
TS
48 mips*tx39*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
49 mips*-sde-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
cc220243 50 mips*-mti-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
c906108c
SS
51 mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
52 mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
1e799e28
CD
53 mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
54 mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
c906108c
SS
55 mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
56 *) mips_fpu=HARD_FLOATING_POINT ;;
57esac
58SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
59
60
61
c906108c
SS
62#
63# Select the IGEN architecture
64#
65sim_gen=IGEN
66sim_igen_machine="-M mipsIV"
139181c8 67sim_m16_machine="-M mips16,mipsIII"
c906108c
SS
68sim_igen_filter="32,64,f"
69sim_m16_filter="16"
4c54fc26
CD
70sim_mach_default="mips8000"
71
c906108c
SS
72case "${target}" in
73 mips*tx39*) sim_gen=IGEN
74 sim_igen_filter="32,f"
75 sim_igen_machine="-M r3900"
76 ;;
77 mips64vr43*-*-*) sim_gen=IGEN
78 sim_igen_machine="-M mipsIV"
4c54fc26 79 sim_mach_default="mips8000"
c906108c
SS
80 ;;
81 mips64vr5*-*-*) sim_gen=IGEN
82 sim_igen_machine="-M vr5000"
4c54fc26 83 sim_mach_default="mips5000"
c906108c
SS
84 ;;
85 mips64vr41*) sim_gen=M16
86 sim_igen_machine="-M vr4100"
87 sim_m16_machine="-M vr4100"
88 sim_igen_filter="32,64,f"
89 sim_m16_filter="16"
4c54fc26 90 sim_mach_default="mips4100"
c906108c 91 ;;
4c54fc26
CD
92 mips64vr-*-* | mips64vrel-*-*)
93 sim_gen=MULTI
94 sim_multi_configs="\
95 vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
96 vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
97 vr5000:mipsIV:32,64,f:mips4300,mips5000\
98 vr5400:mipsIV,vr5400:32,64,f:mips5400\
99 vr5500:mipsIV,vr5500:32,64,f:mips5500"
100 sim_multi_default=mips5000
101 ;;
cc220243 102 mips*-sde-elf* | mips*-mti-elf*)
8e394ffc
AB
103 sim_gen=MULTI
104 sim_multi_configs="\
105 micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
106 mips64r2:mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,64,f:mipsisa64r2"
107 sim_multi_default=mipsisa64r2
3669427c 108 ;;
c906108c
SS
109 mips64*-*-*) sim_igen_filter="32,64,f"
110 sim_gen=IGEN
111 ;;
112 mips16*-*-*) sim_gen=M16
113 sim_igen_filter="32,64,f"
114 sim_m16_filter="16"
115 ;;
8e394ffc
AB
116 mipsisa32r2*-*-*) sim_gen=MULTI
117 sim_multi_configs="\
118 micromips:micromips32,micromipsdsp:32,f:mips_micromips\
119 mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
120 sim_multi_default=mipsisa32r2
e70cb6cd 121 ;;
d5fb0879
RS
122 mipsisa32*-*-*) sim_gen=M16
123 sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
124 sim_m16_machine="-M mips16,mips16e,mips32"
125 sim_igen_filter="32,f"
126 sim_mach_default="mipsisa32"
1e799e28 127 ;;
d5fb0879
RS
128 mipsisa64r2*-*-*) sim_gen=M16
129 sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
130 sim_m16_machine="-M mips16,mips16e,mips64r2"
131 sim_igen_filter="32,64,f"
132 sim_mach_default="mipsisa64r2"
e70cb6cd 133 ;;
7cbea089 134 mipsisa64sb1*-*-*) sim_gen=IGEN
109ad085 135 sim_igen_machine="-M mips64,mips3d,sb1"
7cbea089 136 sim_igen_filter="32,64,f"
4c54fc26 137 sim_mach_default="mips_sb1"
7cbea089 138 ;;
d5fb0879
RS
139 mipsisa64*-*-*) sim_gen=M16
140 sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
141 sim_m16_machine="-M mips16,mips16e,mips64"
142 sim_igen_filter="32,64,f"
143 sim_mach_default="mipsisa64"
1e799e28 144 ;;
109ad085 145 mips*lsi*) sim_gen=M16
c906108c
SS
146 sim_igen_machine="-M mipsIII,mips16"
147 sim_m16_machine="-M mips16,mipsIII"
148 sim_igen_filter="32,f"
149 sim_m16_filter="16"
4c54fc26 150 sim_mach_default="mips4000"
109ad085 151 ;;
c906108c
SS
152 mips*-*-*) sim_gen=IGEN
153 sim_igen_filter="32,f"
154 ;;
155esac
4c54fc26
CD
156
157# The MULTI generator can combine several simulation engines into one.
158# executable. A configuration which uses the MULTI should set two
159# variables: ${sim_multi_configs} and ${sim_multi_default}.
160#
161# ${sim_multi_configs} is the list of engines to build. Each
162# space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
163# where:
164#
165# - NAME is a C-compatible prefix for the engine,
166# - MACHINE is a -M argument,
167# - FILTER is a -F argument, and
168# - BFDMACHS is a comma-separated list of bfd machines that the
169# simulator can run.
170#
171# Each entry will have a separate simulation engine whose prefix is
172# m32<NAME>. If the machine list includes "mips16", there will also
173# be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
174# generated using the same machine list as the 32-bit version,
175# but the filter will be "16" instead of FILTER.
176#
177# The simulator compares the bfd mach against BFDMACHS to decide
178# which engine to use. Entries in BFDMACHS should be bfd_mach
179# values with "bfd_mach_" removed. ${sim_multi_default} says
180# which entry should be the default.
181if test ${sim_gen} = MULTI; then
182
183 # Simple sanity check.
184 if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
306f4178 185 AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)
4c54fc26
CD
186 fi
187
188 # Start in a known state.
189 rm -f multi-include.h multi-run.c
190 sim_multi_flags=
191 sim_multi_src=
8e394ffc 192 sim_multi_obj=
4c54fc26
CD
193 sim_multi_igen_configs=
194 sim_seen_default=no
195
196 cat << __EOF__ > multi-run.c
197/* Main entry point for MULTI simulators.
88b9d363 198 Copyright (C) 2003-2022 Free Software Foundation, Inc.
4c54fc26
CD
199
200 This program is free software; you can redistribute it and/or modify
201 it under the terms of the GNU General Public License as published by
35ee6e1e 202 the Free Software Foundation; either version 3 of the License, or
4c54fc26
CD
203 (at your option) any later version.
204
205 This program is distributed in the hope that it will be useful,
206 but WITHOUT ANY WARRANTY; without even the implied warranty of
207 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
208 GNU General Public License for more details.
209
210 You should have received a copy of the GNU General Public License
35ee6e1e 211 along with this program. If not, see <http://www.gnu.org/licenses/>.
4c54fc26
CD
212
213 --
214
215 This file was generated by sim/mips/configure. */
216
217#include "sim-main.h"
218#include "multi-include.h"
8e394ffc
AB
219#include "elf-bfd.h"
220#include "elf/mips.h"
4c54fc26
CD
221
222#define SD sd
223#define CPU cpu
224
225void
226sim_engine_run (SIM_DESC sd,
227 int next_cpu_nr,
228 int nr_cpus,
229 int signal) /* ignore */
230{
231 int mach;
232
233 if (STATE_ARCHITECTURE (sd) == NULL)
234 mach = bfd_mach_${sim_multi_default};
1554f758 235 else if (elf_elfheader (STATE_PROG_BFD (sd))->e_flags
8e394ffc
AB
236 & EF_MIPS_ARCH_ASE_MICROMIPS)
237 mach = bfd_mach_mips_micromips;
4c54fc26
CD
238 else
239 mach = STATE_ARCHITECTURE (SD)->mach;
240
241 switch (mach)
242 {
243__EOF__
244
245 for fc in ${sim_multi_configs}; do
246
247 # Split up the entry. ${c} contains the first three elements.
248 # Note: outer sqaure brackets are m4 quotes.
249 c=`echo ${fc} | sed ['s/:[^:]*$//']`
250 bfdmachs=`echo ${fc} | sed 's/.*://'`
251 name=`echo ${c} | sed 's/:.*//'`
252 machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
253 filter=`echo ${c} | sed 's/.*://'`
254
255 # Build the following lists:
256 #
257 # sim_multi_flags: all -M and -F flags used by the simulator
258 # sim_multi_src: all makefile-generated source files
259 # sim_multi_obj: the objects for ${sim_multi_src}
260 # sim_multi_igen_configs: igen configuration strings.
261 #
262 # Each entry in ${sim_multi_igen_configs} is a prefix (m32
263 # or m16) followed by the NAME, MACHINE and FILTER part of
264 # the ${sim_multi_configs} entry.
265 sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
266
8e394ffc 267 # Check whether special handling is needed.
4c54fc26
CD
268 case ${c} in
269 *:*mips16*:*)
270 # Run igen twice, once for normal mode and once for mips16.
271 ws="m32 m16"
272
273 # The top-level function for the mips16 simulator is
274 # in a file m16${name}_run.c, generated by the
275 # tmp-run-multi Makefile rule.
276 sim_multi_src="${sim_multi_src} m16${name}_run.c"
277 sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
278 sim_multi_flags="${sim_multi_flags} -F 16"
279 ;;
8e394ffc
AB
280 *:*micromips32*:*)
281 # Run igen thrice, once for micromips32, once for micromips16,
282 # and once for m32.
283 ws="micromips_m32 micromips16 micromips32"
284
285 # The top-level function for the micromips simulator is
286 # in a file micromips${name}_run.c, generated by the
287 # tmp-run-multi Makefile rule.
288 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
289 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
290 sim_multi_flags="${sim_multi_flags} -F 16,32"
291 ;;
292 *:*micromips64*:*)
293 # Run igen thrice, once for micromips64, once for micromips16,
294 # and once for m64.
295 ws="micromips_m64 micromips16 micromips64"
296
297 # The top-level function for the micromips simulator is
298 # in a file micromips${name}_run.c, generated by the
299 # tmp-run-multi Makefile rule.
300 sim_multi_src="${sim_multi_src} micromips${name}_run.c"
301 sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
302 sim_multi_flags="${sim_multi_flags} -F 16,32,64"
303 ;;
4c54fc26
CD
304 *)
305 ws=m32
306 ;;
307 esac
308
309 # Now add the list of igen-generated files to ${sim_multi_src}
310 # and ${sim_multi_obj}.
311 for w in ${ws}; do
312 for base in engine icache idecode model semantics support; do
313 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
314 sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
315 sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
316 done
317 sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
318 done
319
320 # Add an include for the engine.h file. This file declares the
321 # top-level foo_engine_run() function.
322 echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
323
324 # Add case statements for this engine to sim_engine_run().
325 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
326 echo " case bfd_mach_${mach}:" >> multi-run.c
327 if test ${mach} = ${sim_multi_default}; then
328 echo " default:" >> multi-run.c
329 sim_seen_default=yes
330 fi
331 done
332 echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
333 >> multi-run.c
334 echo " break;" >> multi-run.c
335 done
336
337 # Check whether we added a 'default:' label.
338 if test ${sim_seen_default} = no; then
306f4178 339 AC_MSG_ERROR(Error in configure.ac: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
4c54fc26
CD
340 fi
341
342 cat << __EOF__ >> multi-run.c
343 }
344}
345
346int
347mips_mach_multi (SIM_DESC sd)
348{
349 if (STATE_ARCHITECTURE (sd) == NULL)
350 return bfd_mach_${sim_multi_default};
351
352 switch (STATE_ARCHITECTURE (SD)->mach)
353 {
354__EOF__
355
356 # Add case statements for this engine to mips_mach_multi().
357 for fc in ${sim_multi_configs}; do
358
359 # Split up the entry. ${c} contains the first three elements.
360 # Note: outer sqaure brackets are m4 quotes.
361 c=`echo ${fc} | sed ['s/:[^:]*$//']`
362 bfdmachs=`echo ${fc} | sed 's/.*://'`
363
364 for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
365 echo " case bfd_mach_${mach}:" >> multi-run.c
366 done
367 done
368
369 cat << __EOF__ >> multi-run.c
370 return (STATE_ARCHITECTURE (SD)->mach);
371 default:
372 return bfd_mach_${sim_multi_default};
373 }
374}
375__EOF__
376
377 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
378else
379 # For clean-extra
380 sim_multi_src=doesnt-exist.c
381
382 if test x"${sim_mach_default}" = x""; then
306f4178 383 AC_MSG_ERROR(Error in configure.ac: \${sim_mach_default} not defined)
4c54fc26
CD
384 fi
385 SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
386fi
c906108c
SS
387sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
388sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
8e394ffc
AB
389sim_micromips16_flags=" -F ${sim_micromips16_filter} ${sim_micromips16_machine} ${sim_igen_smp}"
390sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${sim_igen_smp}"
c906108c
SS
391AC_SUBST(sim_igen_flags)
392AC_SUBST(sim_m16_flags)
8e394ffc
AB
393AC_SUBST(sim_micromips_flags)
394AC_SUBST(sim_micromips16_flags)
c906108c 395AC_SUBST(sim_gen)
4c54fc26
CD
396AC_SUBST(sim_multi_flags)
397AC_SUBST(sim_multi_igen_configs)
398AC_SUBST(sim_multi_src)
399AC_SUBST(sim_multi_obj)
c906108c 400
c906108c 401SIM_AC_OUTPUT
This page took 1.112739 seconds and 4 git commands to generate.