aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2022-09-05sim/riscv: Complete tidying up with SBREAKTsukasa OI1-3/+3
This commit removes SBREAK-related references on the simulator as it's renamed to EBREAK in 2016 (the RISC-V ISA, version 2.1). sim/ChangeLog: * riscv/sim-main.c (execute_i): Use "ebreak" instead of "sbreak".
2022-09-04sim/erc32: fix gdb with simulator buildAndrew Burgess3-3/+16
In commit: commit 7b01c1cc1d111ba0afa51e60fa9842d3b971e2d1 Date: Mon Apr 4 22:38:04 2022 +0100 sim: fixes for libopcodes styled disassembler changes were made to the simulator source to handle the new libopcodes disassembler styling API. Unfortunately, these changes broke building GDB with the erc32 (sparc) simulator, like this: ../src/configure --target=sparc-linux make all-gdb .... /usr/bin/ld: ../sim/erc32/libsim.a(interf.o): in function `sim_open': /tmp/build/sim/../../src/sim/erc32/interf.c:247: undefined reference to `fprintf_styled' collect2: error: ld returned 1 exit status The problem is that in commit 7b01c1cc1d11 the fprintf_styled function was added into sis.c. This file is only used when building the 'run' binary, that is, the standalone simulator, and is not included in the libsim.a library. Now, the obvious fix would be to move fprintf_styled into libsim.a, however, that turns out to be tricky. The erc32 simulator currently has two copies of the function run_sim, one in sis.c, and one in interf.c, both of these copies are global. Currently, the 'run' binary links fine, though I suspect this might be pure luck. When I tried moving fprintf_styled into interf.c, I ran into multiple-definition (of run_sim) errors. I suspect that by requiring the linker to pull in fprintf_styled from libsim.a I was changing the order in which symbols were loaded, and the linker was now seeing both copies of run_sim, while currently we only see one copy. The ideal solution of course, would be to merge the two similar, but slightly different copies of run_sim, and just use the one copy. Then we could safely move fprintf_styled into interf.c too, and all would be good. But I don't have time right now to start debugging the erc32 simulator, so I wanted a solution that fixes the build without introducing multiple definition errors. The easiest solution I think is to just have two copies of fprintf_styled, one in sis.c, and one in interf.c. Unlike run_sim, these two copies are both static, so we will not run into multiple definition issues with this function. The functions themselves are not very big, so it's not a huge amount of duplicate code. I am very aware that this is not an ideal solution, and I would welcome anyone who wants to take on fixing the run_sim problem properly, and then cleanup the fprintf_styled duplication.
2022-09-01sim: Update mailing list addressTsukasa OI1-1/+1
The commit bf1102165389 "* MAINTAINERS: Perform some obvious fixups." back in 2009 changed the mailing list address gdb-patches@sources.redhat.com to gdb-patches@sourceware.org. This commit does the same to sim/MAINTAINERS. sim/ChangeLog: * MAINTAINERS: Update mailing list address. Change-Id: I56c6bf21a4bddfb35ffc3336ffcba7ff9b39926e
2022-08-25sim/aarch64: Fix aarch64_get_CPSR_bits() declarationJan-Benedict Glaw1-1/+1
Noticed while doing mass builds with a very recent GCC: /usr/lib/gcc-snapshot/bin/gcc -DHAVE_CONFIG_H -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wno-error=maybe-uninitialized -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wpointer-sign -Wold-style-declaration -Werror -I. -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64 -I../common -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../common -I../../include -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../include -I../../bfd -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../bfd -I../../opcodes -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../opcodes -I../.. -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../gnulib/import -I../../gnulib/import -g -O2 -c -o cpustate.o -MT cpustate.o -MMD -MP -MF .deps/cpustate.Tpo cpustate.c cpustate.c:270:1: error: conflicting types for 'aarch64_get_CPSR_bits' due to enum/integer mismatch; have 'uint32_t(sim_cpu *, FlagMask)' {aka 'unsigned int(struct _sim_cpu *, FlagMask)'} [-Werror=enum-int-mismatch] 270 | aarch64_get_CPSR_bits (sim_cpu *cpu, FlagMask mask) | ^~~~~~~~~~~~~~~~~~~~~ In file included from sim-main.h:30, from cpustate.c:28: cpustate.h:310:20: note: previous declaration of 'aarch64_get_CPSR_bits' with type 'uint32_t(sim_cpu *, uint32_t)' {aka 'unsigned int(struct _sim_cpu *, unsigned int)'} 310 | extern uint32_t aarch64_get_CPSR_bits (sim_cpu *, uint32_t); | ^~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors
2022-08-06Don't use BFD_VMA_FMT in gdb and simAlan Modra9-46/+48
Like commit b82817674f, this replaces BFD_VMA_FMT "x" in sim/ with PRIx64 and casts to promote bfd_vma to uint64_t. The one file using BFD_VMA_FMT in gdb/ instead now uses hex_string, and a typo in the warning message is fixed.
2022-06-15sim: fix BFD_VMA format arguments on 32-bit hosts [PR gdb/29184]Sergei Trofimovich3-8/+10
Noticed format mismatch when attempted to build gdb on i686-linux-gnu in --enable-64-bit-bfd mode: sim/../../sim/cris/sim-if.c:576:28: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'bfd_size_type' {aka 'long long unsigned int'} [-Werror=format=] 576 | sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x,0x%lx", | ^~~~~~~~~~~~~~~~~~~ 577 | interp_load_addr, interpsiz); | ~~~~~~~~~ | | | bfd_size_type {aka long long unsigned int} While at it fixed format string for time-related types.
2022-05-13sim: remove use of PTRAlan Modra14-23/+23
PTR will soon disappear from ansidecl.h. Remove uses in sim. Where a PTR cast is used in assignment or function args to a void* I've simply removed the unnecessary (in C) cast rather than replacing with (void *).
2022-04-06Fix for v850e divq instructionJeff Law2-2/+13
This is the last of the correctness fixes I've been carrying around for the v850. Like the other recent fixes, this is another case where we haven't been as careful as we should WRT host vs target types. For the divq instruction both operands are 32 bit types. Yet in the simulator code we convert them from unsigned int to signed long by assignment. So 0xfffffffb (aka -5) turns into 4294967291 and naturally that changes the result of our division. The fix is simple, insert a cast to int32_t to force interpretation as a signed value. Testcase for the simulator is included. It has a trivial dependency on the bins patch.
2022-04-06Fix "bins" simulation for v850e3v5Jeff Law3-2/+21
I've been carrying this for a few years. One test in the GCC testsuite is failing due to a bug in the handling of the v850e3v5 instruction "bins". When the "bins" instruction specifies a 32bit bitfield size, the simulator exhibits undefined behavior by trying to shift a 32 bit quantity by 32 bits. In the case of a 32 bit shift, we know what the resultant mask should be. So we can just set it. That seemed better than using 1UL for the constant (on a 32bit host unsigned long might still just be 32 bits) or needlessly forcing everything to long long types. Thankfully the case where this shows up is only bins <src>, 0, 32, <dest> which would normally be encoded as a simple move. * testsuite/v850/allinsns.exp: Add v850e3v5. * testsuite/v850/bins.cgs: New test. * v850/simops.c (v850_bins): Avoid undefined behavior on left shift.
2022-04-04sim: fixes for libopcodes styled disassemblerAndrew Burgess11-9/+109
In commit: commit 60a3da00bd5407f07d64dff82a4dae98230dfaac Date: Sat Jan 22 11:38:18 2022 +0000 objdump/opcodes: add syntax highlighting to disassembler output I broke several sim/ targets by forgetting to update their uses of the libopcodes disassembler to take account of the new styled printing. These should all be fixed by this commit. I've not tried to add actual styled output to the simulator traces, instead, the styled print routines just ignore the style and print the output unstyled.
2022-03-29Fix for MUL instruction on the v850Jeff Law2-2/+17
* sim/v850/simops.c (Multiply64): Properly test if we need to negate either of the operands. * sim/testsuite/v850/mul.cgs: New test.
2022-03-28sim: add arch/.gdbinit stub scriptsMike Frysinger4-34/+169
Make it easy to load the common gdbinit script even when running in the arch/ subdir instead of the top-level sim dir.
2022-03-25libtool.m4: fix the NM="/nm/over/here -B/option/with/path" caseNick Alcock1-7/+13
My previous nm patch handled all cases but one -- if the user set NM in the environment to a path which contained an option, libtool's nm detection tries to run nm against a copy of nm with the options in it: e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle". This is unlikely to be desirable: in this case we should run "/usr/bin/nm --blargle /usr/bin/nm". Furthermore, as part of this nm has to detect when the passed-in $NM contains a path, and in that case avoid doing a path search itself. This too was thrown off if an option contained something that looked like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run "nm -B../prev-gcc nm" which rarely works well (and indeed it looks to see whether that nm exists, finds it doesn't, and wrongly concludes that nm -p or whatever does not work). Fix all of these by clipping all options (defined as everything including and after the first " -") before deciding whether nm contains a path (but not using the clipped value for anything else), and then removing all options from the path-modified nm before looking to see whether that nm existed. NM=my-nm now does a path search and runs e.g. /usr/bin/my-nm -B /usr/bin/my-nm NM=/usr/bin/my-nm now avoids a path search and runs e.g. /usr/bin/my-nm -B /usr/bin/my-nm NM="my-nm -p../wombat" now does a path search and runs e.g. /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search: ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm This seems to be all combinations, including those used by GCC bootstrap (which, before this commit, fails to bootstrap when configured --with-build-config=bootstrap-lto, because the lto plugin is now using --export-symbols-regex, which requires libtool to find a working nm, while also using -B../prev-gcc to point at the lto plugin associated with the GCC just built.) Regenerate all affected configure scripts. * libtool.m4 (LT_PATH_NM): Handle user-specified NM with options, including options containing paths.
2022-03-24sim: fix a comment typo in sim-load.cReuben Thomas1-1/+1
Fix a typo where the documentation refers to a function parameter by the wrong name. Change-Id: I99494efe62cd4aa76fb78a0bd5da438d35740ebe
2022-03-24sim: fix “alligned” typosReuben Thomas3-4/+4
Change-Id: Ifd574e38524dd4f1cf0fc003e0c5c7499abc84a0
2022-02-21sim: gdbinit: hoist setup to common codeMike Frysinger12-70/+11
This was left in subdirs because of the dynamic cgen usage. However, we can move this breakpoint call to runtime and let gdb detect whether the symbol exists.
2022-02-16sim/common: Improve sim_dump_memory head commentHans-Peter Nilsson1-1/+2
As requested by Mike. * sim-memopt.c: Improve head comment.
2022-02-16sim/testsuite/cris/c/stat3.c: Fix formatting nitHans-Peter Nilsson1-1/+1
* c/stat3.c (main): Fix formatting nit.
2022-02-16sim: testsuite: cleanup the istarget * logicMike Frysinger46-467/+332
Now that the multitarget testing has settled, clean up the cases where istarget * is used. This ends up being mostly style unindenting.
2022-02-15sim/testsuite: Default global_cc_os and global_cc_works properlyHans-Peter Nilsson1-4/+2
There was an omission on 3e6dc39ed7a8 "sim/testsuite: Set global_cc_os also when no compiler is found"; global_cc_os wasn't set for other than the primary target, which means that the "unguarded" use of global_cc_os in testsuite/cris/c/c.exp caused the dreaded "ERROR: can't read "global_cc_os": no such variable" when e.g. configuring for pru-elf and doing "make check-sim". Better initializing both variables at the top to default values, rather than adding another single 'set global_cc_os ""', to reduce the risk of not setting them properly if or when that if-statement-chain is made longer. sim/testsuite: * lib/sim-defs.exp (sim_init_toolchain): Default global_cc_os and global_cc_works properly, before if-chain.
2022-02-14sim/testsuite/cris: If failing compilation, mark C tests as errorsHans-Peter Nilsson1-1/+1
...when we know we have a working compiler. This will reduce the risk of faulty edits by exposing them rather than hiding them as "unresolved". It also harmonizes behavior with that of run_sim_test. * c/c.exp: Mark C tests failing compilation test errors.
2022-02-14sim/testsuite/cris: Remove faulty use of basename in C testsHans-Peter Nilsson2-4/+7
Calls to basename were added here as part of commit e1e1ae6e9b5e "sim: testsuite: fix objdir handling", but that commit missed adding "#include <libgen.h>" or the equivalent GNU extension, see basename(3). Fixing that shows a logical error in the change to openpf1.c; the non-/-prefixed code-path was changed instead of the "/"-prefixed code-path, which is the one executed after that commit. For "newlib" these tests failed linking after that commit. Recent newlib has the (asm-renamed) GNU-extension-variant of basename, but we're better off not using it at all. Unfortunately, compilation failures for C tests run by the machinery in c.exp are currently just marked "unresolved", in contrast to C and assembler tests run by calling run_sim_test. The interaction of calling with the full program-path vs. use of --sysroot exposes a consistency problem: when --sysroot is used, argv[0] isn't the path by which the program can find itself. It's undecided whether argv[0] for the program running in the simulator should be edited (related to the naked argument to the simulator before passing on to the simulated program) to remove a leading --sysroot. Either way, such a change would be out of scope for this commit. * c/stat3.c (mybasename): New macro. Use it instead of basename. * c/openpf1.c: Correct basename-related change and update related comment.
2022-02-14sim: Add sim_dump_memory for debuggingHans-Peter Nilsson1-0/+10
Intended to be called from the debugger tool. sim/common: * sim-memopt.c (sim_dump_memory): New function.
2022-02-14sim: Fix use of out-of-tree assembler and linker when testingHans-Peter Nilsson3-106/+278
With commit 7a259895bb2d "sim: testsuite: expand arch specific toolchain settings", trying to use out-of-tree ld and as at test-time broke for the "primary target", like when testing a release-tarball. Subsequent to that commit, all assembler tests without in-tree-built tools FAIL, getting errors when trying to call $(abs_builddir)/../gas/as-new. But, that isn't the actual culprint; it's actually it's its immediate predecessor, commit 8996c21067373 "sim: testsuite: setup per-port toolchain settings for multitarget build", which hardcodes in-tree-paths to those tools instead of considering e.g. $(<X>_FOR_TARGET), the preferred overridable variable for single-target builds, as set up by the toplevel Makefile. This commit calls GCC_TARGET_TOOL (a deceptive name; gcc-specific features aren't used) from toplev/config/acx.m4, somewhat like calls in toplev/configure.ac but without the NCN_STRICT_CHECK_TARGET_TOOLS step, for each X to find a value for $(<X>_FOR_TARGET). N.B.: in-tree tools still override any ${target}-${tool} found in $PATH, i.e. only previously broken builds are affected. The variables $(<X>_FOR_TARGET) are usually overridden by the toplevel Makefile to the same value or better, but has to be set here too, as automake "wants" Makefiles to be self-contained (you get an error pointing out that the variable may be empty). If it hadn't been for that, SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET would not be needed. This detail should only (positively) affect users invoking "make check" in sim/ instead of "make check-sim" (or "make check") at the toplevel. Now the output from "configure" matches the target tools actually used by sim at test-time, for the "primary target". Using $(CC) for "example-" targets CC_FOR_TARGET is not changed, as that appears to be a deliberate special-case. Note that all tools still have to be installed and present in $PATH at configure-time to be properly used at test-time. sim: * m4/sim_ac_toolchain.m4 (SIM_AC_CHECK_TOOLCHAIN_FOR_PRIMARY_TARGET): New defun. (SIM_TOOLCHAIN_VARS): Call it using AC_REQUIRE, and use variables AS_FOR_TARGET, LD_FOR_TARGET and CC_FOR_TARGET instead of hard-coded values. * Makefile.in, configure: Regenerate.
2022-02-14sim cris: Unbreak --disable-sim-hardware buildsHans-Peter Nilsson1-0/+8
With --disable-sim-hardware (--enable-sim-hardware=no), whose default was changed to --enable-sim-hardware(=yes) in commit 34cf51120683, building for cris-elf fails as sim_hw_parse then doesn't exist. A cris-elf simulator configured for --enable-sim-hardware (or the default after to the mentioned commit) runs about 2.5x slower than one configured --disable-sim-hardware. A further 2-5% performance regression was not investigated. When sim_hw_parse doesn't exist, --cris-900000xx can't be supported. The best action here is to remove it completely, so its absence can be identified through --help, but avoiding littering the code with "#if WITH_HW". sim/cris: * sim-if.c (cris_options) [WITH_HW]: Conditionalize support of option --cris-900000xx. (sim_open) [WITH_HW]: Conditionalize sim_hw_parse call.
2022-02-14sim/testsuite/cris: As applicable, require simoption --cris-900000xxHans-Peter Nilsson5-0/+5
Apply the new run_sim_test option "require" as in "#require simoption --cris-900000xx" for all tests using that option. This allows a clean test-suite-run for a build with --disable-sim-hardware, where that option is not supported, by skipping those tests as "untested". sim/testsuite/cris: * asm/io1.ms, asm/io2.ms, asm/io3.ms, asm/io6.ms, asm/io7.ms: Call "#require: simoption --cris-900000xx".
2022-02-14sim/testsuite: Support "requires: simoption <--name-of-option>"Hans-Peter Nilsson1-0/+60
Simulator features can be present or not, typically depending on different-valued configure options, like --enable-sim-hardware[=off|=on]. To avoid failures in test-suite-runs when testing such configurations, a new predicate is needed, as neither "target", "progos" nor "mach" fits cleanly. The immediate need was to check for presence of a simulator option, but rather than a specialized "requires-simoption:" predicate I thought I'd handle the general (parametrized) need, so here's a generic predicate machinery and a (first) predicate to use together with it; checking whether a particular option is supported, by looking at "run --help" output. This was inspired by the check_effective_target_ machinery in the gcc test-suite. Multiple "requires: <requirement> <parameter>" form a list of predicates (with parameters), to be used as a conjunction. sim/testsuite: * lib/sim-defs.exp (sim_check_requires_simoption): New function. (run_sim_test): Support "requires: <requirement> <parameter>".
2022-02-14sim/testsuite/cris/hw/rv-n-cris/irq1.ms: Disable due to randomnessHans-Peter Nilsson1-0/+1
For reasons that remain largely to be investigated (besides the apparent lack of synchronization between two processes), this test fails randomly, with two different sets of common outputs. Curiously, that doesn't happen for the other similar tests. There's a comment that mentions this, though that doesn't make it a sustainable part of a test-suite. (Known-blinking tests should be disabled until fixed.) sim/testsuite/cris: * hw/rv-n-cris/irq1.ms: Disable by use of a never-matched "progos" value.
2022-02-14sim/testsuite/cris/c: Use -sim3 but only for newlib targetsHans-Peter Nilsson1-4/+12
Commit a39487c6685f "sim: cris: use -sim with C tests for cris-elf targets" caused " -sim" to be appended to CFLAGS_FOR_TARGET for cris*-*-elf, where testing had until then relied on "RUNTESTFLAGS=--target_board=cris-sim" being passed when running "make check-sim", adding the right options. While "-sim" happens to work, the baseboard-file cris-sim.exp uses "-sim3" so for consistency use that instead. Then commit b42f20d2ac72 "sim: testsuite: drop most specific istarget checks" caused " -sim" to be appended for *all* targets, which just doesn't work. For example, for crisv32-linux-gnu, that's not a recognized option and will cause a dejagnu error and further testing in c.exp will be aborted. While cris-sim.exp appends "-static" for *-linux-gnu, further changes in the test-suite have caused "linux"-specific tests to break, so that part will be tended to separately. But, save and restore CFLAGS_FOR_TARGET around the modification and use where needed, to not have the CRIS-specific modification affect a continuing test-run (possibly for other targets). sim/testsuite/cris: * c/c.exp (CFLAGS_FOR_TARGET): Replace appended option " -sim" with " -sim3", but do it conditionally for newlib targets. Save and restore CFLAGS_FOR_TARGET in saved_CFLAGS_FOR_TARGET such that it doesn't affect the value of CFLAGS_FOR_TARGET outside c.exp.
2022-02-14sim/testsuite: Set global_cc_os also when no compiler is foundHans-Peter Nilsson1-0/+1
If we don't set this variable, it doesn't exist, and using "#progos:" in an assembler-file will cause an error rather than just skipping the test, viz: Running /src/sim/testsuite/cris/hw/rv-n-cris/rvc.exp ... ERROR: tcl error sourcing /src/sim/testsuite/cris/hw/rv-n-cris/rvc.exp. ERROR: can't read "global_cc_os": no such variable while executing "if { $opts(progos) != "" && $opts(progos) != $global_cc_os } { untested $subdir/$name return }" (procedure "run_sim_test" line 102) Neither the commit introducing progos, nor the top comment in run_sim_test, mentions progos as intended only for C tests, or that its use must be gated on $global_cc_works != 0, so (not) setting it in the no-working-compiler path seems just overlooked. Allowing it to be used for assembler tests makes it usable for e.g. an always-false predicate and in expressions in .exp files without gating on $global_cc_works != 0. With this patch, global_cc_os is set to "", just as for "unknown OS". sim/testsuite: * lib/sim-defs.exp (sim_init_toolchain): Set global_cc_os also when no working target C compiler is found.
2022-02-14sim/testsuite/cris: Assembler testcase for PRIx32 usage bugHans-Peter Nilsson1-0/+47
Several C test-cases exposed the bug, but let's have one for people who test using just the assembler and linker. * asm/endmem1.ms: New test.
2022-02-14sim cris: Correct PRIu32 to PRIx32Hans-Peter Nilsson1-1/+1
In 5ee0bc23a68f "sim: clean up bfd_vma printing" there was an additional introduction of PRIx32 and PRIu32 but just in sim/cris/sim-if.c. One type of bug was fixed in commit d16ce6e4d581 "sim: cris: fix memory setup typos" but one remained; the PRIu32 usage is wrong, as hex output is desired; note the 0x prefix. Without this fix, you'll see output like: memory map 0:0x4000..0x5fff (8192 bytes) overlaps 0:0x0..0x16383 (91012 bytes) program stopped with signal 6 (Aborted). for some C programs, like some of the ones in the sim/cris/c testsuite from where the example is taken (freopen2.c). The bug behavior was with memory allocation. With an attempt to allocate memory using the brk syscall such that the room up to the next 8192-byte "page boundary" wasn't sufficient, the simulator memory allocation machinery horked on a consistency error when trying to allocate a memory block to raise the "end of the data segment": there was already memory allocated at that address. Unfortunately, none of the programs in sim/cris/asm exposed this bug at the time, but an assembler test-case is committed after this fix. sim/cris: * sim-if.c (sim_open): Correct PRIu32 to PRIx32.
2022-02-04sim: mips: Add simulator support for mips32r6/mips64r6Faraz Shahbazker26-75/+3749
2022-02-01 Ali Lown <ali.lown@imgtec.com> Andrew Bennett <andrew.bennett@imgtec.com> Dragan Mladjenovic <dragan.mladjenovic@rt-rk.com> Faraz Shahbazker <fshahbazker@wavecomp.com> sim/common/ChangeLog: * sim-bits.h (EXTEND9, EXTEND18 ,EXTEND19, EXTEND21, EXTEND26): New macros. sim/mips/ChangeLog: * Makefile.in (IGEN_INCLUDE): Add mips3264r6.igen. * configure: Regenerate. * configure.ac: Support mipsisa32r6 and mipsisa64r6. (sim_engine_run): Pick simulator model from processor specified in e_flags. * cp1.c (value_fpr): Handle fmt_dc32. (fp_unary, fp_binary): Zero initialize locals. (update_fcsr, fp_classify, fp_rint, fp_r6_cmp, inner_fmac, fp_fmac, fp_min, fp_max, fp_mina, fp_maxa, fp_fmadd, fp_fmsub): New functions. (sim_fpu_class_mips_mapping): New. * cp1.h (fcsr_ABS2008_mask, fcsr_ABS2008_shift): New define. * interp.c (MIPSR6_P): New. (load_word): Allow unaligned memory access for MIPSR6. * micromips.igen (sc, scd): Adapt to new do_sc* helper signature. * mips.igen: Add *r6 models. (signal_if_cti, forbiddenslot32): New helpers. (delayslot32): Use signal_if_cti. (do_sc, do_scd); Add store_ll_bit parameter. (sc, scd): Adapt to previous change. (nal, beq, bal): New definitions for *r6. (sll): Split nop and ssnop cases into ... (nop, ssnop): New definitions. (loadstore_ea): Use the 32-bit compatibility adressing. (cache): Split logic into ... (do_cache): New helper. (check_fpu): Select IEEE 754-2008 mode for R6. (not_word_value, unpredictable, check_mt_hilo, check_mf_hilo, check_multi_hilo, check_div_hilo, check_u64, do_dmfc1b, add, li, addu, and, andi, bgez, bgtz, blez, bltz, bne, break, dadd, daddiu, daddu, dror, dror32, drorv, dsll, dsll32, dsllv, dsra, dsra32, dsrav, dsrl, dsrl32, dsub, dsubu, j, jal, jalr, jalr.hb, lb, lbu, ld, lh, lhu, lui, lw, lwu, nor, or, ori, ror, rorv, sb, sd, sh, sll, sllv, slt, slti, sltiu, sltu, sra, srav, srl, srlv, sub, subu, sw, sync, syscall, teq, tge, tgeu, tlt, tltu, tne, xor, xori, check_fmt_p, do_load_double, do_store_double, abs.FMT, add.FMT, ceil.l.FMT, ceil.w.FMT, cfc1, ctc1, cvt.d.FMT, cvt.l.FMT, cvt.w.FMT, div.FMT, dfmc1, dmtc1, floor.l.FMT, floor.w.FMT, ldc1, lwc1, mfc1, mov.FMT, mtc1, mul.FMT, recip.FMT, round.l.FMT, round.w.FMT, rsqrt.FMT, sdc1, sqrt.FMT, sub.FMT, swc1, trunc.l.FMT, trunc.w.FMT, bc0f, bc0fl, bc0t, bc0tl, dmfc0, dmtc0, eret, mfc0, mtc0, cop, tlbp, tlbr, tlbwi, tlbwr): Enable on *r6 models. * mips3264r2.igen (dext, dextm, dextu, di, dins, dinsm, dinsu, dsbh, dshd, ei, ext, mfhc1, mthc1, ins, seb, seh, synci, rdhwr, wsbh): Likewise. * mips3264r6.igen: New file. * sim-main.h (FP_formats): Add fmt_dc32. (FORBIDDEN_SLOT): New macros. (simFORBIDDENSLOT, FP_R6CMP_*, FP_R6CLASS_*): New defines. (fp_r6_cmp, fp_classify, fp_rint, fp_min, fp_max, fp_mina, fp_maxa, fp_fmadd, fp_fmsub): New declarations. (R6Compare, Classify, RoundToIntegralExact, Min, Max, MinA, MaxA, FusedMultiplyAdd, FusedMultiplySub): New macros. Wrapping previous declarations. sim/testsuite/mips/ChangeLog: * basic.exp: Add r6-*.s tests. (run_r6_removed_test): New function. (run_endian_tests): New function. * hilo-hazard-3.s: Skip for mips*r6. * r2-fpu.s: New test. * r6-64.s: New test. * r6-branch.s: New test. * r6-forbidden.s: New test. * r6-fpu.s: New test. * r6-llsc-dp.s: New test. * r6-llsc-wp.s: New test. * r6-removed.csv: New test. * r6-removed.s: New test. * r6.s: New test. * utils-r6.inc: New inc.
2022-02-04sim: Add partial support for IEEE 754-2008Faraz Shahbazker2-5/+131
2022-02-01 Faraz Shahbazker <fshahbazker@wavecomp.com> sim/common/ChangeLog: * sim-fpu.c (sim_fpu_minmax_nan): New. (sim_fpu_max): Add variant behaviour for IEEE 754-2008. (sim_fpu_min): Likewise. (sim_fpu_is_un, sim_fpu_is_or): New. (sim_fpu_un, sim_fpu_or): New. (sim_fpu_is_ieee754_2008, sim_fpu_is_ieee754_1985): New. (sim_fpu_set_mode): New. (sim_fpu_classify): New. * sim-fpu.h (sim_fpu_minmax_nan): New declaration. (sim_fpu_un, sim_fpu_or): New declarations. (sim_fpu_is_un, sim_fpu_is_or): New declarations. (sim_fpu_mode): New enum. [sim_fpu_state](current_mode): New field. (sim_fpu_current_mode): New define. (sim_fpu_is_ieee754_2008): New declaration. (sim_fpu_is_ieee754_1985): New declaration. (sim_fpu_set_mode): New declaration. (sim_fpu_classify): New declaration.
2022-02-04sim: Factor out NaN handling in floating point operationsFaraz Shahbazker2-158/+41
2022-02-01 Faraz Shahbazker <fshahbazker@wavecomp.com> sim/common/ChangeLog: * sim-fpu.c (sim_fpu_op_nan): New. (sim_fpu_add): Factor out NaN operand handling with a call to sim_fpu_op_nan. (sim_fpu_sub, sim_fpu_mul, sim_fpu_div): Likewise. (sim_fpu_rem, sim_fpu_max, sim_fpu_min): Likewise. * sim-fpu.h (sim_fpu_op_nan): New declaration.
2022-02-04sim: Allow toggling of quiet NaN-bit semanticsFaraz Shahbazker5-18/+48
IEEE754-1985 specifies the top bit of the mantissa as an indicator of signalling vs. quiet NaN, but does not define the precise semantics. Most architectures treat this bit as indicating quiet NaN, but legacy (pre-R6) MIPS goes the other way and treats it as signalling NaN. This used to be controlled by a macro that was only defined for MIPS. This patch replaces the macro with a variable to track the current semantics of the NaN bit and allows differentiation between older (pre-R6) and and newer MIPS cores. 2022-02-01 Faraz Shahbazker <fshahbazker@wavecomp.com> sim/common/ChangeLog: * sim-fpu.c (_sim_fpu): New. (pack_fpu, unpack_fpu): Allow reversal of quiet NaN semantics. * sim-fpu.h (sim_fpu_state): New struct. (_sim_fpu): New extern. (sim_fpu_quiet_nan_inverted): New define. sim/mips/ChangeLog: * cp1.h (fcsr_NAN2008_mask, fcsr_NAN2008_shift): New. * mips.igen (check_fpu): Select default quiet NaN mode for legacy MIPS. * sim-main.h (SIM_QUIET_NAN_NEGATED): Remove.
2022-01-06sim: ppc: migrate to standard uintXX_t typesMike Frysinger37-1343/+1332
Drop the sim-specific unsignedXX types and move to the standard uintXX_t types that C11 provides.
2022-01-06sim: common: migrate to standard uintXX_t typesMike Frysinger22-432/+425
Drop the sim-specific unsignedXX types and move to the standard uintXX_t types that C11 provides.
2022-01-06sim: igen: migrate to standard uintXX_t typesMike Frysinger6-27/+9
Move off the custom local 64-bit types and to the standard uintXX_t types that C11 provides.
2022-01-06sim: mips: migrate to standard uintXX_t typesMike Frysinger17-1083/+1083
Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
2022-01-06sim: cris: migrate to standard uintXX_t typesMike Frysinger7-80/+80
Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
2022-01-06sim: iq2000: migrate to standard uintXX_t typesMike Frysinger1-4/+4
Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
2022-01-06sim: synacor: migrate to standard uintXX_t typesMike Frysinger2-27/+27
Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
2022-01-06sim: msp430: migrate to standard uintXX_t typesMike Frysinger2-15/+15
Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
2022-01-06sim: riscv: migrate to standard uintXX_t typesMike Frysinger1-28/+28
Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
2022-01-06sim: bfin: migrate to standard uintXX_t typesMike Frysinger1-2/+2
Move off the sim-specific unsignedXX types and to the standard uintXX_t types that C11 provides.
2022-01-06sim: testsuite: migrate to standard uintXX_t typesMike Frysinger4-19/+19
This old code setup its own uintXX types, but since we require C11 now, we can assume the standard uintXX_t types exist and use them.
2022-01-06sim: erc32: migrate to standard uintXX_t typesMike Frysinger7-312/+305
This old port setup its own uintXX types, but since we require C11 now, we can assume the standard uintXX_t types exist and use them.
2022-01-06sim: mn10300: migrate to standard uintXX_t typesMike Frysinger11-505/+498
This old port setup its own uintXX types, but since we require C11 now, we can assume the standard uintXX_t types exist and use them.
2022-01-06sim: v850: migrate to standard uintXX_t typesMike Frysinger5-111/+105
This old port setup its own uintXX types, but since we require C11 now, we can assume the standard uintXX_t types exist and use them.