Instruction verification method and device, electronic equipment and storage medium

By designing the instruction sequence structure with jump instructions embedded in the chip verification, combined with the verification of historical execution times, the problem of embedding jump instructions destroying legality and resource consumption is solved, and efficient instruction verification is achieved.

CN118626324APending Publication Date: 2024-09-10KUNWANG (SHANGHAI) TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202310231652.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-10
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

During the chip verification process, the embedding of jump instructions will destroy the legitimacy of the legal instruction sequence, leading to verification failure, and existing methods require too many simulation resources or limit verification scenarios.

Method used

By designing the structure of the instruction sequence, jump instructions are embedded into the random instruction sequence to ensure the legitimacy of the instruction sequence, and the jump instructions are verified through historical execution times to cover more jump scenarios.

Benefits of technology

Without consuming too many simulation resources, it ensures the legality of the instruction sequence, avoids jump exceptions during the execution process, covers more jump scenarios, and improves the accuracy and efficiency of verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626324A
    Figure CN118626324A
Patent Text Reader

Abstract

The invention provides an instruction verification method and device, equipment, a storage medium and a program product, and relates to the technical field of computers, in particular to the technical field of chips. According to the specific implementation scheme, the method comprises the steps of splicing a plurality of instruction sequences according to the number of instructions included in each instruction sequence in the plurality of instruction sequences to obtain a to-be-verified instruction stream; in response to the received verification request, determining a to-be-verified instruction sequence from the to-be-verified instruction stream; and verifying the to-be-verified instruction sequence according to the historical execution times of the to-be-verified instruction sequence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to the field of chip technology. Background Art

[0002] During the chip verification process, the jump instruction is embedded in the legal instruction sequence to verify the correctness of the chip's execution of the jump instruction. However, the embedding of the jump instruction will destroy the original legality of the legal instruction sequence, resulting in verification failure.

[0003] To ensure the legality of the instruction sequence, multiple constraints can be used to constrain the embedding method of jump instructions. However, too many constraints will limit the verification scenario. Alternatively, a simulator can be used to simulate the legality of the instruction sequence embedded with jump instructions, but the simulation process will consume too many simulation resources. Summary of the invention

[0004] The present disclosure provides an instruction verification method, a deep learning model training method, an apparatus, a device, a storage medium, and a program product.

[0005] According to one aspect of the present disclosure, an instruction verification method is provided, comprising: splicing multiple instruction sequences according to the number of instructions included in each instruction sequence in the multiple instruction sequences to obtain an instruction stream to be verified; determining the instruction sequence to be verified from the instruction stream to be verified in response to a received verification request; and verifying the instruction sequence to be verified according to the historical number of executions of the instruction sequence to be verified.

[0006] According to another aspect of the present disclosure, an instruction verification device is provided, comprising: a plurality of first registers, each corresponding to a plurality of instruction sequences one by one, and used to indicate the number of historical executions of a corresponding instruction sequence in the plurality of instruction sequences; and a processor, configured to: splice the plurality of instruction sequences according to the number of instructions included in each of the plurality of instruction sequences to obtain an instruction stream to be verified; determine the instruction sequence to be verified from the instruction stream to be verified in response to a received verification request; access the first register corresponding to the instruction sequence to be verified to determine the number of historical executions of the instruction sequence to be verified; and verify the instruction sequence to be verified according to the number of historical executions.

[0007] Another aspect of the present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method shown in the embodiment of the present disclosure.

[0008] According to another aspect of an embodiment of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method shown in the embodiment of the present disclosure.

[0009] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program / instruction, wherein the computer program / instruction implements the steps of the method shown in the embodiment of the present disclosure when executed by a processor.

[0010] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0012] Figure 1A A schematic diagram schematically shows an example of a legal jump instruction;

[0013] Figure 1B A schematic diagram schematically shows an example of an illegal jump instruction;

[0014] Figure 2 A flowchart of an instruction verification method according to an embodiment of the present disclosure is schematically shown;

[0015] Figure 3A A flowchart for verifying a sequence of instructions to be verified according to an embodiment of the present disclosure is schematically shown;

[0016] Figure 3B A schematic diagram schematically shows a sequence of instructions to be verified according to an embodiment of the present disclosure;

[0017] Figure 4 A flowchart of an instruction verification method according to another embodiment of the present disclosure is schematically shown;

[0018] Figure 5 A schematic diagram schematically shows an instruction sequence according to an embodiment of the present disclosure;

[0019] Figure 6 A schematic diagram schematically shows an instruction flow to be verified according to an embodiment of the present disclosure;

[0020] Figure 7 A block diagram of an instruction verification device according to an embodiment of the present disclosure is schematically shown;

[0021] Figure 8 A block diagram schematically shows an instruction verification device according to another embodiment of the present disclosure; and

[0022] Fig. 9 A block diagram schematically illustrates an example electronic device that may be used to implement an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0024] In the verification process of the processor chip, a randomly generated legal instruction sequence and a directed generated specific instruction sequence are usually used to verify the correctness of the instruction execution function of the processor chip. For example, the fifth-generation Reduced Instruction Set Computer (RISC-V) instruction set can be used to verify the instruction execution function of the processor chip. The RISC-V instruction set includes arithmetic instructions, numerical comparison instructions, logical instructions, shift instructions, read and write instructions, jump instructions, etc.

[0025] In the RISC-V instruction set, arithmetic instructions, numerical comparison instructions, logical instructions, shift instructions, and read-write instructions can be considered as operation instructions. The verification process of jump instructions requires stricter constraints than operation instructions to ensure the legality of the instruction sequence. For example, randomly embedding jump instructions in the instruction sequence may result in illegal instruction sequences, such as the jump destination address crossing the boundary, the original legal constraints of the instruction sequence being destroyed after the jump, and the jump falling into an infinite loop.

[0026] The verification process of the processor chip may include inputting a sequence of instructions into the circuit of the chip to be verified and the simulator respectively. The circuit of the chip to be verified may be a virtual circuit to be verified running in the simulator, and the simulator runs a standard circuit model. The simulator verifies the instruction execution function of the circuit of the designed chip to be verified by controlling the virtual circuit to be verified to execute the instructions in the instruction sequence. By comparing the output results of the simulator and the simulator, it is determined whether the circuit of the chip to be verified is correct. However, when the instruction sequence is illegal, the simulator may also have a verification error or compare the output results of the simulator and the simulator inconsistent, resulting in verification failure. Therefore, when the instruction sequence cannot be ensured to be legal, when verification fails, it is impossible to accurately judge whether the circuit of the chip to be verified is correct.

[0027] The present disclosure provides an instruction verification method, which ensures the legitimacy of the instruction sequence without requiring too many simulation resources by designing the structure of the instruction sequence. In addition, the present disclosure also avoids the phenomenon of jump exceptions in the execution process by designing the execution method of the instruction sequence, and can cover more jump scenarios.

[0028] The following will be combined Figure 1A and Figure 1B Describe the jump instruction.

[0029] Figure 1A A schematic diagram of an example legal jump instruction is schematically shown.

[0030] like Figure 1A As shown, the instruction sequence 110 includes a jump instruction J0, a jump instruction J1, a jump instruction J2, and operation instructions I0 to I13. The instruction sequence 110 can be used to verify the function of the processor chip to execute multiple jumps. For example, the jump instruction J0, the jump instruction J1, and the jump instruction J2 are all forward jump instructions. When the processor chip executes the jump instruction J0, the pointer can jump to the operation instruction I4. According to the execution order, the processor chip executes the operation instruction I4, the operation instruction I5, and the jump instruction J1 in sequence. When the processor chip executes the jump instruction J1, the pointer can jump to the operation instruction I9. According to the execution order, the processor chip executes the operation instruction I9 and the jump instruction J2 in sequence. When the processor chip executes the jump instruction J2, the pointer can jump to the operation instruction I11. According to the execution order, the processor chip executes the operation instruction I11, the operation instruction I12, and the operation instruction I13 in sequence until the instruction sequence is executed.

[0031] like Figure 1A As shown, the instruction sequence 120 includes jump instruction J0, jump instruction J1, jump instruction J2 and operation instruction I0 to operation instruction I13. The instruction sequence 120 can be used to verify the function of the processor chip to execute forward and reverse jumps. For example, jump instruction J0 and jump instruction J1 are forward jump instructions, and jump instruction J2 is a backward jump instruction. When the processor chip executes jump instruction J0, the pointer can jump to operation instruction I9. According to the execution order, the processor chip executes operation instruction I9 and jump instruction J2 in sequence. When the processor chip executes jump instruction J2, the pointer can jump to operation instruction I4. According to the execution order, the processor chip executes operation instruction I4, operation instruction I5 and jump instruction J1 in sequence. When the processor chip executes jump instruction J1, the pointer can jump to operation instruction I11. According to the execution order, the processor chip executes operation instruction I11, operation instruction I12 and operation instruction I13 in sequence until the instruction sequence is executed.

[0032] like Figure 1AAs shown, the instruction sequence 130 includes jump instruction J0, jump instruction J1, jump instruction J2, jump instruction J3 and operation instruction I0 to operation instruction I12. The instruction sequence 130 can be used to verify the function of the processor chip to execute nested jumps. For example, the jump instruction J0, jump instruction J1 and jump instruction J2 are nested in the jump instruction J3, the jump instruction J0 and the jump instruction J1 are forward jump instructions, and the jump instruction J2 and the jump instruction J3 are backward jump instructions. When the processor chip executes the jump instruction J0, the pointer can jump to the operation instruction I9. According to the execution order, the processor chip executes the operation instruction 19 and the jump instruction J2 in sequence. When the processor chip executes the jump instruction J2, the pointer can jump to the operation instruction I4. According to the execution order, the processor chip executes the operation instruction I4, the operation instruction I5 and the jump instruction J1 in sequence. When the processor chip executes the jump instruction J1, the pointer can jump to the operation instruction I11. According to the execution order, the processor chip executes the operation instruction I11 and the jump instruction J3 in sequence. When the processor chip executes the jump instruction J3, the pointer can jump to the operation instruction I1. According to the execution order, the processor chip executes the operation instruction I1 and the jump instruction J0 in sequence.

[0033] Figure 1B A schematic diagram of an example illegal jump instruction is schematically shown.

[0034] like Figure 1B As shown, the instruction sequence 140 includes jump instruction J0, jump instruction J1, jump instruction J2 and operation instruction I0 to operation instruction I13. The instruction sequence 140 can be used to verify the function of the processor chip to execute multiple jumps. For example, jump instruction J0, jump instruction J1 and jump instruction J2 are all forward jump instructions. When the processor chip executes jump instruction J0, the pointer can jump to operation instruction 14. According to the execution order, the processor chip executes operation instruction I4, operation instruction I5 and jump instruction J1 in sequence. When the processor chip executes jump instruction J1, because the jump destination address indicated by jump instruction J1 is out of bounds, the pointer jumps out of the address range specified by the instruction sequence 140, thereby causing the instruction execution function verification of the processor chip to fail due to the illegality of the instruction sequence 140.

[0035] like Figure 1BAs shown, the instruction sequence 150 includes jump instruction J0, jump instruction J1, jump instruction J2 and operation instruction I0 to operation instruction I13. The instruction sequence 150 can be used to verify the function of the processor chip to execute forward and reverse jumps. For example, jump instruction J0 and jump instruction J1 are forward jump instructions, and jump instruction J2 is a backward jump instruction. When the processor chip executes jump instruction J0, the pointer can jump to operation instruction I4. According to the execution order, the processor chip executes operation instruction I4, operation instruction I5 and jump instruction J1 in sequence. When the processor chip executes jump instruction J1, the pointer can jump to operation instruction I9. According to the execution order, the processor chip executes operation instruction I9 and jump instruction J2 in sequence. When the processor chip executes jump instruction J2, the pointer jumps to operation instruction I9 again. Because jump instruction J1 and jump instruction J2 form a jump dead loop, the pointer repeatedly jumps within a specific address range, so that the instruction execution function verification of the processor chip fails due to the illegality of instruction sequence 150.

[0036] like Figure 1B As shown, the instruction sequence 160 includes jump instruction J0, jump instruction J1, jump instruction J2 and operation instruction I0 to operation instruction I13, wherein operation instruction I10 to operation instruction I12 are read-write instruction constraint combinations. When the processor chip executes jump instruction J0, the pointer can jump to operation instruction I4. According to the execution order, the processor chip executes operation instruction I4, operation instruction I5 and jump instruction J1 in sequence. When the processor chip executes jump instruction J1, the pointer jumps to operation instruction I11. Since operation instruction I10 to operation instruction I12 are legal read-write instruction constraint combinations, the execution order of operation instruction I10 to operation instruction I13 is operation instruction I10, operation instruction I11, and operation instruction I13 in sequence. When it is determined that the pointer jumps to operation instruction I11, the jump process breaks the original legal constraint of the read-write instruction constraint combination, destroys the verification of the read-write instruction, and thus the instruction execution function verification of the processor chip fails due to the illegality of instruction sequence 160.

[0037] The present disclosure provides an instruction verification method, which can embed a jump instruction into a random instruction sequence without destroying the original legal constraints of the random instruction sequence. In addition, the random instruction sequence embedded with the jump instruction covers more jump scenarios.

[0038] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0039] In the technical solution of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.

[0040] The following will be combined Figure 2 The instruction verification method provided by the present disclosure is described.

[0041] Figure 2 The flowchart of the instruction verification method according to the embodiment of the present disclosure is schematically shown.

[0042] like Figure 2 As shown, the instruction verification method 200 includes operations S210 to SS230. Figure 2 The instruction verification method according to the embodiment of the present disclosure is described.

[0043] In operation S210, multiple instruction sequences are concatenated according to the number of instructions included in each of the multiple instruction sequences to obtain an instruction stream to be verified.

[0044] According to an embodiment of the present disclosure, the instruction stream to be verified may be obtained by splicing multiple instruction sequences, each of which may include at least one instruction type. Different instruction sequences may include multiple instructions of the same type, or may include multiple instructions of different types.

[0045] According to an embodiment of the present disclosure, the length of each instruction sequence can be determined according to the number of instructions included in each instruction sequence. When it is determined that the more instructions a sequence includes, the longer the length of the instruction sequence is. According to the length of each instruction sequence, multiple instruction sequences are sequentially connected end to end to form an instruction stream to be verified. For example, the execution order of multiple instruction sequences is set, and when it is determined that the last instruction of the current instruction sequence is executed, the first execution of the next instruction sequence is started, thereby realizing the end to end connection of the two instruction sequences.

[0046] In the instruction stream to be verified, multiple instruction sequences can be executed sequentially according to the connection order. In each instruction sequence, multiple instructions are executed sequentially under legal constraints.

[0047] Then, in operation S220, in response to the received verification request, a sequence of instructions to be verified is determined from the instruction stream to be verified.

[0048] According to an embodiment of the present disclosure, the verification request may be a verification start request, which indicates a request for the processor chip to start executing the verification. In response to the received verification start request, the first instruction sequence in the instruction stream to be verified may be determined as the instruction sequence to be verified, or a specific instruction sequence may be determined as the instruction sequence to be verified from the instruction stream to be verified.

[0049] According to an embodiment of the present disclosure, the verification request may also be an execution request generated when executing the instruction stream to be verified, and the execution request instructs the processor chip to execute a specific instruction sequence of the instruction stream to be verified. In response to the received execution request, the specific instruction sequence indicated by the execution request may be determined from the instruction stream to be verified as the instruction sequence to be verified.

[0050] In operation S230 , the instruction sequence to be verified is verified according to the historical execution times of the instruction sequence to be verified.

[0051] According to an embodiment of the present disclosure, the instruction sequence to be verified may include multiple instructions, and different instructions in the instruction sequence to be verified may be verified according to the historical number of executions of the instruction sequence to be verified. For example, in the case where it is determined that the instruction sequence to be verified includes a jump instruction, when each instruction is executed in sequence according to the instruction order of the instruction sequence to be verified, the instruction after the jump instruction may not be executed, thereby limiting the instruction verification scenario. In addition, in the case where it is determined that the instruction sequence to be verified has been executed multiple times according to the historical number of executions of the instruction sequence to be verified, the execution of the instruction sequence to be verified may be skipped to avoid falling into an infinite loop caused by the jump instruction.

[0052] According to the embodiments of the present disclosure, multiple instruction sequences are sequentially spliced ​​to obtain an instruction stream to be verified. According to the splicing order, multiple instruction sequences of the instruction stream to be verified can be sequentially executed, thereby realizing verification of multiple instruction scenarios covered by the multiple instruction sequences.

[0053] The following will be combined Figure 3A and Figure 3B The process of verifying the instruction sequence to be verified provided by the present disclosure is described.

[0054] Figure 3A The flowchart of verifying a sequence of instructions to be verified according to an embodiment of the present disclosure is schematically shown.

[0055] like Figure 3A As shown, the instruction sequence to be verified includes a jump instruction and at least one operation instruction, and the method 330 for verifying the instruction sequence to be verified may include operations S331 to S333. Figure 3A A method for verifying an instruction sequence to be verified according to an embodiment of the present disclosure is described.

[0056] In operation S331 , when it is determined that the historical execution count of the instruction sequence to be verified is 0, a jump instruction is executed.

[0057] According to the embodiments of the present disclosure, when it is determined that the historical execution times of the instruction sequence to be verified is 0, it can be considered that the current verification operation is the first time to use the instruction sequence to be verified to verify the instruction execution function. At this time, the jump instruction in the instruction sequence to be verified can be executed first, so as to realize the verification of the function of the processor chip to execute the jump instruction.

[0058] Then, in operation S332, when it is determined that the historical execution count of the instruction sequence to be verified is 1, at least one action instruction is executed.

[0059] According to an embodiment of the present disclosure, when it is determined that the historical execution count of the instruction sequence to be verified is 1, it can be considered that the current verification operation is the second time to use the instruction sequence to be verified to verify the instruction execution function. At this time, the operation instructions in the instruction sequence to be verified can be executed preferentially, so as to verify the function of the processor chip to execute the operation instructions. The at least one operation instruction may include at least one of the following instructions: arithmetic instructions, numerical comparison instructions, logical instructions, shift instructions, and read-write instructions, etc.

[0060] In operation S333 , when it is determined that the historical execution count of the instruction sequence to be verified is 2, an end instruction of the instruction stream to be verified is executed.

[0061] According to the embodiment of the present disclosure, when it is determined that the historical execution times of the instruction sequence to be verified is 2, it can be considered that the current verification operation is the third time to use the instruction sequence to be verified to verify the instruction execution function. At this time, the instruction jumps to the end instruction of the instruction stream to be verified, and the verification of the instruction stream to be verified is ended, thereby avoiding the dead loop phenomenon caused by the jump instruction in the verification process.

[0062] According to an embodiment of the present disclosure, executing a jump instruction in operation S331 may include: determining at least one instruction sequence from multiple instruction sequences of an instruction stream to be verified, wherein in the instruction stream to be verified, at least one instruction sequence is continuous in execution order with the instruction sequence to be verified; determining the number of instructions included in at least one instruction sequence; determining a jump destination address based on the number of instructions; and determining an instruction sequence to be verified corresponding to the jump destination address in the instruction stream to be verified.

[0063] For example, at least one instruction sequence whose execution order is continuous with the instruction sequence to be verified is selected from multiple instruction sequences whose execution order is before or after the instruction sequence to be verified, and the jump destination address is determined according to the length of the at least one instruction sequence.

[0064] For example, the jump destination address may also be determined according to the sum of the length of the jump instruction in the instruction sequence to be verified from the last instruction and the length of at least one instruction sequence.

[0065] Figure 3B A schematic diagram of verifying a sequence of instructions to be verified according to an embodiment of the present disclosure is schematically shown.

[0066] like Figure 3B As shown, the instruction stream S to be verified may include multiple instruction sequences (instruction sequence Q0 to instruction sequence Q6), and the execution order is instruction sequence Q0, instruction sequence Q1, instruction sequence Q2, instruction sequence Q3, instruction sequence Q4, instruction sequence Q5 and instruction sequence Q6. Among them, instruction sequence Q3 includes jump instruction J3, operation instruction A3 and operation instruction B3, and the execution order of operation instructions is operation instruction A3 and operation instruction B3. Instruction sequence Q4 includes jump instruction J4, operation instruction A4, operation instruction B4 and operation instruction C4, and the execution order of operation instructions is operation instruction A4, operation instruction B4 and operation instruction C4. Instruction sequence Q5 includes jump instruction J5 and operation instruction A5.

[0067] For example, the instruction sequence to be verified is the instruction sequence Q3. When it is determined that the historical execution number of the instruction sequence Q3 is 0, the jump instruction J3 of the instruction sequence Q3 is executed. At this time, the instruction sequence Q4 and the instruction sequence Q5 can be selected from the instruction sequence Q4, the instruction sequence Q5 and the instruction sequence Q6 whose execution order is after the instruction sequence Q3. According to the number of instructions included in the instruction sequence Q4 and the number of instructions included in the instruction sequence Q5, the total length of the instruction sequence Q4 and the instruction sequence Q5 is determined. For example, the instruction sequence Q4 includes 4 instructions and the instruction sequence Q5 includes 2 instructions, and the total length of the instruction sequence Q4 and the instruction sequence Q5 is determined to be 6. According to the total length, the jump destination address is determined so that the distance between the jump destination address and the jump source address is equal to the total length of the instruction sequence Q4 and the instruction sequence Q5. At this time, the jump source address is the address of the last instruction B3 of the instruction sequence Q3. According to the total length 6, jump from the operation instruction B3 to the instruction sequence Q6.

[0068] For example, the jump destination address is also determined according to the number of instructions after the jump instruction J3 in the instruction sequence Q3, the number of instructions included in the instruction sequence Q4, and the number of instructions included in the instruction sequence Q5. For example, the number of instructions after the jump instruction J3 in the instruction sequence Q3 is 2, the instruction sequence Q4 includes 4 instructions, and the instruction sequence Q5 includes 2 instructions, and the total length is 8 at this time. According to the total length, the jump destination address is determined so that the distance between the jump destination address and the jump source address is equal to the total length. At this time, the jump source address is the address of the jump instruction J3 of the instruction sequence Q3, and according to the total length 8, jump from the jump instruction J3 to the instruction sequence Q6.

[0069] According to an embodiment of the present disclosure, executing at least one operation instruction in operation S332 may include: executing at least one operation instruction in sequence according to the execution order of the at least one operation instruction; and when it is determined that at least one operation instruction has been executed, executing the next instruction sequence of the instruction sequence to be verified according to the execution order of multiple instruction sequences in the instruction stream to be verified.

[0070] For example, at least one operation instruction is sequentially executed according to the execution order of at least one operation instruction in the instruction to be verified. When it is determined that at least one operation instruction of the instruction to be verified has been executed, it can be considered that the execution of the instruction to be verified has been completed, and the next instruction sequence located after the execution order of the instruction sequence to be verified can be executed according to the execution order of multiple instruction sequences in the instruction stream to be verified.

[0071] For example, in the instruction stream S to be verified, when it is determined that the operation instruction B3 of the instruction sequence Q3 is executed, the instruction sequence Q4 can be started to be executed.

[0072] According to an embodiment of the present disclosure, when it is determined that the instruction sequence to be verified is executed for the first time, the jump instruction of the instruction sequence to be verified can be executed preferentially, thereby realizing the verification of the jump function of the processor chip. When it is determined that the instruction sequence to be verified is executed for the second time, the operation instructions other than the jump instruction in the instruction sequence to be verified can be executed preferentially, avoiding the failure to verify other operation functions of the processing chip due to the execution of the jump instruction again, thereby realizing the verification of various instruction scenarios covered by the instruction sequence. When it is determined that the instruction sequence to be verified is executed for the third time, the end instruction of the instruction stream to be verified can be jumped to avoid falling into an infinite loop caused by the jump instruction.

[0073] The following will be combined Figure 4 The instruction verification method provided by the present disclosure is described.

[0074] Figure 4 The flowchart of the instruction verification method according to another embodiment of the present disclosure is schematically shown.

[0075] like Figure 4 As shown, the instruction verification method 400 includes operations 410 to S450. Figure 4 The instruction verification method according to the embodiment of the present disclosure is described.

[0076] In operation S410 , a plurality of instruction branches are generated.

[0077] According to an embodiment of the present disclosure, an instruction branch may be generated by a random instruction generator, for example, the random instruction generator may be a software program controlled and run by a processor. The random instruction generator may constrain each type of instruction and randomly generate a legal instruction combination. For example, when N is input as the number of times to the random instruction generator, the random instruction generator randomly generates N random legal instruction combinations. During the generation process of the instruction combination, the legal constraint judgment module of the random instruction generator constrains and judges each instruction combination to ensure the legality of each instruction. N is an integer greater than 1.

[0078] For example, the legal constraint module in the random instruction generator can randomly obtain an operation instruction A from the instruction set, and determine which types of operation instructions the operation instruction A can be combined with, and determine which operation instructions the operation instruction A must be combined with, to ensure the legality of the operation instruction, thereby generating an independent instruction sequence ABC including the operation instruction A. When selecting the operation instruction B and the operation instruction C, it is also necessary to ensure that the instruction sequence ABC is decoupled from other operation instructions, so when generating the next instruction combination, it can be arbitrarily selected in the instruction set.

[0079] It should be noted that, in the embodiment of the present disclosure, the instruction branch includes at least one operation instruction but does not include a jump instruction.

[0080] Then, in operation S420, a loop instruction and a jump instruction are respectively configured for each of the plurality of instruction branches to obtain a plurality of instruction sequences.

[0081] According to an embodiment of the present disclosure, a loop instruction is associated with the historical execution count of a corresponding instruction sequence in a plurality of instruction sequences, and a jump instruction is associated with the number of instructions included in the plurality of instruction sequences.

[0082] According to an embodiment of the present disclosure, each instruction sequence includes a loop instruction, a jump instruction and at least one operation instruction.

[0083] According to an embodiment of the present disclosure, a loop instruction is used to record the historical execution times of a corresponding instruction sequence. For example, when executing a loop instruction, the historical execution times of the instruction sequence corresponding to the loop instruction can be determined. The loop instruction is used to indicate a jump destination address according to the number of instructions included in a plurality of instruction sequences. For example, when executing a jump instruction, the jump destination address can be determined. The jump destination address can be determined according to the number of instructions included in a plurality of instruction sequences.

[0084] In operation S430, multiple instruction sequences are concatenated according to the number of instructions included in each of the multiple instruction sequences to obtain an instruction stream to be verified.

[0085] In operation S440 , in response to the received verification request, a sequence of instructions to be verified is determined from the instruction stream to be verified.

[0086] In operation S450 , the instruction sequence to be verified is verified according to the historical execution times of the instruction sequence to be verified.

[0087] According to an embodiment of the present disclosure, operations S430 to S450 are respectively Figure 2 Operations S210 to S230 in the illustrated embodiment are similar, and for the sake of brevity, the disclosure will not elaborate on them here.

[0088] According to an embodiment of the present disclosure, the instruction verification method 400 also includes corresponding the loop instructions of multiple instruction sequences to multiple first registers one by one, the first registers indicating the historical execution times of the corresponding instruction sequences, so as to determine the historical execution times of the corresponding instruction sequences by executing the loop instructions; and corresponding the jump instructions of multiple instruction sequences to multiple second registers one by one, the second registers indicating the jump destination addresses, so as to determine the instruction sequence located at the jump destination addresses by executing the jump instructions.

[0089] According to an embodiment of the present disclosure, the multiple first registers and the multiple second registers are independent of other registers used to temporarily store data during the operation of the processor chip, thereby preventing the register values ​​of the first registers and the second registers from being changed during the verification process.

[0090] According to an embodiment of the present disclosure, a first register is associated with a loop instruction and is used to store the historical execution times of a corresponding instruction sequence. When executing a loop instruction, the processor can determine the historical execution times of the instruction sequence corresponding to the loop instruction by accessing the register value corresponding to the first register. A second register is associated with a jump instruction and is used to store the number of instruction data included in each instruction sequence. When executing a jump instruction, the processor can randomly determine the jump destination address by accessing the register value corresponding to the second register.

[0091] According to an embodiment of the present disclosure, loop instructions and jump execution are configured in each instruction sequence, and verification of various jump scenarios can be achieved based on the historical execution times of each instruction sequence. A first register and a second register are configured for each instruction sequence. For example, the historical execution times of each instruction sequence are configured in a corresponding single first register, thereby avoiding unexpected data appearing in the first register when accessing the first register. The number of instruction data included in each instruction sequence is configured in a corresponding single second register, and multiple jump destination addresses can be obtained by randomly accessing multiple data in the second register, thereby achieving multiple jump scenarios.

[0092] The following will be combined Figure 5The instruction sequence provided by the present disclosure is described in detail.

[0093] Figure 5 A schematic diagram schematically shows an instruction sequence according to an embodiment of the present disclosure.

[0094] like Figure 5 As shown, the instruction sequence 500 includes a loop instruction part 510, a jump instruction part 520 and an operation instruction part 530. The loop instruction part 510 includes a loop instruction Jw, the jump instruction part 520 includes a jump instruction J, and the operation instruction part 530 includes at least one operation instruction, for example, the operation instruction part 530 includes an operation instruction A, an operation instruction B, an operation instruction C, an operation instruction D, an operation instruction E and an operation instruction F.

[0095] According to the embodiment of the present disclosure, at least one operation instruction of the operation instruction part 530 can be an instruction combination generated by a random instruction generator to meet the legality constraint. A jump instruction J and a loop instruction Jw are embedded in the original instruction combination to obtain an instruction sequence.

[0096] According to an embodiment of the present disclosure, in each instruction sequence of multiple instruction sequences, the execution order of loop instructions, jump instructions and instruction branches is continuous. For example, the execution order of multiple instructions in the instruction sequence 500 is loop instruction Jw, jump instruction J, operation instruction A, operation instruction B, operation instruction C, operation instruction D, operation instruction E and operation instruction F. When verifying the instruction sequence 500, according to the execution order, the loop instruction Jw is first executed, and when it is determined that the loop instruction Jw is executed, the jump instruction J is executed. When it is determined that the jump instruction J is skipped, the operation instruction A, the operation instruction B, the operation instruction C, the operation instruction D, the operation instruction E and the operation instruction F can be executed in sequence according to the execution order.

[0097] The following will be combined Figure 6 The instruction stream to be verified provided by the present disclosure is described in detail.

[0098] Figure 6 The diagram schematically shows a flow of instructions to be verified according to an embodiment of the present disclosure.

[0099] like Figure 6 As shown, the instruction stream to be verified 600 includes multiple instruction sequences and an end instruction Exit. For example, the instruction stream to be verified 600 includes N instruction sequences, where N is a positive integer. The N instruction sequences include the first instruction sequence 610, the second instruction sequence 620, the third instruction sequence 630, ..., the nth instruction sequence 640, ..., and the Nth instruction sequence 650. Where n = 1, 2, 3, ..., N.

[0100] The first instruction sequence 610 includes a loop instruction Jw1, a jump instruction J1, an operation instruction A1, an operation instruction B1, and an operation instruction C1. The second instruction sequence 620 includes a loop instruction Jw2, a jump instruction J2, an operation instruction A2, an operation instruction B2, and an operation instruction C2. The third instruction sequence 630 includes a loop instruction Jw3, a jump instruction J3, an operation instruction A3, and an operation instruction B3. The nth instruction sequence 640 includes a loop instruction Jwn, a jump instruction Jn, an operation instruction An, an operation instruction Bn, and an operation instruction Cn. The Nth instruction sequence 650 includes a loop instruction JwN, a jump instruction JN, an operation instruction AN, an operation instruction BN, and an operation instruction CN.

[0101] It should be noted that the loop instruction Jwn can represent the nth loop instruction, and the jump instruction Jn can represent the nth jump instruction. The operation instruction An, the operation instruction Bn, and the operation instruction Cn can represent three operation instructions, wherein An, Bn, and Cn are only schematic symbols, and the operation instruction An, the operation instruction Bn, and the operation instruction Cn can represent the same operation instruction or different operation instructions. Those skilled in the art can design the operation instruction part of each instruction sequence according to the legal constraints on the operation instructions and the actual required instruction scenarios, and the present disclosure does not limit the number of instructions and the type of instructions in the operation instruction part.

[0102] According to the embodiment of the present disclosure, the instruction stream 600 to be verified may be a level 1 instruction, each instruction sequence may be a level 2 instruction, and each instruction in the instruction sequence may be a level 3 instruction. When the instruction stream 600 to be verified includes N instruction sequences, the instruction 600 to be verified may be used to perform at most N jump instruction verifications.

[0103] According to an embodiment of the present disclosure, in the instruction stream 600 to be verified, the execution order of multiple instruction sequences is continuous, for example, the execution order of the 1st instruction sequence 610, the 2nd instruction sequence 620, the 3rd instruction sequence 630, ..., the nth instruction sequence 640, ..., and the Nth instruction sequence 650 is continuous. Without executing a jump instruction, the 1st instruction sequence 610, the 2nd instruction sequence 620, the 3rd instruction sequence 630, ..., the nth instruction sequence 640, ..., and the Nth instruction sequence 650 can be executed in sequence.

[0104] According to an embodiment of the present disclosure, the process of generating the instruction stream 600 to be verified can use an instruction generator to generate the operation instruction part of each instruction sequence, and insert loop instructions and jump instructions in each operation instruction part to obtain multiple instruction sequences, and splice multiple instruction sequences to obtain the instruction stream to be verified. In each instruction sequence, the address of the loop instruction can be the starting address of the instruction sequence. Record the number of instructions and the starting address included in each instruction sequence. The number of instructions included in each instruction sequence can be recorded in the corresponding second register, and the starting address can be recorded in the program counter (Program Counter, PC), and the address can be represented by the PC value. Before starting verification, the first register can be initialized so that the data stored in the first register are all 0.

[0105] According to the disclosed embodiment, during the instruction fetching process of the processor chip, an instruction sequence can be fetched from the memory and transmitted to the decoding module, the randomly generated instruction sequence can be compiled into an assembly code, the assembly code can be stored in the corresponding address segment, and the corresponding address information can be configured in the processor. When executing the instruction, the processor chip can obtain the corresponding instruction sequence according to the address information.

[0106] According to an embodiment of the present disclosure, verifying an instruction sequence to be verified includes: accessing a first register corresponding to a loop instruction of the instruction sequence to be verified to obtain a historical execution count of the instruction sequence to be verified; when determining that the historical execution count is 0, accessing a second register corresponding to a jump instruction of the instruction sequence to be verified to obtain a jump destination address, wherein the jump destination address indicates an address of a loop instruction of any instruction sequence to be verified in the instruction stream to be verified; and returning to access the first register corresponding to the loop instruction of the instruction sequence to be verified to obtain a historical execution count of the instruction sequence to be verified according to the address of the loop instruction.

[0107] According to an embodiment of the present disclosure, verifying the instruction sequence to be verified based on the historical execution times of the instruction sequence to be verified includes: updating a first register and incrementing the historical execution times recorded in the first register when it is determined that the instruction sequence to be verified has been executed.

[0108] Combination Figure 6 The process of verifying the instruction execution function of the processor chip based on the instruction stream 600 to be verified is exemplified and described.

[0109] For example, in the initial state, before each loop instruction is instructed, the number of times recorded in the first register corresponding to each loop instruction is 0.

[0110] like Figure 6As shown, in response to the received start verification request, the instruction sequence to be verified 610 is determined from the instruction stream to be verified 600. The first register corresponding to the loop instruction Jw1 of the instruction sequence to be verified 610 is accessed, and it is determined that the number of historical executions of the instruction sequence to be verified is 0. When it is determined that the number of historical executions is 0, the second register corresponding to the jump instruction J1 of the instruction sequence to be verified 610 is accessed to obtain the jump destination address. The jump destination instruction indicates that the jump destination address is the address of the loop instruction Jw2 of the instruction sequence 620. According to the address of the loop instruction Jw2, the first operation P1 is executed, and the pointer jumps to the loop instruction Jw2, thereby executing the loop instruction Jw2. At this time, the number of times recorded in the first register corresponding to the loop instruction Jw1 increases by one, which is recorded as 1.

[0111] For example, the process of executing the loop instruction Jw2 includes accessing the first register corresponding to the loop instruction Jw2, and determining that the historical execution number of the instruction sequence 620 is 0. When it is determined that the historical execution number is 0, the second register corresponding to the jump instruction J2 of the instruction sequence 620 is accessed to obtain the jump destination address. The jump destination instruction indicates that the jump destination address is the address of the loop instruction Jwn of the instruction sequence 640. According to the address of the loop instruction Jwn, the second operation P2 is executed, and the pointer jumps to the loop instruction Jwn, thereby executing the loop instruction Jwn. At this time, the number of times recorded in the first register corresponding to the loop instruction Jw2 increases by one, which is recorded as 1.

[0112] At this time, the process of executing the loop instruction Jwn includes accessing the first register corresponding to the loop instruction Jwn, and determining that the historical execution number of the instruction sequence 640 is 0. When it is determined that the historical execution number is 0, the second register corresponding to the jump instruction Jn of the instruction sequence 640 is accessed to obtain the jump destination address. The jump destination instruction indicates that the jump destination address is the address of the loop instruction JwN of the instruction sequence 650. According to the address of the loop instruction JwN, the third operation P3 is executed, and the pointer jumps to the loop instruction JwN, thereby executing the loop instruction JwN. At this time, the number of times recorded in the first register corresponding to the loop instruction Jwn increases by one, which is recorded as 1.

[0113] At this time, the process of executing the loop instruction JwN includes accessing the first register corresponding to the loop instruction JwN, and determining that the historical execution number of the instruction sequence 650 is 0. When it is determined that the historical execution number is 0, the second register corresponding to the jump instruction JN of the instruction sequence 650 is accessed to obtain the jump destination address. The jump destination instruction indicates that the jump destination address is the address of the loop instruction Jw2 of the instruction sequence 620. According to the address of the loop instruction Jw2, the fourth operation P4 is executed, and the pointer jumps to the loop instruction Jw2, thereby executing the loop instruction Jw2. At this time, the number of times recorded in the first register corresponding to the loop instruction JwN increases by one, which is recorded as 1.

[0114] At this time, the process of executing the loop instruction Jw2 includes accessing the first register corresponding to the loop instruction Jw2, and determining that the historical execution number of the instruction sequence 620 is 1. When it is determined that the historical execution number is 1, the loop instruction J2 is skipped, the fifth operation P5 is executed, and the pointer jumps to the operation instruction A2. According to the execution order, the operation instruction A2, the operation instruction B2 and the operation instruction C2 are executed in sequence. When it is determined that the operation instruction C2 is executed, according to the execution order between the instruction sequences, the loop instruction Jw3 is continued to be executed. At this time, the number of times recorded in the first register corresponding to the loop instruction Jw2 increases by one, which is recorded as 2 times.

[0115] At this time, the process of executing the loop instruction Jw3 includes accessing the first register corresponding to the loop instruction Jw3, and determining that the historical execution number of the instruction sequence 630 is 0. When it is determined that the historical execution number is 0, the second register corresponding to the jump instruction J3 of the instruction sequence 630 is accessed to obtain the jump destination address. The jump destination instruction indicates that the jump destination address is the address of the loop instruction Jw1 of the instruction sequence 610. According to the address of the loop instruction Jw1, the sixth operation P6 is executed to jump the pointer to the loop instruction Jw1, thereby executing the loop instruction Jw1.

[0116] At this time, the process of executing the loop instruction Jw1 includes accessing the first register corresponding to the loop instruction Jw1, and determining that the historical execution number of the instruction sequence 610 is 1. When it is determined that the historical execution number is 1, the loop instruction J1 is skipped, the seventh operation P7 is executed, and the pointer jumps to the operation instruction A1. According to the execution order, the operation instruction A1, the operation instruction B1 and the operation instruction C1 are executed in sequence. When it is determined that the operation instruction C1 is executed, the loop instruction Jw2 is continued to be executed according to the execution order between the instruction sequences.

[0117] At this time, the process of executing the loop instruction Jw2 includes accessing the first register corresponding to the loop instruction Jw2, and determining that the historical execution times of the instruction sequence 620 is 2. When it is determined that the historical execution times is 2, the loop instruction J2, the operation instruction A2, the operation instruction B2 and the operation instruction C2 are skipped, the eighth operation P8 is executed, and the pointer jumps to the end instruction Exit to end the verification operation.

[0118] In the above execution process, the 1st operation P1, the 2nd operation P2, the 3rd operation P3, the 4th operation P4 and the 6th operation P6 can simulate the use scenario of the chip processor to realize the successful jump judgment, and the 5th operation P5 and the 7th operation P5 can simulate the use scenario of the chip processor to realize the unsuccessful jump judgment. The 1st operation P1, the 2nd operation P2 and the 3rd operation P3 can simulate the use scenario of the chip processor to realize continuous jumps, the 2nd operation P2 and the 4th operation P4 can simulate the use scenario of the chip processor to realize a large jump, the 4th operation P4 and the 6th operation P6 can simulate the use scenario of the chip processor to realize the jump and then execute a section of instructions and then jump back, the 2nd operation P2, the 5th operation P5 and the 8th operation P8 can simulate the use scenario of the chip processor to realize multiple judgments on the same instruction sequence.

[0119] According to an embodiment of the present disclosure, accessing the second register corresponding to the jump instruction of the instruction sequence to be verified to obtain the jump destination address includes: generating multiple instruction sequence combinations, each instruction sequence combination of the multiple instruction sequences includes at least one instruction sequence of the multiple instruction sequences; determining the number of instructions of each instruction sequence combination to obtain multiple instruction numbers; writing the multiple instruction numbers into the second register; and randomly reading the instruction number from the multiple instruction numbers of the second register as the jump destination address.

[0120] For example, the N instruction sequences in the instruction stream 600 to be verified are combined to obtain multiple instruction sequence combinations. Each instruction sequence combination includes at least one instruction sequence among the N instruction sequences. When the instruction sequence combination includes multiple instruction sequences, the execution order of the multiple instruction sequences is continuous. For example, instruction sequence combination 1 may include the first instruction sequence 610, the second instruction sequence 620 and the third instruction sequence 630, instruction sequence combination 2 may include the third instruction sequence 630 and the fourth instruction sequence, instruction sequence combination 3 may include the Nth instruction sequence 650, and instruction sequence combination 4 may include the N-1th instruction sequence and the Nth instruction sequence 650.

[0121] Determine the number of instructions for each instruction sequence combination, and write the number of instructions for each instruction sequence combination into each second register. Different instruction numbers can indicate different jump lengths between a jump source address and a jump destination address. When executing a jump instruction, access the corresponding second register, and randomly read the instruction number from a plurality of instruction numbers in the second register as the jump destination address.

[0122] It should be noted that when randomly reading the number of instructions from the second register, it is necessary to determine that the instruction sequence in the instruction sequence combination corresponding to the number of instructions to be read is continuous with the execution order of the instruction sequence in which the jump instruction is located. For example, when executing the jump instruction J2, the instruction sequence in the instruction sequence combination corresponding to the number of instructions read from the corresponding second register can be the above-mentioned instruction combination 2.

[0123] According to the embodiment of the present disclosure, the jump destination address is determined according to the number of instructions included in each instruction sequence, so that when the jump instruction is executed, the jump destination address will not fall into the operation instruction part of any instruction sequence, thereby avoiding the destruction of the original legal constraints between multiple operation instructions in the operation instruction part. In addition, the number of instructions is randomly read from the second register as the jump destination address, so that the configurable parameters of the jump instruction can be randomized and cover a variety of jump scenarios.

[0124] According to the disclosed embodiment, by using a random instruction generator to add jump type instructions to the generated operation instruction part, the workload of generating instruction sequences during the verification process can be effectively reduced. The structure of the instruction sequence is designed so that the illegal combination of jump instructions can be avoided without repeatedly going through the legal judgment process of randomly generating test sequences and simulator testing feasibility, ensuring that the generated instruction sequence is executable and meets the actual usage scenario, thereby reducing the time and resource consumption of the test.

[0125] The following will be combined Figure 7 The instruction verification device provided by the present disclosure is described.

[0126] Figure 7 The block diagram of the instruction verification device according to the embodiment of the present disclosure is schematically shown.

[0127] like Figure 7 As shown, the instruction verification apparatus 700 includes a plurality of first registers 710 and a processor 720. The plurality of first registers 710 include a first register 710_1, a first register 710_2, ..., a first register 710_n.

[0128] The multiple first registers 710 correspond to the multiple instruction sequences one by one, respectively, and the multiple first registers 710 are used to indicate the historical execution times of the corresponding instruction sequences in the multiple instruction sequences.

[0129] The processor 720 is configured to: splice multiple instruction sequences according to the number of instructions included in each instruction sequence in the multiple instruction sequences to obtain an instruction stream to be verified; determine the instruction sequence to be verified from the instruction stream to be verified in response to a received verification request; access the first register corresponding to the instruction sequence to be verified to determine the historical execution count of the instruction sequence to be verified; and verify the instruction sequence to be verified based on the historical execution count.

[0130] According to an embodiment of the present disclosure, the processor 720 is further configured to: generate multiple instruction branches; and configure a loop instruction and a jump instruction for each of the multiple instruction branches, respectively, to obtain multiple instruction sequences.

[0131] According to an embodiment of the present disclosure, multiple loop instructions correspond to multiple first registers respectively, the loop instructions are associated with the historical execution times of corresponding instruction sequences in the multiple instruction sequences, and the multiple jump instructions are associated with the number of instructions included in the multiple instruction sequences.

[0132] According to an embodiment of the present disclosure, each instruction branch of the multiple instruction branches includes at least one operation instruction, and the processor 720 is also configured to: when it is determined that the historical execution number of the instruction sequence to be verified is 0, execute a jump instruction; when it is determined that the historical execution number of the instruction sequence to be verified is 1, execute at least one operation instruction; and when it is determined that the historical execution number of the instruction sequence to be verified is 2, execute the end instruction of the instruction stream to be verified.

[0133] The following will be combined Figure 8 The instruction verification device provided by the present disclosure is described.

[0134] Figure 8 A block diagram of an instruction verification device according to another embodiment of the present disclosure is schematically shown.

[0135] like Figure 8 As shown, the instruction verification device 800 includes multiple first registers 810, a processor 820 and multiple second registers 830. The multiple first registers 810 include a first register 8101, a first register 810_2, ..., a first register 810_n. The multiple second registers 830 include a second register 830_1, a second register 830_2, ..., a second register 830_n.

[0136] According to an embodiment of the present disclosure, the plurality of first registers 810 correspond to the plurality of instruction sequences one by one, and the plurality of first registers 810 are used to indicate the historical execution times of the corresponding instruction sequences in the plurality of instruction sequences. The plurality of second registers 830 correspond to the jump instructions of the plurality of instruction sequences one by one, and the plurality of second registers 830 are used to indicate the jump destination address of the corresponding jump instruction.

[0137] According to an embodiment of the present disclosure, the processor 820 is configured to: access a first register corresponding to a loop instruction of an instruction sequence to be verified to obtain a historical number of executions of the instruction sequence to be verified; when it is determined that the historical number of executions is 0, access a second register corresponding to a jump instruction of the instruction sequence to be verified to obtain a jump destination address, wherein the jump destination address indicates an address of a loop instruction of any instruction sequence to be verified in the instruction stream to be verified; and according to the address of the loop instruction, return to access the first register corresponding to the loop instruction of the instruction sequence to be verified to obtain an operation of the historical number of executions of the instruction sequence to be verified.

[0138] According to an embodiment of the present disclosure, the processor 820 is configured to: when it is determined that the number of historical executions is 1, execute at least one operation instruction in sequence according to the execution order of at least one operation instruction; and when it is determined that at least one operation instruction has been executed, execute the next instruction sequence of the instruction sequence to be verified according to the execution order of multiple instruction sequences in the instruction stream to be verified.

[0139] According to an embodiment of the present disclosure, the processor 820 is configured to: generate multiple instruction sequence combinations, each instruction sequence combination of the multiple instruction sequences includes at least one instruction sequence from multiple instruction sequences, wherein in the instruction stream to be verified, at least one instruction sequence is continuous in execution order with the instruction sequence to be verified; determine the number of instructions included in each instruction sequence combination to obtain multiple instruction numbers; write the multiple instruction numbers into multiple second registers; and randomly read the instruction number from the multiple instruction numbers of the second registers corresponding to the jump instruction in the multiple second registers as the jump destination address.

[0140] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0141] Fig. 9 A block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure is schematically shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0142] like Fig. 9As shown, the device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0143] A number of components in the device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0144] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as instruction verification methods and training methods for deep learning models. For example, in some embodiments, the instruction verification method and the training method for the deep learning model may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the instruction verification method and the training method for the deep learning model described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to execute the instruction verification method and the deep learning model training method in any other appropriate manner (e.g., by means of firmware).

[0145] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0146] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0147] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0148] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0149] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0150] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

[0151] The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system. It solves the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server can also be a server of a distributed system, or a server combined with blockchain.

[0152] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0153] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A command verification method, comprising: According to the number of instructions included in each of the multiple instruction sequences, splicing the multiple instruction sequences to obtain an instruction stream to be verified; In response to the received verification request, determining a sequence of instructions to be verified from the instruction stream to be verified; as well as The instruction sequence to be verified is verified according to the historical execution times of the instruction sequence to be verified.

2. The method according to claim 1, wherein: The instruction sequence to be verified includes a jump instruction and at least one operation instruction, and verifying the instruction sequence to be verified according to the historical execution times of the instruction sequence to be verified includes: When it is determined that the historical execution times of the instruction sequence to be verified is 0, executing the jump instruction; When it is determined that the historical execution count of the instruction sequence to be verified is 1, executing the at least one action instruction; and When it is determined that the historical execution times of the instruction sequence to be verified is 2, an end instruction of the instruction stream to be verified is executed.

3. The method according to claim 2, wherein: The executing the jump instruction comprises: Determine at least one instruction sequence from a plurality of instruction sequences of the instruction stream to be verified, wherein in the instruction stream to be verified, the at least one instruction sequence is continuous in execution order with the instruction sequence to be verified; determining the number of instructions included in the at least one instruction sequence; Determining a jump destination address according to the number of instructions; and An instruction sequence to be verified corresponding to the jump destination address is determined in the instruction stream to be verified.

4. The method according to claim 2, wherein: The executing the at least one operation instruction comprises: Execute the at least one operation instruction in sequence according to the execution order of the at least one operation instruction; and When it is determined that the at least one operation instruction has been executed, an instruction sequence following the instruction sequence to be verified is executed according to the execution order of multiple instruction sequences in the instruction stream to be verified.

5. The method according to claim 1, further comprising: Generate multiple instruction branches; as well as respectively configuring a loop instruction and a jump instruction for each of the plurality of instruction branches to obtain the plurality of instruction sequences; The loop instruction is associated with the historical execution times of a corresponding instruction sequence in the multiple instruction sequences, and the jump instruction is associated with the number of instructions included in the multiple instruction sequences.

6. The method according to claim 5, further comprising: The loop instructions of the plurality of instruction sequences are respectively matched one by one with a plurality of first registers, wherein the first registers indicate the historical execution times of the corresponding instruction sequences, so as to determine the historical execution times of the corresponding instruction sequences by executing the loop instructions; as well as The jump instructions of the multiple instruction sequences are respectively matched one by one with multiple second registers, where the second registers indicate the jump destination address, so that the instruction sequence located at the jump destination address is determined by executing the jump instructions.

7. The method according to claim 6, wherein: The verifying the instruction sequence to be verified according to the historical execution times of the instruction sequence to be verified comprises: Accessing a first register corresponding to a loop instruction of the instruction sequence to be verified to obtain a historical execution count of the instruction sequence to be verified; When it is determined that the historical execution count is 0, accessing a second register corresponding to the jump instruction of the instruction sequence to be verified to obtain the jump destination address, where the jump destination address indicates an address of a loop instruction of any instruction sequence to be verified in the instruction stream to be verified; and An operation of returning, according to the address of the loop instruction, a first register corresponding to the loop instruction that accesses the instruction sequence to be verified, and obtaining a historical execution count of the instruction sequence to be verified.

8. The method according to claim 7, wherein: The step of accessing the second register corresponding to the jump instruction of the instruction sequence to be verified to obtain the jump destination address comprises: generating a plurality of instruction sequence combinations, each instruction sequence combination of the plurality of instruction combinations comprising at least one instruction sequence of the plurality of instruction sequences; Determine the number of instructions of each instruction sequence combination to obtain multiple instruction numbers; writing the plurality of instruction quantities into the second register; and An instruction number is randomly read from the multiple instruction numbers in the second register as a jump destination address.

9. The method according to claim 7, wherein: The verifying the instruction sequence to be verified according to the historical execution times of the instruction sequence to be verified further comprises: When it is determined that the instruction sequence to be verified has been executed, the first register is updated and the number of historical executions recorded in the first register is incremented.

10. The method according to claim 5, wherein: In the instruction stream to be verified, the execution order of the multiple instruction sequences is continuous; and In each of the plurality of instruction sequences, the loop instruction, the jump instruction and the instruction branch are executed in a continuous order.

11. An instruction verification device, comprising: A plurality of first registers, corresponding to the plurality of instruction sequences respectively, and used to indicate the historical execution times of the corresponding instruction sequence in the plurality of instruction sequences; as well as Processor, configured as: According to the number of instructions included in each of the multiple instruction sequences, splicing the multiple instruction sequences to obtain an instruction stream to be verified; In response to the received verification request, determining a sequence of instructions to be verified from the instruction stream to be verified; Accessing a first register corresponding to the instruction sequence to be verified to determine a historical execution count of the instruction sequence to be verified; and The instruction sequence to be verified is verified according to the historical execution times.

12. The device according to claim 11, wherein The processor is further configured to: generating a plurality of instruction branches; and respectively configuring a loop instruction and a jump instruction for each of the plurality of instruction branches to obtain a plurality of instruction sequences; The plurality of loop instructions correspond to the plurality of first registers respectively, the loop instructions are associated with the historical execution times of corresponding instruction sequences in the plurality of instruction sequences, and the plurality of jump instructions are associated with the number of instructions included in the plurality of instruction sequences.

13. The device according to claim 12, wherein: Each of the plurality of instruction branches includes at least one operation instruction, and the processor is further configured to: When it is determined that the historical execution times of the instruction sequence to be verified is 0, executing the jump instruction; When it is determined that the historical execution number of the instruction sequence to be verified is 1, executing the at least one operation instruction; as well as When it is determined that the historical execution times of the instruction sequence to be verified is 2, an end instruction of the instruction stream to be verified is executed.

14. The apparatus according to claim 12, further comprising: A plurality of second registers, corresponding one-to-one to the jump instructions of the plurality of instruction sequences, respectively, and used to indicate the jump destination address of the corresponding jump instruction; Wherein, the processor is further configured to: Accessing a first register corresponding to a loop instruction of the instruction sequence to be verified to obtain a historical execution count of the instruction sequence to be verified; When it is determined that the historical execution count is 0, accessing a second register corresponding to the jump instruction of the instruction sequence to be verified to obtain the jump destination address, where the jump destination address indicates an address of a loop instruction of any instruction sequence to be verified in the instruction stream to be verified; and An operation of returning, according to the address of the loop instruction, a first register corresponding to the loop instruction that accesses the instruction sequence to be verified, and obtaining a historical execution count of the instruction sequence to be verified.

15. The device according to claim 13, wherein: The processor is also configured to: When it is determined that the historical execution count is 1, sequentially executing the at least one operation instruction according to the execution order of the at least one operation instruction; as well as When it is determined that the at least one operation instruction has been executed, an instruction sequence following the instruction sequence to be verified is executed according to the execution order of multiple instruction sequences in the instruction stream to be verified.

16. The device according to claim 14, wherein: The processor is also configured to: Generate a plurality of instruction sequence combinations, each of the plurality of instruction sequence combinations includes at least one instruction sequence from the plurality of instruction sequences, wherein in the instruction stream to be verified, the at least one instruction sequence is continuous in execution order with the instruction sequence to be verified; Determine the number of instructions included in each instruction sequence combination to obtain multiple instruction numbers; writing the plurality of instruction quantities into the plurality of second registers; as well as The instruction quantity is randomly read from the plurality of instruction quantities of the second register corresponding to the jump instruction in the plurality of second registers as the jump destination address.

17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.

18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.

19. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Cited By

  • Safe operation method and device of application program, equipment and storage medium

    CN119646770A

  • Reconstruction method and device of instruction stream, electronic equipment and readable storage medium

    CN119883372A

  • Method, apparatus, electronic device, and readable storage medium for reconstructing instruction stream

    CN119883372B