Rockbox General > Rockbox General Discussion

Why processor emulation is slow?

(1/1)

greatjack:
I understand that this question doesnt have a direct connection to rockbox, but I figured that I will ask it here anyway, since the rockbox community has many professionals who would likely know the answer.

The question is why is processor emulation so slow, for example emulating arm on x86, if all processors have the same basic operations just that they are implemented with different assembler functions, why cant we just map the assembler functions. for example map the x86 addition function to the arm addition function and so forth, wouldnt this be fast and not cause slow down thats found in most arm to x86 emulators?

saratoga:

--- Quote from: greatjack on April 05, 2017, 12:40:57 PM ---The question is why is processor emulation so slow, for example emulating arm on x86, if all processors have the same basic operations just that they are implemented with different assembler functions, why cant we just map the assembler functions.

--- End quote ---

When we say that they are different processor families, what we mean is that the underlying assembly instructions do different things.  Because they do different things, many native instructions will be needed to implement each of the emulated instructions.  If it takes on average 10 native instructions to implement each emulated instruction, then the emulating machine must be 10 times faster than the emulated machine to run it at full speed. 

wodz:
In fact emulating just core is easy. Emulating I/O is expensive. Not speaking of interrupts, caches etc.

BTW. What you are proposing i.e mapping basic operations from one ISA to the other is known as dynamic translation and most of current emulators work this way (for example qemu). Once upon the time there was also mixed hardware-software implementation of this concept (Transmeta Cruzoe) which proven to be unsuccessful.

Navigation

[0] Message Index

Go to full version