#1244 Add CPU32 processor variant with full instruction set support#9084
#1244 Add CPU32 processor variant with full instruction set support#9084polartape wants to merge 1 commit intoNationalSecurityAgency:masterfrom
Conversation
|
Here are real differences to #8463 (moved your last |
|
Heya, I just want to see this support merged so I don't have to maintain my own fork :) I did not do any of this original work and just tried to bring others work up to date with main so it was mergable. If you are more familiar with this stack I'm happy to let y'all carry the torch and support you if I can. Let's just get this support merged :) |
|
I have been in the process of reviewing #8463 and I have no problem prioritizing one over the other. Having the pcodetests here helps, as well as the additional two instructions. It would be good to verify that the gcc toolchain will generate the For I'm less concerned about the instructions that are |
…truction set support Add Motorola CPU32 processor variant to the 68000 processor module. CPU32 is based on the 68020 with some instructions removed and table lookup/interpolation instructions added. Used in MC68330, MC68340, MC68360 and similar microcontrollers. Changes: - 68000.sinc: @ifdef/@ifndef CPU32 conditionals - Added: TBL instructions, LPSTOP, BGND - Excluded: BFxxx, CALLM, CAS, CAS2, PACK, RTM, UNPK - CPU32.slaspec: new language specification - 68000.ldefs: CPU32 variant definition - certification.manifest: CPU32.slaspec entry - Emulator test classes and pcode_defs.py configuration All 79 CPU32 instructions verified against CPU32 Reference Manual (Rev 1, Dec 1990). Pcode emulator tests pass: 16/16 O0, 16/16 O3.
33821bb to
0f803d1
Compare
|
TBL disassembly verified with all addressing modes (mode 2/4/5/7), all sizes (B/W/L), all variants (TBLS/TBLU/TBLSN/TBLUN), and both table lookup and register interpolate forms — 60 instruction encodings total, verified through Ghidra disassembly. The FPU exclusion (@ifndef CPU32) was needed to resolve a line-F opcode conflict that prevented TBL modes 5 and 7 from disassembling correctly. Added |
|
Implemented full TBL pcode semantics replacing the pcodeop placeholders. The implementation covers all variants (TBLS/TBLU/TBLSN/TBLUN), all sizes (B/W/L), both table lookup and register interpolate modes, including the signed rounding algorithm from RM p.213 and VF overflow detection for unrounded long results. Verified through Ghidra's emulator with 34 test cases covering the manual's worked example, rounding boundary conditions, signed/unsigned, all three sizes, rounded and unrounded modes, register interpolate, and VF overflow — all passing. This is a larger change that may be harder to review. Would you prefer it as a separate follow-up PR after this one is merged, or included here? |
I think that should probably be a follow-up PR. |
Summary
Add Motorola CPU32 processor variant to the 68000 processor module. Closes #1244.
CPU32 is based on the 68020 instruction set with some instructions removed and table lookup/interpolation instructions added. Used in MC68330, MC68340, MC68360 and similar microcontrollers.
Credits
This work builds on PR #2617 by @LegacyNsfw which provided the original CPU32 SLEIGH implementation. See also PR #8463 by @jlaustill which updates PR #2617 for current Ghidra. This PR additionally excludes unsupported instructions, adds BGND/LPSTOP, fixes TBL addressing modes, and includes pcode emulator test classes.
Changes
68000.sinc: @ifdef/@ifndef CPU32 conditionals for instruction set differencesCPU32.slaspec: New language specification (@define CPU32, @define MC68332)68000.ldefs: CPU32 variant definition (68000:BE:32:CPU32)certification.manifest: CPU32.slaspec entrypcode_defs.py: CPU32 pcodetest build configurationBuilding pcode test binaries
Test binaries require
m68k-linux-gnu-gccwith-mcpu=cpu32. The standard cross-compiledlibgcc.acontains 68020 bitfield instructions (BFFFO in__divdi3/__moddi3/__udivdi3) not available on CPU32. A modifiedlibgcc.awith CPU32-compatible C replacements for these functions is needed. Float/double tests are excluded since CPU32 has no FPU.Test plan
AI (Claude Code) was used to assist with verification, testing, and implementation.