IP Library › Granted Patent US 12,288,068
Granted Patent B2
US 12,288,068 · App. 18/465,189 · Granted Apr 29, 2025

Instruction simulation device and method thereof

Inventors: Weilin Wang (Beijing, CN); Yingbing Guan (Shanghai, CN); Mengchen Yang (Beijing, CN)
Assignee: Shanghai Zhaoxin Semiconductor Co., Ltd.
G06F9/30145G06F9/30047G06F9/30101G06F9/3017G06F9/30174G06F9/30185G06F9/30189G06F9/3814G06F9/3854G06F9/3858G06F9/455G06F9/45516G06F9/4812G06F11/0772
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 12,288,068
App. No.
18/465,189
Granted
Apr 29, 2025
Kind
B2
Abstract

An instruction simulation device and a method thereof are provided. The instruction simulation device includes a processor. The processor includes an instruction decoder which generates format information of a ready-for-execution instruction. The processor determines whether the ready-for-execution instruction currently executed by the processor is a compatible instruction or an extended instruction based on the format information of the ready-for-execution instruction. If the ready-for-execution instruction is an extended instruction under the new instruction set or the extended instruction set, the processor converts the ready-for-execution instruction into a simulation program corresponding to the extended instruction, and simulates an execution result of the ready-for-execution instruction by executing the simulation program. The simulation program is composed of at least one compatible instructions of the processor. If the ready-for-execution instruction is a compatible instruction, the processor executes the ready-for-execution instruction.

Claims (68)

1. An instruction simulation device, comprising a processor, the processor comprising:

an instruction decoder, configured to generate format information of a ready-for-execution instruction; and

the processor is configured to determine whether the ready-for-execution instruction currently executed by the processor is a compatible instruction or an extended instruction based on the format information of the ready-for-execution instruction, wherein the compatible instruction is an instruction under a current instruction set of the processor, and the extended instruction is not an instruction under the current instruction set of the processor but is an instruction under a new instruction set or an extended instruction set, wherein the new instruction set and the extended instruction set are instruction sets that do not belong to a native instruction set of the processor; wherein

if the ready-for-execution instruction is an extended instruction under the new instruction set or the extended instruction set, the processor converts the ready-for-execution instruction into a simulation program corresponding to the extended instruction, and simulates an execution result of the ready-for-execution instruction by executing the simulation program; and

if the ready-for-execution instruction is a compatible instruction, the processor executes the ready-for-execution instruction;

wherein the simulation program is composed of at least one compatible instructions of the processor.

2. The instruction simulation device according to claim 1 , wherein a computer system embodied with the processor comprises a system memory, the system memory comprising:

a processor-current-state store region, configured to store a current-context state of the processor;

a conversion-information store region, configured to store temporary information in a process of translating the ready-for-execution instruction into the corresponding simulation program; and

an execution-result store region, configured to store the execution result after executing the simulation program.

3. The instruction simulation device according to claim 1 , wherein when the ready-for-execution instruction is the extended instruction, the processor asserts an emulation flag to obtain the corresponding simulation program by means of an interrupt service program.

4. The instruction simulation device according to claim 1 , wherein the processor comprises:

a plurality of registers, comprising a register configured to indicate an address of a storage space caching a current state of the processor, a register configured to indicate an address of a storage space caching a conversion intermediate result when calling the corresponding simulation program, a register configured to indicate an address of a storage space caching a simulation execution result, a simulation register configured to map a target register indicated by the extended instruction, and a register configured to cache an address indicative of a real-time conversion mode state store region.

5. The instruction simulation device according to claim 1 , wherein an interrupt service program calls a simulation module to query if there is a simulation program corresponding to the extended instruction, wherein if the simulation program corresponding to the extended instruction is found, the simulation module executes the simulation program and obtains a simulation execution result for simulating the execution result of the ready-for-execution instruction.

6. The instruction simulation device according to claim 5 , wherein the simulation execution result is reserved after terminating the calling to the simulation module, and when the simulation program corresponding to the extended instruction is not found, a failure result is returned to notify the processor and the calling to the simulation module is terminated in responsive to the failure result.

7. The instruction simulation device according to claim 6 , wherein after terminating the calling to the simulation module, the processor reads the reserved simulation execution result or receives the failure result, wherein the processor notifies an application program arising the ready-for-execution instruction of the failure result.

8. The instruction simulation device according to claim 6 , wherein if a subsequent ready-for-execution instruction is an extended instruction and the subsequent ready-for-execution instruction is converted into a simulation program corresponding to the subsequent ready-for-execution instruction, the reserved simulation execution result serves as a reference when executing the simulation program corresponding to the subsequent ready-for-execution instruction.

9. The instruction simulation device according to claim 5 , wherein the simulation module is embodied in a processor driver, in a kernel of an operating system running on the processor, or stored in a basic input/output system of a computer system embodied with the processor.

10. The instruction simulation device according to claim 1 , wherein the compatible instruction and the extended instruction are both instructions under an x86 instruction set architecture or a reduced instruction set computer (RISC) architecture.

11. An instruction simulation method, performed by a processor including an instruction decoder, the instruction simulation method comprising:

using the instruction decoder of the processor to generate format information of a ready-for-execution instruction;

determining by the processor whether the ready-for-execution instruction currently executed by the processor is a compatible instruction or an extended instruction based on the format information of the ready-for-execution instruction, wherein the compatible instruction is an instruction under a current instruction set of the processor, and the extended instruction is not an instruction under the current instruction set of the processor, but is an instruction under a new instruction set or an extended instruction set, wherein the new instruction set and the extended instruction set are instruction sets that do not belong to a native instruction set of the processor;

translating the ready-for-execution instruction into a simulation program corresponding to the extended instruction wherein an execution result of the ready-for-execution instruction is generated by means of a simulation execution result generated by the simulation program if the read-for-execution instruction is an extended instruction under the new instruction set or the extended instruction set; and

executing the ready-for-execution instruction by the processor if the read-for-execution instruction is a compatible instruction;

wherein the simulation program is composed of at least one compatible instruction of the processor.

12. The instruction simulation method according to claim 11 , wherein a computer system embodied the processor comprises a system memory, the system memory comprising:

a processor-current-state store region, configured to store a current context state of the processor;

a conversion-information store region, configured to store temporary information in a process of translating the ready-for-execution instruction into the corresponding simulation program; and

an execution-result store region, configured to store the simulation execution result after executing the simulation program.

13. The instruction simulation method according to claim 11 , wherein when the ready-for-execution instruction is the extended instruction, the processor asserts an emulation flag to obtain the corresponding simulation program by means of an interrupt service program.

14. The instruction simulation method according to claim 11 , further comprising:

calling a simulation module by an interrupt service program to read the ready-for-execution instruction;

querying whether there is the simulation program corresponding to the extended instruction by the simulation module; and

generating the simulation execution result by executing the simulation program by the simulation module when the simulation program corresponding to the extended instruction is found.

15. The instruction simulation method according to claim 14 , further comprising:

reserving the simulation execution result after terminating the calling to the simulation module; and

providing a failure result by the simulation module to the processor and terminating the calling to the simulation module when the simulation program corresponding to the extended instruction is not found.

16. The instruction simulation method according to claim 15 , further comprising:

reading the simulation execution result reserving by the processor after terminating the calling to the simulation module, or obtaining the failure result and notifying an application program arising the ready-for-execution instruction of the failure result.

17. The instruction simulation method according to claim 16 , wherein if a subsequent ready-for-execution instruction is an extended instruction and the subsequent ready-for-execution instruction is converted into a simulation program corresponding to the subsequent ready-for-execution instruction, the reserved execution result serves as a reference when executing the simulation program of the subsequent ready-for-execution instruction.

18. The instruction simulation method according to claim 15 , wherein the simulation module is embodied in a processor driver, in a kernel of an operating system running on the processor, or stored in a basic input/output system of a computer system embodied with the processor.

19. The instruction simulation method according to claim 11 , wherein the compatible instruction and the extended instruction are both instructions under an x86 instruction set architecture or a reduced instruction set computer (RISC) architecture.

20. A processor instruction simulation method, comprising:

using an instruction decoder of a processor to generate format information of a ready-for-execution instruction;

determining, by the processor, whether the ready-for-execution instruction currently executed by the processor is an extended instruction based on the format information of the ready-for-execution instruction;

when the ready-for-execution instruction currently executed by the processor is the extended instruction, calling a simulation module by using an interrupt service program to obtain a simulation program corresponding to the extended instruction, wherein the extended instruction is not an instruction under a current instruction set of the processor, but is an instruction under a new instruction set or an extended instruction set, wherein the new instruction set and the extended instruction set are instruction sets that do not belong to a native instruction set of the processor; and

executing the simulation program to generate a simulation execution result for simulating an execution result of the ready-for-execution instruction.

21. The processor instruction simulation method according to claim 20 , wherein the ready-for-execution instruction is sent as a parameter when the simulation module is called.

22. The processor instruction simulation method according to claim 21 , wherein the processor executes the simulation module by means of a system call to an operating system performing on the processor.

23. The processor instruction simulation method according to claim 22 , wherein the simulation module is in a kernel of the operating system or is a callback function in a driver of the processor.

24. The processor instruction simulation method according to claim 20 , wherein the simulation module and the simulation program are stored in a basic input/output system of a computer system embodied with the processor, and when the computer system is turned on, the simulation module and the simulation program are loaded into a system memory of the computer system.

25. The processor instruction simulation method according to claim 20 , further comprising:

terminating the calling to the simulation module after reserving a simulation execution result of the simulation program in a system memory of a computer system embodied with the processor.

26. The processor instruction simulation method according to claim 20 , wherein the simulation execution result is reserved after terminating the calling to the simulation module, wherein if a subsequent ready-for-execution instruction is an extended instruction and the subsequent ready-for-execution instruction is converted into a simulation program corresponding to the subsequent ready-for-execution instruction, the reserved execution result serves as a reference when executing the simulation program of the subsequent ready-for-execution instruction.

27. The processor instruction simulation method according to claim 20 , wherein the simulation program is programmed by a processor designer beforehand by using at least one compatible instruction of the processors to simulate the execution result of the extended instruction.

28. The processor instruction simulation method according to claim 20 , wherein a compatible instruction and the extended instruction are both instructions under an x86 instruction set architecture or a reduced instruction set computer (RISC) architecture.

29. A processor instruction simulation method, comprising:

using an instruction decoder of a processor to generate format information of a ready-for-execution instruction;

determining, by the processor, whether the ready-for-execution instruction currently executed by the processor is an extended instruction based on the format information of the ready-for-execution instruction;

when the ready-for-execution instruction currently executed by the processor is the extended instruction, calling an interrupt service program to obtain a simulation program corresponding to the extended instruction, wherein the extended instruction is not an instruction under a current instruction set of the processor, but is an instruction under a new instruction set or an extended instruction set, wherein the new instruction set and the extended instruction set are instruction sets that do not belong to a native instruction set of the processor; and

executing the simulation program to generate a simulation execution result for simulating the extended instruction.

30. The processor instruction simulation method according to claim 29 , wherein the interrupt service program obtains the simulation program corresponding to the extended instruction by means of a system call, and the ready-for-execution instruction is sent as a parameter when invoking the system call.

31. The processor instruction simulation method according to claim 30 , wherein the system call invokes a simulation module in a kernel of an operating system performing on the processor or in a processor driver to obtain the simulation program.

32. The processor instruction simulation method according to claim 31 , wherein the simulation module is a callback function.

33. The processor instruction simulation method according to claim 31 , wherein the calling to the simulation module is terminated after the simulation module executes the simulation program to generate the simulation execution result.

34. The processor instruction simulation method according to claim 33 , wherein the simulation execution result is reserved after terminating the calling to the simulation module, wherein if a subsequent ready-for-execution instruction is determined an extended instruction and the subsequent ready-for-execution instruction is converted into a simulation program corresponding to the subsequent ready-for-execution instruction, the reserved simulation execution result serves as a reference when executing the simulation program of the subsequent ready-for-execution instruction.

35. The processor instruction simulation method according to claim 29 , wherein the simulation program is programmed by a processor designer beforehand by using at least one compatible instruction of the processor to simulate the execution result of the extended instruction.

36. The processor instruction simulation method according to claim 29 , wherein a compatible instruction and the extended instruction are both instructions under an x86 instruction set architecture or a reduced instruction set computer (RISC) architecture.

Priority Claims (2)
CN 202011588885.3 · Dec 29, 2020 · national
CN 202011588921.6 · Dec 29, 2020 · national
Continuity (2)
Continuation 17471167 · Sep 10, 2021
Related Publication 20240004658A1 · Jan 4, 2024
References Cited (103)
US 4514803A · Agnew · 1985 [cited by examiner]
US 4839797A · Katori et al. · 1989 [cited by applicant]
US 4873629A · Harris et al. · 1989 [cited by applicant]
US 5630052A · Shah · 1997 [cited by applicant]
US 5701442A · Ronen · 1997 [cited by applicant]
US 5781750A · Blomgren et al. · 1998 [cited by applicant]
US 5794063A · Favor · 1998 [cited by applicant]
US 5838987A · Brightman et al. · 1998 [cited by applicant]
US 5881258A · Arya · 1999 [cited by applicant]
US 5896519A · Worrell · 1999 [cited by applicant]
US 5909567A · Novak et al. · 1999 [cited by applicant]
US 5983337A · Mahalingaiah et al. · 1999 [cited by applicant]
US 6093213A · Favor et al. · 2000 [cited by applicant]
US 6496922B1 · Borrill · 2002 [cited by applicant]
US 6711667B1 · Ireton · 2004 [cited by applicant]
US 6928536B2 · Duesterwald et al. · 2005 [cited by applicant]
US 7831807B1 · Johnson et al. · 2010 [cited by applicant]
US 9442794B1 · Tian · 2016 [cited by applicant]
US 9563424B2 · Sehr et al. · 2017 [cited by applicant]
US 9594927B2 · Zimmer et al. · 2017 [cited by applicant]
US 11513818B1 · Chen · 2022 [cited by examiner]
US 11816487B2 · Wang et al. · 2023 [cited by applicant]
US 20010010072A1 · Yoshida · 2001 [cited by applicant]
US 20030221035A1 · Adams · 2003 [cited by applicant]
US 20040111717A1 · Abdulhayoglu · 2004 [cited by applicant]
US 20080216073A1 · Yates et al. · 2008 [cited by applicant]
US 20080282241A1 · Dong · 2008 [cited by applicant]
US 20090158015A1 · Hillman et al. · 2009 [cited by applicant]
US 20090204785A1 · Yates, Jr. et al. · 2009 [cited by applicant]
US 20090222654A1 · Hum et al. · 2009 [cited by applicant]
US 20100058034A1 · Zaks · 2010 [cited by applicant]
US 20100192137A1 · Inglis et al. · 2010 [cited by applicant]
US 20100268916A1 · Hu · 2010 [cited by examiner]
US 20110093627A1 · De et al. · 2011 [cited by applicant]
US 20120198122A1 · Abdallah · 2012 [cited by applicant]
US 20120260042A1 · Henry et al. · 2012 [cited by applicant]
US 20130028332A1 · Le Leannec · 2013 [cited by examiner]
US 20130047050A1 · Kuwamura · 2013 [cited by examiner]
US 20130246768A1 · Gschwind · 2013 [cited by applicant]
US 20130305013A1 · Ebersole · 2013 [cited by applicant]
US 20140129808A1 · Naveh et al. · 2014 [cited by applicant]
US 20140281399A1 · Rash et al. · 2014 [cited by applicant]
US 20140304493A1 · Zhong et al. · 2014 [cited by applicant]
US 20140325516A1 · Ventroux · 2014 [cited by examiner]
US 20150178076A1 · Sudhakar · 2015 [cited by applicant]
US 20150186170A1 · Jennings · 2015 [cited by examiner]
US 20150356297A1 · Guri et al. · 2015 [cited by applicant]
US 20160026482A1 · Abdallah · 2016 [cited by applicant]
US 20160026486A1 · Abdallah · 2016 [cited by applicant]
US 20160070932A1 · Zimmer et al. · 2016 [cited by applicant]
US 20160092236A1 · Kanapathipaillai et al. · 2016 [cited by applicant]
US 20170134347A1 · Kupreev et al. · 2017 [cited by applicant]
US 20180159747A1 · Chang et al. · 2018 [cited by applicant]
US 20180322313A1 · Yao et al. · 2018 [cited by applicant]
US 20190034316A1 · Levit-Gurevich et al. · 2019 [cited by applicant]
US 20190043159A1 · Levit-Gurevich et al. · 2019 [cited by applicant]
US 20190220279A1 · McNeeney et al. · 2019 [cited by applicant]
US 20190391904A1 · Sabharwal et al. · 2019 [cited by applicant]
US 20200073643A1 · Tsirkin · 2020 [cited by applicant]
US 20200082491A1 · Harris · 2020 [cited by applicant]
US 20200174794A1 · Golla · 2020 [cited by examiner]
US 20210117251A1 · Cristofi et al. · 2021 [cited by applicant]
US 20210182073A1 · Karageorgos · 2021 [cited by examiner]
US 20210182724A1 · Zou et al. · 2021 [cited by applicant]
US 20210397425A1 · Zwarich et al. · 2021 [cited by applicant]
US 20220066933A1 · Kamand · 2022 [cited by applicant]
US 20220100527A1 · Viste et al. · 2022 [cited by applicant]
US 20220197678A1 · Poornachandran et al. · 2022 [cited by applicant]
US 20220206794A1 · Wang et al. · 2022 [cited by applicant]
US 20220206808A1 · Wang et al. · 2022 [cited by applicant]
US 20220206810A1 · Wang et al. · 2022 [cited by applicant]
US 20220206812A1 · Wang et al. · 2022 [cited by applicant]
US 20220206813A1 · Wang et al. · 2022 [cited by applicant]
US 20220206815A1 · Wang et al. · 2022 [cited by applicant]
US 20230221957A1 · Pool et al. · 2023 [cited by applicant]
CN 102707926 · 2012 [cited by applicant]
CN 102937889 · 2013 [cited by applicant]
WO 0045257 · 2001 [cited by applicant]
Alipour, M. et al., FIFOrder MicroArchitecture: Ready-Aware Instruction Scheduling for OoO Processors, 2019, Design and Test in Europe, pp. 716-721. (Year: 2019). [cited by examiner]
“Office Action of Related U.S. Appl. No. 17/471,343”, issued on Jun. 27, 2022, p. 1-p. 9. [cited by applicant]
“Notice of allowance of Related U.S. Appl. No. 17/471,387”, issued on Jul. 11, 2022, p. 1-p. 9. [cited by applicant]
“Office Action of U.S. Appl. No. 17/471,440”, issued on Sep. 21, 2022, p. 1-p. 12. [cited by applicant]
“Office Action of Related U.S. Appl. No. 17/471,423”, issued on Oct. 5, 2022, pp. 1-20. [cited by applicant]
“Notice of allowance of Related U.S. Appl. No. 17/471,400”, issued on Oct. 19, 2022, pp. 1-21. [cited by applicant]
“Office Action of Related U.S. Appl. No. 17/471,359”, issued on Dec. 21, 2022, pp. 1-29. [cited by applicant]
“Office Action of Related U.S. Appl. No. 17/471,170”, issued on Dec. 1, 2022, p. 1-p. 36. [cited by applicant]
“Office Action of Related U.S. Appl. No. 17/471,371”, issued on Jan. 26, 2023, p. 1-p. 46. [cited by applicant]
“Office Action of Related U.S. Appl. No. 17/471,454”, issued on Jan. 19, 2023, p. 1-p. 46. [cited by applicant]
“Office Action of Related U.S. Appl. No. 17/471,170”, issued on Mar. 16, 2023, p. 1-p. 23. [cited by applicant]
“Office Action of Related U.S. Appl. No. 17/471,423”, issued on Apr. 13, 2023, p. 1-p. 10. [cited by applicant]
“Office Action of Related U.S. Appl. No. 17/471,454”, issued on Apr. 18, 2023, p. 1-p. 24. [cited by applicant]
“Notice of allowance of Related U.S. Appl. No. 17/471,454”, issued on Jun. 22, 2023, p. 1-p. 17. [cited by applicant]
“Office Action of Related U.S. Appl. No. 17/471,371”, issued on Jul. 18, 2023, p. 1-p. 13. [cited by applicant]
“Office Action of Parent U.S. Appl. No. 17/471,167”, issued on Oct. 31, 2022, p. 1-p. 23. [cited by applicant]
“Final Office Action of Parent U.S. Appl. No. 17/471,167”, issued on Feb. 3, 2023, p. 1-p. 22. [cited by applicant]
“Advisory Action of Parent U.S. Appl. No. 17/471,167”, issued on Apr. 12, 2023, p. 1-p. 6. [cited by applicant]
“Notice of allowance of Related U.S. Appl. No. 17/471,423”, issued on Jul. 25, 2023, p. 1-p. 17. [cited by applicant]
“Notice of allowance of Parent U.S. Appl. No. 17/471,167”, issued on Jun. 15, 2023, p. 1-p. 17. [cited by applicant]
“Office Action of China Related Application, Application No. 202011589763.6”, issued on Apr. 12, 2024, p. 1-p. 10. [cited by applicant]
Jing Lu, “University computer information technology and experimental study guide tutorial”, Jul. 31, 2008, pp. 24, with English translation thereof, China Railway Publishing House. [cited by applicant]
“Office Action of China Related Application No. 202011589763.6”, issued on Sep. 11, 2024, p. 1-p. 10. [cited by applicant]
“Office Action of China Counterpart Application”, issued on Oct. 30, 2024, p. 1-p. 15. [cited by applicant]
“Office Action of U.S. Related Application, U.S. Appl. No. 18/474,207”, issued on Dec. 10, 2024, p. 1-p. 32. [cited by applicant]