IP Library Granted Patent US 11,086,631
Granted Patent B2
US 11,086,631 · App. 16/661,223 · Granted Aug 10, 2021

Illegal instruction exception handling

Inventors: Robert T. Golla (Austin, TX); Matthew B. Smittle (Allen, TX)
Assignee: Western Digital Technologies, Inc.
G06F9/3861G06F9/3004G06F9/30145G06F9/4812G06F8/40G06F9/3017
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,086,631
App. No.
16/661,223
Granted
Aug 10, 2021
Kind
B2
Abstract

Techniques are disclosed relating to the handling of exceptions generated by illegal instructions in a processor. In an embodiment, a processor may be configured to fetch instructions defined according to an instruction set architecture (ISA). The ISA may include a set of uncompressed instructions and a set of compressed instructions. The processor may further be configured to, upon detecting a given one of the set of compressed instructions, cause a copy of the given compressed instruction to be saved and convert the given compressed instruction to a corresponding given uncompressed instruction. The processor may also be configured to detect that the given uncompressed instruction is illegal and was converted from the given compressed instruction, and based at least in part on these, cause an illegal instruction exception to be generated using the copy of the given compressed instruction.

Claims (87)

1. A processor, comprising:

an instruction fetch circuit configured to fetch instructions defined according to an instruction set architecture (ISA), wherein:

the ISA includes a set of uncompressed instructions and a set of compressed instructions;

members of the set of compressed instructions have corresponding members in the set of uncompressed instructions; and

members of the set of compressed instructions are encoded in fewer bits than their corresponding members in the set of uncompressed instructions;

an instruction conversion circuit configured to, upon detecting a given one of the set of compressed instructions, cause a copy of the given compressed instruction to be saved and convert the given compressed instruction to a corresponding given uncompressed instruction for downstream processing; and

an illegal instruction detection circuit configured to:

detect that the given uncompressed instruction is illegal;

detect that the given uncompressed instruction was converted from the given compressed instruction; and

based at least in part on detection that the given uncompressed instruction is illegal and was converted from the given compressed instruction:

cause an illegal instruction exception to be generated; and

include an indication that the given compressed instruction is associated with the illegal instruction exception.

2. The processor of claim 1 , wherein the illegal instruction detection circuit is further configured to:

detect that a second uncompressed instruction is illegal;

detect that the second uncompressed instruction was not converted from a compressed instruction; and

based at least in part on detection that the second uncompressed instruction is illegal and was not converted from a compressed instruction:

cause a different illegal instruction exception to be generated; and

include a different indication that the second uncompressed instruction is associated with the different illegal instruction exception.

3. The processor of claim 1 , wherein to cause the illegal instruction exception to be generated, the illegal instruction detection circuit is further configured to assert an exception condition, wherein the exception condition causes the illegal instruction exception to be generated based at least in part upon the given uncompressed instruction reaching a commit pipeline stage without being flushed.

4. The processor of claim 1 , wherein the ISA is a version of the RISC-V ISA.

5. The processor of claim 4 , wherein to cause the illegal instruction exception to be generated, the illegal instruction detection circuit is further configured to cause either the given uncompressed instruction or the given compressed instruction to be written to an MTVAL register of the version of the RISC-V ISA.

6. A processor, comprising:

an instruction fetch circuit configured to fetch instructions defined according to an instruction set architecture (ISA), wherein:

the ISA includes a set of uncompressed instructions and a set of compressed instructions;

members of the set of compressed instructions have corresponding members in the set of uncompressed instructions; and

members of the set of compressed instructions are encoded in fewer bits than their corresponding members in the set of uncompressed instructions;

an instruction conversion circuit configured to, upon detecting a given one of the set of compressed instructions, cause a copy of the given compressed instruction to be saved and convert the given compressed instruction to a corresponding given uncompressed instruction for downstream processing; and

an illegal instruction detection circuit configured to:

detect that the given uncompressed instruction is illegal;

detect that the given uncompressed instruction was converted from the given compressed instruction; and

based at least in part on detection that the given uncompressed instruction is illegal and was converted from the given compressed instruction, cause an illegal instruction exception to be generated using the copy of the given compressed instruction;

wherein to cause the copy of the given compressed instruction to be saved, the instruction conversion circuit is further configured to write the copy of the given compressed instruction into an illegal instruction register based at least in part on detection that the given uncompressed instruction is illegal.

7. The processor of claim 6 , further comprising a decoder circuit configured to:

receive the given uncompressed instruction and contents of the illegal instruction register; and

based at least in part on detection that the given uncompressed instruction is illegal and an original size of the given uncompressed instruction, select one of the given uncompressed instruction or the contents of the illegal instruction register to be written into a pending illegal instruction register.

8. A processor, comprising:

an instruction fetch circuit configured to fetch instructions defined according to an instruction set architecture (ISA), wherein:

the ISA includes a set of uncompressed instructions and a set of compressed instructions;

members of the set of compressed instructions have corresponding members in the set of uncompressed instructions; and

members of the set of compressed instructions are encoded in fewer bits than their corresponding members in the set of uncompressed instructions;

an instruction conversion circuit configured, upon detecting a given one of the set of compressed instructions, to:

cause a copy of the given compressed instruction to be saved by saving an opcode field of the given compressed instruction without saving a remainder of the given compressed instruction; and

convert the given compressed instruction to a corresponding given uncompressed instruction for downstream processing; and

an illegal instruction detection circuit configured to:

detect that the given uncompressed instruction is illegal;

detect that the given uncompressed instruction was converted from the given compressed instruction; and

based at least in part on detection that the given uncompressed instruction is illegal and was converted from the given compressed instruction, cause an illegal instruction exception to be generated using the copy of the given compressed instruction.

9. A device, comprising:

a mass storage medium; and

a controller comprising a processor that is configured to execute instructions defined according to an instruction set architecture (ISA), wherein the ISA includes a set of uncompressed instructions and a set of compressed instructions, wherein members of the set of compressed instructions have corresponding members in the set of uncompressed instructions; and wherein members of the set of compressed instructions are encoded in fewer bits than their corresponding members in the set of uncompressed instructions;

wherein subsequent to fetching a given one of the set of compressed instructions, the processor is configured to cause a copy of the given compressed instruction to be saved and convert the given compressed instruction to a corresponding given uncompressed instruction for downstream processing;

wherein the processor is further configured to:

detect that the given uncompressed instruction is illegal;

detect that the given uncompressed instruction was converted from the given compressed instruction; and

based at least in part on detection that the given uncompressed instruction is illegal and was converted from the given compressed instruction:

cause an illegal instruction exception to be generated; and

include an indication that the given compressed instruction is associated with the illegal instruction exception.

10. The device of claim 9 , wherein the mass storage medium comprises a magnetic medium.

11. The device of claim 9 , wherein the mass storage medium comprises a nonvolatile memory medium.

12. The device of claim 9 , wherein the processor is further configured to:

detect that a second uncompressed instruction is illegal;

detect that the second uncompressed instruction was not converted from a compressed instruction; and

based at least in part on detection that the second uncompressed instruction is illegal and was not converted from a compressed instruction:

cause a different illegal instruction exception to be generated; and

include a different indication that the second uncompressed instruction is associated with the different illegal instruction exception.

13. The device of claim 9 , wherein the ISA is a version of the RISC-V ISA.

14. The device of claim 9 , wherein to save the copy of the given compressed instruction, the processor is further configured to save an opcode field of the given compressed instruction without saving a remainder of the given compressed instruction.

15. A device, comprising:

a mass storage medium; and

a controller comprising a processor that is configured to execute instructions defined according to a version of the RISC-V instruction set architecture (ISA), wherein the RISC-V ISA includes a set of uncompressed instructions and a set of compressed instructions, wherein members of the set of compressed instructions have corresponding members in the set of uncompressed instructions; and wherein members of the set of compressed instructions are encoded in fewer bits than their corresponding members in the set of uncompressed instructions;

wherein subsequent to fetching a given one of the set of compressed instructions, the processor is configured to cause a copy of the given compressed instruction to be saved and convert the given compressed instruction to a corresponding given uncompressed instruction for downstream processing;

wherein the processor is further configured to:

detect that the given uncompressed instruction is illegal;

detect that the given uncompressed instruction was converted from the given compressed instruction; and

based at least in part on detection that the given uncompressed instruction is illegal and was converted from the given compressed instruction, cause, using the copy of the given compressed instruction, an illegal instruction exception to be generated by causing either the given uncompressed instruction or the given compressed instruction to be written to an MTVAL register of the version of the RISC-V ISA.

16. A method, comprising:

fetching, by a processor, an instruction stream including instructions of varying executable formats defined according to a particular instruction set architecture that is supported by the processor;

converting, by the processor, the instructions so that post-conversion instructions have a single executable format of the varying executable formats;

during the converting, detecting, by the processor, that a given one of the instructions has an illegal format;

based on the detecting, storing, by the processor, the given instruction in its pre-conversion executable format;

executing, by the processor, the given instruction in its post-conversion executable format;

generating, by the processor, an illegal instruction exception; and

including an indication that the given instruction in its pre-conversion executable format is associated with the illegal instruction exception.

17. The method of claim 16 , wherein detecting that the given instruction has an illegal format comprises detecting the illegal format based on the pre-conversion executable format of the given instruction.

18. The method of claim 16 , wherein detecting that the given instruction has an illegal format comprises detecting the illegal format based on the post-conversion executable format of the given instruction.

19. The method of claim 16 , wherein the instruction stream includes instructions defined according to a version of the RISC-V ISA.

20. The method of claim 16 , wherein the instruction stream includes instructions corresponding to a plurality of threads, and wherein the given instruction is associated with a particular one of the plurality of threads.

Assignments (4)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 28, 2022
From: WESTERN DIGITAL TECHNOLOGIES, INC.
To: CADENCE DESIGN SYSTEMS, INC.
Reel/Frame 060334/0340 →
RELEASE OF SECURITY INTEREST AT REEL 051717 FRAME 0716 Recorded Feb 8, 2022
From: JPMORGAN CHASE BANK, N.A.
To: WESTERN DIGITAL TECHNOLOGIES, INC.
Reel/Frame 058965/0385 →
SECURITY INTEREST Recorded Feb 4, 2020
From: WESTERN DIGITAL TECHNOLOGIES, INC.
To: JPMORGAN CHASE BANK, N.A., AS AGENT
Reel/Frame 051717/0716 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 23, 2019
From: GOLLA, ROBERT T.; SMITTLE, MATTHEW B.
To: WESTERN DIGITAL TECHNOLOGIES, INC.
Reel/Frame 050805/0718 →
Continuity (2)
Provisional Application 62773829 · Nov 30, 2018
Related Publication 20200174794A1 · Jun 4, 2020