1. Field of the Invention
The present invention relates to a data processing device with an instruction translator for translating instructions not native to a certain processor into instructions native to the same processor, and can rapidly execute a program including a processing routine formed of normative instructions and a processing routine formed of native instructions in a mixed fashion. The invention also relates to a memory interface device for such a data processing device.
2. Description of the Background Art
There is a close relationship between a processor architecture and a system of instructions that can be executed on such a processor. If the instruction system is updated in accordance with advance of the processor architecture, those program codes written for the old processors designed in accordance with the old instruction systems will usually be impossible to execute. What is most important is how the program assets implemented in accordance with the old instruction system will be effectively inherited. For this purpose, many techniques have been developed for executing the programs, which were written for old processors designed in accordance with the old instruction system, by new processors having a certain instruction system.
One of the typical conventional schemes for executing the program written for the old processor on a new processor, is to provide hardware of the new processor with a function of the old processor. Referring to
Instruction memory 3 holds both the instructions of the old processor and the instructions of the new processor. Multifunction instruction decoder 5 decodes instructions read from instruction memory 3 and transferred to processor 1 via bus 4. Multifunction instruction decoder 5 has the function of decoding both the instructions for the new processor and the instructions for the old processor. Arithmetic portion 6 executes the decoded instruction. Data memory 2 can be accessed from both the instruction for the new processor and the instruction for the old processor.
Examples of the technique, in which the function of hardware of the old processor is given to the hardware of new processor, have been described in various books and magazines primarily for the developers, and reference can be made on them for more information.
In addition, the conventional methods for executing the programs for the old processor on the new processor includes one wherein the software for the old processor is first translated into software for the new processor and then executed, and one wherein the operations of instructions for the old processor are emulated by the software running on the new processor. These methods are likewise described in various books and magazines primarily for developers, and reference can be made on them for more information.
In some other cases, it may also be effective to execute the program written for a certain instruction system by the processor designed in accordance with another instruction system. For example, the program size can be reduced by defining a subset of a certain instruction system and writing a program in the instruction subset. JAVA™ language is designed such that programs are written for an instruction system prescribed for a virtual processor, and a different kinds of processors execute the same program thus written by using instruction systems of the respective processors. Therefore, the program written in the JAVA language can be commonly executed by multiple kinds of processors of different instruction systems.
There have been proposed many methods, in which the reduced instruction system of subsets are prepared for reducing the program size, and both the instructions of the non-reduced instruction system and the instructions of the reduced instruction system are decoded by a multifunction instruction decoder of a processor. For example, reference may be made to “Thumb Squeezes ARM Code Size (New Core Module Provides Optimizes Second Instruction Set)” by James L. Turley (Micro Processor Report, Vol. 9, No. 4, pp. 1 and 6-9, Mar. 27, 1995).
However, the conventional methods described above all suffer from the following problems.
If the function of executing the program written in the plurality of instruction systems are given to hardware of the processor, the hardware becomes complicated, and have increased sizes. For adding or changing the instruction system to be executed, the whole hardware must be redesigned, and it is difficult to deal with such addition and change with flexibility.
The following problem arises when changing or translating the program by the software. For translating the program itself, a memory of a large capacity is additionally required for holding the translated program. This increases costs of the memory and therefore the data processing device. In the case of emulating the operation of instructions with the instructions of another instruction system, it is naturally necessary to emulate the operation results, and further it is necessary to emulate values of program counters and, if necessary, flags. For this reason, it is necessary to replace the operation of one instruction with many instructions of another system. This significantly lowers the operation speed.
An object of the invention is to provide a data processing device, which can rapidly execute a program formed of instructions in a plurality of different instruction systems, using native instructions, without changing hardware itself of a processor, and does not require a memory of a large capacity, as well as a memory interface device provided with an instruction translator for the same.
A data processing device according to an aspect of the invention includes a processor core, and a memory interface portion arranged between the processor core and an external memory mapped into a predetermined external memory space. The memory interface portion includes a fetch circuit for receiving an address value for access to the external memory space from the processor core, and fetching the data at the address in the external memory. This data is an instruction normative or native to the processor, or data to be processed. The memory interface portion further includes a translator for translating the instruction normative to the processor core fetched by the fetch circuit from the external memory into a native instruction or native instructions, and a select circuit for selectively applying the data read from the external memory space and the instruction or instructions prepared by translating the instruction read from the external memory space by the translator to the processor core depending on whether the address value for the access from the processor core to the external memory space is in a predetermined region or not.
A memory interface device according to another aspect of the invention is a device arranged between a processor core and an external memory mapped into a predetermined external memory space, and includes a fetch circuit for receiving an address value for access to the external memory space from the processor core, and fetching the data at the address in the external memory. This data is an instruction normative or native to the processor, or data to be processed. The data interface device further includes a translator for translating the normative instruction for the processor core fetched by the fetch circuit from the external memory into a native instruction or native instructions, and a select circuit for selectively applying the data read from the external memory space and the instruction prepared by translating the instruction read from the external memory space by the translator to the processor core depending on whether the address value for the access from the processor core to the external memory space is in a predetermined region or not.
A data reading method according to still another aspect of the invention is a method of reading data from an external memory mapped into a predetermined external memory space to a processor core, and includes a step of receiving an address value for access from the processor core to the external memory space, and fetching the data at the address in the external memory. This data is an instruction normative or native to the processor, or data to be processed. The method further includes a step of translating the instruction normative to the processor core fetched from the external memory into a native instruction or native instructions, and a step of selectively applying the data read from the external memory space and the instruction prepared by the translation of the instruction read from the external memory space to the processor core depending on whether the address value for the access from the processor core to the external memory space is in a predetermined region or not.
The foregoing and other objects, features, aspects and advantages of the present invention will become more apparent from the following detailed description of the present invention when taken in conjunction with the accompanying drawings.
Referring to
Referring to
Core 100 is a processor core having a VLIW (Very Long Instruction Word) type instruction system. Core 100 includes an instruction decoder 110 for decoding a VLIW instruction sent from instruction bus 105 as well as a memory arithmetic portion 130 and an integer arithmetic portion 140, which are employed for executing instructions decoded by instruction decoder 110. Core 100 also includes a general purpose register file 120, which is connected via a plurality of buses to memory and integer arithmetic portions 130 and 140 for reading and writing by software.
Instruction decoder 110 includes two sub-instruction decoders 111 and 112.
Memory arithmetic portion 130 includes arithmetic units such as an address arithmetic unit 131, a PC (Program Counter) arithmetic unit 132, a shifter 133 and an ALU (Arithmetic Logic Unit) 134. Memory arithmetic portion 130 is employed for executing the memory access instruction, PC control instruction, integer arithmetic operation instruction and others in accordance with the output of sub-instruction decoder 111. Integer arithmetic portion 140 includes a shifter 141, an ALU 142, a multiplier 143 and an accumulator 144. Integer arithmetic portion 140 is employed for executing the integer arithmetic operation instruction in accordance with the output of sub-instruction decoder 112. Memory arithmetic portion 130 and integer arithmetic portion 140 can execute two sub-instructions in parallel, and can also operate in such a manner that each execute one sub-instruction independently of the other.
Referring to
Register 150 is a register always holding zero. Register 162 is employed for holding data on a stack top during non-interrupt processing. Register 163b is a stack pointer during non-interrupt processing for holding the address of data immediately under the stack top.
Register 163 is switched at a mode bit within a control register 170, which is a PSW (Processor Status Word), so that it is selectively used as register 163a during the interrupt processing, and is used as register 163b during the non-interrupt processing.
Control registers 170-180 are dedicated to predetermined components or elements, respectively. Control register 170 is a PSW, and includes mode bits representing flags, which change depending on the operation, whether the interrupt is being performed or not, whether interrupt is masked or not, whether it is in the debugging mode or not, and others. Control register 172 is a program counter (PC), and represents an address of the instruction being executed. Control registers 171 and 173 are employed for copying and holding values of control registers 170 and 172 at the times of interrupt, exception and a trap, respectively. Other functions and others of the control registers are shown in
Accumulators 144a and 144b are employed for holding results of multiplication and product-sum operation. Each of accumulators 144a and 144b can hold data of 64 bits, which are equal to double the bit length of the general purpose registers.
Referring to
Referring to
Bus interface portion 503 further includes: a selector 538 having two inputs connected to a signal line 544 connected to the output of the translation circuit and a signal line 545, respectively, and an output connected to lower 24 bits of address bus 31; a selector 537 which has two terminals on the select side and connected to a signal line 562 and signal line 541 of 4-byte width, respectively, and one terminal connected to data bus 32 of 4-byte width, and has a function of outputting the input sent from data bus 32 selectively onto signal lines 541 and 542, and selecting the data on signal line 562 for outputting it onto data bus 32; a bus width changing circuit 560 which has an input connected to signal line 541 and an output connected to signal line 560; a selector 536 having two inputs connected to an output line 539 extending from translation circuit 540 and a signal line 563 of 8-byte width extending from bus width changing circuit 560, respectively, and output connected to instruction bus 105; and a bus width changing circuit 561 having two I/O terminals connected to a signal line 562 of 4-byte width and a data bus 107 of 64-bit width.
Signal line 541 is also connected to the input of translation circuit 540. Signal line 542 is also connected to control portion 532.
Control portion 532 determines whether the address value sent from MUX 531 falls within a predetermined address region, and controls selectors 535, 538 and 536 in accordance with the determination. This predetermined address region corresponds to an address region 573 in
When accessing the memory, processor core 100 outputs a control signal indicating whether the memory access is to be performed for an instruction designated by an instruction address or for data to be designated by a data address. Selector 531 is controlled by this control signal, and thereby selects signal line 104 to output the address value on signal line 104 onto signal line 543 when the access is to be performed for the instruction. When the access is to be performed for the data, selector 531 selects signal line 106, and outputs the address value on signal line 106 onto signal line 542. Selector 537 is likewise controlled by this control signal. Thereby, selector 537 selects signal line 541, and electrically connects signal line 32 to signal line 541 when the access is to be performed for the instruction. When the access is to be performed for the data, selector 537 selects signal line 562, and connects it to signal line 107.
Referring to
Referring to
Instruction fetch stage 191 fetches the instruction and holds it in instruction register 113 of instruction decoder 110. In decode and address calculating stage 192, the instruction thus held is decoded by sub-instruction decoders 111 and 112, and simultaneously register file 120 (represented as register file 120a for clarifying that it is on input) is accessed and the address calculation of the operand and PC is performed. In the arithmetic and memory access stage 193, integer operation and data memory access processing are performed. In a write-back stage 194, the operation result and the data fetched from the memory are rewritten into register file 120 (represented as register file 120b for clarifying that it is on the output side).
Referring to
The condition fields 203 and 204 specify the conditions depending on the values of flags F0 and F1 (F0 bit 170c and F1 bit 170d) in the PSW (i.e., control register 170). For example, when condition field 203 is “000”, the sub-instruction contained in L-container 205 is executed unconditionally. When the condition field 204 is “101”, the sub-instruction included in R-container 206 is executed if F0 (F0 bit 170c) is equal to 1 and F1 (F1 bit 170d) is equal to 1, and otherwise is invalidated.
FM fields 201a and 201b designate the execution operation for executing the sub-instructions contained in L- and R-containers 205 and 206. There are four execution operations. The first operation is to execute in parallel the sub-instructions included in L- and R-containers 205 and 206. The second operation is to execute the sub-instruction of L-container 205, and thereafter execute the sub-instruction of R-container 206. The third operation is opposite to the second operation so that the sub-instruction of R-container 206 is first executed, and then the sub-instruction of L-container 205 is executed. The fourth execution operation is to execute one long sub-instruction divided and held by L- and R-containers. More specifically, one of the foregoing four operations is selected depending on the values of FM fields 201a and 201b.
Referring to
Format 211 is of the sub-instruction for performing the memory access operation (load/store operation). Format 212 is of the sub-instruction for performing an operation between operands held by general purpose registers (OP operation). Formats 213-217 are of the sub-instructions for performing the branch operations. Format 218 of the long sub-instruction is commonly used by all of the three kinds of operations.
When processor 510 performs the pipeline processing on the sub-instructions as shown in
When FM fields 201a and 201b designate the execution order of the sub-instructions, the pipeline processing is effected on the sub-instructions by MU and IU pipes 139 and 149 as shown in
The sub-instructions defined with respect to processor 510 are shown in the following list. In the list, mnemonics of the respective sub-instructions are represented in upper cases, and the processing contents thereof are described on the right of the respective mnemonics.
When viewed from processor 510, the address in memory 523 is equal to address regions 573 and 574 shown in
As is apparent from the contents already described with reference to
Bus width changing circuit 561 has a similar function. More specifically, in the case where reading or writing data of 8 bytes by accessing address region 571 or the like, two pieces of 4-byte data each, which are received from signal line 562 of the 4-byte width by continuously performing two times the memory access, are output as one 8-byte data onto data bus 107. Further, one 8-bit data received from data bus 107 is divided into two pieces of 4-bit data, which are output onto data bus 32 via signal line 562 and selector 537 by continuously performing the memory access twice.
If data bus 32 is 64-bit width, bus width changing circuits 560 and 561 are not required. In this case, signal lines 541 and 563 may be directly connected. Likewise, signal line 562 and data bus 107 may be directly connected.
Processor 510 having the structure described above operates as follows. First, description will be given on the memory access, which is effected without HW translation on address spaces 571-573 and 574-575 for the instruction or data. Referring to
The instruction access is effected on an address space 573. In the case of the memory access with HW translation, control portion 532 controls translation circuit 540 and selectors 535 and 536 via signal line 546, and translates the JAVA byte codes fetched from memory 523 into the native instruction for outputting it onto instruction bus 105. In this operation, the address value, which is sent from instruction address bus 104 via selector 531 onto signal line 542, and is further input into address signal shift circuit 534, is shifted rightward by three bits by address signal shift circuit 534. Thus, the address value is divided by eight, is output onto signal line 545, and is input into translation circuit 540.
Referring to
The operation of translation circuit 540 in the above state will now be described specifically with reference to
If the corresponding JAVA byte code is not present in input buffer memory 551, address management circuit 554 outputs a control signal onto control signal line 546. This control signal is used for access memory 523 using the address value of the lower 24 bits in address region 573 received via signal line 545 as the address value of the lower 24 bits in address region 574. For fetching the JAVA byte codes in units of aligned 4 bytes in the above operation, the lower 2 bits of the address value of 24 bits, which are output from address management circuit 554 onto signal line 544, is always 0 regardless of the input address value. This address value is selected by selector 538 as shown in
Referring to
A JAVA instruction 402 of 2 bytes is translated into two 8-byte VLIW instructions 412a and 412b. A JAVA instruction 404 of 5 bytes is translated into three 8-byte VLIW instructions 414a, 414b and 414c. JAVA instruction 403, 406-408 and others are translated similarly. JAVA instruction 403 is translated into VLIW instruction 413, JAVA instructions 406 is translated into VLIW instruction 416, JAVA instruction 407 is translated into VLIW instruction 417, and JAVA instruction 408 is translated into three 8-byte VLIW instructions 418a-418c.
The address of memory region 573 is output as the address of memory region 574 by bus interface portion 503, and thereby memory 523 is accessed. Memory region 573 is a virtual JAVA byte code region. Therefore, the JAVA byte code (normative instruction), which is fetched by accessing actual memory 523, is translated into native instruction by bus interface portion 503, and is transferred via bus 105 to core 100. Thus, the native instruction of 16 MB of memory region 573 is compressed into ⅛, when viewed from core 100, and is held in memory 523 as the JAVA byte code of 2 MB of memory region 574. The JAVA byte code, which is fetched four bytes at a time by interface portion 503 from memory 523, is temporarily stored in input buffer 551, and then is read from input buffer 551 to translator 552 for translation into the native instruction. Then, the native instruction thus prepared is output to core 100 via output buffer memory 553. In this manner, a function of expanding the instruction code is achieved.
When accessing address region 574, processor 510 can use the JAVA byte code stored in JAVA instruction memory 523 as data for the access operation. Therefore, the address designating the JAVA byte code to be fetched is transferred via data address bus 106 onto address bus 31, and the JAVA byte code is transferred via data bus 32 from memory 523 to data bus 107. Processor 510 can execute the JAVA byte code fetched as data by using software, which is called “software interpreter” and is written in native instructions. Alternatively, processor 510 can execute the JAVA byte code fetched as data after translating it into the native instructions by using software, which is called “software translator”, and is described in native instructions. Accordingly, processor 501 of this embodiment is supported such that it can execute the program written in normative instructions such as JAVA byte code in any one of the manners of using the hardware translator, software translator and software interpreter.
A study relating to a standard or criterion, on which the processor selects one of the hardware translator, software translator and software interpreter for executing the JAVA byte code, has been described, e.g., in Japanese Patent Laying-Open No. 2000-368729 filed on Dec. 4, 2000 by the same assignee.
Referring to
Referring to
Register R4 holds a value “−4”, and register RIO holds the base address of the local variable region. For the PC value, the PC value of processor 510 is advanced by 16 addresses as a result of execution of the two VLIW instructions, whereby simulation of advancing the PC value by two addresses in accordance with the execution of JAVA instruction “iload” is performed.
Referring to
Referring to
For the PC value, the three VLIW instructions are executed, and the branching for skipping the two VLIW instructions is performed, whereby the PC value of processor 510 is advanced by 40 addresses so that the operation of advancing the PC value by 5 addresses in accordance with execution of JAVA instruction “jsr_w” is simulated.
In the example shown in
According to the embodiment of the invention, the program including the normative and native instruction processing routines in a mixed fashion can be executed fast. Even if the instruction length of the normative instruction is different from that of the native instruction, the processor core is not required to recognize the difference in instruction length, and the device can execute the program including the normative and native instruction processing routines in a mixed fashion.
Further, only a simple circuit is required to perform the address conversion for fetching the normative instruction if the instruction length of the normative instruction is equal to a value obtained by dividing the instruction length of the native instruction by n-th power of 2. The address conversion for fetching the normative instruction can be performed by a very simple circuit.
The processor core having the above memory interface executes the instruction in a simple manner without determining whether the instruction to be executed is native or normative, and thereby can execute the program including the normative and native instruction processing routines in a mixed fashion. Since only the native instructions are used within the processor core, the execution in the processor core can be fast. Even if the normative and native instructions have different instruction lengths, the processor core is not required to recognize the difference in instruction length, and can execute the program including the processing routines of the normative and native instructions in a mixed fashion without changing the structure of the processor.
Although the present invention has been described and illustrated in detail, it is clearly understood that the same is by way of illustration and example only and is not to be taken by way of limitation, the spirit and scope of the present invention being limited only by the terms of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
2001-012687 | Jan 2001 | JP | national |
This application is a Continuation of U.S. patent application Ser. No. 09/911,739, filed on Jul. 25, 2001, claiming priority of Japanese Patent Application No. 2001-012687, filed on Jan. 22, 2001, the entire contents of each of which are hereby incorporated by reference.
Number | Date | Country | |
---|---|---|---|
Parent | 09911739 | Jul 2001 | US |
Child | 12564397 | US |