1. Technical Field of the Invention
The present invention relates generally to processors and more particularly to an executable instruction that is capable of testing two values and skipping or executing the subsequent instruction based on the result of the test.
2. Background Information
Many types of electronic devices are battery operated and thus preferably consume as little power as possible. An example is a cellular telephone. Further, it may be desirable to implement various types of multimedia functionality in an electronic device such as a cell phone. Examples of multimedia functionality may include, without limitation, games, audio decoders, digital cameras, etc. It is thus desirable to implement such functionality in an electronic device in a way that, all else being equal, is fast, consumes as little power as possible and requires as little memory as possible. Improvements in this area are desirable.
As disclosed herein, a processor may execute an instruction that includes an immediate value and a reference to a register accessible to the processor. The instruction causes the processor to perform a test using the immediate value and the contents of the register referenced in the instruction. Based on the outcome of test, the subsequent instruction is executed or skipped. Further, the instruction includes at least one bit that specifies how the test is to be performed. The bit may specify that the immediate value is to be compared to the register value, or that the immediate value is used to mask the register value and the masked register value has one or more of its bits tested.
Certain terms are used throughout the following description and claims to refer to particular system components. As one skilled in the art will appreciate, semiconductor companies may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following discussion and in the claims, the terms “including” and “comprising” are used in an open-ended fashion, and thus should be interpreted to mean “including, but not limited to . . . ”. Also, the term “couple” or “couples” is intended to mean either an indirect or direct connection. Thus, if a first device couples to a second device, that connection may be through a direct connection, or through an indirect connection via other devices and connections. “Skipping” an instruction means that the instruction, which may have already been fetched by the processor, is not permitted to complete through the processor's pipeline in favor of the instruction following the skipped instruction.
For a more detailed description of the preferred embodiments of the present invention, reference will now be made to the accompanying drawings, wherein:
The following discussion is directed to various embodiments of the invention. Although one or more of these embodiments may be preferred, the embodiments disclosed should not be interpreted, or otherwise used, as limiting the scope of the disclosure, including the claims, unless otherwise specified. In addition, one skilled in the art will understand that the following description has broad application, and the discussion of any embodiment is meant only to be exemplary of that embodiment, and not intended to intimate that the scope of the disclosure, including the claims, is limited to that embodiment.
The subject matter disclosed herein is directed to a programmable electronic device such as a processor that executes various instructions including, without limitation, a “test with immediate and skip” instruction. The following describes the operation of a preferred embodiment of a processor on which the test with immediate and skip instruction may run. Other processor architectures and embodiments may be available or developed on which to run the instruction and thus this disclosure and the claims which follow are not limited to any particular type of processor. Details regarding the format and operation of the test with immediate and skip instruction follow the description of the processor.
The processor described herein is particularly suited for executing Java™ Bytecodes or comparable code. As is well known, Java is particularly suited for embedded applications. Java is a relatively “dense” language meaning that on average each instruction may perform a large number of functions compared to various other programming languages. The dense nature of Java is of particular benefit for portable, battery-operated devices that preferably include as little memory as possible to save space and power. The reason, however, for executing Java code is not material to this disclosure or the claims which follow. The processor described herein may be used in a wide variety of electronic systems. By way of example and without limitation, the Java-executing processor described herein may be used in a portable, battery-operated cell phone. Further, the processor advantageously includes one or more features that permit the execution of the Java code to be accelerated.
Referring now to
As is generally well known, Java code comprises a plurality of “bytecodes” 112. Bytecodes 112 may be provided to the JVM 108, compiled by compiler 110 and provided to the JSM 102 and/or MPU 104 for execution therein. In accordance with a preferred embodiment of the invention, the JSM 102 may execute at least some, and generally most, of the Java bytecodes. When appropriate, however, the JSM 102 may request the MPU 104 to execute one or more Java bytecodes not executed or executable by the JSM 102. In addition to executing Java bytecodes, the MPU 104 also may execute non-Java instructions. The MPU 104 also hosts an operating system (“O/S”) (not specifically shown), which performs various functions including system memory management, the system task management that schedules the JVM 108 and most or all other native tasks running on the system, management of the display 114, receiving input from input devices, etc. Without limitation, Java code may be used to perform any one of a variety of applications including multimedia, games or web based applications in the system 100, while non-Java code, which may comprise the O/S and other native applications, may still run on the system on the MPU 104.
The JVM 108 generally comprises a combination of software and hardware. The software may include the compiler 110 and the hardware may include the JSM 102. The JVM may include a class loader, bytecode verifier, garbage collector, and a bytecode interpreter loop to interpret the bytecodes that are not executed on the JSM processor 102.
In accordance with preferred embodiments of the invention, the JSM 102 may execute at least two instruction sets. One instruction set may comprise standard Java bytecodes. As is wel1-known, Java is a stack-based programming language in which instructions generally target a stack. For example, an integer add (“IADD”) Java instruction pops two integers off the top of the stack, adds them together, and pushes the sum back on the stack. As will be explained in more detail below, the JSM 102 comprises a stack-based architecture with various features that accelerate the execution of stack-based Java code.
Another instruction set executed by the JSM 102 may include instructions other than standard Java instructions. In accordance with at least some embodiments of the invention, such other instruction set may include register-based and memory-based operations to be performed. This other instruction set generally complements the Java instruction set and, accordingly, may be referred to as a complementary instruction set architecture (“C-ISA”). By complementary, it is meant that the execution of some more complex Java bytecodes may be substituted by “microsequences” using C-ISA instructions that permit an address calculation process to “walk through” the JVM data structures. Further, such micro-sequences may also use bytecode instructions. Further, Java execution may be made more efficient and run faster by replacing some sequences of Bytecodes by preferably shorter and more efficient sequences of C-ISA instructions. Bytecodes also may be used within a C-ISA sequence. The two sets of instructions may be used in a complementary fashion to obtain satisfactory code density and efficiency. As such, the JSM 102 generally comprises a stack-based architecture for efficient and accelerated execution of Java bytecodes combined with a register-based architecture for executing register and memory based CISA instructions. Both architectures preferably are tightly combined and integrated through the CISA.
Referring now to
Referring again to
The second, register-based, memory-based instruction set may comprise the C-ISA instruction set introduced above. The C-ISA instruction set preferably is complementary to the Java bytecode instruction set in that the C-ISA instructions may be used to accelerate or otherwise enhance the execution of Java bytecodes. For example, the compiler 110 may scan a series of Java bytes codes 112 and replace one or more of such bytecodes with an optimized code segment mixing C-ISA and bytecodes and which is capable of more efficiently performing the function(s) performed by the initial group of Java bytecodes. In at least this way, Java execution may be accelerated by the JSM 102. The C-ISA instruction set includes a plurality of instructions including a “test with immediate and skip” instruction as mentioned above and explained below in detail.
Referring still to
The data storage 122 generally comprises data cache (“D-cache”) 124 and data random access memory (“D-RAMset”) 126. Reference may be made to copending applications U.S. Ser. No. 09/591,537 filed Jun. 9, 2000, Ser. No. 09/591,656 filed Jun. 9, 2000 (atty docket TI-29960), and Ser. No. 09/932,794 filed Aug. 17, 2001, all of which are incorporated herein by reference. The stack (excluding the micro-stack 146), arrays and non-critical data may be stored in the D-cache 124, while Java local variables, critical data and non-Java variables (e.g., C, C++) may be stored in D-RAM 126. The instruction storage 130 may comprise instruction RAM (“I-RAM”) 132 and instruction cache (“I-cache”) 134. The I-RAMset 132 may be used for “complex” micro-sequenced bytecodes or other micro-sequences or sequences of code, as will be described below. The I-cache 134 may be used to store other types of Java bytecode and mixed Java/CISA instructions.
As explained above, the C-ISA instruction set preferably permits register-based and memory-based operations. While not the only C-ISA instruction, as noted above one such instruction is the “test with immediate and skip” instruction. An exemplary embodiment of this instruction is depicted in
The test with immediate and skip instruction 228 in
In accordance with the preferred embodiment, as noted above when Rd is a 0, the register Rd 232 encodes one of a first group of registers, preferably registers R0-R7 in
If, however, value V matches the contents of register Rd, then the subsequent instruction is executed, and thus not skipped. The combination of various logic including, without limitation, the decode logic 152 and/or fetch logic 154 may be used to perform the instruction replacement as described above. Further, the comparison of immediate value V with the contents of Rd may be performed by any suitable logic in the processor core 120 such as the ALU 148. The comparison preferably comprises a bit-by-bit comparison between V and the contents of Rd. If desired, a bit in the status register R15 may be written to reflect the result of the comparison. For example, this status bit may be written as a “0” if V does not match the contents of Rd or as a “1” if there is a match.
The test with immediate and skip instruction avoids having to use a register to store the immediate value which may be helpful in cores having a limited number of registers. Further, the instruction described herein avoids having to load the immediate value from memory, thereby reducing the instruction count.
If Rd is a logic 1, register reference Rd 232 encodes one of a second group of registers, preferably registers R8-R15. In this mode, the processor 102 generally examines the state of one or more bits, but not necessarily all bits, in register Rd. As such, the immediate value V is used to mask the contents of register Rd 232. This may be accomplished in the preferred embodiment by logically AND'ing register Rd with the immediate value V on a bit-by-bit basis. The mask (immediate value V) may comprise 0's in the bit places that are not of interest, and 1's in the bit places that are of interest. Once the contents of register Rd 232 are masked, the bits corresponding to the bit positions of the mask having a 1 are examined to determine whether they are a 0 or a 1. If the contents of register Rd, after masking, are not all 0's, then the next instruction following the test and skip instruction 228 is skipped as described above. If, however, the masked register Rd is all 0's, the subsequent instruction is executed and not skipped.
Targeting registers R8-R15 may be particularly appropriate for testing individual bits of the status register (e.g., the eight lower bits) and for jumping to a specific routine if one of those bits is set or continue to run another routine if not set. In the JSM architecture, some of these lower status bit may be used (set/cleared) by the MPU 104 to dynamically change the behavior of JSM 102. When one of these status bit is set to “1”, the micro-sequence executing complex bytecodes may behave differently than when the same status bit is set to “0”.
The format shown in
While the preferred embodiments of the present invention have been shown and described, modifications thereof can be made by one skilled in the art without departing from the spirit and teachings of the invention. The embodiments described herein are exemplary only, and are not intended to be limiting. Many variations and modifications of the invention disclosed herein are possible and are within the scope of the invention. Accordingly, the scope of protection is not limited by the description set out above. Each and every claim is incorporated into the specification as an embodiment of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
03291910 | Jul 2003 | EP | regional |
This application claims priority to U.S. Provisional Application Ser. No. 60/400,391 titled “JSM Protection,” filed Jul. 31, 2002, incorporated herein by reference. This application also claims priority to EPO Application No. 03291927.6, filed Jul. 30, 2003 and entitled “A Multi-Processor Computing System Having A Java Stack Machine And A RISC-Based Processor,” incorporated herein by reference. This application also may contain subject matter that may relate to the following commonly assigned co-pending applications incorporated herein by reference. “System And Method To Automatically Stack And Unstack Java Local Variables,” Ser. No. 10/632,228, filed Jul. 31, 2003, “Memory Management Of Local Variables,” Ser. No. 10/632,067, filed Jul. 31, 2003, “Memory Management Of Local Variables Upon A Change Of Context,” Ser. No. 10/632,076, filed Jul. 31, 2003, “A Processor With A Split Stack,” Ser. No. 10/632,079, filed Jul. 31, 2003, “Using IMPDEP2 For System Commands Related To Java Accelerator Hardware,” Ser. No. 10/632,069, filed Jul. 31, 2003, “Test With Immediate And Skip Processor Instruction,” Ser. No. 10/632,214, filed Jul. 31, 2003, “Test And Skip Processor Instruction Having At Least One Register Operand,” Ser. No. 10/632,084, filed Jul. 31, 2003, “Synchronizing Stack Storage,” Ser. No. 10/631,422, filed Jul. 31, 2003, “Methods And Apparatuses For Managing Memory,” Ser. No. 10/631,252, filed Jul. 31, 2003, “Write Back Policy For Memory,” Ser. No. 10/631,185, filed Jul. 31, 2003, “Methods And Apparatuses For Managing Memory,” Ser. No. 10/631,205, filed Jul. 31, 2003, “Mixed Stack-Based RISC Processor,” Ser. No. 10/631,308, filed Jul. 31, 2003, “Processor That Accommodates Multiple Instruction Sets And Multiple Decode Modes,” Ser. No. 10/631,246, filed Jul. 31, 2003, “System To Dispatch Several Instructions On Available Hardware Resources,” Ser. No. 10/631,585, filed Jul. 31, 2003, “Micro-Sequence Execution In A Processor,” Ser. No. 10/632,216, filed Jul. 31, 2003, “Program Counter Adjustment Based On The Detection Of An Instruction Prefix,” Ser. No. 10/632,222, filed Jul. 31, 2003, “Reformat Logic To Translate Between A Virtual Address And A Compressed Physical Address,” Ser. No. 10/632,215, filed Jul. 31, 2003, “Synchronization Of Processor States,” Ser. No. 10/632,024, filed Jul. 31, 2003, “Conditional Garbage Based On Monitoring To Improve Real Time Performance,” Ser. No. 10/631,195, filed Jul. 31, 2003, “Inter-Processor Control,” Ser. No. 10/631,120, filed Jul. 31, 2003, “Cache Coherency in A Multi-Processor System,” Ser. No. 10/632,229, filed Jul. 31, 2003, and “Concurrent Task Execution In A Multi-Processor, Single Operating System Environment,” Ser. No. 10/632,077, filed Jul. 31, 2003.
Number | Name | Date | Kind |
---|---|---|---|
4873627 | Baum | Oct 1989 | A |
5471593 | Branigin | Nov 1995 | A |
5504903 | Chen et al. | Apr 1996 | A |
5555428 | Radigan et al. | Sep 1996 | A |
5638525 | Hammond et al. | Jun 1997 | A |
5659722 | Blaner et al. | Aug 1997 | A |
5815695 | James | Sep 1998 | A |
6041399 | Terada et al. | Mar 2000 | A |
6088786 | Feierbach et al. | Jul 2000 | A |
6098089 | O'Connor et al. | Aug 2000 | A |
6115808 | Arora | Sep 2000 | A |
6253307 | Boutaud et al. | Jun 2001 | B1 |
6567905 | Otis | May 2003 | B2 |
6571260 | Morris | May 2003 | B1 |
6826749 | Patel et al. | Nov 2004 | B2 |
6880074 | Perry et al. | Apr 2005 | B2 |
6931632 | Ramasamy et al. | Aug 2005 | B2 |
20020065990 | Chauvel et al. | May 2002 | A1 |
20020069332 | Chauvel et al. | Jun 2002 | A1 |
20030101320 | Chauvel et al. | May 2003 | A1 |
Number | Date | Country |
---|---|---|
0079995 | Jun 1983 | EP |
Number | Date | Country | |
---|---|---|---|
20040024997 A1 | Feb 2004 | US |
Number | Date | Country | |
---|---|---|---|
60400391 | Jul 2002 | US |