Emulation accuracy: Difference between revisions
No edit summary |
|||
| Line 6: | Line 6: | ||
*'''Hypervisors''' usually used for partitioning physical hardware resources among multiple guest operating systems | *'''Hypervisors''' usually used for partitioning physical hardware resources among multiple guest operating systems | ||
*'''Simulators''' where developers build virtual replicas of specific environments or processes | *'''Simulators''' where developers build virtual replicas of specific environments or processes | ||
*'''Emulation''' endeavors to recreate an entire historical architecture. This digital reconstruction seeks to faithfully capture the instruction set, timing behaviors, hardware features and even peripheral nuances of a bygone hardware platform. Unlike compatibility layers, which translate software instructions to a native format, emulation builds a virtual stage upon which the software itself can perform authentically. Emulation's intricate tapestry sometimes intertwines with threads of other technologies though. Notably, certain emulators leverage VM or hypervisor features for a more efficient handling of resource allocation and isolation such as Device Mapping & SMMU.[https://forums.pcsx2.net/Thread-Does-CPU-virtualization-feature-have-anything-to-do-with-PCSX2?pid=583191#pid583191][https://yuzu-mirror.github.io/entry/yuzu-progress-report-jan-2024/#device-mapping-and-smmu] Additionally, some emulators employ compatibility layers as subcomponents, acting as translators for specific libraries or APIs that might otherwise be incompatible with the host environment. Think of these layers as linguistic bridges, allowing the emulated software to converse fluently with the modern system hardware. By strategically merging these techniques including the help of skilled use of [[High/Low_level_emulation|HLE and LLE or Hybrid methods]], [https://github.com/xenia-project/xenia/wiki/ROV code paths for rendering output] and [[High/Low_level_emulation#Future_outlook|compute shader renderers]], [[Dynamic_recompilation|compiler techniques]], popular features such as Fast Memory Access[https://github.com/PCSX2/pcsx2/pull/5821][https://github.com/PCSX2/pcsx2/pull/7295][https://yuzu-emu.org/entry/yuzu-fastmem/#what-is-fastmem][https://dolphin-emu.org/blog/2016/09/06/booting-the-final-gc-game/], instruction set support (such as [https://whatcookie.github.io/posts/why-is-avx-512-useful-for-rpcs3/ AVX-512 for RPCS3]) and other various optimizations which may be platform specific ([https://web.archive.org/web/20240110213529/https://yunzu-emu.org/entry/yuzu-progress-report-dec-2023#android-adventures-and-kernels-with-benefits MADV_REMOVE] and context switches in SysV ABI used in *nix, [https://yuzu-mirror.github.io/entry/yuzu-progress-report-nov-2023/#project-nice Native Code Execution] instead of [[Dynamic_recompilation#See_also|JIT]] if ISA is appropriate, [https://github.com/RPCS3/rpcs3/pull/16692 link-time optimisations], [https://community.amd.com/t5/opengl-vulkan/vulkan-poor-performance-due-to-barrier-region-bit-being-ignored/td-p/501962 VK_DEPENDENCY_BY_REGION_BIT], [https://github.com/GPUOpen-Drivers/AMDVLK/issues/108 VK_EXT_fragment_shader_interlock] etc), certain emulators achieve impressive levels of performance and compatibility, further unlocking the doors to historical software [[Preservation_projects|preservation]].[https://youtu.be/cCXri4yDHmU] | *'''Emulation''' endeavors to recreate an entire historical architecture. This digital reconstruction seeks to faithfully capture the instruction set, timing behaviors, hardware features and even peripheral nuances of a bygone hardware platform. Unlike compatibility layers, which translate software instructions to a native format, emulation builds a virtual stage upon which the software itself can perform authentically. Emulation's intricate tapestry sometimes intertwines with threads of other technologies though. Notably, certain emulators leverage VM or hypervisor features for a more efficient handling of resource allocation and isolation such as Device Mapping & SMMU.[https://forums.pcsx2.net/Thread-Does-CPU-virtualization-feature-have-anything-to-do-with-PCSX2?pid=583191#pid583191][https://yuzu-mirror.github.io/entry/yuzu-progress-report-jan-2024/#device-mapping-and-smmu] Additionally, some emulators employ compatibility layers as subcomponents, acting as translators for specific libraries or APIs that might otherwise be incompatible with the host environment. Think of these layers as linguistic bridges, allowing the emulated software to converse fluently with the modern system hardware. By strategically merging these techniques including the help of skilled use of [[High/Low_level_emulation|HLE and LLE or Hybrid methods]], [https://github.com/xenia-project/xenia/wiki/ROV code paths for rendering output] and [[High/Low_level_emulation#Future_outlook|compute shader renderers]], [[Dynamic_recompilation|compiler techniques]], popular features such as Fast Memory Access[https://github.com/PCSX2/pcsx2/pull/5821][https://github.com/PCSX2/pcsx2/pull/7295][https://yuzu-emu.org/entry/yuzu-fastmem/#what-is-fastmem][https://dolphin-emu.org/blog/2016/09/06/booting-the-final-gc-game/], instruction set support (such as [https://whatcookie.github.io/posts/why-is-avx-512-useful-for-rpcs3/ AVX-512 for RPCS3]) and other various optimizations which may be platform specific ([https://web.archive.org/web/20240110213529/https://yunzu-emu.org/entry/yuzu-progress-report-dec-2023#android-adventures-and-kernels-with-benefits MADV_REMOVE] and context switches in SysV ABI used in *nix, [https://yuzu-mirror.github.io/entry/yuzu-progress-report-nov-2023/#project-nice Native Code Execution] instead of [[Dynamic_recompilation#See_also|JIT]] if ISA is appropriate, [https://github.com/RPCS3/rpcs3/pull/16692 link-time optimisations], [https://community.amd.com/t5/opengl-vulkan/vulkan-poor-performance-due-to-barrier-region-bit-being-ignored/td-p/501962 VK_DEPENDENCY_BY_REGION_BIT], [https://github.com/GPUOpen-Drivers/AMDVLK/issues/108 VK_EXT_fragment_shader_interlock] etc), certain emulators achieve impressive levels of [[Frames_per_second|performance]] and compatibility, further unlocking the doors to historical software [[Preservation_projects|preservation]].[https://youtu.be/cCXri4yDHmU] | ||
*'''Sandboxing''' creates a restricted environment for running applications on your Host operating system. Within this "sandbox," applications can't make permanent changes to your system files or registry. | *'''Sandboxing''' creates a restricted environment for running applications on your Host operating system. Within this "sandbox," applications can't make permanent changes to your system files or registry. | ||
*'''Docker''' is a containerization platform. It creates isolated containers that share the host operating system kernel but have their own set of files and configurations. Docker is primarily used for deploying and isolating applications, particularly microservices, for development, testing, and deployment purposes. | *'''Docker''' is a containerization platform. It creates isolated containers that share the host operating system kernel but have their own set of files and configurations. Docker is primarily used for deploying and isolating applications, particularly microservices, for development, testing, and deployment purposes. | ||
| Line 13: | Line 13: | ||
==Types== | ==Types== | ||
Emulators tend to favor [[High/Low level emulation|High-Level Emulation (HLE) as opposed to Low-Level Emulation (LLE)]] for hardware demanding systems to emulate, <abbr title="This shouldn't be confused with compatibility though.">which results in lower accuracy</abbr> because instead of mimicking the hardware these games were released on, High-Level emulators mimic how the games themselves behaved on the desired system. While emulators like [[Dolphin]] favor accuracy but still retain HLE for performance and have [[High/Low_level_emulation#Examples|successfully used it to an advantage]], these types of exceptions are uncommon, and it can still hinder accuracy. | Emulators tend to favor [[High/Low level emulation|High-Level Emulation (HLE) as opposed to Low-Level Emulation (LLE)]] for hardware demanding systems to emulate, <abbr title="This shouldn't be confused with compatibility though.">which results in lower accuracy</abbr> because instead of mimicking the hardware these games were released on, High-Level emulators mimic how the games themselves behaved on the desired system. While emulators like [[Dolphin]] favor accuracy but still retain HLE for [[Frames_per_second|performance]] and have [[High/Low_level_emulation#Examples|successfully used it to an advantage]], these types of exceptions are uncommon, and it can still hinder accuracy. | ||
===Low accuracy=== | ===Low accuracy=== | ||
An emulator isn't accurate when it has a large amount of visual and audio glitches and favors performance as much as possible. To work around these glitches, emulator developers typically include game-specific hacks (and prioritize popular games) to skip over problems, such as compatibility issues that can cause games to break. Many times, these emulators will be deemed incompatible with the less popular (obscure) games. As Near (then known as byuu) explains in a 2011 Ars Technica article linked below, ''Speedy Gonzales: Los Gatos Bandidos'' will soft lock towards the end due to a specific hardware edge case that isn't emulated in [[ZSNES]] or [https://github.com/snes9xgit/snes9x/issues/280 Snes9x], but is properly dealt with in his own emulator [[higan]] due to his documentation of the system. This can also become very problematic when ROM hacks abuse software errors (emulator oversights) to create otherwise impossible behaviors to achieve what they can. When a ROM hack can only be used in that one specific emulator, he explains, it becomes incompatible with real hardware (either through a flash cart or printed), and that such an issue has occurred with [[ZSNES]] before and continues to occur with Nintendo 64 ROM hacks. | An emulator isn't accurate when it has a large amount of visual and audio glitches and favors [[Frames_per_second|performance]] as much as possible. To work around these glitches, emulator developers typically include game-specific hacks (and prioritize popular games) to skip over problems, such as compatibility issues that can cause games to break. Many times, these emulators will be deemed incompatible with the less popular (obscure) games. As Near (then known as byuu) explains in a 2011 Ars Technica article linked below, ''Speedy Gonzales: Los Gatos Bandidos'' will soft lock towards the end due to a specific hardware edge case that isn't emulated in [[ZSNES]] or [https://github.com/snes9xgit/snes9x/issues/280 Snes9x], but is properly dealt with in his own emulator [[higan]] due to his documentation of the system. This can also become very problematic when ROM hacks abuse software errors (emulator oversights) to create otherwise impossible behaviors to achieve what they can. When a ROM hack can only be used in that one specific emulator, he explains, it becomes incompatible with real hardware (either through a flash cart or printed), and that such an issue has occurred with [[ZSNES]] before and continues to occur with Nintendo 64 ROM hacks. | ||
===Medium accuracy=== | ===Medium accuracy=== | ||
| Line 40: | Line 40: | ||
In summary, we can talk about three types of cycle emulation: "partial cycle-accuracy", "cycle-based accuracy" and "full cycle-accuracy". These can be considered as subsets of "cycle accuracy." Due to technical challenges and performance considerations, emulators often employ either "partial cycle-accuracy" or "cycle-based accuracy" depending on the specific requirements. | In summary, we can talk about three types of cycle emulation: "partial cycle-accuracy", "cycle-based accuracy" and "full cycle-accuracy". These can be considered as subsets of "cycle accuracy." Due to technical challenges and [[Frames_per_second|performance]] considerations, emulators often employ either "partial cycle-accuracy" or "cycle-based accuracy" depending on the specific requirements. | ||
Mesen, BlastEm, NanoBoyAdvance, Azayaka, MartyPC and Stella are recognized for their cycle-accurate emulation, though for knowing the specific degree of cycle-by-cycle precision for each needs further research. | Mesen, BlastEm, NanoBoyAdvance, Azayaka, MartyPC and Stella are recognized for their cycle-accurate emulation, though for knowing the specific degree of cycle-by-cycle precision for each needs further research. | ||
====Partial cycle-accuracy==== | ====Partial cycle-accuracy==== | ||
This focuses on replicating the timing of instructions and key internal operations, while simplifying or skipping over some less critical details. This can lower the performance requirements compared to full cycle accuracy. Remember, just because an emulator is partially cycle-accurate doesn't necessarily make it more precise than a highly accurate emulator. For example, CEN64 only emulates the CPU pipeline cycle-accurately and that's all, on the other hand Simple64 is more accurate in terms of timing for specific tasks like certain DMA transfers, even though it doesn't achieve partially cycle-accurate emulation. | This focuses on replicating the timing of instructions and key internal operations, while simplifying or skipping over some less critical details. This can lower the [[Computer_specifications|performance requirements]] compared to full cycle accuracy. Remember, just because an emulator is partially cycle-accurate doesn't necessarily make it more precise than a highly accurate emulator. For example, CEN64 only emulates the CPU pipeline cycle-accurately and that's all, on the other hand Simple64 is more accurate in terms of timing for specific tasks like certain DMA transfers, even though it doesn't achieve partially cycle-accurate emulation. | ||
:Examples of partially cycle-accurate emulators are [https://old.reddit.com/r/emulation/comments/vy8cg7/ares_v129_has_been_released_crossplatform/ig4da06/ bsnes] and [https://discord.com/channels/976404869386747954/976463759935696977/1106700321222299762 CEN64]. | :Examples of partially cycle-accurate emulators are [https://old.reddit.com/r/emulation/comments/vy8cg7/ares_v129_has_been_released_crossplatform/ig4da06/ bsnes] and [https://discord.com/channels/976404869386747954/976463759935696977/1106700321222299762 CEN64]. | ||
| Line 70: | Line 70: | ||
===Gate-level accuracy=== | ===Gate-level accuracy=== | ||
Gate-level accuracy focuses on operating at the level of logical gates within a digital circuit. In this approach, the focus is to replicate the behavior of the system by emulating the interactions and operations of logic gates. This level of abstraction allows for a more efficient imitation of digital circuits, as it does not delve into the intricacies of individual transistors. This level of system emulation is suitable for scenarios where a higher-level understanding of circuit behavior is sufficient. This method of hardware imitation should not be recommended for general purposes (for example, casual gaming), because of its rather poor performance as a result of the emulator mimicking the desired machine at a very low level, and as such, requires loads of computational power to function. | Gate-level accuracy focuses on operating at the level of logical gates within a digital circuit. In this approach, the focus is to replicate the behavior of the system by emulating the interactions and operations of logic gates. This level of abstraction allows for a more efficient imitation of digital circuits, as it does not delve into the intricacies of individual transistors. This level of system emulation is suitable for scenarios where a higher-level understanding of circuit behavior is sufficient. This method of hardware imitation should not be recommended for general purposes (for example, casual gaming), because of its rather poor [[Frames_per_second||performance]] as a result of the emulator mimicking the desired machine at a very low level, and as such, requires loads of computational power to function. | ||
Examples of gate-level emulators are Breaknes and GateBoy. | Examples of gate-level emulators are Breaknes and GateBoy. | ||
===Transistor-level accuracy=== | ===Transistor-level accuracy=== | ||
Transistor-level accuracy represents a more granular emulation accuracy level that delves into the behavior of individual transistors within a digital circuit. This approach aims to replicate the electrical characteristics and interactions of transistors, offering a higher degree of accuracy at the cost of increased computational complexity, way more than that of gate-level accuracy. This method is the most accurate representation of the electrical characteristics and interactions within a machine's circuit, but due to its extremely demanding nature, it should not be recommended for most people looking to play their childhood video games not only because of its abysmal performance, but also because it requires way too much computational power to execute. This type of hardware emulation is great for hardware enthusiasts and homebrew developers who want to get a deep understanding of the functionality and behavior of the hardware in question at a very detailed level. | Transistor-level accuracy represents a more granular emulation accuracy level that delves into the behavior of individual transistors within a digital circuit. This approach aims to replicate the electrical characteristics and interactions of transistors, offering a higher degree of accuracy at the cost of increased computational complexity, way more than that of gate-level accuracy. This method is the most accurate representation of the electrical characteristics and interactions within a machine's circuit, but due to its extremely demanding nature, it should not be recommended for most people looking to play their childhood video games not only because of its abysmal [[Frames_per_second|performance]], but also because it [[Computer_specifications|requires way too much computational power]] to execute. This type of hardware emulation is great for hardware enthusiasts and homebrew developers who want to get a deep understanding of the functionality and behavior of the hardware in question at a very detailed level. | ||
Examples of transistor-level emulators are MetalNES and Visualnes. | Examples of transistor-level emulators are MetalNES and Visualnes. | ||
===DICE=== | ===DICE=== | ||
This type is unique in that its method, [[DICE]], emulates arcade machines from the early 1970s. The architecture of these systems is different from a modern architecture, mostly because they don't have a CPU. DICE emulates the discrete logic components of the machines at a circuit level and, although the results are accurate, you need a fast 64-bit CPU (for single thread performance) to run these arcade games at full speed. It's not as deep as gate or transistor-level emulation for other systems because chips are still treated as black boxes, though. | This type is unique in that its method, [[DICE]], emulates arcade machines from the early 1970s. The architecture of these systems is different from a modern architecture, mostly because they don't have a CPU. DICE emulates the discrete logic components of the machines at a circuit level and, although the results are accurate, [[Computer_specifications|you need a fast 64-bit CPU (for single thread performance)]] to run these arcade games at [[Frames_per_second|full speed]]. It's not as deep as gate or transistor-level emulation for other systems because chips are still treated as black boxes, though. | ||
==Perfection?== | ==Perfection?== | ||
| Line 102: | Line 102: | ||
==Further reading== | ==Further reading== | ||
*[http://arstechnica.com/gaming/2011/08/accuracy-takes-power-one-mans-3ghz-quest-to-build-a-perfect-snes-emulator/ Accuracy takes power: one man’s 3GHz quest to build a perfect SNES emulator] - Byuu (now known as Near) ([[higan]] developer), 2011 | *[http://arstechnica.com/gaming/2011/08/accuracy-takes-power-one-mans-3ghz-quest-to-build-a-perfect-snes-emulator/ Accuracy takes power: one man’s 3GHz quest to build a perfect SNES emulator] - Byuu (now known as Near) ([[higan]] developer), 2011 | ||
*[https://www.youtube.com/watch?v=oQZMVo_Fmrs Pokémon glitches and emulation accuracy] - TheZZAZZGlitch | *[https://www.youtube.com/watch?v=oQZMVo_Fmrs Pokémon glitches and emulation accuracy] - TheZZAZZGlitch | ||
*[https://dolphin-emu.org/blog/2024/12/02/dolphin-progress-report-release-2412/#2409-161-fix-some-common-opcode-decoding-errors-by-tilka Dolphin Blog: 2409-161 version - Fix Some Common Opcode Decoding Errors by Tilka] | *[https://dolphin-emu.org/blog/2024/12/02/dolphin-progress-report-release-2412/#2409-161-fix-some-common-opcode-decoding-errors-by-tilka Dolphin Blog: 2409-161 version - Fix Some Common Opcode Decoding Errors by Tilka] | ||
===See also=== | |||
*[[Frames per second]] | |||
*[[Input lag]] | |||
*[[Computer specifications]] | |||
*[[Displays]] | |||
*[[High/Low level emulation]] | |||
===Accuracy Tests=== | ===Accuracy Tests=== | ||