Processor having switch instruction circuit
Abstract
In one implementation a processor has an instruction fetch circuit fetching instructions, the instruction fetch circuit having an input and an output and a decode circuit to decode the fetched instructions, the decode circuit having a first and second input, and an output, wherein the decode circuit first input is coupled to the instruction fetch circuit output receiving the fetched instructions, and an execution circuit executing the decoded fetched instructions, the execution circuit having an input coupled to the decode circuit output to receive the decoded fetched instructions, and a switch instruction circuit (SIC) to detect and execute switch instructions of the fetched instructions, the SIC having an input and an output, wherein the SIC input is coupled to the instruction fetch circuit output to receive the fetched instructions, wherein the SIC output is coupled to the decode circuit second input and the instruction fetch circuit input.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 16 · Forward citations: 0.
Claims (8 — 1 Independent, 7 Dependent)
- Claim 1Independent Claim
A processor comprising: an instruction fetch circuit to fetch instructions, the instruction fetch circuit having an input and an output; a decode circuit to decode the fetched instructions, the decode circuit having a first input, a second input, and an output, wherein the decode circuit first input is coupled to the instruction fetch circuit output to receive the fetched instructions; an execution circuit to execute the decoded fetched instructions, the execution circuit having an input, wherein the execution circuit input is coupled to the decode circuit output to receive the decoded fetched instructions; and a switch instruction circuit (SIC) to detect and execute switch instructions of the fetched instructions, the SIC having an input and an output, wherein the SIC input is coupled to the instruction fetch circuit output to receive the fetched instructions, wherein the SIC output is coupled to the decode circuit second input and the instruction fetch circuit input.
- Claim 2Depends on #1
The processor of claim 1 wherein the SIC comprises: a switch instruction check circuit (SICC) having an input and an output, the SICC to determine when the fetched instruction is the switch instruction, the SICC input coupled to the instruction fetch circuit output; wherein when the SICC determines the fetched instruction is the switch instruction then the SICC places the switch instruction on the SICC output; a switch first address determination circuit (SFADC) having an input, the SFADC to determine a first instruction address following a switch table of the switch instruction, the SFADC input coupled to the SICC output; and a switch address execute determination circuit (SAEDC) having an input, the SAEDC to determine an instruction address of an entry in the switch table to execute, the SAEDC input coupled to the SICC output.
- Claim 3Depends on #2
The processor of claim 2 wherein the SIC comprises: a switch address size check circuit (SASCC) having an input and an output, the SASCC to determine if the instruction address of the entry in the switch table to execute exceeds a size of the switch table, the SASCC input coupled to an output of the SAEDC; and a switch change address circuit (SCAC) having an input, the SCAC to change the instruction address of the entry in the switch table to execute that exceeds the size of the switch table to a last case address in the switch table, the SCAC input coupled to the SASCC output.
- Claim 4Depends on #3
The processor of claim 3 wherein the instruction fetch circuit to pre-fetch instructions comprises: a switch discard instruction(s) circuit (SDIC) having an input and an output, the SDIC to discard any pre-fetched instructions, the SDIC input coupled to the SCAC output; and a switch instruction fetch circuit (SIFC) having an input, the SIFC to fetch a switch target instruction at the instruction address of the entry in the switch table entry to execute, the SIFC input coupled to the SDIC output.
- Claim 5Depends on #2
The processor of claim 2 wherein the SIC comprises: a switch instruction inspection circuit (SIIC) having an input, and an error output, the SIIC to determine when the instruction at the instruction address of the entry in the switch table to execute is not a jump (JUMP instruction) and not a call (CALL instruction) and generate an error signal on the error output when it is determined that the instruction at the instruction address of the entry in the switch table to execute is not the jump (JUMP instruction) and not the call (CALL instruction); and a switch instruction error fault circuit (SIEFC) having an input, the SIEFC to halt execution of the fetched switch target instruction when the error signal is received on the input, the SIEFC input coupled to the SIIC error output.
- Claim 6Depends on #5
The processor of claim 5 wherein the SIC comprises: the SIIC having an output, the SIIC to determine when the instruction at the instruction address of the entry in the switch table to execute is a jump (JUMP instruction) or a call (CALL instruction) and place the switch target instruction on the output when it is determined that the instruction at the instruction address of the entry in the switch table to execute is the jump (JUMP instruction) or the call (CALL instruction); the SFADC having an output to place on the output the first instruction address following the switch table; a switch instruction determination circuit (SIDC) having an input, and an output, the SIDC input coupled to the SIIC output, the SIDC to determine if the fetched switch target instruction is the CALL instruction and if the fetched switch target instruction is the CALL instruction place the CALL instruction on the output of the SIDC; and a switch instruction return stack circuit (SIRSC) having a first input,
- Claim 7Depends on #6
The processor of claim 6 wherein the SIC comprises: the SIDC having a second output, the SIDC second output set to the fetched switch target instruction; a switch instruction target determination circuit (SITDC) the SITDC having an input and an output, the SITDC input coupled to the SIDC second output, the SITDC to determine a target of the JUMP instruction or the CALL instruction and place the determined target on the SITDC output; and wherein the SITDC output is coupled to the instruction fetch circuit input, and is coupled to the decode circuit second input.
- Claim 8Depends on #6
The processor of claim 6 wherein the SIRSC is a same stack used by the processor when not executing the switch instruction.
Technical Overview & Description
CROSS-REFERENCE TO RELATED APPLICATIONS The present application claims priority to U.S. Provisional Patent Application Ser. No. 63/468,462 filed on May 23, 2023, the contents of which are incorporated by reference herein in their entirety. BACKGROUND Processors generally work on machine code instructions, also known as opcodes, which are difficult to decipher. The machine code instructions reflect what the respective processor is electrically arranged to implement. One level above machine code is assembler code, which is basically a more readable version of the opcode. A machine code instruction, and the respective assembler code instruction, may be called a processor instruction, in that the instruction is handled “ as is ” by the processor. Higher level programming languages exist, with associated respective compilers, which convert instructions in the higher level language into a string of machine code instructions for the respective processor. Higher level programming languages often have “ switch ” instructions, which is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via search and map. For example, C++ and C# have the “ switch ” instruction and Visual Basic has the “ select ” instruction. Compilers reduce these to machine-code instructions that perform a series of conditional jumps to finally arrive at the address of the instructions for each case identified by the switch statement. The compiler can be very clever and creative in the structure of this series of jumps that reduce the number of jump instructions that need to be executed by the processor. However, for some specialized processors, a compiler may not yet exist. Programming is then done via assembly language that can be easily converted into the machine code. But the writing of a switch, or switch-like, instruction in assembly language for present processors is cumbersome, awkward to use, difficult to optimize
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.
References Cited — Backward Prior Art (16)
| Patent | Title | Year | Citations |
|---|
Non-Patent Literature (3)
- Machine Translation of Korean Patent Application KR 20070055858 A, 2007. (Year: 2007).
- Machine Translation of Chinese Patent Application CN 107273177 B, 2020. (Year: 2020).
- PCT/US2023/083379, International Search Report and Written Opinion, European Patent Office, Rijswijk ND, Mar. 19, 2024.