aboutsummaryrefslogtreecommitdiff
path: root/sim
AgeCommit message (Collapse)AuthorFilesLines
2024-01-01sim: warnings: enable -Wunused-variableMike Frysinger2-2/+2
2024-01-01cpu: or1k: drop unused l.swa flagMike Frysinger2-2/+0
The "flag" argument isn't set/used in this insn, so drop it. This fixes an unused variable warning in the generated sim.
2024-01-01sim: fix pervasive typoTom Tromey9-42/+42
I noticed a typo in a sim constant. This patch fixes it. permenant -> permanent
2023-12-28sim: pru: Fix emulation of carry bitDimitar Dimitrov2-4/+424
The PRU architecture documentation [1] was used for the initial GNU simulator implementation. But recently [2] TI confirmed the carry behaviour was wrongly documented. In reality, the PRU carry behaves like the carry in ARM processors. This patch fixes simulator to align with latest recommendations from TI. The new carry.s test was also validated to pass on real hardware - a BeaglePlay board [3]. That test is a bit long because TI still has not released official updates for the PRU documents. And I wanted to ensure simulator handles all edge cases exactly as the real hardware does. [1] https://www.ti.com/lit/pdf/spruij2 [2] https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1244359/sk-am64b-am64x-pru-assembler-how-works-this-bloody-carry [3] https://www.beagleboard.org/boards/beagleplay Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2023-12-26sim: common: pull in newlib extensions for Linux compatibilityMike Frysinger2-1/+122
Since newlib allows people to opt-in to extra errno names, pull them into our table too. The values don't conflict with each other -- the newlib names & values are distinct from newlib's Linux compatibility.
2023-12-24sim: cris: rvdummy: delete unused variableMike Frysinger1-1/+0
2023-12-24sim: cgen: mark cgen_rtx_error noreturnMike Frysinger1-1/+1
Since this function never returns, mark it as such to fix some unused variable warnings in error code paths. For example, cris triggers: sim/cris/semcrisv10f-switch.c:3558:11: error: variable 'tmp_newval' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] Even though it has an "else" path that calls this error function.
2023-12-24sim: cgen: regenerate decode tablesMike Frysinger9-5827/+5827
Integrate some changes from upstream cgen that tightened up the generated output. Shouldn't be any functional changes here.
2023-12-24sim: sh: refine pwsb & pwad nopsMike Frysinger1-0/+2
Since these insns don't do anything and are effectively ignored, return early to avoid doing any common processing at the end as that requires initializing variables like "res" with something.
2023-12-24sim: sh: fix plds Dz,MACL implementationMike Frysinger1-1/+1
The plds Dz,MACL insn stores the Dz bit into MACL. The current code was storing the "res" variable into Dz and then into MACL, but not setting "res" to anything. Delete that logic and make it match the existing plds Dz,MACH insn.
2023-12-23sim: warnings: rework individual flag disable into dedicated varsMike Frysinger4-51/+157
The -Wshadow=local is too new for some compilers, so move it to a var that we test at configure time.
2023-12-22sim: sh: fix -Wshadow=local warningsMike Frysinger1-2/+2
Rename the var to avoid shadowing & clobbering the higher context.
2023-12-22sim: riscv: fix -Wshadow=local warningsMike Frysinger1-6/+4
Inline the one usage of sd in these macros to avoid possible shadowing.
2023-12-22sim: ppc: fix -Wshadow=local warningsMike Frysinger1-3/+3
Use a local name in the macro to avoid shadowing wherever it's used.
2023-12-22sim: mips: fix -Wshadow=local warningsMike Frysinger1-5/+2
Delete redundant decls when the existing scope has the same var and type available for use.
2023-12-22sim: m68hc11: fix -Wshadow=local warningsMike Frysinger3-4/+3
Delete redundant decls when the existing scope has the same var and type available for use.
2023-12-22sim: m32c: fix -Wshadow=local warningsMike Frysinger2-12/+9
These decoders declare a lot of common variables for use by substeps, and then shadows a few because of how the opc generator is implemented. Easiest way around it is to rename the per-substep vars as needed as anything more would require substantial changes to the opc logic.
2023-12-22sim: iq2000: fix -Wshadow=local warningsMike Frysinger1-1/+1
Delete redundant decls.
2023-12-22sim: h8300: fix -Wshadow=local warningsMike Frysinger1-2/+2
Delete conflicting decls when the existing scope has vars of the same name & type for this exact use.
2023-12-22sim: frv: fix -Wshadow=local warningsMike Frysinger2-4/+3
Delete redundant decls, and rename conflicting vars.
2023-12-22sim: erc32: fix -Wshadow=local warningsMike Frysinger1-32/+31
Rename shadowed vars with different types to avoid confusion.
2023-12-22sim: cris: disable -Wshadow=local in generated mloop filesMike Frysinger2-1/+5
The mloop files include CGEN generated switch files which have some nested assignments that expand into repeated shadowed variables. Fixing this looks fairly non-trivial as it appears to be interplay between the common CGEN code and how this particular set of cris insns are defined. Disable the warning instead. In file included from sim/cris/mloop.in:286: sim/cris/semcrisv10f-switch.c: In function ‘crisv10f_engine_run_full’: sim/cris/semcrisv10f-switch.c:12383:8: error: declaration of ‘opval’ shadows a previous local [-Werror=shadow=local] 12383 | SI opval = tmp_addr; | ^~~~~ sim/cris/semcrisv10f-switch.c:12371:9: note: shadowed declaration is here 12371 | USI opval = ({ SI tmp_addr; | ^~~~~ And the code looks like: USI opval = ({ ... { SI opval = tmp_addr; ... } ... }); Since the CGEN code treats "opval" as an internal variable that the cpu definitions don't have direct access to, the likelihood of this being a real bug is low, so leave it be. The warning is suppressed for more code that is hand written (e.g. the mloop logic), but disabling for the entire file is the easiest way to suppress while keeping it on everywhere else in the sim.
2023-12-22sim: cris: fix -Wshadow=local warningsMike Frysinger2-2/+0
Delete redundant local decls.
2023-12-22sim: common: fix -Wshadow=local warningsMike Frysinger2-3/+3
Rename shadowed vars with different types, and delete redundant decls.
2023-12-22sim: bfin: fix -Wshadow=local warningsMike Frysinger1-3/+3
Rename the shadowed var to avoid confusion with the function argument as to which address this code is using.
2023-12-22sim: arm: fix -Wshadow=local warningsMike Frysinger3-46/+30
Remove duplicate nested variable declarations, rename some to avoid confusion when the type is different or the original value should be retained, and fix some weirdness with nested enums in structs.
2023-12-22sim: aarch64: fix -Wshadow=local warningsMike Frysinger1-21/+21
These functions have local vars named "val" of type float, and then create nested vars named "val" of type double. This is a bit confusing and causes build time warnings.
2023-12-22sim: cgen: regenerate decode tables to avoid shadow warningsMike Frysinger9-548/+548
Use latest cgen to regenerate the decode tables which has some shadow warning fixes with "val" variables.
2023-12-22sim: cris: regen cgen decoders to fix build warnings [PR sim/31181]Mike Frysinger2-211/+211
Bug: https://sourceware.org/PR31181
2023-12-21sim: ppc: igen: fix -G handlingMike Frysinger1-2/+9
We weren't using the enable_p flag to see whether the option should be enabled or disabled, and we weren't breaking out when done parsing.
2023-12-21sim: warnings: enable -Wreturn-typeMike Frysinger2-0/+2
Older versions of gcc support this warning flag. We're already clean.
2023-12-21sim: warnings: fix -Wreturn-mismatch typoMike Frysinger2-2/+2
2023-12-21sim: m32c: fix initial #line number in generated codeMike Frysinger1-1/+1
This emits #line 2 for the first line in the output when it should be 1.
2023-12-21sim: mloop: add #line pragmas everywhereMike Frysinger9-0/+63
This will make compiler diagnostics much better with generated code so people can understand the original source file.
2023-12-21sim: common: add $LINENO rewriting support to genmloop scriptsMike Frysinger4-22/+83
The generated mloop files can trigger compile time warnings. It can be difficult to see/understand where the original code is coming from as all the diagnostics point to the generated output. Using #line pragmas, we can point people to the original source files. Unfortunately, this code is written in POSIX shell, and that lacks support for line number tracking. The $LINENO variable, even when available, can just be plain wrong. For example, when using dash and subshells, $LINENO can end up having negative values. Add a wrapper script that will uses awk to rewrite the $LINENO variable to the right value to avoid all that. Basically lineno.sh takes an input script, rewrites all uses of $LINENO into the actual line number (and $0 into the original file name), and then executes the temporary script. This commit doesn't actually add #line pragmas to any files. That comes next.
2023-12-21sim: warnings: enable -Wimplicit-fallthrough=5Mike Frysinger2-0/+2
It caught some legitimate bugs, so clearly it's helpful.
2023-12-21sim: sh: fix -Wimplicit-fallthrough warningsMike Frysinger1-0/+1
These generate conditional insns where it tests, then fallsthru.
2023-12-21sim: rx: fix -Wimplicit-fallthrough warningsMike Frysinger1-2/+2
Replace some fall through comments with the attribute.
2023-12-21sim: rl78: fix -Wimplicit-fallthrough warningsMike Frysinger1-0/+1
Seems like this code was meant to fallthru.
2023-12-21sim: riscv: fix -Wimplicit-fallthrough warningsMike Frysinger1-0/+1
2023-12-21sim: ppc: fix -Wimplicit-fallthrough warningsMike Frysinger1-1/+1
Replace some fall through comments with the attribute.
2023-12-21sim: or1k: fix -Wimplicit-fallthrough warningsMike Frysinger1-1/+1
Replace some fall through comments with the attribute.
2023-12-21sim: mips: fix -Wimplicit-fallthrough warningsMike Frysinger3-1/+13
Seems like these cases were meant to fallthru.
2023-12-21sim: mcore: fix Wimplicit-fallthrough warningsMike Frysinger1-0/+2
Seems like these decodes were intended to fallthru.
2023-12-21sim: m68hc11: fix -Wimplicit-fallthrough warningsMike Frysinger2-0/+2
Seems like these register operations intended on falling thru.
2023-12-21sim: frv: fix -Wimplicit-fallthrough warningsMike Frysinger2-3/+3
Replace some fall through comments with the attribute.
2023-12-21sim: erc32: fix -Wimplicit-fallthrough warningsMike Frysinger3-0/+12
Add the attribute where it seems to make sense.
2023-12-21sim: cris: fix -Wimplicit-fallthrough warningsMike Frysinger2-1/+5
Replace some fall through comments with the attribute.
2023-12-21sim: bfin: fix -Wimplicit-fallthrough warningsMike Frysinger4-0/+5
Add the attribute to places where we want to fall thru.
2023-12-21sim: avr: fix -Wimplicit-fallthrough warningsMike Frysinger1-1/+1
Replace some fall through comments with the attribute.