v1.0.2 28-Jun-2003 ColdFire V4 Amiga accelerator project from the m68k emulation perspective by Harry Sintonen MCF5407's V4 ColdFire core adds Revision B of the instruction set. At first glance it looks like it really adds lots of improvements especially suited for the m68k emulation, however a closer examination reveals the grim truth: These additions help only a little, more likely not at all. Examining the CFPRM.pdf(1), the MCF5407UM.pdf(2) and the M68000PRM.pdf(3) reveal that a lot of m68k features are missing. V4 COLDFIRE CORE REVISION B INSTRUCTION SET IMPROVEMENTS The improvements in Revision B of the instruction set for m68k compatibility are: long offset for Bcc/BRA/BSR byte/word sizes for CMP, CMPI word size for CMPA byte/word sizes for MOVE.[BW] #,d16(Ax) MISSING ADDRESSING MODES Address Register Indirect with Index Base Displacement (bd,An,Xn) Memory Indirect postindexed (od,[bd,Ax,Xn]) preindexed ([bd,Ax,Xn],od) Program Counter Indirect with Index Base Displacement (bd,PC,Xn) Program Counter Memory Indirect postindexed (od,[bd,PC,Xn]) preindexed ([bd,PC,Xn],od) MISSING SIZES FOR OPCODES add .b .w adda .w addi .b .w addq .b .w addx .b .w and .b .w andi .b .w and .b .w andi .b .w asl .b .w asr .b .w lsr .b .w lsl .b .w eor .b .w eori .b .w movem .w neg .b .w negx .b .w not .b .w or .b .w ori .b .w sub .b .w suba .w subi .b .w subq .b .w subx .b .w [probably missed some] COMPLETELY MISSING OPCODES BCD missing (binary coded decimal, virtually unused) bit field (bf*, rarely used, 020 XPK SQSH) logical rotate (rol/ror roxl/roxr) DBcc, (dbra/dbf, dbne, dbeq etc, used a lot) mulu/muls 32*32->64 (used a lot) CONCLUSION All the missing addressing modes, opcodes and sizes for opcodes need to be emulated. Especially common math operations like add, and, asl, eor, neg, not, or, sub for sizes .b and .w will be met a lot. Also rol and ror are common and will need to be emulated. DBcc is common in loops, and need to be emulated aswell. My conclusion is that MCF5407 with the V4 ColdFire core will be unbearably slow when executing average m68k code typically found in the Amiga environment. I'd estimate that the overall performance drops below MC68060 @ 50MHz performance. The situation can be improved by replacing slow programs and os components with specially ColdFire optimized code or by doing just-in-time recompilation. Another possibility is to use CyberGuard/OxyPatcher method to replace the emulated opcodes with 'jsr (abs).w' to low 64K memory and that will contain the emulation routines (or JMP to actual code, if 64k is not enough to hold all the emulation code). However, with such method new problems arise: - ROM code cannot be patched (can be worked around with MMU ROM mirror) - Some software do checksum of their code (virus checkers, Elbox drivers) This problem can perhaps be worked around with different code and data virtual memory space. However I didn't look closer at ColdFire to see if this is possible. REFERENCES 1) CFPRM.pdf ColdFire Family Programmer's Reference Manual http://e-www.motorola.com/brdata/PDFDB/docs/CFPRM.pdf 2) MCF5407UM.pdf MCF5407 ColdFire(r) Integrated Microprocessor User's Manual http://e-www.motorola.com/brdata/PDFDB/docs/MCF5407UM.pdf 3) M68000PRM.pdf Motorola M68000 Family Programmer's Reference Manual http://e-www.motorola.com/collateral/M68000PRM.pdf