Integrated interface communication method between RISC-V processor and CAM

By using TICAI interface between the RISC-V processor and the customized acceleration module, a tight integrated interface with zero delay is achieved, which solves the communication delay problem of auxiliary acceleration modules in SoC chips, improves processing speed and applicability, and simplifies the Accelerate logic integration.

CN118963840APending Publication Date: 2024-11-15SHENZHEN DUOLIANG INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411039418.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

The auxiliary acceleration module in existing SoC chips has a large delay in communication through the BUS bus, which affects the processing speed.

Method used

Using the TICAI interface communication method between the RISC-V processor and the customized acceleration module, the CPU is directly connected to different pipelines of the CPU through 7 signals (cam_inst, cam_rs1, cam_rs2, cam_mem_valid, cam_next_inst, cam_data_o, cam_valid, etc.), achieving zero delay tightly integrated interface.

Benefits of technology

It greatly improves the response and processing speed of custom acceleration modules, simplifies the integration of acceleration logic, supports multiple acceleration modules, and reduces programming workload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118963840A_ABST
    Figure CN118963840A_ABST
Patent Text Reader

Abstract

The invention discloses an integrated interface communication method between an RISC-V processor and a CAM (Customized Acceleration Module), which comprises the following steps of: representing an instruction read from a CPU (Central Processing Unit) memory and transmitted to the CAM by a camst signal; the camrs1 signal is used for representing an operation code which is decoded by the CPU to the register 1 and is transmitted to the CAM; the camrs2 signal is used for representing an operation code which is decoded into the register 2 by the CPU and is transmitted to the CAM of the customized acceleration module; the cammvalid signal is used for representing that the camrs1 signal and the camrs2 signal have prepared the current instruction; the camnext signal is used for representing that the current value of the camnext signal is a valid instruction and should be latched by a CAM (Customized Acceleration Module); the camdata signal is used for representing result data of a CAM (Customized Acceleration Module) and can be written into a destination register specified by the custom instruction; and the camvalid signal is used for representing that the camdata signal is prepared to be written into the register file pile. The method has the technical characteristics that the response and processing speed of the CAM of the customized acceleration module can be improved, various acceleration modules are supported, and the customized acceleration logic can be simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an integrated interface for a customized acceleration module CAM, and in particular to an integrated interface communication method between a RISC-V processor and a customized acceleration module CAM. Background Art

[0002] With the continuous development of modern chip design technology, System-on-a-Chip (SoC) chips have come into being. SoC chips are a chip system that integrates multiple functions, integrating processors, memory, input and output interfaces, communication modules and other key functional components into one chip. The other functional components mentioned here are specific functional modules designed for different application fields, which exist as auxiliary functions of the main processor. These functional modules perform special accelerated calculations for a certain type of application and provide computing power that is many times faster than similar software code calculations. Therefore, this type of integration technology has brought great expansion possibilities for SoC chips in various application fields.

[0003] At the same time, the processors in current SoC chips are generally ARM cores or RISC-V cores, and the auxiliary function modules generally include DSP, GPU, NPU, DPU, etc. There are also other customer-defined hardware acceleration modules that specialize in processing specific functional operations. For these auxiliary function modules, they are generally interconnected and communicated with the main processor CPU through the BUS bus (such as AXI4 or AHB bus technology). Due to the arbitration on the bus, this design method makes the delay of the auxiliary acceleration module relatively large.

[0004] See also Figure 1 , customer-defined auxiliary function modules (CAM, Customer Accelerator Module), such as DSP modules, or NPU modules, are mounted on the AXI bus like the CPU core IP (if the speed is not high, this bus can also be the AHB bus). At this time, the DSP / NPU exists in parallel as a "coprocessor mode" of the CPU, and many other devices will be mounted on the bus. When the DSP / NPU module needs to communicate with the CPU, it will first initiate a request to the AXI4 bus, but at the same time, other devices on the AXI bus will also initiate requests to the CPU. At this time, arbitration is required on the AXI bus to determine which device's request is sent to the CPU for communication first. However, due to the existence of communication and arbitration on the BUS bus, the DSP / NPU acceleration module connected in this coprocessor mode has a relatively large delay, generally within 200 to 300 cycles. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide an integrated interface communication method that can improve the response and processing speed of a customized acceleration module CAM, support multiple acceleration modules, and simplify customized acceleration logic in view of the deficiencies of the prior art.

[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions.

[0007] An integrated interface communication method between a RISC-V processor and a custom acceleration module CAM is implemented based on a CPU, a TICAI interface and a custom acceleration module CAM. The CPU and the custom acceleration module CAM are connected through the TICAI interface. The signals transmitted by the TICAI interface include: a cam_inst signal, used to represent an instruction read from the CPU memory and transmitted to the custom acceleration module CAM; a cam_rs1 signal, used to represent an operation code decoded by the CPU into register 1 and transmitted to the custom acceleration module CAM; a cam_rs2 signal, used to represent an operation code decoded by the CPU into register 2 and transmitted to the custom acceleration module CAM; a cam_mem_valid signal, used to represent that the cam_rs1 signal and the cam_rs2 signal are ready for the current instruction; a cam_next_inst signal, used to represent that the current value of the cam_inst signal is a valid instruction and should be latched by the custom acceleration module CAM; a cam_data_o signal, used to represent that the result data of the custom acceleration module CAM can be written into the destination register specified by the custom instruction; and a cam_valid signal, used to represent that the cam_data_o signal is ready to be written into a register file stack.

[0008] Preferably, the TICAI interface is modeled using R-type instructions.

[0009] Preferably, the signal paths of the cam_inst signal, the cam_rs1 signal, the cam_rs2 signal, the cam_mem_valid signal, the cam_next_inst signal and the cam_valid signal are directly connected to different pipelines in the CPU, and when the cam_data_o signal is connected to the decoding segment and the register file stack in the CPU, multiplexing selection is performed through a multiplexer.

[0010] Preferably, the CPU sends a complete instruction to the custom acceleration module CAM via a cam_inst signal, and uses the funct7 and funct3 fields of the opcode to enable the custom acceleration module CAM to decode the expected function and calculate the correct result.

[0011] Preferably, the cam_rs1 signal and the cam_rs2 signal correspond to the rs1 field and the rs2 field of the R-type instruction respectively, and the cam_rs1 signal, the cam_rs2 signal and the cam_data_o signal are all consistent with the data width of the register in the CPU.

[0012] Preferably, the CPU sends a logic high level through the cam_mem_valid signal to indicate that the CPU has retrieved the values ​​of the rs1 field and the rs2 field from the register file, so that the cam_rs1 signal and the cam_rs2 signal are valid for the custom acceleration module CAM, and the custom acceleration module CAM latches the input data accordingly and starts execution at the next clock cycle.

[0013] Preferably, when the custom acceleration module CAM sends a logic high level to the CPU through the cam_valid signal, it indicates that the data of the cam_data_o signal is valid, and the CPU latches these valid data in the next clock cycle; when the custom acceleration module CAM sends a logic low level to the CPU through the cam_valid signal, it provides reverse pressure to the CPU and generates necessary stalls during multi-clock cycle hardware execution.

[0014] Preferably, if the currently executed instruction is in the CPU pipeline and is switched, the CPU uses the cam_next_inst signal to send a logic high level to the custom acceleration module CAM, and the CPU also multiplexes the data in the cam_data_o signal with the output result of the ALU unit, and uses the correct instruction to decide which data to write back to the register file.

[0015] Preferably, the signal setting process corresponding to the multi-channel pipeline in the CPU includes: when the customized acceleration module CAM sets the cam_valid signal to a logic low level, the CPU is paused at the corresponding stage; when it is determined that the data on the cam_rs1 signal and the cam_rs2 signal are valid data from the register file stack, a high-level valid signal is sent through the cam_mem_valid signal; when the currently executed instruction changes, a high-level valid signal is sent through the cam_next_inst signal.

[0016] Preferably, the customized acceleration module CAM is used to: correctly decode instructions from the cam_inst signal and latch the logic high level value from the cam_next_inst signal; set the cam_valid signal to a logic high level to ensure that no unnecessary stall occurs in the pipeline of the CPU; process the cam_mem_valid signal and latch the input data value only when the cam_mem_valid signal is a logic high level; when the preset customized acceleration logic successfully outputs correct data on the cam_data_o signal, set the cam_valid signal to a logic high level, allowing the CPU to release the stall and latch the result data at the next clock edge.

[0017] The integrated interface communication method between the RISC-V processor and the custom acceleration module CAM disclosed in the present invention has the following beneficial effects compared with the prior art: first, since the custom acceleration module CAM is tightly integrated into the decoding unit and register stack of the CPU, it has fine-grained execution capability and does not need to go through BUS bus arbitration, so it can achieve zero delay, greatly improving the response and processing speed of CAM; at the same time, through reconfiguration, the custom acceleration logic can be more easily interchanged in simulation and actual hardware, and can widely support DSP, GPU, DPU, NPU, Tensorcore, FPU, VPU and many AI acceleration modules, etc.; furthermore, the custom acceleration logic module design connected to the TICAI interface can be used for any processor that supports TICAI, and has a wide range of applicability; in addition, future developers do not need to focus on modifying the instruction pipeline, thereby simplifying the integration of custom acceleration logic and reducing the programming workload required to integrate the custom logic accelerator into the CPU. In practical applications, developers can use inline assembly to create C-based algorithms so that TICAI instructions can be used in existing algorithms. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A schematic diagram of a processing method of a coprocessor in the prior art;

[0019] Figure 2 This is a schematic diagram of the classic five-stage pipeline of RISC-VCPU;

[0020] Figure 3 This is a schematic diagram of the TICAI interface without delay;

[0021] Figure 4 This is a diagram of the four main instruction types of RISC-V;

[0022] Figure 5 The figure is a schematic diagram of the connection relationship of the 7 signals in the TICAI interface;

[0023] Figure 6 A schematic diagram of the new signal setting method corresponding to the synchronization of each level of CPU pipeline;

[0024] Figure 7 It is a schematic diagram of the connection relationship of multiple acceleration functional units in the same customized acceleration module CAM. DETAILED DESCRIPTION

[0025] The present invention will be described in more detail below with reference to the accompanying drawings and embodiments.

[0026] The present invention relates to a method for adding a customized acceleration function module to a RISC-V CPU / MCU, and provides a delay-free tightly integrated interface technology. In practical applications, since the ARM kernel IP is generally encrypted, the inside of the processor cannot be seen, and the architecture cannot be modified, the present invention mainly improves the open source RISC-V kernel architecture, and its purpose is to make full use of the open source and scalable characteristics of the RISC-V architecture, and provide a tightly coupled integrated interface technology between the main processor and the customized acceleration module in the SoC chip, and use 7 signals to connect the customized acceleration module CAM with the CPU, so that the delay of the customized acceleration module CAM can be zero, greatly improving the response speed of the acceleration module, and the interface of the present invention is simple and easy to use, which can greatly reduce the programming workload when implementing customized logic inside the processor.

[0027] For the classic five-stage pipeline model of the RISC-V architecture, see Figure 2 RISC-V is an open source CPU core architecture standard. Different customers can customize and design their own processors based on this standard to develop different types of processors. The RISC-V architecture generally adopts the classic five-stage pipeline model, such as Figure 2 As shown in the figure, different processor products are added or subtracted on this basis. Some may only have two pipeline stages: value fetch and execution units, while some high-performance processors will expand some stages to reach more than ten pipeline stages, but all contain five classic pipeline stages: instruction fetch, decode, execute, memory access and write back.

[0028] On this basis, the present invention discloses an integrated interface communication method between a RISC-V processor and a custom acceleration module CAM. The method is implemented based on a CPU, a TICAI interface and a custom acceleration module CAM. The CPU and the custom acceleration module CAM are connected via the TICAI interface. The signals transmitted by the TICAI interface include:

[0029] cam_inst signal, used to represent the instruction read from the CPU memory and transmitted to the custom acceleration module CAM;

[0030] cam_rs1 signal, used to represent the operation code decoded by the CPU into register 1 and transmitted to the custom acceleration module CAM;

[0031] cam_rs2 signal, used to represent the operation code decoded by the CPU into register 2 and transmitted to the custom acceleration module CAM;

[0032] The cam_mem_valid signal is used to indicate that the cam_rs1 signal and the cam_rs2 signal are ready for the current instruction;

[0033] cam_next_inst signal, used to indicate that the current value of the cam_inst signal is a valid instruction and should be latched by the custom acceleration module CAM;

[0034] The cam_data_o signal is used to indicate that the result data of the custom acceleration module CAM can be written into the destination register specified by the custom instruction;

[0035] The cam_valid signal is used to indicate that the cam_data_o signal is ready to be written to the register file.

[0036] TICAI refers to A Tightly Integrated Customer Accelerator Interface (TICAI for short), which is translated as "delay-free tightly integrated interface technology for customized acceleration module CAM", see Figure 3 It is based on the above open source classic five-stage pipeline RISC-V architecture, and can be customized and modified at different pipeline stages with creativity. The present invention can reduce the delay of the customized acceleration module CAM to zero.

[0037] See also Figure 3 , the leftmost is the RISC-V core, which adopts the classic five-stage pipeline model. The red part on the rightmost is the customer-customized acceleration function module (CAM, Customer Accelerator Module). The middle custom accelerator interface (Customer Accelerator Interface) is the interface used in this embodiment. It uses 7 signals to complete the close integration and communication with the corresponding signals in different pipeline stages in the CPU. These 7 signals are: cam_inst, cam_rs1, cam_rs2, cam_mem_valid, cam_next_inst, cam_data_o, cam_valid, where the abbreviation cam = customer accelerator module, that is, Figure 3 The part enclosed by the dotted line.

[0038] See also Figure 3 , from the right RISC-V CPU outward, 5 of the 7 signals of TICAI: cam_inst, cam_rs1, cam_rs2, cam_mem_valid, cam_next_inst are outputs, and the remaining 2 signals cam_data_o and cam_valid are input signals. The specific explanation of each signal is shown in the following table:

[0039]

[0040] manual

[0041]

[0042] As a preferred method, this embodiment uses R-type instructions to model the TICAI interface. Specifically: Regarding the type of TICAI custom instructions, when the custom acceleration module CAM communicates with the CPU, custom instructions are required. When the custom instructions are decoded in the decoding stage of the CPU, the relevant instruction data will be passed to the custom acceleration module CAM, and the CPU processing will be suspended to wait for the result of the acceleration module.

[0043] Specifically, RISC-V is designed with four main instruction types: R-type instructions, I-type instructions, U-type instructions, and S-type instructions, such as Figure 4 As shown, the R-type instruction requires two source registers, rs1 and rs2, and writes the result to the destination register rd. The opcode field of each type specifies the major opcode of the instruction. When the funct3 and funct7 fields appear, they represent 3-bit and 7-bit minor opcodes, respectively, to further distinguish instructions. Among them, the rs1, rs2, and rd fields point to the location in the processor register file, specifying the read and write locations required for each instruction.

[0044] It should be noted that this embodiment does not discuss the other three instruction types in detail. In short, I-type instructions are used for instructions that require immediate input values. When I-type instructions are used together with U-type instructions, the value of the register can be loaded into 32 bits. S-type instructions are used for storage, and the immediate field of S-type instructions is used together as a memory offset.

[0045] Specifically, this embodiment uses R-type instructions to model TICAI, such as Figure 4As shown in the black box, this type of instruction has the greatest versatility and flexibility in data transfer between the custom acceleration module CAM and the processor. When creating the TICAI interface design, the main opcodes 0001011 and 0101011 will be used. These two opcodes are reserved as custom instructions in RISC-V and are guaranteed not to be used by future ISA extensions. In actual applications, since R-type instructions contain both funct7 and funct3 fields, each main opcode can create 1024 unique instructions. In view of this, TICAI custom instructions only need to use one main opcode. As an application example, the customer customizes the R-type instruction, taking the funct3 field as an example as shown in the following table:

[0046]

[0047] Similarly, funct7 can be customized in the same way. It is used in combination with funct3. In theory, 2 10 =1024 instructions.

[0048] Regarding the detailed connection method of the 7 signals in the TICAI interface, in this embodiment:

[0049] The signal paths of the cam_inst signal, the cam_rs1 signal, the cam_rs2 signal, the cam_mem_valid signal, the cam_next_inst signal and the cam_valid signal are directly connected to different pipelines in the CPU. When the cam_data_o signal is connected to the decoding segment and the register file stack in the CPU, multiplexing selection is performed through a multiplexer.

[0050] Furthermore, the CPU sends a complete instruction to the custom acceleration module CAM via the cam_inst signal, and uses the funct7 and funct3 fields of the opcode to enable the custom acceleration module CAM to decode the expected function and calculate the correct result.

[0051] At the same time, the cam_rs1 signal and the cam_rs2 signal correspond to the rs1 field and the rs2 field of the R-type instruction respectively, and the cam_rs1 signal, the cam_rs2 signal and the cam_data_o signal are all consistent with the data width of the register in the CPU.

[0052] Furthermore, the CPU sends a logic high level through the cam_mem_valid signal to indicate that the CPU has retrieved the values ​​of the rs1 field and the rs2 field from the register file, so that the cam_rs1 signal and the cam_rs2 signal are valid for the custom acceleration module CAM, and the custom acceleration module CAM latches the input data accordingly and starts execution at the next clock cycle.

[0053] On the contrary, when the custom acceleration module CAM sends a logic high level to the CPU through the cam_valid signal, it indicates that the data of the cam_data_o signal is valid, and the CPU latches the valid data in the next clock cycle;

[0054] When the custom acceleration module CAM sends a logic low level to the CPU through the cam_valid signal, it provides back pressure to the CPU and generates necessary stalls during multi-clock cycle hardware execution.

[0055] In actual applications, if the currently executed instruction is in the CPU pipeline and is switched, the CPU uses the cam_next_inst signal to send a logic high level to the custom acceleration module CAM. The CPU also multiplexes the data in the cam_data_o signal with the output result of the ALU unit, and uses the correct instruction to decide which data to write back to the register file.

[0056] In a preferred embodiment of the present invention, see Figure 5 The connection between the 7 signals of the TICAI interface and the CPU is relatively simple and easy to implement. Most of the signals are directly connected to the corresponding signals in different pipelines in the CPU. Only when the cam_data_o signal is connected to the decoding segment and register file stack in the CPU, it needs to be multiplexed and selected through a multiplexer.

[0057] Furthermore, according to the format of the R-type instruction, two data inputs and one data output are required to meet all specification requirements. The specific connection method of the 7 signals and the corresponding signals in the CPU is as follows:

[0058] a. Considering that a complex custom CAM may perform more than one operation, in order to maintain versatility, the CPU is required to send a complete instruction to the custom CAM through the cam_inst signal, so that the funct7 and funct3 fields of the opcode can be used to enable the custom CAM to decode the expected function and calculate the correct result;

[0059] b. The signals cam_rs1 and cam_rs2 correspond to the rs1 and rs2 fields of the R-type instruction, respectively. Specifically, the rsx signal should pass the corresponding value in the CPU register file to TICAI. These data are the same as those passed to the processor ALU.

[0060] c. The data cam_data_o output from the custom acceleration module CAM corresponds to the rd field of the instruction and will eventually be written back to this location in the register file. The data width of cam_rs1, cam_rs2 and cam_data_o is consistent with the registers in the processor.

[0061] d. In order to synchronize with the processor without request queues or additional delays, TICAI uses two main signals cam_mem_valid and cam_valid. The CPU must send a logic high level through cam_mem_valid to indicate that the CPU has retrieved the values ​​of rs1 and rs2 from the register file, and that these data exist and are valid for the custom acceleration module CAM on the corresponding signals cam_rs1 and cam_rs2. In this way, the custom acceleration module CAM can latch the input data and start execution at the next clock cycle;

[0062] e. Conversely, the custom acceleration module CAM sends a logic high level to the processor through cam_valid, indicating that the data on cam_data_o is valid, and the CPU can latch this data in the next clock cycle. The custom acceleration module CAM sends a logic low level through cam_valid to provide reverse pressure to the CPU and generate necessary stalls during multi-clock cycle hardware execution;

[0063] f. For many processors, the next instruction may be decoded before the currently executed instruction completes the operation. This requires the cam_next_inst signal, which the processor uses to send a logic high level when the currently executed instruction is switching in the processor pipeline. It should also multiplex the data in cam_data_o with the output results of the ALU and use the correct instructions to decide which data will be written back to the register file.

[0064] Regarding the signal settings corresponding to the CPU pipeline, in this embodiment, each processor design needs to handle the synchronization logic in a different way. The TICAI interface must remain unchanged and universal in all designs. See Figure 6 , Figure 6 It shows the synchronization signal settings of the four-stage CPU pipeline when integrating CAM.

[0065] Specifically in this embodiment, the signal setting process corresponding to the multi-channel pipeline in the CPU includes:

[0066] When the custom acceleration module CAM sets the cam_valid signal to a logic low level, the CPU is suspended at the corresponding stage;

[0067] When it is determined that the data on the cam_rs1 signal and the cam_rs2 signal are valid data from the register file, a high-level valid signal is sent through the cam_mem_valid signal;

[0068] When the currently executed instruction changes, a high-level valid signal is sent through the cam_next_inst signal.

[0069] In practical applications, the developer who integrates the TICAI interface into the design in this embodiment is responsible for the following signal settings:

[0070] First, when the custom acceleration module CAM sets cam_valid to a logic low level, it ensures that the processor is paused at the corresponding correct stage;

[0071] At the same time, when it is guaranteed that the data on cam_rs1 and cam_rs2 are valid data from the register file stack, a high-level valid signal is sent to cam_mem_valid;

[0072] Furthermore, when the currently executed instruction changes, a high-level active signal is sent to cam_next_inst;

[0073] In addition, it is necessary to ensure that all required signals are provided externally to the CPU, allowing for custom acceleration logic to exist outside the design to maintain the modularity of the TICAI interface.

[0074] like Figure 6 The information shown in the box area on the left shows that most of the work required to introduce a general TICAI interface is the same as the work required to add any new execution unit to the processor. First, you need to understand the functions of the existing processor to see if it has a pipeline pause mechanism to determine whether it must be added to the basic CPU logic. Each processor requires different modifications to include custom module functions. Some processors require developers to add mechanisms that allow the processor to stall, while some processors already include examples of execution units that can stall.

[0075] In this embodiment, after adding and verifying the new execution unit, the developer must generalize the logic and Figure 3Within the TICAI execution unit, the developer must handle all synchronization and communication with the processor to keep the TICAI interface simple and versatile. Once completed, the processor does not need to be modified to introduce new custom acceleration logic.

[0076] Regarding the design of the custom acceleration module CAM, in the preferred embodiment of the present invention, the design goal of the TICAI interface is to be used with any custom acceleration module CAM with minimal workload and overhead, allowing developers to freely design hardware and test it in any simulation environment. When developing a custom acceleration module CAM for TICAI, users can focus on creating hardware that meets their requirements and design corresponding custom instructions in a targeted manner, so that custom acceleration module hardware that meets specific acceleration requirements can be developed.

[0077] Specifically, the customized acceleration module CAM is used for:

[0078] Correctly decode the instruction from the cam_inst signal, and latch the logic high value from the cam_next_inst signal;

[0079] Setting the cam_valid signal to a logic high level to ensure that no unnecessary stalls occur in the CPU pipeline;

[0080] Processing the cam_mem_valid signal, latching the input data value only when the cam_mem_valid signal is at a logic high level;

[0081] When the preset custom acceleration logic successfully outputs the correct data on the cam_data_o signal, the cam_valid signal is set to a logic high level, allowing the CPU to release the stall and latch the result data at the next clock edge.

[0082] In practical applications, after the embodiment verifies the given customized acceleration module CAM through simulation, the user must create a wrapper to communicate through the TICAI interface. The developer of the customized acceleration logic should be familiar with the TICAI function described in 5 above and handle the following tasks:

[0083] First, design it to connect to the system clock and reset if necessary;

[0084] At the same time, correctly decode the instruction from cam_inst and latch the logic high value from cam_next_inst when necessary to ensure that the customized acceleration module knows that the TICAI instruction is currently in the execution stage of the pipeline;

[0085] For some designs, such as unclocked hardware that can complete quickly, it may not be necessary to latch the next instruction as long as the correct acknowledgement can be provided on the next clock edge. These designs should always set cam_valid to logic high to ensure that there are no unnecessary stalls in the CPU pipeline.

[0086] The designer is required to select minor opcodes for each function in the custom acceleration logic during this development phase.

[0087] Furthermore, the cam_mem_valid signal is properly handled to latch the input data value only when it is logic high (if required by the given custom acceleration hardware);

[0088] When the custom acceleration logic successfully outputs the correct data on cam_data_o, cam_valid is set to logic high, allowing the CPU to release any stalls and latch the result on the next clock edge.

[0089] Regarding the expansion of the customized acceleration module CAM, in a preferred embodiment of the present invention:

[0090] Generally speaking, a custom acceleration module CAM mainly performs a single acceleration function, such as single DSP acceleration, NPU acceleration, GPU acceleration, DPU acceleration, Tensor acceleration, AES encryption acceleration, or FPU, VPU, and various commonly used AI accelerations, etc., but sometimes designers can also include multiple accelerators or functions in their custom logic design.

[0091] like Figure 7 In the right box shown, for multiple functional modules, corresponding multiplexers need to be added for selection to ensure that the correct valid bits and data bits are sent back to the processor. If necessary, a decoder is also required to parse the input instructions. Figure 7 The cam_inst shown in is the selection line of the multiplexer, but for designs that execute in multiple clock cycles, it can be changed to an internal latch instruction to meet the strict requirements of multiple clock cycles.

[0092] In actual applications, in order to maintain the universality of TICAI, developers can pass all signals to each individual custom accelerator and handle data latching and processing within each accelerator, or create a decoder at the top level to handle appropriate instruction decoding and latching. Since the TICAI interface implemented by the present invention is independent of the processor, the custom acceleration module CAM design connected through the interface is completely portable. At the same time, the universality of the TICAI interface allows developers to create a design once and use the same custom acceleration module CAM on any processor that supports TICAI.

[0093] Finally, the hardware descriptions used for the TICAI interface in this embodiment mainly include: VHDL, Superlog, Verilog, SystemVerilog, chisel, BluespecSystemVerilog (BSV), spinalHDL, etc. All of the above languages ​​can be used to implement the TICAI interface and add relevant hardware logic and signals according to the requirements of the TICAI interface.

[0094] The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM disclosed in the present invention has the beneficial effect compared with the prior art in that the present invention only needs to complete a one-time integrated development of the TICAI interface without further modifying the underlying processor architecture, thereby connecting any customized acceleration module CAM to the main processor CPU and achieving zero-delay communication.

[0095] This one-time initial programming work requires an in-depth understanding of the selected CPU. Connecting through TICAI and tightly integrating the custom acceleration module CAM into the main processor CPU can bring many technical effects: First, because the custom acceleration module CAM is tightly integrated into the CPU's decoding unit and register stack, it has fine-grained execution capabilities and does not require BUS bus arbitration, so it can achieve zero latency, greatly improving the response and processing speed of CAM; at the same time, through reconfiguration, the custom acceleration logic can be more easily interchanged in simulation and actual hardware, and can widely support DSP, GPU, DPU, NPU, Tensorcore, FPU, VPU and many AI acceleration modules, etc.; secondly, the custom acceleration logic module design connected to the TICAI interface can be used for any processor that supports TICAI, and its applicability is very wide; in addition, future developers do not need to focus on modifying the instruction pipeline, thereby simplifying the integration of custom acceleration logic and reducing the programming workload required to integrate custom logic accelerators into the CPU. In actual applications, developers can use inline assembly to create C-based algorithms to use TICAI instructions in existing algorithms.

[0096] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions or improvements made within the technical scope of the present invention should be included in the scope of protection of the present invention.

Claims

1. An integrated interface communication method between a RISC-V processor and a custom acceleration module CAM, characterized in that: The method is implemented based on a CPU, a TICAI interface and a custom acceleration module CAM. The CPU and the custom acceleration module CAM are connected via the TICAI interface. The signal transmitted by the TICAI interface includes: cam_inst signal, used to represent the instruction read from the CPU memory and transmitted to the custom acceleration module CAM; cam_rs1 signal, used to represent the operation code decoded by the CPU into register 1 and transmitted to the custom acceleration module CAM; cam_rs2 signal, used to represent the operation code decoded by the CPU into register 2 and transmitted to the custom acceleration module CAM; The cam_mem_valid signal is used to indicate that the cam_rs1 signal and the cam_rs2 signal are ready for the current instruction; cam_next_inst signal, used to indicate that the current value of the cam_inst signal is a valid instruction and should be latched by the custom acceleration module CAM; The cam_data_o signal is used to indicate that the result data of the custom acceleration module CAM can be written into the destination register specified by the custom instruction; The cam_valid signal is used to indicate that the cam_data_o signal is ready to be written to the register file.

2. The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM as claimed in claim 1, characterized in that: The TICAI interface is modeled using R-type instructions.

3. The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM as claimed in claim 1, characterized in that: The signal paths of the cam_inst signal, the cam_rs1 signal, the cam_rs2 signal, the cam_mem_valid signal, the cam_next_inst signal and the cam_valid signal are directly connected to different pipelines in the CPU. When the cam_data_o signal is connected to the decoding segment and the register file stack in the CPU, multiplexing selection is performed through a multiplexer.

4. The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM as claimed in claim 1, characterized in that: The CPU sends a complete instruction to the custom acceleration module CAM via the cam_inst signal, and uses the funct7 and funct3 fields of the opcode to enable the custom acceleration module CAM to decode the expected function and calculate the correct result.

5. The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM as claimed in claim 1, characterized in that: The cam_rs1 signal and the cam_rs2 signal correspond to the rs1 field and the rs2 field of the R-type instruction respectively, and the cam_rs1 signal, the cam_rs2 signal and the cam_data_o signal are all consistent with the data width of the register in the CPU.

6. The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM as claimed in claim 1, characterized in that: The CPU sends a logic high level through the cam_mem_valid signal to indicate that the CPU has retrieved the values ​​of the rs1 field and the rs2 field from the register file, so that the cam_rs1 signal and the cam_rs2 signal are valid for the custom acceleration module CAM, and the custom acceleration module CAM latches the input data accordingly and starts execution at the next clock cycle.

7. The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM as claimed in claim 1, characterized in that: When the custom acceleration module CAM sends a logic high level to the CPU through the cam_valid signal, it indicates that the data of the cam_data_o signal is valid, and the CPU latches the valid data in the next clock cycle; When the custom acceleration module CAM sends a logic low level to the CPU through the cam_valid signal, it provides back pressure to the CPU and generates necessary stalls during multi-clock cycle hardware execution.

8. The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM as claimed in claim 1, characterized in that: If the currently executed instruction is in the CPU pipeline and is switched, the CPU uses the cam_next_inst signal to send a logic high level to the custom acceleration module CAM. The CPU also multiplexes the data in the cam_data_o signal with the output result of the ALU unit and uses the correct instruction to decide which data to write back to the register file.

9. The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM as claimed in claim 1, characterized in that: The signal setting process corresponding to the multi-channel pipeline in the CPU includes: When the custom acceleration module CAM sets the cam_valid signal to a logic low level, the CPU is suspended at the corresponding stage; When it is determined that the data on the cam_rs1 signal and the cam_rs2 signal are valid data from the register file, a high-level valid signal is sent through the cam_mem_valid signal; When the currently executed instruction changes, a high-level valid signal is sent through the cam_next_inst signal.

10. The integrated interface communication method between the RISC-V processor and the customized acceleration module CAM as claimed in claim 1, characterized in that: The customized acceleration module CAM is used for: Correctly decode the instruction from the cam_inst signal, and latch the logic high value from the cam_next_inst signal; Setting the cam_valid signal to a logic high level to ensure that no unnecessary stalls occur in the CPU pipeline; Processing the cam_mem_valid signal, latching the input data value only when the cam_mem_valid signal is at a logic high level; When the preset custom acceleration logic successfully outputs the correct data on the cam_data_o signal, the cam_valid signal is set to a logic high level, allowing the CPU to release the stall and latch the result data at the next clock edge.

Citation Information

Cited By

  • Instruction processing method

    CN120508320A