To-be-processed task processing method and system, storage medium and electronic device

By determining and executing instruction sets in the hardware accelerator based on task parameters and demand information, the problem of insufficient flexibility in ASIC chip design is solved, and higher chip flexibility and task processing capabilities are achieved.

CN119514430APending Publication Date: 2025-02-25SANECHIPS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311034305.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-15
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The flexibility of existing large ASIC chip design is low, resulting in increased costs when flexibility is reserved in the early stage of chip design, and it is impossible to effectively deal with the differences between commercial scenarios and early stages of design.

Method used

By implementing task programming for the task to be processed in the hardware accelerator, the instruction set is determined based on the task parameter information and demand information, and the instructions in the instruction set are executed to process the pending task.

Benefits of technology

It improves the flexibility of the chip, enables the hardware accelerator to flexibly handle different tasks, and solves the problem of insufficient chip design flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119514430A_ABST
    Figure CN119514430A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a to-be-processed task processing method and system, a storage medium and an electronic device.The to-be-processed task processing method comprises the steps that an instruction set corresponding to a to-be-processed task is determined according to parameter information and demand information of the to-be-processed task, the demand information is used for indicating a processing result corresponding to the to-be-processed task; determining a first instruction address of each instruction to be executed in the instruction set; and executing each to-be-executed instruction according to the first instruction address of each to-be-executed instruction so as to process the to-be-processed task. According to the chip design method and device, the problem that the flexibility of chip design is low is solved, and the effect of improving the flexibility of the chip is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of communications, and in particular, to a method and system for processing a task to be processed, a storage medium, and an electronic device. Background Art

[0002] Existing large-scale ASIC chips generally adopt the design of CPU processor plus hardware accelerator. The CPU has a large area and high power consumption, but is highly versatile. It has low performance when processing complex services and generally handles flexible and changeable services. If it is a specific or complex service with low flexibility, it is generally implemented using a hardware accelerator, which can improve performance, save power consumption and area, but the disadvantage is that it is inflexible.

[0003] One of the major design difficulties of ASIC chips is the division of software and hardware, that is, which services are implemented by the CPU and which services are implemented by the hardware accelerator. Because the chip development cycle is long, the scenarios in commercial use are often quite different from those in the early stages of design, which requires a certain degree of flexibility to be reserved in the early stages of chip design, but this means an increase in chip costs, which leads to a dilemma.

[0004] With regard to the problems in related technologies such as low flexibility in chip design, no effective solutions have yet been proposed. Summary of the invention

[0005] The embodiments of the present invention provide a method and system for processing a task to be processed, a storage medium and an electronic device, so as to at least solve the problem of low flexibility in chip design in the related art.

[0006] According to one embodiment of the present invention, there is provided a method for processing a task to be processed, which is applied to a hardware accelerator, and includes: determining an instruction set corresponding to the task to be processed based on parameter information and requirement information of the task to be processed, wherein the requirement information is used to indicate a processing result corresponding to the task to be processed; determining a first instruction address of each instruction to be executed in the instruction set; and executing each instruction to be executed based on the first instruction address of each instruction to be executed to process the task to be processed.

[0007] In an exemplary embodiment, determining an instruction set corresponding to the task to be processed based on parameter information and requirement information of the task to be processed includes: determining multiple logical processing methods of the task to be processed based on the parameter information and requirement information; determining instructions corresponding to the multiple logical processing methods, and determining the multiple instructions as the instruction set.

[0008] In an exemplary embodiment, executing each instruction to be executed according to the first instruction address of each instruction to be executed includes: a processing step: obtaining a second instruction address in a program counter, wherein the program counter is used to store the instruction address of the next instruction to be executed; determining the instruction to be executed corresponding to the second instruction address in the instruction set according to the first instruction address of each instruction to be executed, and executing the instruction to be executed; and looping through the processing steps until each instruction to be executed in the instruction set is executed.

[0009] In an exemplary embodiment, executing the instruction to be executed includes: parsing the instruction to be executed to obtain first instruction information corresponding to the instruction to be executed, wherein the first instruction information includes at least one of the following: a first instruction code, a first source operand, a first target operand, and a first immediate number; generating a control signal corresponding to the first instruction information, and sending the control signal to the corresponding execution unit of the hardware accelerator to execute the instruction to be executed.

[0010] In an exemplary embodiment, generating a control signal corresponding to the first instruction information includes at least one of the following: when the first instruction information includes: the first instruction code and the first source operand, generating first sub-control information according to the type of the first instruction code, and generating a second sub-control signal for reading an operand register according to the first source operand, wherein the control signal includes: the first sub-control signal and the second sub-control signal; when the first instruction information includes: the first instruction code, the first source operand, and the first target operand, generating first sub-control information according to the type of the first instruction code, generating a second sub-control signal for reading an operand register according to the first source operand, and generating a third sub-control signal for writing into a general register according to the first target operand, wherein the control signal includes: the first sub-control signal, the second sub-control signal, and the third sub-control signal; when the first instruction information includes: the first instruction code, the first immediate value, and the first target operand, generating first sub-control information according to the type of the first instruction code, generating a fourth sub-control signal for reading the first immediate value, and generating a third sub-control signal for writing into a general register according to the first target operand, wherein the control signal includes: the first sub-control signal, the fourth sub-control signal, and the third sub-control signal.

[0011] In an exemplary embodiment, before obtaining the instruction set corresponding to the task to be processed, the method also includes: determining second instruction information of the instruction to be written, wherein the second instruction information includes at least one of the following: a second instruction code, a second source operand, a second target operand, and a second immediate value, the second instruction code is used to indicate the function of the instruction to be written, and the second source operand and the second target operand are used to indicate the read and write addresses of the instruction to be written; and determining the instruction to be written according to the second instruction information.

[0012] According to another embodiment of the present invention, a processing system for a task to be processed is provided, comprising: an instruction extraction unit, used to determine an instruction set corresponding to the task to be processed based on parameter information and requirement information of the task to be processed, wherein the requirement information is used to indicate a processing result corresponding to the task to be processed; determining an instruction address of each instruction to be executed in the instruction set; and an execution unit, used to execute each instruction to be executed according to the instruction address of each instruction to be executed, so as to process the task to be processed.

[0013] In an exemplary embodiment, the instruction extraction unit is also used to obtain a second instruction address in a program counter, wherein the program counter is used to store the instruction address of the next instruction to be executed; the instruction to be executed corresponding to the second instruction address is determined in the instruction set according to the first instruction address of each instruction to be executed; and the execution unit is also used to execute the instruction to be executed.

[0014] In an exemplary embodiment, an instruction decoding unit is used to parse the instruction to be executed to obtain first instruction information corresponding to the instruction to be executed, wherein the first instruction information includes at least one of the following: a first instruction code, a first source operand, a first target operand, and a first immediate number; generate a control signal corresponding to the first instruction information, and send the control signal to a corresponding execution unit to execute the instruction to be executed.

[0015] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when run.

[0016] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0017] Through the present invention, since the hardware accelerator can determine the instruction set of the task to be processed according to the preset instructions (i.e., it realizes the task programming of the task to be processed), and then processes the task to be processed by executing the instructions in the instruction set, the hardware accelerator can also flexibly process different tasks. Therefore, the problem of low flexibility in chip design can be solved, thereby achieving the effect of improving chip flexibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a hardware structure block diagram of a computer terminal of a method for processing a task to be processed according to an embodiment of the present invention;

[0019] Figure 2 is a flowchart of a method for processing a task to be processed according to an embodiment of the present application;

[0020] Figure 3 is a flowchart of a method for processing a task to be processed according to an optional embodiment of the present invention;

[0021] Figure 4 is an internal structure diagram of a hardware accelerator according to an embodiment of the present invention;

[0022] Figure 5 is a schematic diagram of a general register according to an embodiment of the present invention;

[0023] Figure 6 is a schematic diagram of an instruction according to an embodiment of the present invention (I);

[0024] Figure 7 is a schematic diagram of instructions according to an embodiment of the present invention (II);

[0025] Figure 8 is a schematic diagram of instructions according to an embodiment of the present invention (III);

[0026] Fig. 9 is a schematic diagram of instructions according to an embodiment of the present invention (IV);

[0027] Fig.10 is a schematic diagram of instructions according to an embodiment of the present invention (V);

[0028] Fig.11 is a schematic diagram of instructions according to an embodiment of the present invention (VI);

[0029] Fig.12 is a schematic diagram of instructions according to an embodiment of the present invention (VII);

[0030] Fig.13 is a schematic diagram of a packet header format according to an embodiment of the present invention;

[0031] Fig.144 is a structural block diagram of a system for processing tasks to be processed according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.

[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0034] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a computer terminal of a method for processing a task to be processed according to an embodiment of the present invention. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to hardware accelerator, microprocessor (Central Processing Unit, MCU), programmable logic device (Field Programmable Gate Array, FPGA), application-specific integrated circuit (Application-Specific Integrated Circuit, ASIC), digital signal processor, floating point unit, coprocessor, multi-core processor, multi-thread processor and other processing devices) and memory 104 for storing data, wherein the above-mentioned computer terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0035] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the processing method of the task to be processed in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0036] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0037] In this embodiment, a method for processing a task to be processed running on the above-mentioned computer terminal is provided. Figure 2 is a flowchart of a method for processing a task to be processed according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0038] Step S202, determining an instruction set corresponding to the task to be processed according to parameter information and requirement information of the task to be processed, wherein the requirement information is used to indicate a processing result corresponding to the task to be processed;

[0039] It should be noted that the task requirement information is the specific requirements and goals of the task, including the content, time requirements, quantity requirements, etc. The parameter information refers to the parameters needed in the task, including input parameters and output parameters. The input parameters are the data that need to be input when the task is executed, and the output parameters are the results obtained after the task is completed. These parameters can be different types of data such as numbers, text, dates, files, etc. During the task execution process, the task execution and the output of the results are completed according to the requirement information and parameter information.

[0040] Step S204, determining the first instruction address of each instruction to be executed in the instruction set;

[0041] It should be noted that the instruction address refers to the address of the memory location or storage unit that indicates the specific instruction to be executed in the computer program. In the computer's instruction set architecture, each instruction has a unique address, through which the instruction can be loaded into the processor for execution. The instruction address can be represented as a number or a memory address, which is not limited in the embodiments of the present invention.

[0042] Step S206: Execute each of the to-be-executed instructions according to the first instruction address of each of the to-be-executed instructions to process the to-be-processed tasks.

[0043] Through the above steps, when the computer terminal receives the task to be processed, the task to be processed is sent to the hardware accelerator located on the computer terminal. Since the hardware accelerator can determine the instruction set of the task to be processed according to the preset instructions (i.e., it realizes the task programming of the task to be processed), and then processes the task to be processed by executing the instructions in the instruction set, that is, the hardware accelerator can also flexibly process different tasks. Therefore, the problem of low flexibility in chip design can be solved, thereby achieving the effect of improving chip flexibility.

[0044] The execution subject of the above steps may be a hardware accelerator in the terminal, etc., but is not limited thereto.

[0045] Optionally, the above step S202 can be implemented by the following steps:

[0046] Step 11: Determine multiple logical processing modes of the task to be processed according to the parameter information and the requirement information;

[0047] Step 12: Determine the instructions corresponding to the multiple logical processing modes, and determine the multiple instructions as the instruction set.

[0048] That is to say, the above-mentioned multiple logical processing methods can be understood as a method of determining the result obtained after the task is executed according to the parameter information and requirement information of the task to be processed.

[0049] The above logic processing methods include but are not limited to:

[0050] 1. AND operation: When both logical values ​​are true, the result is true; otherwise, the result is false.

[0051] 2. OR operation: When at least one of the two logical values ​​is true, the result is true; otherwise, the result is false.

[0052] 3. NOT: Perform the inversion operation on a logical value, that is, true becomes false and false becomes true.

[0053] For example, taking the parsing of classified messages as an example, assuming that a message header format is as follows Fig.13 As shown, bit0 to bit11 are the DA field, which is used to indicate the destination address; bit12 to bit23 are the SA field, which is used to indicate the source address; bit24 to bit27 are type, which is used to indicate the frame type; bit28 to bit31 are subtype, which is used to indicate the frame subtype.

[0054] In the embodiment of the present invention, the message type is determined by the subtype field. For example, messages with subtype equal to 0 are classified into the first category, and other cases are classified into the second category.

[0055] Write the packet header to DTCM address 0 through the upstream logic.

[0056] The instructions are written as follows and written into ITCM by the main control CPU writing registers:

[0057] 0: ADDI (32'b000000000001_00000_000_00011_0010011) initializes the data in address 3 of regfile to 1;

[0058] 1: LW (32'b0000000000000_00000_010_00001_0000011) reads the data in DTCM address 0 into regfile address 1 LW instruction: reads back 32 bits of data from memory and writes it back to register rd;

[0059] 2: SLLI (32'b0000000_11100_00001_001_00010_0010011) The data in regfile address 1 is shifted left by 28 bits and written to regfile address 2;

[0060] 3: SRLI (32'b0000000_11100_00010_101_00001_0010011) The data in regfile address 2 is shifted right by 28 bits and written to regfile address 1;

[0061] 4: BEQI (32'b0000000_00000_00001_010_00010_1100111) If the data in address 1 of regfile is equal to 0, jump to the sixth line of instruction, otherwise, jump to the fifth line of instruction;

[0062] 5: SW(32'b0000000_00000_00000_010_00001_0100011) writes 0 to DTCM address 1;

[0063] 6: SW (32'b0000000_00011_00000_010_00001_0100011) writes 1 to DTCM address 1.

[0064] After starting the device, the downstream only needs to read the data in DTCM address 1. If it is 0, it means that the message is of the second category, and if it is 1, it means that the message is of the first category.

[0065] Optionally, if the demand for message classification changes, DA, SA, and type need to be used as the basis for classification judgment. You only need to modify the instruction combination in ITCM to complete the combination judgment of any field in the 32-bit packet header, and it is no longer subject to the requirements of traditional hardware logic, thereby improving the flexibility of the chip.

[0066] Optionally, the above step S208 can be implemented by the following steps:

[0067] Step 21: Processing step: obtaining a second instruction address in a program counter, wherein the program counter is used to store an instruction address of a next instruction to be executed;

[0068] Step 22: determining the instruction to be executed corresponding to the second instruction address in the instruction set according to the first instruction address of each instruction to be executed, and executing the instruction to be executed;

[0069] Step 23: Execute the processing steps in a loop until each instruction to be executed in the instruction set is completed.

[0070] It should be noted that the program counter is a register in the computer that stores the address of the currently executed instruction or the address of the next instruction. It is continuously incremented during the execution of instructions to indicate the location of the next instruction to be executed. When the computer executes an instruction, the program counter automatically increments to the address of the next instruction so that the instruction can be fetched and executed. The value of the program counter is usually expressed in binary form and is updated in every clock cycle of the computer. Therefore, the instruction to be executed is determined according to the instruction address in the program counter until all instructions are executed.

[0071] Optionally, before obtaining the instruction set corresponding to the task to be processed, the instructions need to be written. Specifically, the instructions can be written in the following way: determine the second instruction information of the instruction to be written, wherein the second instruction information includes at least one of the following: a second instruction code, a second source operand, a second target operand, and a second immediate value, the second instruction code is used to indicate the function of the instruction to be written, and the second source operand and the second target operand are used to indicate the read and write addresses of the instruction to be written; determine the instruction to be written according to the second instruction information.

[0072] The instructions to be written in the embodiments of the present application include: DTCM read and write instructions, basic integer operation instructions (addition, comparison, OR, AND, shift), unconditional jump instructions, conditional jump instructions (equal, unequal, greater than, less than, greater than or equal to, less than or equal to).

[0073] The contents of the instructions to be written include:

[0074] 1) Instruction code (required), used to identify the action the instruction is intended to complete;

[0075] 2) Operation address (required), the read / write address of DTCM (equivalent to the source operand in the above embodiment) or the read / write address of regfile (equivalent to the target operand in the above embodiment);

[0076] 3) Immediate value (optional), a specific operand.

[0077] Optionally, the instruction to be executed is executed in the following manner, including: parsing the instruction to be executed to obtain first instruction information corresponding to the instruction to be executed, wherein the first instruction information includes at least one of the following: a first instruction code, a first source operand, a first target operand, and a first immediate number; generating a control signal corresponding to the first instruction information, and sending the control signal to the corresponding execution unit of the hardware accelerator to execute the instruction to be executed.

[0078] That is to say, in the embodiment of the present invention, the execution unit of the hardware accelerator executes the instruction to be executed, and the execution unit performs corresponding arithmetic and logic operations, such as addition, multiplication, displacement, and logic operations.

[0079] Specifically, generating a control signal corresponding to the first instruction information includes at least one of the following: when the first instruction information includes: the first instruction code and the first source operand, generating first sub-control information according to the type of the first instruction code, and generating a second sub-control signal for reading an operand register according to the first source operand, wherein the control signal includes: the first sub-control signal and the second sub-control signal; when the first instruction information includes: the first instruction code, the first source operand and the first target operand, generating first sub-control information according to the type of the first instruction code, generating a second sub-control signal for reading an operand register according to the first source operand, and generating a third sub-control signal for writing into a general register according to the first target operand, wherein the control signal includes: the first sub-control signal, the second sub-control signal and the third sub-control signal; when the first instruction information includes: the first instruction code, the first immediate number and the first target operand, generating first sub-control information according to the type of the first instruction code, generating a fourth sub-control signal for reading the first immediate number, and generating a third sub-control signal for writing into a general register according to the first target operand, wherein the control signal includes: the first sub-control signal, the fourth sub-control signal and the third sub-control signal.

[0080] It can be understood that the first sub-control signal is a control signal for implementing operations such as addition, multiplication, displacement, and logical operations; the second sub-control signal is a control signal for reading the operand register; the third sub-control signal is a control signal for writing target information to the target location of the general register; and the fourth sub-control signal is a control signal for reading the first immediate value.

[0081] For example: The ADDI instruction is used to instruct the addition operation of the integer value in the operand register rs1 and the 12-bit immediate value (with sign bit extension), and the result is written back to the register RD. The SW instruction is parsed, the first sub-control signal is the control signal for the addition operation, the second sub-control signal is the control signal for reading the integer value in the operand register rs1, and the third sub-control signal is the control signal for writing the result back to the general register RD.

[0082] In order to better understand the process of the processing method of the above-mentioned tasks to be processed, the implementation method flow of the processing of the above-mentioned tasks to be processed is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.

[0083] In this embodiment, a method for processing a task to be processed is provided. Figure 3 is a flowchart of a method for processing a task to be processed according to an optional embodiment of the present invention. Figure 3As shown, the details are as follows:

[0084] Read instructions, decode instructions, execute instructions, access memory, and write back results. The embodiment of the present invention uses a two-stage pipeline, in which reading instructions uses 1 beat, and decoding, execution, memory access, and writing back all use 1 beat. The state machine can be programmed through the arrangement of different instructions.

[0085] In this embodiment, a hardware accelerator for processing the task to be processed is also provided. Figure 4 is an internal structure diagram of a hardware accelerator according to an embodiment of the present invention, such as Figure 4 As shown, specifically including:

[0086] Data Tightly-Coupled Memory (DTCM), used for high-speed data caching;

[0087] Instruction Fetch Unit (IFU) is used to complete instruction fetch and PC jump;

[0088] Instruction Tightly Coupled Memory (ITCM) is the instruction cache space that supports offline reading and writing.

[0089] Instruction Decode Unit: (DeCode for short), used for decoding;

[0090] Execution Unit (EXU), used to complete the execution of instructions;

[0091] Register File (Register File, referred to as RegFile) is used to complete the operation of internal general registers.

[0092] In order to improve the flexibility of the chip, the present application imposes certain constraints on the input content (instructions), that is, a solution for instruction design is provided in the embodiment of the present application, specifically:

[0093] The instructions include DTCM read and write instructions, basic integer operation instructions (addition, comparison, OR, AND, shift), unconditional jump instructions, and conditional jump instructions (equal, unequal, greater than, less than, greater than or equal to, less than or equal to).

[0094] The content of the instruction needs to include:

[0095] The code of the instruction (required), used to identify the action the instruction is intended to complete;

[0096] Operation address (required), read / write address of DTCM or read / write address of regfile;

[0097] Immediate value (optional), a specific operand;

[0098] regfile is 32 32-bit general registers, used with instructions, such as Figure 5 As shown, the general register at address 0 is always 0 and cannot be written. PC is the address of the instruction currently being processed.

[0099] In the embodiment of the present invention, the designed instructions are written into the ITCM by the CPU and the device is started; the IFU controls the instruction reading address and reads the instruction; the DeCode completes the instruction parsing; and the EXU completes the instruction execution and data writing back.

[0100] The instructions designed in the embodiment of the present invention are based on the RV32I basic instruction set in RSIC-V, directly borrowing some instructions and supplementing some custom instructions. The instruction design can be freely defined and extended. The necessary instructions are read and write instructions, basic logical operation instructions and jump instructions.

[0101] 1. Storage read and write instructions:

[0102] This group of instructions performs memory read or write operations, and the address used to access the memory is obtained by adding the value in the operand register rs1 to a 12-bit immediate value (with sign bit extension).

[0103] LW instruction, such as Figure 6 As shown: read back 32 bits of data from the memory and write back to register rd;

[0104] SW instructions, such as Figure 7 As shown: write the 32-bit data in the operand register rs2 back to the memory;

[0105] 2. Basic integer operation instructions:

[0106] This group of instructions performs basic integer operations on registers and immediate values.

[0107] ADDI instruction, such as Figure 8 As shown in the figure: the integer value in the operand register rs1 is added to the 12-bit immediate value (with the sign bit extended), and the result is written back to the register RD. If the result overflows, no special processing is required, and the excess bits are discarded, and only the lower 32 bits of the result are retained.

[0108] SLTIU instruction, such as Fig. 9As shown: The integer value in the operand register rs1 is compared with the 12-bit immediate value (sign bit extended) as an unsigned number. If the value in rs1 is less than the value of the immediate value, the result is 1, otherwise it is 0 and the result is written back to register RD.

[0109] ANDI instruction, such as Fig. 9 As shown: the integer value in the operand register rs1 is ANDed with the 12-bit immediate value (with the sign bit extended), and the result is written back to the register rd.

[0110] ORI instruction, such as Fig. 9 As shown: the integer value in the operand register rs1 is ORed with the 12-bit immediate value (with sign bit extended), and the result is written back to register rd.

[0111] XORI instruction, such as Fig. 9 As shown: The instruction performs an exclusive OR (XOR) operation on the integer value in operand register rs1 and the 12-bit immediate value (with sign bit extended), and writes the result back to register rd.

[0112] SLLI instructions, such as Fig. 9 As shown: a logical left shift operation is performed on the integer value in the operand register rs1 (0 is filled in the low bit), the shift amount is a 5-bit immediate value, and the result is written back to the register rd.

[0113] SRLI instructions, such as Fig. 9 As shown: a logical right shift operation is performed on the integer value in the operand register rs1 (the high bits are filled with 0), the shift amount is a 5-bit immediate value, and the result is written back to the register rd.

[0114] 3. Data construction instructions:

[0115] LUI instructions, such as Fig.10 As shown: the value of the 20-bit immediate number is shifted left by 12 bits (the lower 12 bits are filled with 0) to become a 32-bit number, and this number is written back to register rd.

[0116] 4. Jump instructions, such as Fig.11 and Fig.12 As shown:

[0117] Fig.11 It represents an unconditional jump instruction:

[0118] JAL instruction: Use a 20-bit immediate number (signed number) as an offset, and then add it to the PC of the instruction to generate the final jump target address. The jal instruction writes the value of the PC of the next instruction (that is, the current instruction PC+1) into its result register rd.

[0119] JALR instruction: Use 12-bit immediate number (signed number) as offset and add it to the value in operand register rs1 to get the final jump target address. The jalr instruction writes the value of the PC of the next instruction (i.e. the current instruction PC+1) into its result register rd.

[0120] Fig.12 It represents a conditional jump instruction:

[0121] This group of instructions is a conditional jump instruction, which uses a 12-bit immediate number (signed number) as an offset, and then adds it to the PC of the instruction to generate the final jump target address. The conditional jump instruction needs to jump only when the condition is true, as follows.

[0122] BEQI instruction: It will jump only if the value in operand register rs1 is equal to the value of the 5-bit immediate value in the operand register.

[0123] BNEI instruction: It will jump only if the value in operand register rs1 is not equal to the value of the 5-bit immediate value in the operand register.

[0124] BGTUI instruction: It will jump only if the unsigned number in operand register rs1 is greater than the unsigned number of the 5-bit immediate value in the operand register.

[0125] BLEUI instruction: It will jump only if the unsigned number in operand register rs1 is less than or equal to the unsigned number in operand register 5-bit immediate value.

[0126] BLTUI instruction: It will jump only if the unsigned number in operand register rs1 is less than the unsigned number of the 5-bit immediate value in the operand register.

[0127] BGEUI instruction: It will jump only if the unsigned number in operand register rs1 is greater than or equal to the unsigned number in operand register 5-bit immediate value.

[0128] The embodiment of the present invention designs a set of hardware architecture and imposes certain constraints on its input content (instructions), adds programmable functions similar to software on the basis of ordinary hardware design, realizes the programmability of state machines and even logic functions, and provides certain flexibility without increasing the power consumption area of ​​the chip. To a certain extent, it solves the dilemma of both flexibility and low cost in chip design.

[0129] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory (ROM / RAM), a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0130] In the present embodiment, a processing system for a task to be processed is also provided, and the system is used to implement the above-mentioned embodiment and preferred implementation mode, and the descriptions that have been made are not repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.

[0131] The embodiment of the present invention provides a processing system for a task to be processed. The processing system for a task to be processed in the embodiment of the present application is located in the above-mentioned hardware accelerator. Fig.14 is a structural block diagram of a processing system for tasks to be processed according to an embodiment of the present invention, such as Fig.14 As shown, the system includes:

[0132] The instruction extraction unit 1402 is used to determine the instruction set corresponding to the task to be processed according to the parameter information and requirement information of the task to be processed, wherein the requirement information is used to indicate the processing result corresponding to the task to be processed; determine the instruction address of each instruction to be executed in the instruction set;

[0133] The execution unit 1404 is used to execute each of the instructions to be executed according to the instruction address of each of the instructions to be executed, so as to process the task to be processed.

[0134] Through the above device, since the hardware accelerator can determine the instruction set of the task to be processed according to the preset instructions (i.e., it realizes the task programming of the task to be processed), and then processes the task to be processed by executing the instructions in the instruction set, the hardware accelerator can also flexibly process different tasks. Therefore, the problem of low flexibility in chip design can be solved, thereby achieving the effect of improving chip flexibility.

[0135] It should be noted that the processing system for the tasks to be processed in the embodiment of the present invention is located in the above-mentioned hardware accelerator, and the hardware accelerator processes the tasks to be processed through the processing system for the tasks to be processed. Therefore, the system structure of the processing system for the tasks to be processed in the embodiment of the present application is similar to the internal structure of the above-mentioned hardware accelerator.

[0136] Since the system structure of the processing system for the task to be processed in the embodiment of the present application is similar to the internal structure of the above-mentioned hardware accelerator, Figure 4 As shown, the processing system for the above-mentioned task to be processed also includes: a data tightly coupled memory, an instruction tightly coupled memory unit, an instruction decoding unit, an execution unit, and a register file.

[0137] It should be noted that, when the task to be processed is completed, the processing result is written back to the data tightly coupled memory in a preset format.

[0138] The register file is a component inside the processing system of the task to be processed, which is used to store and manage the registers of the system. The register is a high-speed memory inside the system, which is used to temporarily store instructions and data. The regfile usually contains multiple registers, such as general registers, program counter (PC), etc. The register file can provide the system with fast data storage and access functions to support the execution of instructions and the processing of data.

[0139] In an exemplary embodiment, the instruction extraction unit 1402 is used to determine multiple logical processing methods of the task to be processed according to the parameter information and the requirement information; determine the instructions corresponding to the multiple logical processing methods, and determine the multiple instructions as the instruction set.

[0140] In an exemplary embodiment, the instruction extraction unit is also used to obtain a second instruction address in a program counter, wherein the program counter is used to store the instruction address of the next instruction to be executed; the instruction to be executed corresponding to the second instruction address is determined in the instruction set according to the first instruction address of each instruction to be executed; and the execution unit is also used to execute the instruction to be executed.

[0141] In an exemplary embodiment, an instruction decoding unit is used to parse the instruction to be executed to obtain first instruction information corresponding to the instruction to be executed, wherein the first instruction information includes at least one of the following: a first instruction code, a first source operand, a first target operand, and a first immediate number; generate a control signal corresponding to the first instruction information, and send the control signal to a corresponding execution unit to execute the instruction to be executed.

[0142] In an exemplary embodiment, the instruction decoding unit is further used for one of the following:

[0143] In a case where the first instruction information includes: the first instruction code and the first source operand, generating first sub-control information according to the type of the first instruction code, and generating a second sub-control signal for reading an operand register according to the first source operand, wherein the control signal includes: the first sub-control signal and the second sub-control signal;

[0144] In a case where the first instruction information includes: the first instruction code, the first source operand, and the first target operand, generating first sub-control information according to the type of the first instruction code, generating a second sub-control signal for reading an operand register according to the first source operand, and generating a third sub-control signal for writing into a general register according to the first target operand, wherein the control signal includes: the first sub-control signal, the second sub-control signal, and the third sub-control signal;

[0145] In the case where the first instruction information includes: the first instruction code, the first immediate value and the first target operand, first sub-control information is generated according to the type of the first instruction code, a fourth sub-control signal for reading the first immediate value is generated, and a third sub-control signal for writing into a general register is generated according to the first target operand, wherein the control signal includes: the first sub-control signal, the fourth sub-control signal and the third sub-control signal.

[0146] In an exemplary embodiment, the above-mentioned device also includes: an instruction writing unit, used to determine second instruction information of the instruction to be written, wherein the second instruction information includes at least one of the following: a second instruction code, a second source operand, a second target operand, and a second immediate value, the second instruction code is used to indicate the function of the instruction to be written, and the second source operand and the second target operand are used to indicate the read and write addresses of the instruction to be written; the instruction to be written is determined according to the second instruction information.

[0147] It should be noted that the programmed instructions are stored in the instruction tightly coupled memory unit, and the instruction set is also stored in the instruction tightly coupled memory unit before being fetched.

[0148] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0149] To facilitate the understanding of the technical solution provided by the present invention, a detailed description will be given below in conjunction with embodiments of specific scenarios.

[0150] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0151] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0152] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0153] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0154] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0155] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0156] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for processing a task to be processed, characterized in that: Applied to hardware accelerators, including: Determine an instruction set corresponding to the task to be processed according to parameter information and requirement information of the task to be processed, wherein the requirement information is used to indicate a processing result corresponding to the task to be processed; Determining a first instruction address of each instruction to be executed in the instruction set; Each of the instructions to be executed is executed according to the first instruction address of each of the instructions to be executed, so as to process the task to be processed.

2. The method according to claim 1, characterized in that Determining an instruction set corresponding to the task to be processed according to the parameter information and requirement information of the task to be processed includes: Determine multiple logical processing modes of the task to be processed according to the parameter information and the requirement information; Instructions corresponding to the multiple logical processing modes are determined, and the multiple instructions are determined as the instruction set.

3. The method according to claim 1, characterized in that Executing each of the instructions to be executed according to the first instruction address of each of the instructions to be executed includes: Processing steps: obtaining a second instruction address in a program counter, wherein the program counter is used to store an instruction address of a next instruction to be executed; Determine, in the instruction set, the instruction to be executed corresponding to the second instruction address according to the first instruction address of each instruction to be executed, and execute the instruction to be executed; The processing steps are executed in a loop until each instruction to be executed in the instruction set is completed.

4. The method according to claim 3, characterized in that Executing the to-be-executed instruction includes: Parsing the instruction to be executed to obtain first instruction information corresponding to the instruction to be executed, wherein the first instruction information includes at least one of the following: a first instruction code, a first source operand, a first target operand, and a first immediate value; Generate a control signal corresponding to the first instruction information, and send the control signal to the corresponding execution unit of the hardware accelerator to execute the instruction to be executed.

5. The method according to claim 4, characterized in that Generating a control signal corresponding to the first instruction information includes at least one of the following: In a case where the first instruction information includes: the first instruction code and the first source operand, generating first sub-control information according to the type of the first instruction code, and generating a second sub-control signal for reading an operand register according to the first source operand, wherein the control signal includes: the first sub-control signal and the second sub-control signal; In a case where the first instruction information includes: the first instruction code, the first source operand, and the first target operand, generating first sub-control information according to the type of the first instruction code, generating a second sub-control signal for reading an operand register according to the first source operand, and generating a third sub-control signal for writing into a general register according to the first target operand, wherein the control signal includes: the first sub-control signal, the second sub-control signal, and the third sub-control signal; In the case where the first instruction information includes: the first instruction code, the first immediate value and the first target operand, first sub-control information is generated according to the type of the first instruction code, a fourth sub-control signal for reading the first immediate value is generated, and a third sub-control signal for writing into a general register is generated according to the first target operand, wherein the control signal includes: the first sub-control signal, the fourth sub-control signal and the third sub-control signal.

6. The method according to claim 1, characterized in that Before obtaining the instruction set corresponding to the task to be processed, the method further includes: Determine second instruction information of the instruction to be written, wherein the second instruction information includes at least one of the following: a second instruction code, a second source operand, a second target operand, and a second immediate value, the second instruction code is used to indicate the function of the instruction to be written, and the second source operand and the second target operand are used to indicate the read and write addresses of the instruction to be written; The instruction to be written is determined according to the second instruction information.

7. A processing system for tasks to be processed, characterized in that: include: An instruction extraction unit is used to determine an instruction set corresponding to the task to be processed according to parameter information and requirement information of the task to be processed, wherein the requirement information is used to indicate a processing result corresponding to the task to be processed; and determine an instruction address of each instruction to be executed in the instruction set; An execution unit is used to execute each of the instructions to be executed according to the instruction address of each of the instructions to be executed, so as to process the task to be processed.

8. The system according to claim 7, characterized in that Also includes: The instruction fetching unit is further used to obtain a second instruction address in a program counter, wherein the program counter is used to store the instruction address of the next instruction to be executed; and determine the instruction to be executed corresponding to the second instruction address in the instruction set according to the first instruction address of each instruction to be executed; The execution unit is further configured to execute the instruction to be executed.

9. The system according to claim 8, characterized in that Also includes: An instruction decoding unit, configured to parse the instruction to be executed to obtain first instruction information corresponding to the instruction to be executed, wherein the first instruction information includes at least one of the following: a first instruction code, a first source operand, a first target operand, and a first immediate value; Generate a control signal corresponding to the first instruction information, and send the control signal to a corresponding execution unit to execute the instruction to be executed.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 6 when executed by a processor.

11. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 6 are implemented.