Traditional simulators aim at the given processors, restricting the development of simulators, while multi-target simulators are fast, flexible and retargetable, so they can solve the deficiencies of traditional simulators. Virtual-instruction-based constructing technique is one of the multi-target simulating techniques. Relative to plug-in-based multi-target simulators, it is well-scalable and reusable. Virtual instruction translation is the key technique of this kind of simulator, whose objective is translating different object codes into equivalent virtual instructions, providing the back end of simulators with them.Based upon studying all sorts of machine description languages, this paper designs a database-based machine description language(DBML) and explains how to use this language to describe the system configuration and instruction set of object processors; it uses java virtual machine's idea for reference to define a set of virtual instruction set as the interface of simulator back end, and explains that any common instructions can be translated into the corresponding virtual instructions; it puts research on kinds of translating techniques, uses analyzer/parser automate generator flex and bison to implement VI translator, then uses optimizing technique to simplify the virtual instructions on the instruction level, and improves the speed of instruction translating by cache technique on the system level.At the end of this paper, it tests on the speed, efficiency and veracity of virtual instruction translator. The result shows the virtual instruction translator satisfies the requirement of simulators at all points. |