> functional verification of migrated system has to go through stringent compliance testing.
If I were in charge of the compliance I'd refuse anything running under an emulator. I'd require "proof" that the emulation is perfect first, and that's impossible. After all, you're the first to ever build that emulation software and hardware combination. Existing chips have "trust" built on their history. New and unique ones don't have that "trust".
They're also dreadful to debug. When anything goes wrong you don't know if it is the emulator, its hardware or the emulated code that is going wrong.
> For timing we will be adding FPGA which will be connected to PPC local bus
> and shall perform required address translation and timing adjustments.
That is "theoretically possible" with a 68000 but virtually impossible with a 68020. The CPU execution speed changes hugely depending on whether instructions hit in the cache or not. Then there's the prefetching and overlap.
The "good news" is that the original code had better not depend on any (or at least "too many") CPU timing loops, or depend on execution timing as it should be variable on the original hardware anyway. I'd forgotten how slow these chips were - 40 clocks for a MUL and 90 for a DIV!
> One of the proprietary ASIC which is there on existing hardware uses 68020 function
> codes to provide access to various memories connected at other end of ASIC.
> important to understand how function codes are being generated.
It would be far better to understand what the ASIC is using the signals for. It will only be using a subset of the 8 possible codes and that should let you simplify the design.
What Function Codes is the ASIC decoding for what purpose? It is possible using special instructions and the SFC and DFC registers to read and write from arbitrary spaces, but that's pretty strange. If someone tried to use the "User" and "Supervisor" modes to implement some form of external memory management it is going to get very difficult. Note that "data reads" use the "Data" function codes, but that fetches of immediate values from the same memory use the "Instruction" code. Normally the only thing that the Function Codes are used for in the memory decoder is to recognise the "CPU Space" code during an Interrupt and to block the RAM from being accessed during that cycle. Prove it isn't doing that before worrying about this too much.
You're going to have to replace all of the external hardware anyway as the PPC bus signals are nothing like the 68020 ones. You don't want to try to "translate" the PPC bus into a 68k bus. That way lies pain and madness.
The decoder will be using A0, A1, SIZ0, SIZ1, AS, DS, DBEN and RW to decode the memory cycles, but should only use the Function Codes as stated above.
> I want to know what physical logic is present inside the processor which lets
> it to automatically generate these function codes?
User/Supervisor, Instruction/Data and Interrupts. And also Breakpoints and something else. What more do you want to know?
> We are also implementing the floating point co-processor 6888x in the PPC.
That's going to be fun. The MC68881/MC68882 are full 80-bit IEEE754. It also has "Support of functions not defined by the IEEE standard, including a full set of trigonometric and transcendental functions.". You should hope they're not being used. I don't know that floating point the PPC supports natively, and it is very hard to find out, as every manual refers to some other manual which refers to some architecture designator, which may be documented somewhere else or may not.
> Further can you suggest a possible available chip from freescale which we
> can easily use to emulate the current system?
No. Reimplement it on an appropriate Coldfire chip with new external hardware. Clean-slate design. That could end up far cheaper and faster (and the final hardware should be cheaper) that what you're looking at. I could imagine the debugging taking years.
If you need Floating Point then you may want one with that FP hardware. Frankly, any mid range ColdFire chip is so fast it could run floating point operations in software faster than the 68881 could ever run them in hardware, so why bother.
If you need some peripherals that exist only in PPC or ARM, then use them, but remember the ARM is little-endian. This is unlikely as your old 68020 hardware can't have anything too special on it.
Tom