A message classification cache scheduling method, device, chip and electronic device
By dividing and merging message data in segmented interfaces on the chip, and storing and outputting them with multiple ports of RAM, the problem of difficult processing of message data and slow output speed in segmented interfaces is solved, and efficient Message processing.
Patent Information
- Application Number
- CN202411150549.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-21
AI Technical Summary
In the segmented interface, due to the complexity of message data and the difficulty of chip processing, the message data output speed is slow, causing data congestion and affecting normal processing.
By implementing the message classification cache scheduling method on the chip, dividing data belonging to different messages and merging data of the same priority, storing and outputting using multiple ports of RAM, ensuring that data at different priority levels are stored and output separately, and data congestion is avoided.
This improves the packet output speed, avoids the problem of data congestion in the chip, and ensures the normal progress of packet processing.
Smart Images

Figure CN118672807B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of chip technology, and in particular to a message classification cache scheduling method, device, chip and electronic device. Background Art
[0002] With the continuous improvement of ASIC (Application Specific Integrated Circuit) interface bandwidth, many high-speed interfaces MAC (Media Access Control Address) IP (Internet Protocol) provide user-side interfaces that often choose segmented interfaces. The main difference between segmented interfaces and ordinary interfaces in related technologies is that multiple messages may appear in the same beat, and the start and end positions of the messages are uncertain. That is, data belonging to different messages may be transmitted at the same time, but in ordinary interfaces, only data belonging to the same message may be transmitted in the same beat. And the sop (Start of Packet) indicator and the eop (End of Packet) indicator may appear at any segment position in the interface, but in ordinary interfaces, the sop indicator may only be located in the first data segment in a beat.
[0003] For example, see Figure 1 , which is a schematic diagram of a segmented interface in the related art.
[0004] The first row in the figure is the clock signal, and the second row is the valid signal. A high level valid signal indicates that there is a message transmission in this beat, and a low level valid signal indicates that there is no message transmission in this beat. From the third row onwards, each row corresponds to a data segment, from top to bottom, they are data segment 0-data segment Nseg-1, respectively, representing the 0th data segment to the Nseg-1th data segment in the same beat, and Nseg is the total number of data segments that can be transmitted in one beat by this segmented interface. The yellow part in the figure is data 1, the orange part is data 2, and the blue part is data 3, respectively, representing the data segments belonging to message 1-message 3. 1, 2, and 3 in the figure are sop1-sop3 of different messages 1-message 3, and 1', 2', and 3' are eop1-eop3 of different messages 1-message 3. The oblique line part in the figure indicates that there is no data transmission.
[0005] As can be seen from the figure, taking the third last beat as an example, the segmented interface transmits data 1, data 2, and data 3 belonging to three types of messages in the beat, and packet start 2 and packet start 3 are not located in the first data segment in the beat.
[0006] Based on the above characteristics, since the message data input into the chip through the segmented interface is relatively complex, it is difficult for the chip to process such message data. In the related art, the chip often divides the data of different messages input in the same beat into different beats for storage and output in different beats. This results in the message data that can be input into the chip in one beat needing to be divided into multiple beats for output from the chip. This makes the output speed of the message data slower than the input speed, which in turn causes data congestion in the chip, affecting the normal processing of the message. Summary of the invention
[0007] The purpose of the embodiments of the present application is to provide a message classification cache scheduling method, device, chip and electronic device to avoid the problem of message data congestion in the chip. The specific technical solution is as follows:
[0008] In a first aspect, an embodiment of the present application provides a message classification cache scheduling method, which is applied to a chip, and the method includes:
[0009] After receiving the message data within one beat through the segmented interface, the message data belonging to different messages are divided, and the message data belonging to the messages of the same priority are merged;
[0010] For each priority, determine a first address in a multi-port random access memory RAM currently corresponding to the priority, wherein the number of RAMs included in the multi-port RAM is equal to the maximum number of data segments that can be transmitted in one beat of the segmented interface;
[0011] The message data received in one beat is written into the multi-port RAM in the same beat in the following manner:
[0012] For each priority level, take the current first address corresponding to the priority level as the starting position, and write the message data of the priority level into the first storage space where the first address is located; if there is free space in the first storage space after writing, update the first address to the next address after the newly written message data; if there is no free space in the first storage space after writing, apply for a new storage space, and update the first address to the starting address of the new storage space; if there is still unwritten message data of the priority level, continue to write the message data with the updated first address as the starting position; wherein each storage space is composed of storage areas with the same offset in each RAM in the multi-port RAM, and each storage area can store a segment of message data received in one beat, and the initial first address is the starting address of the storage area first applied for the priority level;
[0013] Determine the target priority of the message data to be read;
[0014] Determine the second address currently corresponding to the target priority, read the message data belonging to the same message in the second storage space from the second address, and update the second address; wherein the second address is: the starting storage address of the message data corresponding to the target priority, which is not currently read and is written first, and the second storage space is the storage space where the current second address is located;
[0015] If the second storage space does not contain message data, and message data of the target priority that can constitute a complete message is also stored, the second address is updated to the starting address of the next storage space, and the step of returning to read the message data belonging to the same message in the second storage space from the second address and updating the second address is performed, wherein the next storage space is the next storage space applied for the target priority after the second storage space;
[0016] The message data belonging to the same message are merged, and the read message data belonging to the target priority level are output in the same beat.
[0017] In a second aspect, an embodiment of the present application provides a message classification cache scheduling device, which is applied to a chip, and the device includes:
[0018] A data processing module, for dividing the message data belonging to different messages and merging the message data of messages belonging to the same priority after receiving the message data within one beat through the segmented interface;
[0019] A first address determination module, used for determining, for each priority level, a first address in a multi-port random access memory RAM currently corresponding to the priority level, wherein the number of RAMs included in the multi-port RAM is equal to the maximum number of data segments that can be transmitted within one beat of the segmented interface;
[0020] The data writing module is used to write the message data received in one beat into the multi-port RAM in the same beat by:
[0021] For each priority level, take the current first address corresponding to the priority level as the starting position, and write the message data of the priority level into the first storage space where the first address is located; if there is free space in the first storage space after writing, update the first address to the next address after the newly written message data; if there is no free space in the first storage space after writing, apply for a new storage space, and update the first address to the starting address of the new storage space; if there is still unwritten message data of the priority level, continue to write the message data with the updated first address as the starting position; wherein each storage space is composed of storage areas with the same offset in each RAM in the multi-port RAM, and each storage area can store a segment of message data received in one beat, and the initial first address is the starting address of the storage area first applied for the priority level;
[0022] A priority determination module, used to determine the target priority of the message data to be read;
[0023] A data reading module, used to determine the second address currently corresponding to the target priority, read the message data belonging to the same message in the second storage space from the second address, and update the second address; wherein the second address is: the starting storage address of the message data corresponding to the target priority, which is not currently read and is written first, and the second storage space is the storage space where the current second address is located;
[0024] A second address updating module, configured to update the second address to the starting address of the next storage space if there is no message data in the second storage space and message data of the target priority that can constitute a complete message is also stored, and return to trigger the execution of the data reading module, wherein the next storage space is the next storage space applied for the target priority after the second storage space;
[0025] The data output module is used to merge the message data belonging to the same message and output the read message data belonging to the target priority in the same beat.
[0026] In a third aspect, an embodiment of the present application provides a chip, which is used to implement the method steps described in any one of the first aspects.
[0027] In a fourth aspect, an embodiment of the present application provides an electronic device, including a chip, wherein the chip is used to implement the method steps described in any one of the first aspects.
[0028] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.
[0029] In a sixth aspect, an embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the method steps described in the first aspect above.
[0030] Beneficial effects of the embodiments of the present application:
[0031] In the embodiment of the present application, after the chip receives the message data through the segmented interface, the message data in one beat is first divided and merged according to the priority, and then the message data of different priorities are stored and read separately. When storing, message data of different priorities are stored in different storage spaces. And messages of different priorities received in the same beat are stored in the same beat. Message data of different priorities are stored separately, which can facilitate the reading of message data of the target priority without affecting the stored message data of other priorities.
[0032] In addition, when storing message data, message data of the same priority level are stored together, and new storage space is requested only after one storage space is full, which can reduce the occupancy of storage space in the multi-port RAM.
[0033] Furthermore, when outputting message data, message data of more than one message belonging to the target priority can be output in the same beat, so the message output speed is faster than the related technology, thereby avoiding the problem of message data congestion in the chip. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and a person skilled in the art can also obtain other drawings based on these drawings.
[0035] Figure 1 A schematic diagram of a segmented interface in the related art;
[0036] Figure 2 A flowchart of a first message classification cache scheduling method provided in an embodiment of the present application;
[0037] Figure 3 A schematic diagram of the translation of the first type of message data provided in an embodiment of the present application;
[0038] Figure 4 A schematic diagram of a first multi-port RAM provided in an embodiment of the present application;
[0039] Figure 5 A schematic diagram of a second multi-port RAM provided in an embodiment of the present application;
[0040] Figure 6 A schematic diagram of a third multi-port RAM provided in an embodiment of the present application;
[0041] Figure 7 A schematic diagram of a fourth multi-port RAM provided in an embodiment of the present application;
[0042] Figure 8 A schematic diagram of the translation of the second type of message data provided in an embodiment of the present application;
[0043] Fig. 9 A schematic diagram of the translation of the third type of message data provided in an embodiment of the present application;
[0044] Fig.10 A schematic diagram of linked list data reading in a message data reading process provided in an embodiment of the present application;
[0045] Fig.11 A flow chart of a second message classification cache scheduling method provided in an embodiment of the present application;
[0046] Fig.12 A flowchart of a third message classification cache scheduling method provided in an embodiment of the present application;
[0047] Fig.13 A flowchart of a fourth message classification cache scheduling method provided in an embodiment of the present application;
[0048] Fig.14 A schematic diagram of the structure of a message classification cache scheduling device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0050] In the related art, the message data of the chip input with the same clock will be split into different beats for output. When outputting, the sop of the message data will be adjusted to be output after the starting data segment in one beat. For example, the data width of the segmented interface is [1024:0], the sop of the message data is located at the xth bit, x>0, and when outputting, the sop will be adjusted to the 0th bit, and the message data belonging to the same message as the sop will also be shifted equidistantly. After the message data is input into the chip, it can be stored in a FIFO (First Input First Output) until it is output.
[0051] However, there may be data congestion during this process. In the related technology, the system clock at the output end can be increased, that is, the output frequency of the message data can be increased to solve the data congestion problem. However, increasing the system clock at the output end is a hardware improvement. In most cases, it is not possible to directly increase the clock rate of the message processing part.
[0052] Furthermore, since the size of the FIFO storage space that a message needs to occupy before being processed is not easy to determine, space for storing message data in the FIFO needs to be reserved in order to store the message data. If the reserved space is small, write overflow may occur, and if the reserved space is large, chip resources will be wasted.
[0053] In order to solve the above problems, the embodiments of the present application provide a message classification cache scheduling method, device, chip and electronic device.
[0054] See also Figure 2 , which is a flow chart of the first message classification cache scheduling method provided in an embodiment of the present application, applied to a chip, the method includes the following steps S201-step S202, step S203A-step S203D, step S204-step S207, and steps S203A-step S203D shown in the figure are used to implement step S203.
[0055] S201: After receiving message data within one beat through a segmented interface, divide the message data belonging to different messages, and merge the message data of messages belonging to the same priority.
[0056] Assume that there are Nprio different priorities, the number of segments of the message data transmitted in each beat of the segmented interface is Nseg, and the number of bytes in each segment is Nbyte, so the data width of the segmented interface is Nseg×Nbyte×8. If the length of the smallest message that can appear in the system is Lmin bytes, then theoretically the maximum number of messages that can be transmitted in one beat of the segmented interface is: Pmax=Nseg×Nbyte / Lmin+1, where the message data transmitted in the front and rear data segments of each beat may only be a part of the message data of a complete message. For example, in the aforementioned Figure 1 In the illustrated embodiment, the message data transmitted by the frontmost data segment in the third-to-last beat is data1, belonging to message 1, and the message data transmitted by the last end is data3, belonging to message 3, both of which are only parts of the complete message.
[0057] In one embodiment of the present application, after receiving the message data in a beat through a segmented interface, the number of messages can be counted first, that is, the number of different messages to which the message data exists in the beat, which is recorded as Pkt_num. And the starting segment and the ending segment of each message are recorded. They are recorded as Pkt(0)_scope to Pkt(Pmax)_scope respectively. Wherein Pkt(Pmax)_scope is the position of the last message that may exist in the beat in theory. In the actual transmission process, there are often no Pmax messages in a beat. In this case, according to the actual number of messages, the position of each message can be recorded. Wherein, the starting segment of the message is the data segment where the sop of the message is located, and the ending segment is the data segment where the eop of the message is located. If the first half of the message does not exist in the beat, the starting segment of the message is the frontmost data segment, that is, data_seg(0). If the second half of the message does not exist in the beat, the ending segment of the message is the last data segment, that is, data_seg(Nseg-1).
[0058] by Figure 1 For example, in the third-to-last beat, the starting segment of message 1 is data segment 0, and the ending segment is data segment 2; the starting segment of message 2 is data segment 4, and the ending segment is data segment Nseg-5; the starting segment of message 3 is data segment Nseg-4, and the ending segment is data segment Nseg-1.
[0059] After determining the location of each message, determine the priority of each message, record the priority information indicating the priority of the message, and transmit it together with the message data of the message, so that the subsequent module can determine the priority of the message data. Figure 1 For example, in the third-to-last beat, messages 1 and 3 belong to priority 1, and message 2 belongs to priority 2.
[0060] After determining the priority of the message, the message data is split in units of messages according to the positions of the determined messages, and at most Pmax (that is, the maximum number of messages in one beat) groups of message data can be obtained.
[0061] Afterwards, the split message data are merged according to the priority. For example, in the example above, message 1 is merged with message 3. Since message 1 is located before message 3 during transmission, message 1 is still located before message 3 after merging. Specifically, merging refers to splicing the message data of the same priority level end to end without any gaps in between. For example, as in the example above, the packet end 1 of message 1 is located in data segment 2, and the packet start 3 of message 3 is located in data segment Nseg-4. Then, the message data of message 3 is shifted forward as a whole by Nseg-7 data segments so that the two are merged. When the message data is subsequently written into the multi-port RAM, the merged data is written together as a whole set of data.
[0062] See also Figure 3 , which is a schematic diagram of the translation of the first type of message data provided in an embodiment of the present application.
[0063] The figure contains 3 segments of message data belonging to message 0, namely message 0_data segment 0 to message 0_data segment 2, and 2 segments of message data belonging to message 1, namely message 1_data segment 0 and message 1_data segment 1. Message 0 and message 1 belong to the same priority, and there is an invalid field between them. The upper end of the figure is the starting side, and the message data of the following message 1 is shifted to after the message data of message 0. The left side shows the data distribution before the shift, and the right side shows the data distribution after the shift. It can be seen that after the shift, the message data of message 0 and message 1 of the same priority are merged. The part framed by the dotted line is the message data of message 1 that is shifted.
[0064] If there is only one message for a priority level in the same beat, there is no need to merge the message data for the priority level.
[0065] In one embodiment of the present application, message data belonging to the same priority level can be merged through the following steps A-B.
[0066] Step A: When there are message data of the same priority level and belonging to different messages in the message data received within one beat, the message data at the rear end is shifted to the next data segment after the tail of the message data at the front end.
[0067] Specifically, when the number of messages with the same priority is 2, the message data of the subsequent message is moved forward to behind the message data of the previous message, and is connected to the message data of the previous message. When the number of messages with the same priority is greater than 2, for every two adjacent messages, the message data of the subsequent message is moved forward to behind the message data of the previous message, and is connected to the message data of the previous message. Finally, the message data of multiple messages are connected in sequence without any gaps.
[0068] Step B: For each priority level, the message data belonging to the priority level is shifted to the starting data segment.
[0069] Specifically, the merged message data corresponding to each priority level is centrally shifted to the actual data segment, that is, data segment 0.
[0070] Still Figure 1For example, since the front-end data segment of the message data of priority 1 is already located in the starting data segment after the merger, there is no need to shift it. For the message data of message 2 corresponding to priority 2, this type of message data is shifted forward by 4 data segments as a whole, so that the message data corresponding to priority 2 also starts from data segment 0. However, it should be noted that the same starting data segment of the two does not mean that the message data of the two priorities overlap, and the two are actually stored separately.
[0071] In one embodiment of the present application, the message data belonging to different messages can be divided by a message splitting and merging unit, and the message data of messages belonging to the same priority can be merged. The message splitting and merging unit includes an input interface for receiving message data in each beat, and the number of output interfaces is the same as the number of priorities (i.e., Nprio). Each output interface corresponds to a priority and is used to output message data of the priority. Since there are multiple output interfaces, message data of different priorities can be output in the same beat.
[0072] S202: For each priority level, determine a first address in the multi-port random access memory currently corresponding to the priority level.
[0073] The number of RAMs included in the multi-port random access memory, ie, the multi-port RAM, is equal to the maximum number of data segments that can be transmitted within one beat of the segmented interface, ie, Nseg.
[0074] For each priority level, the first address of the priority level will be continuously updated as the message data of the priority level is written into the multi-port RAM. For the specific updating process, please refer to the description of steps S203A to S203C below.
[0075] Since the first address is continuously updated, the chip can store the first addresses corresponding to each priority level, and the stored first addresses are synchronized with the actual updates of the first addresses. Then, the actual value of the current first address can be determined by reading the stored data.
[0076] In one embodiment of the present application, the first address may be stored in a linked list, each priority level corresponds to a linked list, and the data recorded in the linked list may include the first address. Specifically, the linked list may be a FIFO, which is managed by a linked list management unit.
[0077] Afterwards, the message data received within one beat is written into the multi-port RAM within the same beat through steps S203A to S203D.
[0078] Since the maximum number of segments of message data that can be received in one beat is Nseg, and the number of RAMs in the multi-port RAM is equal to Nseg, different data segments of message data received in the same beat can be written into different RAMs in the same beat. The bit width of each RAM is Nbyte×8, where Nbyte is the number of bytes of each data segment.
[0079] S203A: For each priority level, taking the current first address corresponding to the priority level as the starting position, the message data of the priority level is written into the first storage space where the first address is located.
[0080] Among them, each storage space is composed of storage areas with the same offset in each RAM in the above-mentioned multi-port RAM, each storage area can store a segment of message data received in one beat, and the initial first address is the starting address of the storage area first applied for this priority.
[0081] Specifically, the message data includes different data segments, and different data segments are written into different storage areas. When writing, the frontmost data segment in the message data is written into the storage area indicated by the current first address, the second data segment is written into the next storage area after the storage area indicated by the first address, the third data segment is written into the second storage area after the storage area indicated by the first address, and so on.
[0082] In order to save storage space, each storage area can accommodate a data volume equal to a segment of message data.
[0083] See also Figure 4 , is a schematic diagram of the first multi-port RAM provided in an embodiment of the present application.
[0084] Each square in the figure represents a storage area. Each storage area in each horizontal row constitutes a RAM, including N+1 RAMs in total, RAM0-RAMN from top to bottom. The vertical storage areas constitute a storage space. The interface of RAM0 is interface 0, the interface of RAM1 is interface 1, the interface of RAM2 is interface 2, and so on. The interfaces of each RAM are used to write and read message data. The addresses of each storage space are address 1-address M.
[0085] The message data output by the message splitting and merging unit is input into the write management unit for implementing the following steps S202-S203, wherein the write management unit has Nprio input interfaces, which correspond one-to-one to the output interfaces of the message splitting and merging unit, and the write management unit has multiple output interfaces, which are respectively connected one-to-one to the input interfaces of the multi-port RAM. Figure 4 Interface 0 to interface N shown in are the number of interfaces of the RAM, which is equal to the number of RAMs, that is, equal to Nseg. Figure 4There are two groups of RAM interface 0-interface N on the left and right sides respectively, and each group of interface 0-interface N constitutes a multi-port RAM interface. Figure 4 The multi-port RAM in the figure includes two multi-port RAM interfaces. In actual situations, the number of multi-port RAM interfaces may be 2, 4, etc. The case where the number of multi-port RAM interfaces is 2 is only an example. In actual configuration, the number of RAM interfaces is greater than Pmax (i.e., the maximum number of messages that can be transmitted in one beat) and the minimum value of the number of priority types.
[0086] S203B: If there is free space in the first storage space after writing, the first address is updated to the next address after the newly written message data.
[0087] Specifically, different data segments in the message data of this priority level will be stored in storage areas in different RAMs. If there is still free space in the first storage space after the data is written this time, the data of this priority level can continue to be written in the free space next time. Therefore, the first address needs to be updated to the next address after the newly written message data, that is, the next storage area after the storage area where the tail of the newly written message data is located.
[0088] With the aforementioned Figure 4 Taking the embodiment shown as an example, if the first storage space is the leftmost storage space, in the initial state, the first address points to the frontmost storage area of the first storage space. If the written data occupies two storage areas, the first address after update is the address of the third storage area in the first storage space.
[0089] Based on the above embodiments, see Figure 5 , is a schematic diagram of a second multi-port RAM provided in an embodiment of the present application.
[0090] and Figure 4 Compared with the embodiment shown, the gray storage area in the figure is the storage area where the message data is written. As can be seen from the figure, the message data is currently written in the first storage area. In this case, the updated first address is the address of the third storage area in the first storage space.
[0091] After executing step S203B, continue to execute the following step S203D.
[0092] S203C: If there is no free space in the first storage space after writing, apply for a new storage space and update the first address to the starting address of the new storage space.
[0093] In both cases, there is no free space in the first storage space after writing.
[0094] The first case is that the message data of this priority that needs to be written this time has been written. In order to continue writing data next time, a new storage space can be applied for this priority, and the first address is updated to the starting address of the new storage space. The new storage space becomes the new first storage space. When the data of this priority is received again in the future, the data can continue to be written starting from the first address.
[0095] See also Figure 6 , is a schematic diagram of a third multi-port RAM provided in an embodiment of the present application.
[0096] In the aforementioned Figure 5 Based on the embodiment shown, the data of the priority level is continuously written. If the tail of the written message data is located at the RAM at the last end, there is no free space in the first storage space. In this case, a new storage space can be applied for, for example, the new storage space applied for is the storage space in the second column on the left. The first address is updated to the address of the frontmost storage area in the storage space in the second column.
[0097] It should be noted that the new storage space applied for may be any free storage space, and the new storage space may not be adjacent to the current first storage space.
[0098] The second situation is that the message data of the priority level to be written this time has not been written, but the first storage space is exhausted. In order to write the message data of the priority level to be written this time into the RAM, it is necessary to apply for a new storage space, and update the first address to the starting address of the new storage space, so that the new storage space becomes the new first storage space, and the message data that has not been written can continue to be written in the new storage space. Specifically, the writing process is described in step S203D below.
[0099] In one embodiment of the present application, a storage space may be applied for from the address pointer management unit, and the storage space that may be applied for is an idle storage space that does not store any data.
[0100] S203D: If there is still unwritten message data of the priority level, continue writing the message data with the updated first address as the starting position.
[0101] After executing step S203D, the process returns to executing step S203B or step S203C.
[0102] See also Figure 7 , is a schematic diagram of the fourth multi-port RAM provided in an embodiment of the present application.
[0103] On the basis of the embodiment shown in 5 above, the data of the priority level is continuously written. If there are still two segments of unwritten message data after the first storage space is full, a new storage space is applied. For example, the new storage space applied is the storage space in the second column on the left. The first address is updated to the address of the frontmost storage area in the storage space in the second column. The remaining two segments of message data are written into the new storage space.
[0104] It should be noted that after continuing to write the message data, the first address also needs to be updated.
[0105] See also Figure 8 , which is a schematic diagram of the translation of the second type of message data provided in an embodiment of the present application.
[0106] The left side of the figure shows the message data to be written, and each square on the left side represents each data segment in the message data to be written, which are message data segment 0 to message data segment N respectively.
[0107] The message data to be written needs to be written Figure 5 In the case of the first storage space shown, message data segment 0 needs to be written into the third storage area in the first storage space. Therefore, the message data needs to be shifted and written into the original first storage space, and the remaining two message data segments N-1 and message data segment N are shifted and written into the new first storage space.
[0108] In another embodiment of the present application, when the size of the free space in the current first storage space is smaller than a preset size, a new storage space is applied for in advance.
[0109] In this case, when there is no free space in the first storage space, it is not necessary to apply for a new storage space, and the already applied storage space can be directly used.
[0110] That is, when the first storage space is about to be exhausted, a new storage space is applied for in advance, so that after the first storage space is exhausted, the first address can be directly updated to the starting position of the new storage space, and the message data can be directly continued to be written.
[0111] S204: Determine the target priority of the message data to be read.
[0112] In one embodiment of the present application, the target priority may be a priority selected by the controller. Alternatively, the highest priority in a preset priority order among the priorities of complete message data having at least one message stored in the multi-port RAM may be used as the target priority, thereby enabling high-priority message data to be read first.
[0113] In another embodiment of the present application, the linked list corresponding to each priority also records the number of complete messages belonging to the priority currently stored in the multi-port RAM. Specifically, for each priority, whenever an eop of message data of the priority is written to the multi-port RAM, the number of complete messages of the priority recorded is increased by 1, and whenever an eop of message data of the priority is read, the number of complete messages of the priority recorded is decreased by 1.
[0114] In addition, the aforementioned linked list management unit may output a priority message ready (Nprio_pkt_ready) signal, each message ready signal corresponds to a priority, and the level of the message ready signal is a preset level, indicating that at least one complete message belonging to the priority is currently stored in the multi-port RAM. For example, the preset level is a high level.
[0115] The priority of the complete message data storing at least one message can be determined through the above linked list, and then the highest priority is determined therefrom as the target priority.
[0116] S205: Determine a second address currently corresponding to the target priority, read message data belonging to the same message in the second storage space starting from the second address, and update the second address.
[0117] The second address is: the starting storage address of the message data that is not currently read and is written first, corresponding to the target priority, and the second storage space is the storage space where the current second address is located.
[0118] It should be noted that, in order to ensure the integrity of the message data, the target priority will not be changed before the reading of the message data of a complete message is completed.
[0119] In one embodiment of the present application, the second addresses corresponding to the respective priorities are respectively stored in the linked lists corresponding to the respective priorities.
[0120] After the message data of the message is read, if there is still unread message data in the second storage space, the second address is updated to the next address after the tail of the read message data.
[0121] If after reading the message data of the message, there is no unread message data in the second storage space, and there is still message data of the target priority that can constitute a complete message, that is, it is necessary to continue reading message data of the target priority, execute step S206.
[0122] S206: If there is no message data in the second storage space, and the multi-port random access memory still stores message data of the target priority level that can constitute a complete message, update the second address to the start address of the next storage space.
[0123] The next storage space is the next storage space applied for the target priority level after the second storage space.
[0124] Specifically, as shown above, when writing message data of the target priority, one or more storage spaces will be applied for the target priority, and each storage space is applied in sequence. The next storage space is the next storage space after the current second storage space in the application order.
[0125] In addition, the message data that can form a complete message can be currently all stored in the multi-port RAM, or a part of it has been read and the other part is still stored in the multi-port RAM.
[0126] In one embodiment of the present application, the method for determining whether there is message data of the target priority level that can constitute a complete message can refer to the aforementioned linked list-based determination method, which will not be repeated here.
[0127] Return to step S205.
[0128] S207: Merge the message data belonging to the same message, and output the read message data belonging to the target priority level in the same beat.
[0129] In one embodiment of the present application, if the message data belonging to the same message is read from a storage space, the data segments in the read message data are originally adjacent, and therefore may not be merged but directly output.
[0130] In another embodiment of the present application, if message data belonging to the same message is read from multiple storage spaces, the data segments in the read message data are not adjacent, and in this case, they need to be merged. Specifically, the message data read from the later storage space is translated to after the message data read from the earlier storage space.
[0131] See also Fig. 9 , which is a schematic diagram of the translation of the third type of message data provided in an embodiment of the present application.
[0132] The left side of the figure shows the message data before translation, and each square represents a data segment. The data segments framed by the first two dotted lines are message data segments read from the rear storage space, and the subsequent data segments are message data segments read from the front storage space. In the case where the message data is written into the multi-port RAM in the aforementioned manner, if the message data of the same message is distributed in different storage spaces, the message data of the message must be stored in the rear storage space starting from the frontmost RAM. As a result, the message data segment read from the rear storage space is located at the front.
[0133] After the message data is shifted, the message data segment read from the later storage space is shifted to after the message data segment read from the earlier storage space, thereby restoring the original arrangement order of the message data segments and merging them to obtain a complete message.
[0134] See also Fig.10 , is a schematic diagram of linked list data reading in a message data reading process provided in an embodiment of the present application.
[0135] In the figure, according to the level of the message preparation signal of each priority 0-priority N, the priority of the message data to be output is determined, and then the target priority is selected. The linked list data corresponding to the target priority is extracted. Specifically, the second address can be extracted, etc. Finally, the message is output.
[0136] As can be seen from the above, in the embodiment of the present application, after the chip receives the message data through the segmented interface, the message data in one beat is first divided and merged according to the priority, and then the message data of different priorities are stored and read separately. When storing, message data of different priorities are stored in different storage spaces. And messages of different priorities received in the same beat are stored in the same beat. Message data of different priorities are stored separately, which can facilitate the reading of message data of the target priority without affecting the stored message data of other priorities.
[0137] In addition, when storing message data, message data of the same priority level are stored together, and new storage space is requested only after one storage space is full, which can reduce the occupancy of storage space in the multi-port RAM.
[0138] Furthermore, when outputting message data, message data of more than one message belonging to the target priority can be output in the same beat, so the message output speed is faster than the related technology, thereby avoiding the problem of message data congestion in the chip.
[0139] In one embodiment of the present application, the first address is indicated by a first pointer and a second pointer, the first pointer indicates the RAM where the current first address is located, and the second pointer indicates the current first storage space.
[0140] Specifically, the initial first pointer points to the frontmost RAM, and the initial second pointer points to the first storage space initially applied for with priority.
[0141] The second address is indicated by a third pointer and a fourth pointer, the third pointer indicates the RAM where the current second address is located, and the fourth pointer indicates the current second storage space.
[0142] Specifically, the initial third pointer points to the frontmost RAM, and the initial fourth pointer points to the storage space initially applied for the target priority.
[0143] By the aforementioned Figure 4 As can be seen from the embodiment shown, the multi-port RAM is divided into a horizontal RAM and a vertical storage space, which is a two-dimensional structure. Therefore, the address in the multi-port RAM can be represented by two pointers. When writing message data, the first address is indicated by the first pointer and the second pointer. When reading data, the second address is indicated by the third pointer and the fourth pointer.
[0144] On this basis, if there is free space in the above-mentioned first storage space after writing, the first address is updated to the next address after the newly written message data, which can be achieved by the following step C.
[0145] Step C: If there is free space in the first storage space after writing, the first pointer is pointed to the next RAM after the tail of the newly written message data.
[0146] Since there is free space in the first storage space, the message data is still written in the first storage space next time, and the first address is still in the first storage space, so there is no need to update the second pointer pointing to the first storage space, only the first pointer needs to be updated.
[0147] In addition, after applying for a new storage space, the message data is subsequently written into the new storage space. Therefore, the aforementioned application for a new storage space and updating the first address to the starting address of the new storage space can be achieved through the following step D.
[0148] Step D: Apply for new storage space, point the first pointer to the frontmost RAM, and point the second pointer to the new storage space.
[0149] After applying for a new storage space, data needs to be written to the new storage space. Therefore, the first address indicated by the first pointer and the second pointer needs to be updated to the starting position of the new storage space, that is, the position of the frontmost storage area in the new storage space. The frontmost storage area is located in the frontmost RAM. Therefore, the first pointer needs to point to the frontmost RAM, and the second pointer needs to point to the new storage space.
[0150] After reading the message data of the target priority, if there is still message data in the second storage space, the message data needs to be read from the second storage space subsequently, so the storage space indicated by the fourth pointer remains unchanged, but the RAM indicated by the third pointer changes with the data reading.
[0151] Therefore, the aforementioned reading of the message data belonging to the same message in the second storage space from the second address and updating the second address can be achieved through step E.
[0152] Step E: Read the message data belonging to the same message in the second storage space starting from the second address, and point the third pointer to the next RAM after the tail of the newly read message data.
[0153] Since the message data of the same priority level are closely connected during data storage, the header of the next message data to be read should be located after the tail of the message data read this time. Therefore, the third pointer needs to point to the next RAM after the tail of the newly read message data.
[0154] If there is no message data in the current second storage space, that is, all data have been read, and message data of the target priority level that can constitute a complete message is still stored, that is, message data of the target priority level needs to be continued to be read, then it is necessary to continue reading message data in the next storage space.
[0155] In this case, the above-mentioned updating of the second address to the starting address of the next storage space can be achieved by the following step F.
[0156] Step F: point the third pointer to the frontmost RAM, and point the fourth pointer to the next storage space.
[0157] When reading data from the next storage space, it is necessary to start reading data from the starting position of the next storage space, so the third pointer points to the frontmost RAM, and the fourth pointer points to the next storage space, so that the second address is updated to the starting address of the next storage space.
[0158] In addition, if there is no message data of the target priority that can constitute a complete message, that is, there is no need to continue reading the message data of the target priority, the third pointer can be pointed to the frontmost RAM, and after waiting for the subsequent writing of new message data of the target priority, the message data can be read from the frontmost RAM.
[0159] See also Fig.11 , is a flow chart of a second message classification cache scheduling method provided in an embodiment of the present application, which is similar to the aforementioned Figure 2 Compared with the embodiment shown, the method further includes the following step S208.
[0160] S208: After all data stored in a storage space is read, the storage space is used again as a storage space that can be applied for.
[0161] After all the data stored in a storage space is read, the storage space is empty and can be reused to write other message data. Therefore, the storage space can be reused as the requested storage space and managed by the address pointer management unit, thereby making full use of the data storage resources in the multi-port RAM.
[0162] In one embodiment of the present application, for each priority level, there is a linked list corresponding to the priority level, and the linked list records at least one of the following information: the first address corresponding to the priority level, the second address, the number of complete messages belonging to the priority level currently stored in the multi-port RAM, and the amount of message data belonging to the priority level currently stored in the multi-port RAM.
[0163] Wherein, the linked list may be in the form of a FIFO, and the processed data other than the message data in the embodiment of the present application may be stored in the linked list. In the case where the first address is represented by the first pointer and the second pointer, the first pointer and the second pointer may be stored in the linked list instead of the first address. In the case where the second address is represented by the third pointer and the fourth pointer, the third pointer and the fourth pointer may be stored in the linked list instead of the second address.
[0164] In addition, the data volume of the message data belonging to the priority level currently stored in the multi-port RAM may be referred to as the depth of the message data of the priority level.
[0165] For each priority level, when the amount of message data belonging to the priority level currently stored in the multi-port RAM is recorded in the linked list corresponding to the priority level, refer to Fig.12 , is a flow chart of a third message classification cache scheduling method provided in an embodiment of the present application, which is similar to the aforementioned Figure 2 Compared with the embodiment shown, the method further includes the following step S209.
[0166] S209: Determine the priority of the corresponding data volume greater than the preset data volume according to the information stored in the linked list, and send a back pressure signal to the data input end connected to the segmented interface so that the data input end reduces the input speed of the message data of the priority.
[0167] If there is a priority whose corresponding data volume is greater than the preset data volume, it means that the data volume of the message belonging to this priority in the input chip is large, occupying more storage space in the chip. It will affect the storage of message data of other priorities. In this case, a back pressure signal can be sent to the data input end, so that the above data input end reduces the input speed of the message data of this priority, so as to reduce the occupation of the storage space in the chip by the message data of this priority.
[0168] In one embodiment of the present application, after receiving the back pressure signal, the data input end can suspend inputting the message data of this priority into the chip, and the suspension duration can be a preset duration, or it can be suspended until a resume signal is received.
[0169] In another embodiment of the present application, after receiving the back pressure signal, the data input end can reduce the transmission speed of the message data of the priority level by a preset step size.
[0170] See also Fig.13 , which is a flow chart of the fourth message classification cache scheduling method provided in an embodiment of the present application.
[0171] After receiving the message data input from the segmented interface, the message range determination unit determines the range of each message. Then the priority determination unit determines the priority corresponding to each message. Then the message splitting and merging unit divides the message data belonging to different messages and merges the message data belonging to the same priority.
[0172] That is, step S201 is implemented by the message range determination unit, the priority determination unit and the message splitting and merging unit.
[0173] The number of output interfaces of the message splitting and merging unit is the same as the number of priorities, and message data of different priorities are input into the write management unit through corresponding different output interfaces.
[0174] The write management unit is used to implement steps S202, S203A, S203B, S203C, and S203D, and write the message data into the multi-port random access memory.
[0175] Furthermore, the linked list is managed by the linked list management unit. Step S209 is implemented by the back pressure unit according to the data volume corresponding to the priority recorded in the linked list.
[0176] In addition, steps S204 to S207 are implemented through the read management unit to realize the reading and output of the message data.
[0177] Furthermore, the address pointer management unit allocates new storage space for the write management unit and reclaims the storage space that is free after the message data is read by the speed management unit.
[0178] Corresponding to the aforementioned message classification cache scheduling method applied to a chip, an embodiment of the present application further provides a message classification cache scheduling device applied to a chip.
[0179] See also Fig.14 , is a structural diagram of a message classification cache scheduling device provided in an embodiment of the present application. Applied to a chip, the device includes:
[0180] The data processing module 1401 is used to divide the message data belonging to different messages and merge the message data of messages belonging to the same priority after receiving the message data within one beat through the segmented interface;
[0181] A first address determination module 1402 is used to determine, for each priority level, a first address in a multi-port random access memory RAM currently corresponding to the priority level, wherein the number of RAMs included in the multi-port RAM is equal to the maximum number of data segments that can be transmitted in one beat of the segmented interface;
[0182] The data writing module 1403 is used to write the message data received in one beat into the multi-port RAM in the same beat by:
[0183] For each priority level, take the current first address corresponding to the priority level as the starting position, and write the message data of the priority level into the first storage space where the first address is located; if there is free space in the first storage space after writing, update the first address to the next address after the newly written message data; if there is no free space in the first storage space after writing, apply for a new storage space, and update the first address to the starting address of the new storage space; if there is still unwritten message data of the priority level, continue to write the message data with the updated first address as the starting position; wherein each storage space is composed of storage areas with the same offset in each RAM in the multi-port RAM, and each storage area can store a segment of message data received in one beat, and the initial first address is the starting address of the storage area first applied for the priority level;
[0184] The priority determination module 1404 is used to determine the target priority of the message data to be read;
[0185] The data reading module 1405 is used to determine the second address currently corresponding to the target priority, read the message data belonging to the same message in the second storage space from the second address, and update the second address; wherein the second address is: the starting storage address of the message data corresponding to the target priority, which is not currently read and is written first, and the second storage space is the storage space where the current second address is located;
[0186] A second address updating module 1406 is configured to update the second address to the starting address of the next storage space if there is no message data in the second storage space and message data of the target priority that can constitute a complete message is also stored, and return to trigger the execution of the data reading module, wherein the next storage space is the next storage space applied for the target priority after the second storage space;
[0187] The data output module 1407 is used to merge the message data belonging to the same message and output the read message data belonging to the target priority in the same beat.
[0188] As can be seen from the above, in the embodiment of the present application, after the chip receives the message data through the segmented interface, the message data in one beat is first divided and merged according to the priority, and then the message data of different priorities are stored and read separately. When storing, message data of different priorities are stored in different storage spaces. And messages of different priorities received in the same beat are stored in the same beat. Message data of different priorities are stored separately, which can facilitate the reading of message data of the target priority without affecting the stored message data of other priorities.
[0189] In addition, when storing message data, message data of the same priority level are stored together, and new storage space is requested only after one storage space is full, which can reduce the occupancy of storage space in the multi-port RAM.
[0190] Furthermore, when outputting message data, message data of more than one message belonging to the target priority can be output in the same beat, so the message output speed is faster than the related technology, thereby avoiding the problem of message data congestion in the chip.
[0191] In one embodiment of the present application, the first address is indicated by a first pointer and a second pointer, the first pointer indicates the RAM where the current first address is located, and the second pointer indicates the current first storage space;
[0192] The second address is indicated by a third pointer and a fourth pointer, the third pointer indicates the RAM where the current second address is located, and the fourth pointer indicates the current second storage space;
[0193] The data writing module 1403 is specifically used to write the message data received in one beat into the multi-port RAM in the same beat by:
[0194] For each priority level, the message data of the priority level is written into the first storage space where the first address is located, with the current first address corresponding to the priority level as the starting position; if there is free space in the first storage space after writing, the first pointer is pointed to the next RAM after the tail of the newly written message data; if there is no free space in the first storage space after writing, a new storage space is applied, the first pointer is pointed to the frontmost RAM, and the second pointer is pointed to the new storage space; if there is still unwritten message data of the priority level, the message data is continued to be written with the updated first address as the starting position;
[0195] The data reading module 1405 is specifically used for:
[0196] Determine a second address currently corresponding to the target priority, read message data belonging to the same message in the second storage space from the second address, and point the third pointer to the next RAM after the tail of the newly read message data;
[0197] The second address updating module 1406 is specifically configured to:
[0198] If there is no message data in the second storage space, and message data of the target priority level that can constitute a complete message is also stored, the third pointer is pointed to the frontmost RAM, and the fourth pointer is pointed to the next storage space.
[0199] In one embodiment of the present application, the device further includes:
[0200] The space recovery module is used to restore a storage space as a storage space that can be applied for after all data stored in the storage space has been read.
[0201] After all the data stored in a storage space are read, the storage space becomes empty and can be reused to write other message data. Therefore, the storage space can be reused as the requested storage space, thereby making full use of the data storage resources in the multi-port RAM.
[0202] In one embodiment of the present application, the data processing module 1401 includes:
[0203] After receiving the message data in one beat through the segmented interface, the message data belonging to different messages are divided;
[0204] When there are message data of the same priority but belonging to different messages in the message data received within one beat, the message data at the rear end is shifted to the next data segment after the tail of the message data at the front end;
[0205] For each priority level, the message data belonging to the priority level is shifted to the starting data segment.
[0206] In one embodiment of the present application, for each priority level, there is a linked list corresponding to the priority level, and at least one of the following information is recorded in the linked list: the first address corresponding to the priority level, the second address, the number of complete messages belonging to the priority level currently stored in the multi-port RAM, and the amount of message data belonging to the priority level currently stored in the multi-port RAM.
[0207] In one embodiment of the present application, for each priority level, when the amount of message data belonging to the priority level currently stored in the multi-port RAM is recorded in the linked list corresponding to the priority level, the device further includes:
[0208] The back pressure module is used to determine the priority of the corresponding data volume greater than the preset data volume according to the information stored in the linked list, and send a back pressure signal to the data input end connected to the segmented interface to make the data input end reduce the input speed of the message data of this priority.
[0209] If there is a priority whose corresponding data volume is greater than the preset data volume, it means that the data volume of the message belonging to this priority in the input chip is large, occupying more storage space in the chip. It will affect the storage of message data of other priorities. In this case, a back pressure signal can be sent to the data input end, so that the above data input end reduces the input speed of the message data of this priority, so as to reduce the occupation of the storage space in the chip by the message data of this priority.
[0210] In one embodiment of the present application, the device further includes:
[0211] The space pre-application module is used to pre-apply for new storage space when the size of the free space in the current first storage space is smaller than a preset size.
[0212] When the first storage space is about to be exhausted, a new storage space is applied for in advance, so that after the first storage space is exhausted, the first address can be directly updated to the starting position of the new storage space, and the message data can be directly continued to be written.
[0213] Corresponding to the aforementioned message classification cache scheduling method, an embodiment of the present application further provides a chip, which is used to implement any one of the method steps in the message classification cache scheduling method.
[0214] Specifically, the above chip may be a FPGA (Field Programmable Gate Array) or other chips, which is not limited in the present application.
[0215] In another embodiment of the present application, an electronic device is provided, including a chip, wherein the chip is used to implement any one of the method steps in the message classification cache scheduling method.
[0216] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, any method step of the above-mentioned message classification cache scheduling method is implemented.
[0217] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the message classification cache scheduling methods in the above embodiments.
[0218] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0219] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0220] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, chip, electronic device, computer-readable storage medium and computer program embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0221] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A message classification cache scheduling method, characterized in that: Applied to a chip, the method comprises: After receiving the message data within one beat through the segmented interface, the message data belonging to different messages are divided, and the message data belonging to the messages of the same priority are merged; For each priority, determine a first address in a multi-port random access memory RAM currently corresponding to the priority, wherein the number of RAMs included in the multi-port RAM is equal to the maximum number of data segments that can be transmitted in one beat of the segmented interface; The message data received in one beat is written into the multi-port RAM in the same beat in the following manner: For each priority level, take the current first address corresponding to the priority level as the starting position, and write the message data of the priority level into the first storage space where the first address is located; if there is free space in the first storage space after writing, update the first address to the next address after the newly written message data; if there is no free space in the first storage space after writing, apply for a new storage space, and update the first address to the starting address of the new storage space; if there is still unwritten message data of the priority level, continue to write the message data with the updated first address as the starting position; wherein each storage space is composed of storage areas with the same offset in each RAM in the multi-port RAM, and each storage area can store a segment of message data received in one beat, and the initial first address is the starting address of the storage area first applied for the priority level; Determine the target priority of the message data to be read; Determine the second address currently corresponding to the target priority, read the message data belonging to the same message in the second storage space from the second address, and update the second address; wherein the second address is: the starting storage address of the message data corresponding to the target priority, which is not currently read and is written first, and the second storage space is the storage space where the current second address is located; If the second storage space does not contain message data, and message data of the target priority that can constitute a complete message is also stored, the second address is updated to the starting address of the next storage space, and the step of returning to read the message data belonging to the same message in the second storage space from the second address and updating the second address is performed, wherein the next storage space is the next storage space applied for the target priority after the second storage space; The message data belonging to the same message are merged, and the read message data belonging to the target priority level are output in the same beat.
2. The method according to claim 1, characterized in that The first address is indicated by a first pointer and a second pointer, the first pointer indicates the RAM where the current first address is located, and the second pointer indicates the current first storage space; The second address is indicated by a third pointer and a fourth pointer, the third pointer indicates the RAM where the current second address is located, and the fourth pointer indicates the current second storage space; If there is free space in the first storage space after writing, updating the first address to the next address after the newly written message data comprises: If there is free space in the first storage space after writing, the first pointer is pointed to the next RAM after the tail of the newly written message data; The step of applying for a new storage space and updating the first address to the starting address of the new storage space includes: Apply for new storage space, point the first pointer to the frontmost RAM, and point the second pointer to the new storage space; The step of reading the message data belonging to the same message in the second storage space from the second address and updating the second address comprises: Reading the message data belonging to the same message in the second storage space from the second address, and pointing the third pointer to the next RAM after the tail of the newly read message data; The updating of the second address to the starting address of the next storage space comprises: The third pointer is pointed to the frontmost RAM, and the fourth pointer is pointed to the next storage space.
3. The method according to claim 1, characterized in that The method further comprises: After all data stored in a storage space is read, the storage space is used again as a storage space that can be applied for.
4. The method according to claim 1, characterized in that: The merging of message data belonging to the same priority level includes: When there are message data of the same priority but belonging to different messages in the message data received within one beat, the message data at the rear end is shifted to the next data segment after the tail of the message data at the front end; For each priority level, the message data belonging to the priority level is shifted to the starting data segment.
5. The method according to any one of claims 1 to 4, characterized in that For each priority level, there is a linked list corresponding to the priority level, and the linked list records at least one of the following information: the first address corresponding to the priority level, the second address, the number of complete messages belonging to the priority level currently stored in the multi-port RAM, and the amount of message data belonging to the priority level currently stored in the multi-port RAM.
6. The method according to claim 5, characterized in that For each priority level, in a case where the amount of message data belonging to the priority level currently stored in the multi-port RAM is recorded in the linked list corresponding to the priority level, the method further includes: According to the information stored in the linked list, the priority of the corresponding data volume greater than the preset data volume is determined, and a back pressure signal is sent to the data input end of the segmented interface connection to make the data input end reduce the input speed of the message data of this priority.
7. The method according to any one of claims 1 to 4, characterized in that The method further comprises: When the size of the free space in the current first storage space is smaller than the preset size, a new storage space is applied for in advance.
8. A message classification cache scheduling device, characterized in that: Applied to a chip, the device comprises: A data processing module, for dividing the message data belonging to different messages and merging the message data of messages belonging to the same priority after receiving the message data within one beat through the segmented interface; A first address determination module, used for determining, for each priority level, a first address in a multi-port random access memory RAM currently corresponding to the priority level, wherein the number of RAMs included in the multi-port RAM is equal to the maximum number of data segments that can be transmitted within one beat of the segmented interface; The data writing module is used to write the message data received in one beat into the multi-port RAM in the same beat by: For each priority level, take the current first address corresponding to the priority level as the starting position, and write the message data of the priority level into the first storage space where the first address is located; if there is free space in the first storage space after writing, update the first address to the next address after the newly written message data; if there is no free space in the first storage space after writing, apply for a new storage space, and update the first address to the starting address of the new storage space; if there is still unwritten message data of the priority level, continue to write the message data with the updated first address as the starting position; wherein each storage space is composed of storage areas with the same offset in each RAM in the multi-port RAM, and each storage area can store a segment of message data received in one beat, and the initial first address is the starting address of the storage area first applied for the priority level; A priority determination module, used to determine the target priority of the message data to be read; A data reading module, used to determine the second address currently corresponding to the target priority, read the message data belonging to the same message in the second storage space from the second address, and update the second address; wherein the second address is: the starting storage address of the message data corresponding to the target priority, which is not currently read and is written first, and the second storage space is the storage space where the current second address is located; A second address updating module, configured to update the second address to the starting address of the next storage space if there is no message data in the second storage space and message data of the target priority that can constitute a complete message is also stored, and return to trigger the execution of the data reading module, wherein the next storage space is the next storage space applied for the target priority after the second storage space; The data output module is used to merge the message data belonging to the same message and output the read message data belonging to the target priority in the same beat.
9. The device according to claim 8, characterized in that The first address is indicated by a first pointer and a second pointer, the first pointer indicates the RAM where the current first address is located, and the second pointer indicates the current first storage space; The second address is indicated by a third pointer and a fourth pointer, the third pointer indicates the RAM where the current second address is located, and the fourth pointer indicates the current second storage space; The data writing module is specifically used to write the message data received in one beat into the multi-port RAM in the same beat by: For each priority level, the message data of the priority level is written into the first storage space where the first address is located, with the current first address corresponding to the priority level as the starting position; if there is free space in the first storage space after writing, the first pointer is pointed to the next RAM after the tail of the newly written message data; If there is no free space in the first storage space after writing, apply for new storage space, point the first pointer to the front-end RAM, and point the second pointer to the new storage space; if there is still unwritten message data of the priority level, continue to write the message data with the updated first address as the starting position; The data reading module is specifically used for: Determine a second address currently corresponding to the target priority, read message data belonging to the same message in the second storage space from the second address, and point the third pointer to the next RAM after the tail of the newly read message data; The second address updating module is specifically used for: If there is no message data in the second storage space, and message data of the target priority level that can constitute a complete message is also stored, the third pointer is pointed to the frontmost RAM, and the fourth pointer is pointed to the next storage space.
10. The device according to claim 8, characterized in that The device also includes: The space recovery module is used to restore a storage space as a storage space that can be applied for after all data stored in the storage space has been read.
11. The device according to claim 8, characterized in that The data processing module comprises: After receiving the message data in one beat through the segmented interface, the message data belonging to different messages are divided; When there are message data of the same priority but belonging to different messages in the message data received within one beat, the message data at the rear end is shifted to the next data segment after the tail of the message data at the front end; For each priority level, the message data belonging to the priority level is shifted to the starting data segment.
12. The device according to any one of claims 8 to 11, characterized in that For each priority level, there is a linked list corresponding to the priority level, and the linked list records at least one of the following information: the first address corresponding to the priority level, the second address, the number of complete messages belonging to the priority level currently stored in the multi-port RAM, and the amount of message data belonging to the priority level currently stored in the multi-port RAM.
13. The device according to claim 12, characterized in that For each priority level, when the amount of message data belonging to the priority level currently stored in the multi-port RAM is recorded in the linked list corresponding to the priority level, the device further includes: The back pressure module is used to determine the priority of the corresponding data volume greater than the preset data volume according to the information stored in the linked list, and send a back pressure signal to the data input end connected to the segmented interface to make the data input end reduce the input speed of the message data of this priority.
14. The device according to any one of claims 8 to 11, characterized in that The device also includes: The space pre-application module is used to pre-apply for new storage space when the size of the free space in the current first storage space is smaller than a preset size.
15. A chip, characterized in that: The chip is used to implement the method steps described in any one of claims 1-7.
16. An electronic device, characterized in that: The invention comprises a chip, wherein the chip is used to implement the method steps according to any one of claims 1 to 7.
17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.
