A processor may execute a test and skip instruction that includes or otherwise specifies at least two operands that are used in a comparison operation. Based on the results of the comparison, the instruction that follows the test and skip instruction is “skipped.” The test and skip instruction may specify that the operands used in the comparison include (1) the contents of two registers, (2) the contents of one register and the contents of a memory location, or (3) the contents of one register and a stack value. In the second mode (an operand being from memory), a register is specified in the test and skip instruction that contains a value from which a pointer may be calculated. The calculated pointer preferably points to the memory location. If a stack value is used in the execution of the test and skip instruction, the instruction may include a reference to a register that points to the top of the stack. Further, the stack pointer may be adjusted automatically if the stack is used to provide an operand for the instruction. Embodiments may include apparatus and methods.
|
10. A method of executing a test and skip instruction, comprising:
executing a sequence of instructions by a processor;
calling the test and skip instruction within the sequence of instructions;
examining a bit in the test and skip instruction;
determining an address mode based on said bit; comparing contents of a first register to contents of a second register if the bit is in a first state; or comparing the contents of the first register to contents of a non-register location if the bit is in a second state; and
skipping a subsequent instruction based on results of the comparison.
22. A programmable logic device comprising;
control logic; and
a means for executing a test and skip instruction when called within a sequence of instructions that includes a first register reference identifying a first register having a register value and a second register reference identifying a second register also having a register value, for comparing a first value comprising the register value stored in the first register and a second value associated with the second register, and for executing or not executing a subsequent instruction that follows the test and skip instruction based on the comparison.
13. A system, comprising:
a main processor unit; and
a co-processor coupled to said main processor unit, wherein said co-processor executes a test and skip instruction when called within a sequence of instructions that includes a first register reference and a second register reference and causes the processor to compare a first value comprising a register value stored in a register corresponding to the first register reference and a second value associated with the second register reference and to execute or not execute a subsequent instruction that follows the test and skip instruction based on the comparison.
1. A processor executing a plurality of instructions, comprising:
an arithmetic logic unit; and
a plurality of registers coupled to the ALU, each register programmable to store a register value;
wherein said processor executes a test and skip instruction when called within the plurality of instructions that includes a first register reference and a second register reference and causes the processor to compare a first value comprising the register value stored in a register corresponding to the first register reference and a second value associated with the second register reference and to execute or not execute a subsequent instruction that follows the test and skip instruction based on the comparison.
2. The processor of
3. The processor of
4. The processor of
5. The processor of
6. The processor of
7. The processor of
8. The processor of
9. The processor of
11. The method of
12. The method of
14. The system of
15. The system of
16. The system of
17. The system of
18. The system of
19. The system of
20. The system of
|
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. 03291911.0, filed Jul. 30, 2003 and entitled “Test And Skip Processor Instruction Having At Least One Register Operand,” 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; “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. 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; “Concurrent Task Execution In A Multi-Processor, Single Operating System Environment,” Ser. No. 10/632,077, filed Jul. 31, 2003; and “A Multi-Processor Computing System Having A Java Stack Machine And A RISC-Based Processor,” Ser. No. 10/631,939, filed Jul. 31, 2003.
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 a test and skip instruction that includes or otherwise specifies at least two operands that are used in a comparison operation. Based on the results of the comparison (e.g., whether a condition is true or not), the instruction that follows the test and skip instruction is “skipped.” The test and skip instruction may specify that the operands used in the comparison include (1) the contents of two registers, (2) the contents of one register and the contents of a memory location, or (3) the contents of one register and a stack value. In the second mode (an operand being from memory), a register is specified in the test and skip instruction that contains a value from which a pointer may be calculated. The calculated pointer preferably points to the memory location. If a stack value is used in the execution of the test and skip instruction, the instruction may include a reference to a register that points to the top of the stack. Further, the stack pointer may be adjusted automatically if the stack is used to provide an operand for the instruction. Embodiments may include apparatus and methods.
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 and skip processor instruction having at least one register operand. The following describes the operation of a preferred embodiment of a processor on which the test 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 well-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 “micro-sequences” 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 C-ISA instructions. Both architectures preferably are tightly combined and integrated through the C-ISA.
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 bytecodes 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 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. Nos. 09/591,537 filed Jun. 9, 2000, 09/591,656 filed Jun. 9, 2000, and 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/C-ISA 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 and skip instruction which includes at least one register operand. An exemplary embodiment of this instruction is depicted in
The opcode 230 uniquely encodes a value that specifies the test and skip instruction as described herein. The opcode 230 is read by the decode logic 152 (
The test and skip instruction 228 preferably compares two operands to determine whether a condition is true. If the condition is true, then the instruction that follows the test and skip instruction 228 is “skipped.” Skipping the next instruction means that the subsequent instruction, which may have already been fetched by fetch logic 154, is not permitted to complete through the processor's pipeline. Skipping the subsequent instruction may occur by replacing the instruction with a “no operation” (NOP) instruction which is permitted to complete but, by its nature, generally does nothing. Skipping the subsequent instruction may be performed in accordance with other ways as well, such as by flushing the subsequent instruction from the processor's pipeline.
The operands compared in accordance with the test and skip instruction 228 may be determined, at least in part, by the P bit 234. In accordance with at least some embodiments, one of the operands comprises the value stored in a register referenced by Rd 232. The second operand may be determined by the P bit 234. If the P bit 234 is set to a first value (e.g., “0”), the second operand preferably is the value stored in a register referenced by Rs 236. Accordingly, in this addressing mode (P bit set to a value of “0”), the contents of two registers are compared to each other. If, however, the P bit is set to a second value (e.g., “1”), the register referenced by Rs generally contains a pointer to a memory address. In this latter mode, the contents of a register are compared to a memory value pointed by another register. More specifically and in accordance with a preferred embodiment, the pointer to the memory location may be calculated by adding the contents of the register specified in the register reference 236 (Rs) to an implicit register (e.g., register R8) that stores an offset. The R8 register may be post-incremented by a suitable, predetermined value (e.g., 1) after the memory access to prepare the offset present in R8 for a subsequent access. Without limitation, this type of operation may be particularly useful when searching for a specific pattern in memory as in “code book searching.” Accordingly, this test and skip instruction could be used within a software loop from a start address in memory.
Referring again to
The W and B bits 238 specify the size of the operands on which the comparison is performed. For example, the size encoded by the W and B bits may include byte, half word, or word. For example, with the W and B bits encoding a byte size, the lower eight bits of the operands are compared to each other. A half word size means that the lower half of the operand values are compared to each other, while a whole word size means that the entire operand values in their entirety are compared to each other.
Referring to
The test and skip instruction described herein provides a variety of benefits, none of which should be used to narrow the scope of this disclosure. That being stated, such benefits may include optimizing searches through arrays for a specific value, minimum/maximum calculation, etc. The test and skip instruction generally also improves the overall execution time of Java code. Further, the test and skip instruction 228 is generally relatively dense thereby permitting a Java application containing such instructions to require less memory storage space than otherwise would be needed.
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. For example, the format shown in
Chauvel, Gerard, Lasserre, Serge, D'Inverno, Dominique
Patent | Priority | Assignee | Title |
Patent | Priority | Assignee | Title |
4003033, | Dec 22 1975 | Honeywell Information Systems, Inc. | Architecture for a microprogrammed device controller |
4028668, | Dec 22 1975 | Honeywell Information Systems, Inc. | Apparatus for selectively addressing sections and locations in a device controller's memory |
4038537, | Dec 22 1975 | Honeywell Information Systems, Inc. | Apparatus for verifying the integrity of information stored in a data processing system memory |
4314350, | Dec 31 1979 | Bell Telephone Laboratories, Incorporated | Self-checking arithmetic unit |
4873627, | Jun 28 1985 | Hewlett-Packard Company | Method and means for conditional storing of data in a reduced instruction set computer |
4926312, | Dec 25 1985 | NEC Corporation | Program skip operation control system |
5253349, | Jan 30 1991 | International Business Machines Corporation | Decreasing processing time for type 1 dyadic instructions |
5434986, | Jan 09 1992 | Unisys Corporation | Interdependency control of pipelined instruction processor using comparing result of two index registers of skip instruction and next sequential instruction |
5642306, | Jul 27 1994 | Intel Corporation | Method and apparatus for a single instruction multiple data early-out zero-skip multiplier |
5644759, | Jan 19 1995 | Unisys Corporation; MAUNU, LEROY D | Apparatus and method for processing a jump instruction preceded by a skip instruction |
5931940, | Jan 23 1997 | Unisys Corporation | Testing and string instructions for data stored on memory byte boundaries in a word oriented machine |
6029226, | Sep 30 1996 | AVAGO TECHNOLOGIES GENERAL IP SINGAPORE PTE LTD | Method and apparatus having automated write data transfer with optional skip by processing two write commands as a single write command |
6047366, | Dec 31 1996 | Texas Instruments Incorporated | Single-instruction multiple-data processor with input and output registers having a sequential location skip function |
6098089, | Apr 23 1997 | Oracle America, Inc | Generation isolation system and method for garbage collection |
6567905, | Jan 23 2001 | VMWARE, INC | Generational garbage collector with persistent object cache |
6571260, | Mar 31 1999 | UNILOC 2017 LLC | Memory reclamation method |
6880074, | Dec 22 2000 | International Business Machines Corporation | In-line code suppression |
6988187, | Mar 21 2002 | SONY INTERACTIVE ENTERTAINMENT INC | Counting instructions to skip in superscaler processor |
20020065990, | |||
20020069332, | |||
20030061464, | |||
20030101320, | |||
EP79995, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Jul 30 2003 | CHAUVEL, GERARD | Texas Instruments Incorporated | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 014360 | /0554 | |
Jul 30 2003 | LASSERRE, SERGE | Texas Instruments Incorporated | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 014360 | /0554 | |
Jul 30 2003 | D INVERNO, DOMINIQUE | Texas Instruments Incorporated | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 014360 | /0554 | |
Jul 31 2003 | Texas Instruments Incorporated | (assignment on the face of the patent) | / | |||
Feb 10 2004 | TEXAS INSTRUMENTS - FRANCE | Texas Instruments Incorporated | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 014421 | /0982 |
Date | Maintenance Fee Events |
Apr 24 2014 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Apr 13 2018 | M1552: Payment of Maintenance Fee, 8th Year, Large Entity. |
Apr 22 2022 | M1553: Payment of Maintenance Fee, 12th Year, Large Entity. |
Date | Maintenance Schedule |
Nov 23 2013 | 4 years fee payment window open |
May 23 2014 | 6 months grace period start (w surcharge) |
Nov 23 2014 | patent expiry (for year 4) |
Nov 23 2016 | 2 years to revive unintentionally abandoned end. (for year 4) |
Nov 23 2017 | 8 years fee payment window open |
May 23 2018 | 6 months grace period start (w surcharge) |
Nov 23 2018 | patent expiry (for year 8) |
Nov 23 2020 | 2 years to revive unintentionally abandoned end. (for year 8) |
Nov 23 2021 | 12 years fee payment window open |
May 23 2022 | 6 months grace period start (w surcharge) |
Nov 23 2022 | patent expiry (for year 12) |
Nov 23 2024 | 2 years to revive unintentionally abandoned end. (for year 12) |