SOC internal IP inter-core low-delay communication method based on CSR
By introducing a CSR register interface and asynchronous FIFO between the CPU and IP cores, and bypassing the cache, low-latency communication between IP cores is achieved, solving the problem of long communication latency between the CPU and IP cores in the existing technology, and improving the utilization of the CPU and IP cores.
Patent Information
- Application Number
- CN202510988308.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-17
- Publication Date
- 2025-11-04
AI Technical Summary
In existing technologies, the communication latency between the CPU and the IP core is relatively long, especially when polling the IP core status register, there is information redundancy and delay, and bus contention makes it impossible to achieve a deterministic low latency.
A custom CSR register is introduced between the CPU and the IP core as a communication interface. Direct communication is achieved by bypassing the L1/L2/L3 cache through direct connection and asynchronous FIFO of CSR_MASTER and CSR_SLAVE. The IP core status is actively fed back by writing to the CSR register, avoiding interrupts and bus contention.
It significantly shortens the IP core register write time from 150 nanoseconds to 20 nanoseconds, improves CPU utilization, and achieves a high-performance SOC system, especially in small-task scenarios in the 5G field, where it achieves almost 100% utilization.
Smart Images

Figure CN120892383A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of integrated circuit chip, in particular to a low-delay communication method between IP cores in a SOC based on CSR. BACKGROUND
[0002] The design of integrated circuit chip is widely based on IP reuse, and the communication between IP cores, especially between CPU and other IP cores, is the most critical problem. The textbook solution to this problem is to achieve it through bus technology. The current mainstream open-source bus standards include AMBA / WISHBONE / AVALON, among which AMBA is a popular industry-standard on-chip structure, and closed-source includes ring bus and mesh bus of x86. In order to clearly understand the related technologies in this field, the related terms involved will be explained as follows:
[0003] Soc: System on Chip (SoC), also known as System on Chip, is a product, a dedicated target integrated circuit, which contains a complete system and all embedded software;
[0004] CSR: Control and Status Register, state and control register, used for the storage and internal control of key information in CPU, generally invisible to application layer software users;
[0005] IP: refers to IP core, a functional module designed, verified and reusable, usually provided in the form of hardware description language (such as Verilog, VHDL, etc.) or netlist, used for integration into chip design;
[0006] Bus: a common communication trunk for transmitting information between various functional components of a computer, which can be divided into three categories according to function: on-chip bus, system bus and communication bus, among which the on-chip bus is used to connect various components inside the chip, the system bus is used to connect various functional components in the computer system, and the communication bus is used to connect between computer systems or computer systems and other systems;
[0007] AMBA: an on-chip bus standard developed by ARM Company;
[0008] WISHBONE: an on-chip bus standard developed by Silicore Company;
[0009] AVALON: an on-chip bus standard developed by Altera Company.
[0010] Figure 1 The existing AMBA 3.0 bus architecture is shown in the following figure: Figure 1As shown, AMBA includes AHB, APB, ASB, AXI and other specifications, each of which is applicable to different scenarios, and the specifications related to the control of the CPU over the IP core and the active query of the CPU over the state of the IP core are respectively:
[0011] AHB (Advanced High-performance Bus) is a high-speed bus, which is generally used for accessing modules with high speed, such as DMA;
[0012] APB (Advanced Peripheral Bus) is a slow bus, which is generally used for the configuration interface of the IP, that is, the parameter configuration of the IP and the query of the state of the IP.
[0013] The communication between the CPU and the IP core needs to pass through the CPU internal read / write pipeline, L1 / L2 / L3 cache, AXI bus, Bridge and other paths, and the IP core is generally configured in the device memory mode, and the final destination needs to respond to the read and write operations of the CPU, which means that the CPU needs to return twice the path for each 32 / 64-bit read and write operation to initiate the next operation. In this way, the single communication path is long and the delay is large, and the SOC system generally takes about 100 nanoseconds (1G frequency is taken as an example, and the time involved below is also taken as an example) from the time when the CPU issues a read / write instruction to the time when the completion is confirmed, during which the subsequent instructions of the CPU can be in a blocked state. When the CPU polls the state register of the IP core, only 1 bit is needed, so the information redundancy is large. In addition, the IP core reports the state through an interrupt, which has a long processing process, and the delay is usually in the us level. In addition, there is competition on the bus, and it is impossible to achieve a certain low delay.
[0014] Therefore, there is an urgent need in the art for a low-delay communication method between IP cores. SUMMARY
[0015] In order to solve the above problems, the purpose of the present application is to provide a low-delay communication method between IP cores based on CSR in a SOC, which bypasses L1 / L2 / L3 cache and modifies a group of read / write CSR registers into a communication interface between the CPU and the IP core, so as to shorten the communication link between the CPU and the IP core. When the CPU polls the state register of the IP core, only the CSR read register needs to be polled, and a special reporting instruction can be issued through the CSR write register to require the IP core to actively feed back the state of the IP core to a specific bit of the CSR read register in real time. At the same time, the state of the IP core can be fed back by avoiding the interrupt mode, and the bus can be bypassed to avoid the time delay fluctuation caused by competition.
[0016] To achieve the above object, the application provides a low-delay communication method between internal IP cores of a CSR-based SOC, which comprises the following steps:
[0017] Step S1: a set of self-defined CSR registers are added in the CPU to form a CSR_MASTER, which comprises a CSR_MASTER_0 and a CSR_MASTER_1, wherein the CSR_MASTER_0 is used to control the IP and only writes data from the CPU, and the CSR_MASTER_1 is used to feedback the IP state and only reads data from the CPU;
[0018] Step S2: a CSR_SLAVE is integrated in the IP core end in a WRAP encapsulation mode, which comprises a CSR_SLAVE_0 and a CSR_SLAVE_1, wherein the CSR_SLAVE_0 is used to control the IP, and the CSR_SLAVE_1 is used to feedback the IP state;
[0019] Step S3: a direct connection line is led out from the CSR_MASTER_0 of the CPU, passes through an asynchronous FIFO of cross clock domain to reach the CSR_SLAVE_0, and the control data issued by the CSR_MASTER_0 is parsed by the CSR_SLAVE;
[0020] Step S4: a direct connection line is led out from the CSR_SLAVE_1 of the IP core end, passes through an asynchronous FIFO of cross clock domain to reach the CSR_MASTER_1, the control information received by the CSR_SLAVE_0 contains an instruction related to the feedback state information of the IP core, and after receiving the instruction, the CSR_SLAVE_1 feeds back to the specified bit of the CSR_MASTER_1 according to the feedback requirement.
[0021] In an embodiment of the application, the data format in step S3 is in a conventional addr+value form or in a self-defined format.
[0022] In an embodiment of the application, the asynchronous FIFO of cross clock domain in step S3 is a multi-stage asynchronous FIFO, which is set according to the main frequencies of different modules on the path from the CPU to the IP core, and an asynchronous FIFO is set for each cross clock domain.
[0023] In an embodiment of the application, the CSR_SLAVE further comprises a plurality of slave CSRs connected with the IP cores, and after parsing the data format of the CSR_SLAVE_0 in step S3, the CSR_SLAVE further comprises the following steps:
[0024] If any slave CSR is directly connected with the corresponding IP core, the slave CSR writes the parsed data to the corresponding IP core through direct connection; or
[0025] If any of the slave CSRs is not directly connected to its corresponding IP core, the slave CSR will write the parsed data to the corresponding IP core through the standard bus closest to the IP core.
[0026] In an embodiment of the present application, the feedback information in step S4 can include, but is not limited to, a ready flag and a work completion flag. When only the ready and completion states are fed back, the size is only 1 bit.
[0027] In an embodiment of the present application, it further includes:
[0028] The slave CSRs are connected in series or in parallel through a bus to form a set of CSR_SLAVE_SET, and two ports are led out, one of which is connected to CSR_SLAVE_0 for connection with CSR_MASTER_0, and the other is connected to CSR_SLAVE_1 for connection with CSR_MASTER_1.
[0029] In an embodiment of the present application, the function-enhanced CSR_SLAVE further includes:
[0030] Step S5: In the CSR_SLAVE, a feedback FIFO buffer and a monitoring FIFO buffer are set, wherein the feedback FIFO buffer is data written into the CSR_SLAVE_0 triggered by the state of an IP feedback, and the monitoring FIFO buffer is data written into an IP core triggered by the data of the CSR_SLAVE_0.
[0031] The CSR-based low-delay communication method between internal IP cores of an SOC provided by the present application can greatly reduce the time required for register writing of an IP core compared with the prior art, and asynchronous processing is realized, thereby improving the utilization rate of a CPU. The method of the present application can obtain low delay of a CSR + large bandwidth of a standard AMBA bus, and thus a high-performance SOC system can be formed, and the utilization rates of a CPU, an IP core and a bus can be greatly improved in the scene of frequent small tasks in the 5G field. BRIEF DESCRIPTION OF DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description only constitute some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.
[0033] Figure 1 It is a schematic diagram of the existing AMBA 3.0 bus architecture;
[0034] Figure 2 Fig. 1 is a schematic diagram of a communication architecture between a CSR-based CPU and IP cores in an embodiment of the present application. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative effort belong to the protection scope of the present application.
[0036] Figure 2 Fig. 1 is a schematic diagram of a communication architecture between a CSR-based CPU and IP cores in an embodiment of the present application. Figure 2 As shown in Fig. 1, the embodiment provides a low-delay communication method between IP cores in a CSR-based SOC, which comprises the following steps.
[0037] Step S1: There are a plurality of CSR registers with specified functions in the CPU, and the CSR registers with user-defined functions are allowed to be added, which are used to control and save the internal information of the CPU. The reading and writing of the CSR in the CPU typically requires 20 cycles, but a plurality of CSR instructions can be implemented in pipeline, that is, 1 CSR / 1 cycle. The embodiment breaks through the idea that the CSR registers only act on the CPU internally, and a group of CSR registers are led out from the CPU to form a CSR_MASTER, which comprises CSR_MASTER_0 (CSR0 in Figure 2 ) and CSR_MASTER_1 (CSR1 in Figure 2 ). The CSR_MASTER_0 is used for control and written only by the CPU, and the CSR_MASTER_1 is used for feedback and read only by the CPU.
[0038] Step S2: The CSR_SLAVE is integrated in the IP core end in a WRAP encapsulation manner, which comprises CSR_SLAVE_0 (CSR_SLAVE_SET_0 in Figure 2 ) and CSR_SLAVE_1 (CSR_SLAVE_SET_1 in Figure 2 ). The CSR_SLAVE_0 is used for control IP, and the CSR_SLAVE_1 is used for feedback IP state.
[0039] Step S3: A direct connection is drawn from the CPU's CSR_MASTER_0 and passes through an asynchronous FIFO (FirstInput First Output) across clock domains to reach CSR_SLAVE_0. CSR_SLAVE receives and parses the data sent by CSR_MASTER_0. The direct connection sends feedback control data through the CSR_MASTER_0 channel. In this embodiment, the direct connection can be drawn by declaring a custom CSR register inside the CPU and declaring it at the output port. Since this implementation process is well known to those skilled in the art, it will not be described in detail here.
[0040] In one embodiment of the present invention, the data format in step S3 is either the conventional addr+value (address + register value) format or a custom format format.
[0041] For example, since CSR_MASTER_0 is a write channel, typically 64 bits, certain special bits can be predefined. For instance, bits 32 and 63 represent the address of the register to be written to, and bits 0 and 31 represent the value of the register to be written to, which can be used as a regular addr+value format. However, this invention is not limited to this. Another example: CSR_MASTER_0 is 64 bits long. Bits 60 and 61 can be used to represent the module ID, bit 59 can indicate whether it's configuring a register or requesting feedback status, bits 32 and 58 can be used to represent the address (addr) of the register to be configured, and bits 0 and 31 represent the register value. This allows for a custom format. Setting a custom format can support more complex functions. This invention is not limited to the above examples; in actual implementation, settings can be selected according to requirements.
[0042] In one embodiment of the present invention, the asynchronous FIFO across clock domains in step S3 can be a multi-level asynchronous FIFO (ASY FIFO), which can be set according to the main frequency of different modules that need to be passed through on the shortest path from the CPU to the IP core. An asynchronous FIFO needs to be set for each level of clock domain to solve the problem of inconsistent operating frequencies.
[0043] like Figure 2 As shown, CSR_SLAVE also includes multiple slave CSRs connected to IP cores. Taking four slave CSRs as an example, they are CSR_SLAVE_A, CSR_SLAVE_B, CSR_SLAVE_C, and CSR_SLAVE_D, and the corresponding IP cores are IP_A, IP_B, IP_C, and IP_D, respectively. In other embodiments, the number of slave CSRs can be other values. This invention is not limited to four. Figure 2Only for illustrative purposes. After the IP is integrated with the corresponding CSR_SLAVE through WRAP encapsulation, the original interface of the IP core needs to be connected to the outside through WARP.
[0044] In an embodiment of the present application, after the CSR_SLAVE parses the data format of the CSR_SLAVE_0 in step S3, it further includes:
[0045] If any slave CSR is directly connected to the corresponding IP core, such as CSR_SLAVE_A and IP_A in Figure 2 , the slave CSR will write the parsed data to the corresponding IP core through direct connection; or
[0046] If any slave CSR is not directly connected to the corresponding IP core, such as CSR_SLAVE_B and IP_B in Figure 2 , the slave CSR will write the parsed data to the corresponding IP core through the standard bus closest to the IP core.
[0047] There are usually two ways to connect the CSR SLAVE and the IP, including:
[0048] Direct connection is to bypass all interfaces and directly connect to the internal register of the IP core. This way has the shortest delay and the highest performance, and is suitable for self-developed IPs. If a third-party IP also wants to adopt the direct connection method, in order to reduce changes, it can be connected to the standard interface outside the IP. The performance is relatively lost compared to self-developed IPs, but the number of CSR SLAVES can be reduced, such as the connection between CSR_SLAVE_A and IP_A shown in Figure 2 ;
[0049] If the direct connection method is not adopted, then according to the architecture diagram, find out which bus is the closest, such as the connection between CSR_SLAVE_B and IP_B shown in Figure 2 . The direct connection method is not adopted, and the closest bus to IP_B is the noc bus, so CSR_SLAVE_B_0 writes data to IP_B through the noc bus.
[0050] Step S4: a direct connection line is drawn from the end of the IP core CSR_SLAVE_1, and reaches the CSR_MASTER_1 through the asynchronous FIFO across the clock domain; the control information received by the CSR_SLAVE_0 contains an instruction related to the feedback state information of the IP core; after receiving the instruction, the CSR_SLAVE_1 feeds back to the specified bit of the CSR_MASTER_1 according to the preset requirement of the feedback. Any IP core feeds back information to the corresponding slave CSR; after the CSR_SLAVE analyzes the feedback information, the CSR_SLAVE feeds back to the corresponding bit of the CSR_SLAVE_1 according to the requirement of the feedback received by the CSR_SLAVE_0.
[0051] The IP core feedback information can be fed back through the direct connection; the start and stop of the feedback and the bit of the direct connection can be realized through programming. For example, the CSR_MASTER_0 writes a register with a special value 0x1100000000000051, which indicates that the IP1 is required to report the data with the address of 1 and feed back to the 5th bit; then the CSR_SLAVE_1 analyzes the data and executes the operation to feed back the data to the 5th bit of the CSR_SLAVE_1 register.
[0052] In an embodiment of the present application, the feedback information in step S4 can generally include but is not limited to the flags of ready, work completed, etc., and the size thereof is only 1 bit.
[0053] In an embodiment of the present application, it further includes:
[0054] A plurality of slave CSRs are connected in series or in parallel through a bus to form a set of CSR_SLAVE_SET, such as Figure 2 In the embodiment shown in FIG. 4, the CSR_SLAVE_A, the CSR_SLAVE_B, the CSR_SLAVE_C and the CSR_SLAVE_D are connected in series, and two ports are drawn out; the position of the drawn-out port can be set according to the requirement, and the present application does not limit the same; for example, Figure 2 The port is between the CSR_SLAVE_A and the CSR_SLAVE_D, but is not limited thereto; one of the ports is connected to the CSR_SLAVE_0 Figure 2 (CSR_SLAVE_SET_0 in FIG. 3) for connecting with the CSR_MASTER_0, and the other is connected to the CSR_SLAVE_1 Figure 2 (CSR_SLAVE_SET_1 in FIG. 3) for connecting with the CSR_MASTER_1.
[0055] As shown in The end CSR_SLAVE_SET shown in the figure is set at the port of the bus, and according to the foregoing, it is known that only one module at the CPU end is responsible for writing (CSR_MASTER_0), but many IP cores need to monitor the content of writing, so the bus needs to be used to connect / parallelize these IP cores, so that each IP core can obtain the task related to itself in the monitoring process. This way can realize the reuse of CSR_MASTER, and in the use process, it can be flexibly configured which IP needs high-speed active feedback of which state at what time.
[0056] In another embodiment of the present application, the following steps can also be added for the function-enhanced CSR_SLAVE:
[0057] Step S5: In the CSR_SLAVE, a "feedback FIFO" cache and a "monitoring FIFO" cache are set, wherein the "feedback FIFO" cache is triggered by a series of data written into the CSR_SLAVE_0 by an IP feedback state (such as after the IP core completes a certain task), and the "monitoring FIFO" cache is triggered by a series of data written into the IP core by the data of the CSR_SLAVE_0, so as to build a SOC which is directly driven by the data flow and is programmed flexibly by the CPU.
[0058] The CSR is a CPU internal register, and generally, the SOC design is integrated with IP using a standard method without damaging the internal design of the IP including the CPU. The present application uses it for external control and feedback, which is a breakthrough and great innovation in thought. Secondly, the design of the CSR itself is relatively simple, stable and reliable in performance, so the present application can realize a great performance improvement effect through a small innovation improvement.
[0059] The SOC internal IP core low-delay communication method based on the CSR provided by the present application can reduce the time required for writing a single IP core register from 150 nanoseconds to 20 nanoseconds. The time required for configuring 20 registers at a time can be reduced from 3000 nanoseconds to 40 nanoseconds. At the same time, the present application realizes asynchronous processing and improves the utilization rate of the CPU. When the CPU executes a CSR instruction, it can continue to execute other instructions in a non-blocking asynchronous manner, for example, a typical control logic can be IP_A configuration -> IP_B configuration -> IP_C configuration -> CSR read IP state -> IP_A configuration. The method of the present application can obtain low delay of the CSR + large bandwidth of the standard AMBA bus, and in the scene of frequent small tasks in the 5G field, the CPU, IP core and bus can achieve almost 100% utilization rate, and the performance is improved by 4 times compared with the case where only the AMBA bus is used for communication.
[0060] Those skilled in the art can understand that the modules or flows in the drawings are not necessarily required for implementing the present application.
[0061] Those skilled in the art can understand that the modules in the devices in the embodiments can be distributed in the devices in the embodiments as described in the embodiments, or can be changed and located in one or more devices different from the embodiments. The modules in the above embodiments can be combined into one module, or can be further split into multiple sub-modules.
[0062] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A low-latency communication method between IP cores within a System-on-a-Chip (SoC) based on CSR, characterized in that, include: Step S1: Add a set of custom CSR registers inside the CPU to form a CSR_MASTER, which includes CSR_MASTER_0 and CSR_MASTER_1. CSR_MASTER_0 is used to control the IP and the CPU only writes data to it, while CSR_MASTER_1 is used to feedback the IP status and the CPU only reads data from it. Step S2: Integrate CSR_SLAVE at the IP core using WRAP encapsulation, which includes CSR_SLAVE_0 and CSR_SLAVE_1, where CSR_SLAVE_0 is used to control the IP and CSR_SLAVE_1 is used to feedback the IP status; Step S3: A direct connection is drawn from the CPU's CSR_MASTER_0, passes through the asynchronous FIFO across clock domains to reach CSR_SLAVE_0, and the control data sent by CSR_MASTER_0 is parsed by CSR_SLAVE. Step S4: A direct connection is drawn from CSR_SLAVE_1 at the IP core end, passes through the asynchronous FIFO across the clock domain, and reaches CSR_MASTER_1. The control information received by CSR_SLAVE_0 contains an instruction related to the IP core feedback status information. After receiving the instruction, CSR_SLAVE_1 feeds back to the specified bit of CSR_MASTER_1 according to the feedback requirements.
2. The low-latency communication method between IP cores within a SOC based on CSR according to claim 1, characterized in that, The control data format in step S3 is either the standard addr+value format or a custom format.
3. The low-latency communication method between IP cores within a SOC based on CSR according to claim 1, characterized in that, The asynchronous FIFO across clock domains in step S3 is a multi-level asynchronous FIFO, which is set according to the main frequency of the different modules that need to be passed through on the shortest path from the CPU to the IP core, and an asynchronous FIFO is set for each level of clock domain.
4. The low-latency communication method between IP cores within a SOC based on CSR according to claim 1, characterized in that, CSR_SLAVE also includes multiple slave CSRs connected to the IP core. After CSR_SLAVE parses the data format of CSR_SLAVE_0 in step S3, it also includes: If any slave CSR is directly connected to its corresponding IP core, then the slave CSR will write the parsed data to the corresponding IP core via the direct connection; or If any slave CSR is not directly connected to its corresponding IP core, the slave CSR will write the parsed data to the corresponding IP core via the standard bus closest to that IP core.
5. The low-latency communication method between IP cores within a SOC based on CSR according to claim 1, characterized in that, The feedback information in step S4 includes: a ready status and a completed status. When only the ready and completed statuses are fed back, the size is only 1 bit.
6. The low-latency communication method between IP cores within a SOC based on CSR according to claim 4, characterized in that, Also includes: Multiple slave CSRs are connected in series or parallel via a bus to form a set CSR_SLAVE_SET, and two ports are brought out: one is connected to CSR_SLAVE_0 for connection with CSR_MASTER_0, and the other is connected to CSR_SLAVE_1 for connection with CSR_MASTER_1.
7. The low-latency communication method between IP cores within a SOC based on CSR according to claim 1, characterized in that, The enhanced CSR_SLAVE also includes: Step S5: In CSR_SLAVE, set the "Feedback FIFO" cache and the "Listen FIFO" cache. The "Feedback FIFO" cache is the data written to CSR_SLAVE_0 triggered by an IP feedback status, and the "Listen FIFO" cache is the data written to the IP core triggered by the data in CSR_SLAVE_0.
