|
This article is about emulation in computer science. See Emulation (disambiguation) for other meanings. Wikibooks Wikiversity has more about this subject: School of Computer Science Open Directory Project: Computer Science Collection of Computer Science Bibliographies Belief that title science in computer science is inappropriate Categories: Computer science ...
The term emulation may have the following meanings. ...
An emulator, in the most general sense, duplicates (provide an emulation of) the functions of one system with a different system, so that the second system appears to behave like the first system. Unlike a simulation, it does not attempt to precisely model the state of the device being emulated; it only attempts to reproduce its behavior. A system is an assemblage of inter-related elements comprising a unified whole. ...
A simulation is an imitation of some real device or state of affairs. ...
In a technical sense, the Church-Turing thesis implies that any operating environment can be emulated within any other. In practice, it can be quite difficult, particularly when the exact behaviour of the system to be emulated is not documented and has to be deduced through reverse engineering. It also says nothing about timing constraints; if the emulator does not perform as quickly as the original hardware, the emulated software may run much more slowly than it would have on the original hardware. In computability theory the Church-Turing thesis, Churchs thesis, Churchs conjecture or Turings thesis, named after Alonzo Church and Alan Turing, is a hypothesis about the nature of mechanical calculation devices, such as electronic computers. ...
Reverse engineering (RE) is the process of taking something (a device, an electrical component, a software program, etc. ...
A common form of emulation is that of a software emulator, a piece of computer software that allows certain computer programs to run on a platform (computer architecture and/or operating system) other than the one for which they were originally written. It does this by "emulating", or reproducing, the behavior of one type of computer on another by accepting the same data, executing the same programs, and achieving the same results. Computer software (or simply software) refers to one or more computer programs held in the storage of a computer for some purpose. ...
This article needs to be cleaned up to conform to a higher standard of quality. ...
Computer architecture is the theory behind the design of a computer. ...
In computing, an operating system (OS) is the system software responsible for the direct control and management of hardware and basic system operations. ...
Most emulators just emulate a hardware architecture — if a specific operating system is required for the desired software, it must be provided as well (and may itself be emulated). Both the OS and the software will then be interpreted by the emulator, rather than being run by native hardware. Apart from this interpreter for the emulated machine's language, some other hardware (such as input or output devices) must be provided in virtual form as well: if writing to a specific memory location should influence the screen, for example, this will have to be emulated as well. An interpreter is a computer program that executes other programs. ...
A system of codes directly understandable by a computers CPU is termed this CPUs native or machine language. ...
Instead of full emulation of the hardware, a compatibility layer may suffice. This translates system calls for the emulated system into system calls for the host system. In software engineering, a compatibility layer allows binaries for an emulated system to run on a host system. ...
A popular use of emulators is to run software and games, often referred to as ROMs, written for hardware that is no longer sold or readily available, such as the Commodore 64 or early Amiga models. Emulating these on modern desktop computers is usually less cumbersome than relying on the original machine, which may be inoperational. However, software licensing issues may require emulator authors to write original software that duplicates the functionality of the original computer's bootstrap ROM and BIOS, often through high-level emulation. ROM images (or ROMs, for short) is used in the context of emulation for a binary file which contains graphics, sounds, and program code. ...
The Commodore 64 (C64, CBM 64) was a popular home computer of the 1980s. ...
In computing, Amiga is a range of home/personal computers primarily using the Motorola 68000 processor family, whose development started in 1982, initially as a game machine. ...
Bootstrapping alludes to a German legend about a Baron Münchhausen, who was able to lift himself out of a swamp by pulling himself up by his bootstraps. ...
Rom is also the name of a toy and comic book character Rom (Spaceknight). ...
BIOS, in computing, stands for basic input/output system. ...
Developers of software for embedded systems or video game consoles often design their software on especially accurate emulator called a simulator before trying it on the real hardware. This is so that software can be produced and tested before the final hardware exists in large quantities, so that it can be tested without taking the time to copy the program to the hardware, or so that it can be debugged at a low level without introducing the side effects of a debugger. An embedded system is a special-purpose computer system, which is completely encapsulated by the device it controls. ...
The Nintendo GameCube is an example of a video game console. ...
A simulation is an imitation of some real device or state of affairs. ...
A debugger is a computer program that is used to debug (and sometimes test or optimize) other programs. ...
Structure
Typically, an emulator is divided into modules that correspond roughly to the emulated computer's subsystems. Most often, an emulator will be composed of the following modules: A module is a software entity that groups a set of (typically cohesive) subprograms and data structures. ...
- a CPU emulator or CPU simulator (the two terms are mostly interchangeable)
- a memory subsystem module
- various I/O devices emulators
Buses are often not emulated, either for reasons of performance or simplicity, and virtual peripherals communicate directly with the CPU or the memory subsystem. A detailed description of the internals of a specific emulator can be found in the ElectrEm article. ElectrEm [1] is an emulator of the Acorn Electron coded in platform neutral C++ using the Simple DirectMedia Layer library. ...
Memory subsystem It is possible for the memory subsystem emulation to be reduced to simply an array of elements each sized like an emulated word; however, this model falls very quickly as soon as any location in the computer's logical memory does not match physical memory. This clearly is the case whenever the emulated hardware allows for advanced memory management (in which case, the MMU logic can be embedded in the memory emulator, made a module of its own, or sometimes integrated into the CPU simulator). MMU, short for Memory Management Unit, is a class of computer hardware components responsible for handling memory accesses requested by the CPU. Among the functions of such devices are the translation of virtual addresses to physical addresses (i. ...
Even if the emulated computer does not feature an MMU, though, there are usually other factors that break the equivalence between logical and physical memory: many (if not most) architecture offer memory-mapped I/O; even those that do not almost invariably have a block of logical memory mapped to ROM, which means that the memory-array module must be discarded if the read-onlyness of ROM is to be emulated. Memory-mapped O/I (MMIO) and port O/I (also called port-mapped O/I or PMIO) are two complementary methods of performing input/output between the CPU and O/I devices in a computer. ...
Rom is also the name of a toy and comic book character Rom (Spaceknight). ...
As a result, most emulators implement at least two procedures for writing to and reading from logical memory, and it is these procedures' duty to map every access to the correct location of the correct object. On a base-limit addressing system where memory from address 0 to address ROMSIZE is read-only memory, while the rest is RAM, something along the line of the following procedures would be typical: void WriteMemory(word Address, word Value) { word RealAddress; RealAddress=Address+BaseRegister; if(RealAddress<LimitRegister) { if(RealAddress>ROMSIZE) Memory[RealAddress]=Value; } else { RaiseInterrupt(INT_SEGFAULT); } } void ReadMemory(word Address) { word RealAddress; RealAddress=Address+BaseRegister; if(RealAddress<LimitRegister) { return Memory[RealAddress]; } else { RaiseInterrupt(INT_SEGFAULT); } } CPU simulator The CPU simulator is often the most complicated part of an emulator. Many emulators are written using "pre-packaged" CPU simulators, in order to concentrate on good and efficient emulation of a specific machine. The simplest form of a CPU simulator is an interpreter, which follows the execution flow of the emulated program code and, for every machine code instruction encountered, executes operations on the host processor that are semantically equivalent to the original instructions. An interpreter is a computer program that executes other programs. ...
This is made possible by assigning a variable to each register and flag of the simulated CPU. The logic of the simulated CPU can then more or less be directly translated into software algorithms, creating a software re-implementation that basically mirrors the original hardware implementation. In computer science and mathematics, a variable is a symbol denoting a quantity or symbolic representation. ...
In computer architecture, a processor register is a small amount of very fast computer memory used to speed the execution of computer programs by providing quick access to commonly used values—typically, the values being in the midst of a calculation at a given point in time. ...
Flag can mean: A flag is a piece of cloth that is usually colored. ...
The following example illustrates how CPU simulation is accomplished by an interpreter. In this case, interrupts are checked for before every instruction executed, though this behavior is rare in real emulators for performance reasons. void Execute(void) { if(Interrupt!=INT_NONE) { SuperUser=TRUE; WriteMemory(++StackPointer, ProgramCounter); ProgramCounter=InterruptPointer; } switch(ReadMemory(ProgramCounter++)) { // Handling of every valid instruction default: Interrupt=INT_ILLEGAL; } } Interpreters are very popular as CPU simulators, as they are much simpler to implement than more performant alternative solutions, and their speed is more than adequate for emulating computers of more than roughly a decade ago on modern machines. This is a list of decades which have articles with more information about them. ...
However, the speed penalty inherent in interpretation can be a problem when emulating computers whose processor speed is on the same order of magnitude as the host machine. Until not many years ago, emulation in such situations was considered completely inpractical by many. An order of magnitude is the class of scale or magnitude of any amount, where each class contains values of a fixed ratio to the class preceding it. ...
What allowed breaking through this restriction were the advances in dynamic recompilation techniques. Simple a priori translation of emulated program code into code runnable on the host architecture is usually impossible because of several reasons: In computer science, dynamic recompilation is a feature of some emulators and virtual machines, where the system may recompile some part of a program during execution. ...
- code may be self-modifying
- there may not be a way to reliably distinguish data segments (which must not be translated) from text segments (code segments)
- there may not be a way to communicate with the emulated operating system in order for the emulator to be aware of newly loaded (for example from disk) code
Various forms of dynamic recompilation, including the popular Just In Time compiler (JIT) technique, try to cicumvent these problems by waiting until the processor control flow jumps into a location containing untranslated code, and only then ("just in time") translates a block of the code into host code that can be executed. The translated code is kept in a code cache, and the original code is not lost or affected; this way, even data segments can be (meaninglessly) translated by the recompiler, resulting in no more than a waste of translation time. In computer science, self-modifying code is code that modifies itself on purpose. ...
Data is one of the sections of a program in an object file or in memory, which contains the global variables that are initialized by the programmer. ...
A text segment is the code (computer programming) in an object file. ...
In computing, an operating system (OS) is the system software responsible for the direct control and management of hardware and basic system operations. ...
See also Just in time for the business technique In computing, just-in-time compilation (JIT), also known as dynamic translation, is a technique for improving the performance of interpreted programs. ...
In computer science, a cache (pronounced kÄsh) is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data are expensive (usually in terms of access time) to fetch or compute relative to reading the cache. ...
I/O Most emulators do not, as said above, emulate the main system bus; each I/O device is thus often treated as a special case, and no consistent interface for virtual peripherals is provided. This can result in a performance advantage, since each I/O module can be fine-taylored to the characteristics of the emulated device; designs based on a standard, unified I/O API can however rival such simpler models, if well-thought, and they have the additional advantage of "automatically" providing a plug-in service through which third-party virtual devices can be used within the emulator. API redirects here. ...
A unified I/O API may not necessarily mirror the structure of the real hardware bus: bus design is limited by several electric contraints and a need for hardware concurrency management that can mostly be ignored in a software implementation. Parallel programming is a computer programming technique that provides for the execution of operations in parallel, either within a single computer, or across a number of systems. ...
Even emulators that treat each device as a special case, there is usually a common basic infrastructure for - managing interrupts, by means of a procedure that sets flags readable by the CPU simulator whenever an interrupt is raised, allowing the virtual CPU to "poll for (virtual) interrupts"
- writing to and reading from physical memory, by means of two procedures similar to the ones dealing with logical memory (although, contrary to the latter, the former can often be left out, and direct references to the memory array be employed instead)
In computer science, an interrupt is a signal from a device which typically results in a context switch: that is, the processor sets aside what its doing and does something else. ...
See also This article lists software that emulates arcade and console game systems, as well as other computing platforms or CPUs. ...
An arcade emulator is a program that emulates one or more arcade games on a different computer, such as a PC. See the List of emulators for examples of arcade emulators. ...
In computing, binary translation is the emulation of one instruction set by another through translation of code. ...
A console emulator is a program for a computer, or other computing device, that can emulate a video game console or handheld, so a computer can be used to play games that were created for that console or to develop games for that console. ...
A fan translation is an unofficial translation of a computer game or video game, into a language that it was never marketed in. ...
An in-circuit emulator (ICE) is a hardware device used to debug the software of an embedded system. ...
In general terms, a virtual machine in computer science is software that creates an environment between the computer platform and the end user in which the end user can operate software. ...
External links - The History of Emulation - 1800 to 1999: Part 1, Part 2, Part 3
- Information from Nintendo about ROMs and Emulators
- HowTo: Writing a Computer Emulator
- http://www.emulator-zone.com/
|