WO2021128217A1 - Data searching system and data searching method - Google Patents

Data searching system and data searching method Download PDF

Info

Publication number
WO2021128217A1
WO2021128217A1 PCT/CN2019/128897 CN2019128897W WO2021128217A1 WO 2021128217 A1 WO2021128217 A1 WO 2021128217A1 CN 2019128897 W CN2019128897 W CN 2019128897W WO 2021128217 A1 WO2021128217 A1 WO 2021128217A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
data
area
memory
length
Prior art date
Application number
PCT/CN2019/128897
Other languages
French (fr)
Chinese (zh)
Inventor
王锦
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2019/128897 priority Critical patent/WO2021128217A1/en
Priority to CN201980102169.9A priority patent/CN114730322A/en
Publication of WO2021128217A1 publication Critical patent/WO2021128217A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks

Definitions

  • This application relates to the field of electronic science and technology, and in particular to a data search system and a data search method.
  • Branch accelerators are mostly used to provide auxiliary functions for branch acceleration for processors that support multithreading.
  • the branch accelerator includes a first memory and a second memory.
  • the first memory is used to store multiple key entries (keys) that may exist for multiple conditional instructions.
  • the second memory is used to store multiple associated data (AD) corresponding to the multiple key entries in a one-to-one manner.
  • the multiple key entries of each conditional instruction have a one-to-one correspondence with the multiple AD data of the conditional instruction in the second memory through multiple position indexes.
  • the multiple location indexes may respectively indicate the storage addresses of the multiple AD data in the second memory.
  • the processor When the processor reaches the target conditional instruction, it can send the target key entry to the branch accelerator.
  • the branch accelerator can find the storage location of the target key entry in the first memory, and then obtain the target location index corresponding to the target key entry according to the maximum storage length mapping relationship between the first memory and the second memory. After that, the branch accelerator may obtain the target data from the plurality of AD data stored in the second memory according to the target position index. Then, the branch accelerator can send the target data to the processor.
  • the processor can process other threads in parallel during the execution of the above actions by the branch accelerator, and after receiving the target data returned by the branch accelerator, continue to execute the thread where the target conditional instruction is located according to the target data, thereby realizing branch acceleration.
  • the maximum storage length of the first memory is 40 bits
  • the maximum storage length of the second memory is 16 bits. It is assumed that a storage space of 40 ⁇ 20 bit 2 is configured in the first memory, and the storage width of the storage space is 20 bits. Then, according to the mapping relationship, a 16 ⁇ 20 bit 2 storage space will be configured in the second memory. If the first memory stores both a 40-bit key entry and an 80-bit key entry, each of the 80-bit key entry will occupy a storage width of 2 bits. Each 80-bit key entry actually corresponds to only one AD data, which only needs to occupy a storage space with a storage width of 1 bit in the second memory. In this case, each 80-bit key entry will waste storage space with a storage width of 1 bit in the second memory.
  • the maximum storage length of the first memory is configured to be 80 bits, and the maximum storage length of the second memory is 16 bits.
  • the first memory stores both 40-bit key entries and 80-bit key entries, although the storage resources of the second memory can be fully utilized, each A 40-bit length key entry will also occupy 80 ⁇ 1bit 2 storage space, so the storage space in the first memory will be wasted.
  • the storage density of the memory (the first memory and/or the second memory) in the current branch accelerator is not high, and further research is needed.
  • This application provides a data search system and a data search method to improve the storage density of the memory in the data search system.
  • an embodiment of the present application provides a data search system.
  • the data search system may be a branch accelerator or a chip integrated with the branch accelerator.
  • the data search system provided in the embodiments of the present application may include: a controller, a first memory, and a second memory, where the first memory is a content addressable memory (CAM); the first memory includes Multiple key key areas, where each key area includes multiple key entries; the second memory includes multiple associated data AD areas, where each AD area includes multiple AD data; the controller can receive for searching The target key entry and location indication information of the target data, the location indication information can indicate the target key area and the target AD area associated with the target data; the controller can use the target key entry to perform a matching search in the target key area to obtain a match The position of the entry; the controller can then obtain the target data from the target AD area according to the position of the matching entry.
  • CAM content addressable memory
  • the controller can determine the target key area from the first memory according to the location indication information, and then the relative position of the target key entry in the target key area can be obtained. It is the position of the matching table entry.
  • the position indication information may indicate the target AD area, so the controller may determine the target AD area from the second memory according to the position indication information.
  • the first memory in the embodiment of the present application is a CAM memory
  • the matching entry position of the target key entry in the target key area may be equivalent to the relative position of the target data in the target AD area.
  • the controller can obtain the target data from the target AD area according to the position of the matched entry.
  • the controller no longer needs to calculate the location index of the target data according to the mapping relationship between the maximum storage length of the first memory and the maximum storage length of the second memory. Therefore, the first memory can be flexibly configured according to actual application scenarios.
  • the storage space of the memory and the second memory further helps to increase the storage density of the first memory and/or the second memory when the lengths of the key entries in the first memory are inconsistent.
  • the above-mentioned target key entry can be used to execute the target conditional instruction.
  • the data search system provided by the embodiment of the present application further includes a processor.
  • the processor can obtain the above-mentioned position indication information according to the configuration information of the first memory and the second memory, and the target condition instruction, wherein the configuration information includes multiple conditions.
  • the corresponding relationship between the instruction, multiple key areas and multiple AD areas, the key area corresponding to the target conditional instruction is the aforementioned target key area, and the AD area corresponding to the target conditional instruction is the aforementioned target AD area;
  • the processor further controls The device sends the target key entry and location indication information.
  • the controller, the first memory, and the second memory can be used as branch accelerators to provide auxiliary functions of branch acceleration for the processor.
  • the controller may also send target data to the processor. After receiving the target data, the processor can continue to execute the above-mentioned target conditional instruction according to the target data.
  • the target data may be an instruction counter
  • the target conditional instruction includes multiple branch instructions
  • the processor may obtain the branch instruction corresponding to the target data in the target conditional instruction, and continue to execute the branch instruction.
  • the processor may also receive the foregoing configuration information.
  • the storage space of the first memory and the second memory may be configured by a device installed with a compiler according to multiple conditional instructions that may be executed by the processor.
  • the device installed with the compiler may be the processor itself, or other devices other than the processor, which is not limited in the embodiment of the present application.
  • the device can send the configuration information of the first memory and the second memory to the processor, and the processor can according to the received configuration The information instructs the controller to look for data.
  • the configuration information may also include depth information of multiple key areas; the processor may also obtain the depth information of the target key area according to the configuration information, and send the depth information to the controller; the controller may also According to the position indication information and the depth information, the target key area is determined from the first memory, and the target AD area is determined from the second memory.
  • the depth information can be understood as the number of key entries in the target key area.
  • the number of key entries in the target key area is the same as the number of AD data in the target AD area, so the depth information can also be understood as the number of AD data in the target AD area. Therefore, when the controller searches for the target key area, it can respectively determine the target key area from the first memory and the target AD area from the second memory according to the position indication information and the depth information.
  • the configuration information further includes the storage length of multiple key areas; the processor may also determine the storage length corresponding to the target key area according to the configuration information, and send the first length indication information to the controller.
  • the first length indication information may indicate the storage length of the target key area; the controller may determine the target key area from the first memory according to the position indication information, the depth information, and the first length indication information.
  • each AD area one or more AD data are located in the same row of memory cells in the second memory. Adopting the storage method provided by the embodiment of the present application is beneficial to further increase the storage density of the second memory.
  • the configuration information further includes length information of each AD data in each AD area; the processor may also obtain an AD length message corresponding to the target AD area according to the configuration information, where the AD length The message includes data length information of one or more AD data in the target AD area, and each data length information is used to indicate the data length of the AD data corresponding to each data length information; the AD length message is sent to the controller.
  • the processor in the embodiment of the present application sends an AD length message to the controller, so that the controller can distinguish the target data from other data according to the AD length message, so that the target data can be obtained.
  • the configuration information may also include the starting storage address of each key area and the starting storage address of each AD area; the above position indication information may include the starting storage address of the target key area and The start storage address of the target AD area.
  • the controller can obtain the data length of the AD data before the target data in the AD length message according to the position of the matched entry; according to the start storage address of the target AD area, and the AD before the target data
  • the data length of the data determines the starting storage address of the target data; according to the starting storage address of the target data, the target data is obtained from the target AD area.
  • the processor may also determine the data length of the target data according to the configuration information, and send second length indication information to the controller, where the second length indication information may indicate the data length of the target data;
  • the controller can obtain the target data from the target AD area according to the starting storage address of the target data and the data length of the target data.
  • an embodiment of the present application provides a data search method, which can be applied to the data search system provided in any one of the first aspects.
  • the data search method provided in the embodiment of the present application mainly includes: the controller receives a target key entry used to search the target data and position indication information, and the position indication information is used to indicate the data associated with the target data in the first memory.
  • the first memory is the content addressable memory CAM.
  • the first memory includes multiple key key areas, where each key area includes multiple key tables.
  • the second memory includes multiple associated data AD areas, where each AD area includes multiple AD data; the controller uses the target key entry to perform a matching search in the target key area to obtain the location of the matching entry; the controller According to the position of the matched entry, the target data is obtained from the target AD area.
  • the target key entry is used to execute the target conditional instruction
  • the controller receives the target key entry and the position indication information used to find the target data
  • it further includes: the processor according to the first memory and the first memory 2.
  • the configuration information includes the correspondence between multiple conditional instructions, multiple key areas and multiple AD areas.
  • the key area corresponding to the target conditional instruction is the target key area.
  • the AD area corresponding to the target conditional instruction is the target AD area; the processor sends the target key entry and position indication information to the controller.
  • the method further includes: the controller sends the target data to the processor.
  • the method before the processor obtains the location indication information according to the configuration information of the first memory and the second memory and the target condition instruction, the method further includes: the processor receives the configuration information.
  • the configuration information further includes depth information of multiple key areas; the controller uses the target key entry to perform a matching search in the target key area, and before obtaining the position of the matching entry, it also includes: a processor According to the configuration information, obtain the depth information of the target key area and send the depth information to the controller; the controller determines the target key area from the first memory and the target AD area from the second memory according to the position indication information and the depth information .
  • the configuration information further includes the storage length of multiple key areas; the controller uses the target key entry to perform a matching search in the target key area, and before obtaining the position of the matching entry, it also includes: a processor According to the configuration information, the storage length corresponding to the target key area is determined, and the first length indication information is sent to the controller.
  • the first length indication information is used to indicate the storage length of the target key area; the controller reads from the position indication information and depth information. Determining the target key area in the first memory includes: the controller determines the target key area from the first memory according to the position indication information, the depth information, and the first length indication information.
  • each AD area one or more AD data are located in the same row of memory cells in the second memory.
  • the configuration information also includes length information of each AD data in each AD area; before the controller obtains the target data from the target AD area according to the matching entry position, it also includes: processing The device obtains the AD length message corresponding to the target AD area according to the configuration information.
  • the AD length message includes data length information of one or more AD data in the target AD area, where each data length information is used to indicate each data length information The data length of the corresponding AD data; the processor sends an AD length message to the controller.
  • the configuration information also includes the starting storage address of each key area and the starting storage address of each AD area; the location indication information includes the starting storage address of the target key area and the target AD area The starting storage address.
  • the controller obtains the target data from the target AD area according to the position of the matching entry, including: obtaining the data length of the AD data before the target data in the AD length message according to the position of the matching entry ; According to the starting storage address of the target AD area and the data length of the AD data before the target data, the starting storage address of the target data is determined; according to the starting storage address of the target data, the target data is obtained from the target AD area.
  • the controller before the controller obtains the target data from the target AD area according to the position of the matched table entry, it further includes: the processor determines the data length of the target data according to the configuration information, and sends the first data length to the controller. Two length indication information, the second length indication information is used to indicate the data length of the target data; obtaining the target data from the target AD area according to the starting storage address of the target data, including: the controller according to the starting storage address of the target data, According to the data length of the target data, the target data is obtained from the target AD area.
  • FIG. 1 is a schematic structural diagram of a data search system provided by an embodiment of this application.
  • FIG. 2 is a schematic diagram of a storage structure of a first memory provided by an embodiment of the application
  • FIG. 3 is a schematic diagram of a storage structure of a key area provided by an embodiment of the application.
  • FIG. 4 is a schematic diagram of a storage structure of a second memory provided by an embodiment of the application.
  • FIG. 5 is a schematic flowchart of a data search method provided by an embodiment of the application.
  • FIG. 6 is a schematic diagram of a correspondence relationship between a data length and a length identifier provided by an embodiment of this application;
  • FIG. 7 is a schematic structural diagram of an AD length message provided by an embodiment of this application.
  • FIG. 8 is a schematic diagram of a Kswitch instruction structure provided by an embodiment of the application.
  • the memory in the embodiments of the present application can be understood as a two-dimensional storage array
  • the storage length of any data can be understood as the number of bits occupied by the data in the length direction of the storage array (the row direction of the storage array) .
  • the storage width corresponding to the storage length can be understood as the number of bits occupied by data in the width direction of the storage array (column direction of the storage array).
  • the storage length and storage width of any data define the storage space of the data.
  • the following embodiments of this application use a ⁇ b bit 2 to represent the size of the storage space, where a represents the number of bits in the length direction of the storage space, that is, the storage length, and b represents the number of bits in the width direction of the storage space. It is the storage width.
  • Fig. 1 exemplarily shows a schematic structural diagram of a data search system provided by an embodiment of the present application.
  • the data search system can be a branch accelerator, a chip integrated with a branch accelerator, or a system-on-chip.
  • the data search system in the embodiment of the present application may be a processing chip with a large amount of calculation such as a central processing unit (CPU), a graphics processing unit (GPU), the processor 100, and a branch accelerator. 200 is integrated in the chip to increase the computing speed of the chip.
  • CPU central processing unit
  • GPU graphics processing unit
  • 200 is integrated in the chip to increase the computing speed of the chip.
  • the data search system includes a controller 201, a first memory 202 and a second memory 203.
  • the controller 201 is connected to the first memory 202 and the second memory 203 respectively.
  • the controller 201 includes a control circuit of the first memory 202 and a control circuit of the second memory 203.
  • the controller 201 can search for the first memory 202 and the second memory 203. Storage 203.
  • the data search system may further include a processor 100.
  • the processor 100 may be a logic circuit with computing capability.
  • the processor 100 may include an arithmetic and logic unit (ALU), and arithmetic operations, logic operations, and other operational functions can be implemented through the ALU.
  • ALU arithmetic and logic unit
  • the processor 100 and the controller 201 may be interconnected through a control bus, so that information can be transferred between the processor 100 and the branch accelerator 200.
  • conditional instruction may include multiple branch instructions.
  • Common conditional instructions include switch instructions, multiple nested instructions composed of multiple if (if) and otherwise (else), and so on.
  • switch instructions multiple nested instructions composed of multiple if (if) and otherwise (else), and so on.
  • multi-level nested instruction composed of multiple if and else as an example its pseudo code can be expressed as:
  • the conditional instruction includes 4 key entries, which are key entries 1 to 4, respectively.
  • the key entry 4 can be understood as the only entry after the key entries 1 to 3 are excluded, so it is not directly shown in the embodiment of the present application.
  • key entry 1 corresponds to branch instruction 1
  • key entry 2 corresponds to branch instruction 2
  • key entry 3 corresponds to branch instruction 3
  • key entry 4 (else) corresponds to branch instruction 4. .
  • the processor 100 often obtains the target key entry before running the above-mentioned conditional instruction. For example, the processor 100 may generate the target key entry, or may receive the target key entry input by other devices. No restrictions.
  • the processor 100 may execute a CMP (compare) instruction to match the target key table entry with key table entries 1 to 4 one by one until the matching is successful.
  • CMP compute
  • the processor 100 can continue to execute the branch instruction 2.
  • the use of a data search system integrated with a branch accelerator can save the computational pressure on the processor 100 caused by conditional instructions and help improve the computational speed and multi-thread processing capability of the processor 100.
  • the controller 201 may receive the target key entry sent by the processor 100, and search the first memory 202 and the second memory 203 according to the received target key entry, so as to obtain the target data corresponding to the target key entry.
  • the target data corresponding to the target key entry may be a target branch instruction corresponding to the target key entry, or an instruction counter (program counter, PC) corresponding to the target key entry and the target branch instruction in a possible embodiment. ), the embodiment of the application does not limit this.
  • the target data is a PC
  • the processor 100 stores multiple branch instructions. After receiving the target data returned by the controller 201, the processor 100 can read and execute the target data from the stored branch instructions according to the target data.
  • the corresponding branch instruction is the target branch instruction.
  • the first memory 202 may be a content addressable memory (Content Addressable Memory, CAM), and currently more common is a ternary content addressable memory (TCAM).
  • CAM Content Addressable Memory
  • TCAM ternary content addressable memory
  • a plurality of groups are stored in the first memory 202. Each group corresponds to a conditional instruction. For each group, multiple key entries of the conditional command corresponding to the group are included. Exemplarily, assuming that the conditional instruction is a switch instruction, the storage structure of the first memory may be as shown in Table 1 below:
  • M groups are stored in the first memory 202, such as group 1, group 2, ..., group M, where M is an integer greater than 1.
  • M groups correspond to M switch commands, for example, group 1 corresponds to switch command 1, group 2 corresponds to switch command 2, and group M corresponds to switch command M.
  • the key of the switch instruction may have multiple key entries, and the multiple key entries respectively correspond to multiple branch instructions of the switch instruction.
  • the switch instruction 1 in Table 1 Take the switch instruction 1 in Table 1 as an example.
  • the key of switch instruction 1 includes 16 key entries (key entry 11, key entry 12, ..., key entry 116), and the 16 key entries are the same as switch
  • the 16 branch instructions of instruction 1 correspond one-to-one. The same is true for switch instruction 2 to switch instruction M, and will not be repeated here.
  • each key entry in each group can achieve a one-to-one correspondence with the AD data in the second memory 203 through a location index.
  • the key entry 11 in group 1 can correspond to the AD data 11 in the second storage 203 through the position index 11, that is, the key entry 11 is stored in the first storage 202.
  • the key entry 11 corresponds to the position index 11.
  • AD data 11 is stored, and the AD data 11 also corresponds to the position index 11.
  • the correspondence between the key entry 11 and the position index 11 may be the storage address of the controller 201 according to the key entry 11, and between the maximum storage length of the first memory 202 and the maximum storage length of the second memory 203
  • the mapping relationship is calculated.
  • the corresponding relationship between the position index 11 and the AD data 11 can be understood as that the position index 11 can indicate the storage address of the AD data 11 in the second memory 203, that is, the controller 201 can determine the AD data according to the position index 11. 11 is the storage address in the second memory 203, so that the AD data 11 can be read.
  • the processor 100 When the processor 100 executes the conditional instruction, it can send the target key entry to the branch accelerator 200, and the controller 201 can search the first memory 202 according to the target key entry. After hitting the target key entry, assuming that the key entry 11 hits the target key entry, according to the storage address of the key entry 11 in the first memory 202, and the maximum storage length of the first memory 202 and the second memory 203 The mapping relationship between the maximum storage length of, the position index 11 is calculated. The controller 201 reads the AD data 11 from the second memory 203 according to the position index 11.
  • the controller 201 returns the AD data 11 to the processor 100, and the processor 100 can obtain the branch instruction corresponding to the AD data 11 according to the AD data 11, and continue to execute the branch instruction. It can be seen from the above process that the branch accelerator 200 can replace the processor 100 to determine the AD data corresponding to the target key entry, so the process of executing the CMP instruction by the processor 100 can be omitted, which is beneficial to reduce the calculation of the processor 100 when executing conditional instructions. pressure.
  • the data length of multiple key entries therein is the same.
  • the data length of the key table entry may be different.
  • the mapping relationship between the maximum storage length of the first memory 202 and the maximum storage length of the second memory 203 needs to be maintained.
  • the data lengths of the key entries stored in the first memory 202 are not the same, which will result in the first memory 202.
  • the storage resources of the first memory 202 and/or the second memory 203 are wasted, and the storage density of the first memory 202 and/or the second memory 203 needs to be further improved.
  • the first storage 202 is configured with a maximum storage length, and the maximum storage length limits the storage length of a key entry in the first storage 202.
  • the maximum storage length limits the storage length of a key entry in the first storage 202.
  • the maximum storage length is 40 bits
  • the maximum storage length For an 80-bit key entry, it occupies 40 ⁇ 2bit 2 storage space.
  • the second memory 203 is also configured with a maximum storage length, which limits the maximum storage length of AD data in the second memory 203, and a 1-bit storage width can only store one AD data.
  • the mapping relationship between the maximum storage length of the first storage 202 and the maximum storage length of the second storage 203 will limit the first storage 202 and/or The storage density of the second memory is further improved.
  • the data length of key entries 11 to 116 in group 1 is 40 bits
  • the length of key entries 21 to 216 in group 2 is 80 bits.
  • the first memory 202 is configured with a 2000bit 2 storage space, where the maximum storage width is 50bit, and can store a total of 2000bit key entry data.
  • the second memory 203 is configured with 800bit 2 (16 ⁇ 50bit 2 ) storage space.
  • group 1 is mapped to the second memory 203 with a 16 ⁇ 16 bit 2 storage space
  • group 2 is mapped to the second memory 203 with a 16 ⁇ 32 bit 2 storage space.
  • Table 1 it can be seen that both group 1 and group 2 include 16 key entries, that is, group 2 only needs to use the storage space of 16 ⁇ 16bit 2 in the second memory 203. Therefore, some storage resources in the second memory 203 are wasted, resulting in a lower storage density of the second memory 203.
  • the maximum storage length of the first memory 202 is 80 bits, and the maximum storage length of the second memory 203 is 16 bits.
  • the second memory 203 is configured with a storage space of 800 bit 2 (16 ⁇ 50 bit 2 ), and the first memory 202 is configured with a storage space of 4000 bit 2 (80 ⁇ 50 bit 2 ).
  • group 1 is mapped in the second memory 203 has a memory space of 16 ⁇ 16bit 2
  • group2 mapped in the second memory 203 has a memory space of 16 ⁇ 16bit 2.
  • the storage resources of the second memory 203 are not wasted, in the first memory 202, the total amount of data in group 1 is 40 ⁇ 16bit, but it occupies the storage space of 80 ⁇ 16bit 2 , so it will waste the first memory.
  • the storage resources of the memory 202 cause the storage density of the first memory 202 to be low.
  • the storage density of the memory (the first memory 202 and/or the second memory 203) in the current data search system needs to be further improved.
  • the embodiment of the present application provides a data search system. Even if the maximum storage length of the first memory 202 and the maximum storage length of the second memory 203 no longer need to maintain a mapping relationship, the controller 201 can still find the target key table. According to the target data corresponding to the item, the storage structure of the first memory 202 and the second memory 203 can be configured more flexibly. Therefore, the embodiment of the present application is beneficial to improve the storage density of the first memory 202 and/or the second memory 203.
  • the first memory 202 in the embodiment of the present application stores multiple key areas (key areas A, B, C, D, XX, and YY), and each key area includes Multiple key entries.
  • the multiple key areas correspond to multiple conditional instructions. It should be pointed out that the multiple key areas and multiple conditional instructions can be one-to-one, one-to-many, and many-to-one. Any one of the corresponding relationships.
  • one-to-many can be understood as a key area corresponding to multiple conditional instructions.
  • multiple conditional instructions have the same key entry.
  • multiple conditional instructions can correspond to the same key area.
  • multiple conditional instructions corresponding to the same key area may have different branch instructions, that is, multiple conditional instructions corresponding to the same key area may also correspond to different AD areas.
  • Many-to-one can be understood as multiple key areas corresponding to the same conditional command.
  • multiple key entries of a conditional instruction can be divided into multiple key areas for storage.
  • key area A corresponds to instruction A
  • key area B corresponds to instruction B
  • key area C corresponds to instruction C
  • key area D corresponds to instruction D
  • key area XX corresponds to instruction XX
  • key area YY corresponds to instruction YY corresponds, where instruction A, instruction B, instruction C, instruction D, instruction XX, and instruction YY are all conditional instructions.
  • the second memory 203 stores multiple associated data (AD) areas, and each AD area includes multiple AD data.
  • AD associated data
  • the multiple AD areas correspond to multiple key areas in the first memory 202. It should be pointed out that there can be one-to-one or one-to-one relationship between multiple AD areas and multiple key areas. Either the corresponding relationship between many-to-many and many-to-one.
  • one-to-many can be understood as one AD area corresponding to multiple key areas.
  • multiple conditional instructions have different key entries but the same branch instruction.
  • the key areas corresponding to the multiple conditional instructions can correspond to the same AD area.
  • AD areas corresponding to the same key area.
  • multiple conditional instructions have the same key entry but different branch instructions.
  • the multiple conditional instructions can correspond to the same key area, but the key area can correspond to multiple ADs. area.
  • AD area corresponds to one key area.
  • key area A corresponds to AD area A
  • key area B corresponds to AD area B
  • key area C corresponds to AD area C
  • key area D corresponds to AD area D
  • key area XX corresponds to AD area XX
  • the key area YY corresponds to the AD area.
  • the key area A stores N key entries of the command A, and N is an integer greater than or equal to.
  • the AD area A stores N AD data of instruction A, and the N AD data corresponds to the N branch instructions of instruction A one-to-one.
  • the i-th key entry in the key area A corresponds to the i-th AD data in the AD area A, and i is an integer in [1,N]. That is to say, the N key entries in the key area A correspond to the N AD data in the AD area A, and the relative position of the i-th key entry in the key area A is the same as the i-th AD data The relative position in AD area A is the same.
  • FIG. 3 exemplarily shows the storage order of 8 key entries in the key area A.
  • the key area A includes 8 key entries, and the 8 key entries are sequentially stored in the order of A1 to A8.
  • FIG. 4 exemplarily shows the storage order of the 8 AD data (AD data 1 to 8) in the AD area A.
  • the 8 AD data in the AD area A are sequentially stored in the order of 1 to 8.
  • AD data 1 to 8 correspond to key entries A1 to A8 respectively, that is, key entry A1 corresponds to AD data 1, key entry A2 corresponds to AD data 2, and so on.
  • the foregoing storage order is defined on the basis of the reading order of the first memory 202 and the second memory 203.
  • the reading order of the first memory 202 and the second memory 203 is from left to right and from top to bottom.
  • the first memory 202 shown in FIG. 3 and the second memory 203 shown in FIG. 4 Have the same storage order.
  • the reading order of the first memory 202 and the second memory 203 may also be from right to left, from bottom to top, etc., which are not listed one by one in the embodiment of the present application.
  • the processor 100 may instruct the controller 201 to search for data according to the first memory 202 and the second memory 203.
  • the processor 100 may configure the storage structures of the first memory 202 and the second memory 203, or other devices may configure the storage structures of the first memory 202 and the second memory 203.
  • the storage structure of the first memory 202 and the second memory 203 may be configured by another device installed with a compiler. In this case, the device may send the configuration information of the first memory 202 and the second memory 203 to The processor 100 enables the processor 100 to instruct the controller 201 to search for data according to the configuration information.
  • the data search method provided in the embodiment of the present application may be as shown in FIG. 5, and mainly includes the following steps:
  • the processor 100 sends the target key entry and location indication information to the controller 201.
  • the target key entry may be a key entry used to execute the target conditional instruction.
  • the location indication information may indicate the target key area and the target AD area.
  • the target key area can be understood as the key area corresponding to the target conditional instruction in the first memory 202
  • the target AD area can be understood as the AD area corresponding to the target key area in the second memory.
  • the configuration information includes the correspondence between multiple conditional instructions, multiple key areas, and multiple AD areas.
  • the processor 100 may determine, according to the configuration information, the key area corresponding to the target conditional instruction as the target key area, and the AD area corresponding to the target conditional instruction as the target AD area. Since the position indication information in the embodiment of the present application can directly indicate the target key area and the target AD area, even if there is no one-to-one correspondence between a conditional command, multiple key areas, and multiple AD areas, it does not affect the control.
  • the device 201 searches for the target data according to the position indication information.
  • the controller 201 uses the target key entry to perform a matching search in the target key area to obtain the location of the matching entry.
  • the position of the matched entry can be understood as the relative position of the target key entry in the target key area, and can also be understood as the storage order of the target key entry in the target key area.
  • the controller 201 obtains target data from the target AD area according to the matched entry position.
  • the relative position of the i-th key entry in the target key area in the target key area is the same as the relative position of the i-th AD data in the target AD area. Therefore, according to the position of the matched entry
  • the AD data corresponding to the target key entry can be obtained from the position of the matching entry in the target AD area, that is, the target data.
  • the controller 201 may continue to execute S504 and return the target data to the processor 100.
  • the processor 100 can continue to execute the target branch instruction corresponding to the target data.
  • the location indication information may include the area identifiers of the target key area and the target AD area, or may include the start storage addresses of multiple key areas and the start storage addresses of multiple AD areas. That is, the processor 100 can indicate the target key area and the target AD area to the controller 201 through the initial storage address.
  • instruction A corresponds to key area A and AD area A.
  • the initial storage address of key area A is address A
  • the initial storage address of AD area A is address a.
  • the location indication information corresponding to instruction A may indicate address A and address a.
  • instruction B corresponds to key area B and AD area B, as shown in Table 2, the initial storage address of key area B is address B, and the initial storage address of AD area B is address b.
  • the location indication information corresponding to instruction B may indicate address B and address b.
  • Table 2 the corresponding relationship between other conditional instructions and the initial storage address can refer to instruction A and instruction B, which will not be repeated.
  • the processor 100 can obtain the start storage addresses of the target key area and the target AD area according to the configuration information, and directly indicate the start storage addresses of the target key area and the target AD area to the controller 201 through the position indication information. This allows the controller 201 to directly determine the storage location of the target key area and the target AD area according to the location indication information.
  • the storage address of the upper left bit of the key area A is ad11
  • the storage address of the upper right bit is ad18
  • the storage address of the lower left bit is ad81, right
  • the storage address of the lower corner bit is ad88.
  • the key area A includes 8 key entries, so the depth information of the key area A is 8.
  • the initial storage address of the key area A can be any one of ad11, ad18, ad81, and ad88 in FIG. 3. The same is true for the starting position information of AD area A, and will not be repeated.
  • the controller 201 may determine the target key area from the first memory 202 according to the initial storage address of the target key area, and further determine the entry position of the target key entry in the target key area.
  • the controller 201 may start to match and search the target key area from the initial storage address of the target key area, thereby determining the position of the matching entry of the target key entry in the target key area.
  • the target key area is the key area A shown in FIG. 3, and the controller 201 may start from the starting storage address of the target key area (address A is ad11), and sequentially connect the target key entry and the key entry A1 to A8 match. Assuming that the target key entry matches the key entry A5 successfully, it can also be understood that the target key entry is the key entry A5, then the match of the target key entry in the target key area (key area A) can be determined The entry position of is 5.
  • the controller 201 can then determine the target AD area from the second memory 203 according to the initial storage address of the target AD area, and further obtain target data from the target AD area according to the matching entry position. For example, the controller 201 may start from the initial storage address of the target AD area, and determine that the AD data whose relative position is consistent with the position of the matched entry is the target data.
  • the controller 201 can start from the starting storage address (address a) of the target AD area, and determine that the fifth AD data thereafter is the target data. Therefore, the controller 201 It can be determined that the fifth AD data (AD data 5) in the AD area A is the target data.
  • the controller 201 in the embodiment of the present application can directly determine the target key area from the first memory 202 and determine the target AD area from the second memory 203 according to the location indication information.
  • the target data is obtained from the target AD area by using the matching entry position of the target key entry in the target key area.
  • the controller 201 no longer needs to calculate the position index of the target data according to the mapping relationship between the maximum storage length of the first memory 202 and the maximum storage length of the second memory 203, so the first memory can be configured more flexibly.
  • the storage structure of the first memory 202 and the second memory 203 further helps to increase the storage density of the first memory 202 and/or the second memory 203 when the lengths of the key entries in the first memory 202 are inconsistent.
  • the processor 100 can directly indicate the target key area and the target AD area through the position indication information, so that the controller 201 can determine the target key area from the first memory 202 according to the position indication information, and from the second The target AD area is determined in the memory 203, eliminating the need for the controller 201 to traverse the first memory 202 and the second memory 203, thereby helping to increase the search speed of the controller 201 and improve the performance of the data search system as a whole.
  • key areas that are not the target key area may also contain the same key entry as the target key entry. If the controller 201 directly traverses the first memory 202 to find it, a mismatch may also occur. However, in the embodiment of the present application, the key area is indicated by the position indication information, which is also beneficial to prevent the controller 201 from misjudgment, thereby improving the accuracy of the data search system.
  • the configuration information may also include depth information of multiple key regions in the first memory 202.
  • the depth information of each key area can be understood as the number of key entries in the key area. It can be understood that between the key area and the AD area that have a corresponding relationship, the number of key entries in the key area is the same as the number of AD data in the AD area, so the depth information can also be understood as the number of AD data in the AD area.
  • the controller 201 When the controller 201 matches and searches the target key area, it may determine the number of key entries in the target key area according to the depth information. When searching for the target AD area, the controller 201 may also determine the amount of AD data in the target AD area according to the depth information. Therefore, the controller 201 can more accurately determine the target key area and the target AD area.
  • the key entry has a flexible storage manner in the first memory 202.
  • one or more key entries can occupy a storage width of 1 bit, that is, one or more key entries can be located in the same row of storage units in the first memory 202, or one key entry can occupy multiple bits.
  • the storage width is 1 bit, that is, one or more key entries can be located in the same row of storage units in the first memory 202, or one key entry can occupy multiple bits.
  • the maximum storage length of the first memory 202 is 40 bits. If the data length of the key entry in the key area is 20 bits, the storage area of 40 ⁇ 1 bit 2 can be occupied by two key entries in the key area, where the storage width is 1 bit. If the data length of the key entry in the key area is 80 bits, one key entry in the key area occupies a 40 ⁇ 2bit 2 storage area, where the storage width is 2 bits. With the foregoing storage method, the storage space of the first memory 202 can be used more flexibly, which is beneficial to further increase the storage density of the first memory 202.
  • the storage length of the key entry and the data length may be the same or different.
  • the maximum storage length of the first memory 202 is 40 bits
  • the storage length is also 20 bits.
  • the storage length is 40 bits.
  • the configuration information may also include the storage length of multiple key areas.
  • the processor 100 may obtain the storage length of the target key area according to the configuration information, and send the first length information to the controller.
  • the first length information may indicate the storage length of the target key area in the first memory 202.
  • the storage length of the target key area is indicated by the first length indication information, so that the controller 201 can accurately identify the storage area of the target key area from the first memory 202 according to the storage length indicated by the location indication information. It helps to improve the accuracy of the data search system as a whole.
  • the data length of the N pieces of AD data in the same AD area may be the same or different.
  • one or more AD data may be located in the same row of storage cells of the second memory 203, that is to say, the one or more Each AD data occupies a storage width of 1bit.
  • the 8 AD data of the AD area A can be stored in the order from left to right and top to bottom.
  • the address in the upper left corner of AD area A is the initial storage address of AD area A.
  • AD data 1 is stored in the first row (the largest storage area of the first unit)
  • the first row has no space to store the AD data 4
  • the AD data 4 continues to be stored on the left side of the second row (the second unit largest storage area).
  • the AD data 4 is stored in the second row, there is still room for the second row to continue to store the AD data 5 to 7.
  • the AD data 7 is stored in the second row, the second row has no space to store the AD data 8, and then the AD data 8 is stored in the third row.
  • the AD area A occupies a total of 3bit storage width. If the current storage method in which each AD data individually occupies 1 bit storage width is adopted, the AD area A will occupy 8 bits of storage width. It can be seen that the storage method provided by the embodiment of the present application can further increase the storage density of the second memory 203.
  • the configuration information may also include length information of each AD data in each AD area.
  • the processor 100 may also obtain the AD length message corresponding to the target AD area according to the configuration information.
  • the AD length message may include data length information of one or more AD data in the target AD area.
  • the processor 100 sends the AD length information to the controller 201.
  • the configuration information may include length identifiers corresponding to different data lengths.
  • the AD data stored in the second memory 203 has four data lengths, and the length identifiers corresponding to the four data lengths in the configuration information may be as shown in FIG. 6.
  • the length identifier corresponding to the first data length is 0, and the AD data belonging to the first data length includes control information (ctrl in Figure 6) and two instruction counter information (PC in Figure 6), where 9b represents control information A total of 9 bits, 21b represents a total of 21 bits of information about an instruction counter.
  • the length identifier corresponding to the second type of data length is 1, and the AD data belonging to the second type of data length includes ctrl information, 4 pieces of PC information, and one piece of reserved (RSV in FIG. 6) information.
  • the RSV information is 9 bits.
  • the third data length and the fourth data length are similar to the foregoing, and will not be repeated.
  • FIG. 6 also exemplarily shows the storage structure of an AD area.
  • the AD area includes a total of 20 AD data, among which one or more AD data occupies a storage width of 1 bit.
  • the AD length message sent by the processor 100 may carry the data length identifier of the 20 AD data.
  • the AD length message may include a bitmap as shown in FIG. 7, where each indicator bit occupies 2 bits, which may represent a length identifier of AD data.
  • the bitmap shown in FIG. 7 has a total of 20 indicator bits (AT0 to AT19), which can carry the length identifiers of the first to the 20th AD data in the AD area in order from left to right.
  • the bitmap carried in the AD length message corresponding to the AD area may be 0000000000000100010001000001010010100011.
  • the AD length message may indicate the data length of each AD data in the target AD area.
  • the redundant AD data in the AD area can be configured as a uniform data length. For example, for the AD length message shown in FIG. 7, the data length of 20 AD data is indicated at most. Then, if the depth information of the AD area is greater than 20, for example, the AD area B includes 25 AD data, the first 20 AD data can be flexibly configured with a storage structure, and the last 5 AD data can be configured with a uniform storage length.
  • multiple AD length messages may also be sent to indicate the data length of each AD data in the target AD area.
  • the AD area B includes 25 AD data, and one AD length message can indicate the data length of 13 AD data at most.
  • the processor 100 can send two AD length messages. One of the AD length messages indicates the data length of the first to thirteenth AD data, and the other AD length message indicates the data length of the 14th to the 25th AD data.
  • the AD length message may also be referred to as an associated data type (AD Type, ADT) command.
  • Fig. 7 exemplarily shows a specific structure of the AD length message, and 1 to 49 indicate the number of bits of the AD length message.
  • the AD length message carries initial indication information (pocode), which is used to indicate that this message is an AD length message.
  • the AD length message also carries start indication position information (Ad_start), which is used to indicate the start storage address of the first AD data indicated by the ADT instruction.
  • the processor 100 sends two AD length messages.
  • Ad_start in one AD length message is used to indicate the starting storage address of the first AD data in the target AD area
  • Ad_start in the other AD length message is used It indicates the starting storage address of the 14th AD data in the target AD area.
  • the AD length message can be carried by a null instruction to reduce instruction overhead.
  • the controller 201 may obtain the target data from the target AD area according to the AD length message and the matching entry position. Exemplarily, the controller 201 may determine the data length of the AD data before the target data in the target AD area according to the matched entry position and the AD length message. Furthermore, the starting storage address of the target data can be determined according to the starting storage address of the target AD area and the data length of the AD data located before the target data.
  • the controller 201 can obtain the data length of AD data 1 to 4 according to the AD length message, and according to the data length of AD data 1 to 4 The sum can determine the address interval between the target data (AD data 5) and the start storage address of the target AD area. Therefore, the starting storage address of the target data can be obtained according to the starting storage address of the target AD area.
  • the processor 100 may also obtain data length information of the target data according to the configuration information, and send second length indication information to the controller 201, where the second length indication information may indicate the data of the target data length.
  • the controller 201 determines the initial storage address of the target data, it determines the target data from the second memory 203 according to the length information of the target data. It can be understood that the processor 100 may not send the second length indication information. In this case, the controller 201 may also determine the length information of the target data according to the AD length message.
  • the controller 101 can determine that the initial storage address of the target data (AD data 5) is a 0 +75bit. The controller 101 further determines that the target data is 15 bits according to the length information of the target data. Then, the controller 101 can determine to obtain the target data from a 0 +75 bit to a 0 +90 bit.
  • controller 201 may execute the following pseudo code to find the target data:
  • AD_START is the starting storage address of the target AD area
  • offset is the performance position of the target key entry in the target key area
  • AD_TYPE[i] represents the length information of the i-th AD data.
  • AD_INDEX represents the current search position.
  • AD_INDEX AD_INDEX>>2, that is, one row (maximum storage length) of the target AD area includes 4 basic lengths, which can be understood as the greatest common divisor of different data lengths configured for AD data.
  • AD_TYPE length information of the target data
  • AD_INDEX[1:0] representing the basic length
  • the data length of the target data is 1 basic length
  • the data length of the target data is 2 basic lengths
  • the length information of the target data If it is 2, the data length of the target data is 3 basic lengths, and if the length information of the target data is 3, the data length of the target data is 4 basic lengths.
  • the starting storage address of the target key area the starting storage address of the target AD area, depth information, the storage width of the target key entry, the second length indication information, etc.
  • the information can be carried by the Kswitch command shown in Figure 8.
  • the opcode of the Kswitch command is used to indicate that the command is a Kswitch command, where the second length indication information is used to indicate the data length of the target data, and the bucket start is used to indicate the starting storage address of the target key area.
  • AD_Start is used to indicate the starting storage address of the target AD area
  • k_sz is the first length indication information, used to indicate the storage width of the target key area
  • Bucket depth is used to indicate depth information.
  • the processor 100 may be a multi-core processor, and multiple cores of the processor 100 may instruct the controller 201 to search for target data in parallel.
  • the Kswitch instruction may also include a core identifier (Slice ID, SLID), so that the controller 201 can search for target data for multiple cores at the same time.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed are a data searching system and a data searching method. The data searching system may comprise a controller, a first memory, and a second memory, and the first memory is a Content Addressable Memory (CAM). The controller may receive a target key entry and position indication information for searching for target data, and the position indication information may indicate a target key area and a target AD area associated with the target data; the controller may perform matching search in the target key area by using the target key entry to obtain a matched entry position; and the controller may further obtain the target data from the target AD area according to the matched entry position. In embodiments of the present application, a mapping relationship is not required to be maintained any more between the maximum storage length of the first memory and the maximum storage length of the second memory, thereby facilitating improving the storage density of the first memory and/or the second memory.

Description

一种数据查找系统及数据查找方法Data searching system and data searching method 技术领域Technical field
本申请涉及电子科学技术领域,尤其涉及一种数据查找系统及数据查找方法。This application relates to the field of electronic science and technology, and in particular to a data search system and a data search method.
背景技术Background technique
分支加速器多用于为支持多线程的处理器提供分支加速的辅助功能。一般来说,分支加速器包括第一存储器和第二存储器。其中,第一存储器用于存储多个条件指令的关键字(key)可能存在的多个key表项(entry)。第二存储器用于存储与上述多个key表项一一对应的多个关联数据(associated data,AD)。Branch accelerators are mostly used to provide auxiliary functions for branch acceleration for processors that support multithreading. Generally speaking, the branch accelerator includes a first memory and a second memory. Wherein, the first memory is used to store multiple key entries (keys) that may exist for multiple conditional instructions. The second memory is used to store multiple associated data (AD) corresponding to the multiple key entries in a one-to-one manner.
一般来说,每个条件指令的多个key表项,通过多个位置索引,与第二存储器中该条件指令的多个AD数据实现一一对应。其中,上述多个位置索引可以分别指示上述多个AD数据,在第二存储器中的存储地址。Generally speaking, the multiple key entries of each conditional instruction have a one-to-one correspondence with the multiple AD data of the conditional instruction in the second memory through multiple position indexes. Wherein, the multiple location indexes may respectively indicate the storage addresses of the multiple AD data in the second memory.
处理器在运行到目标条件指令时,可以向分支加速器发送目标key表项。分支加速器可以从第一存储器中查找到该目标key表项的存储位置,进而根据第一存储器和第二存储器之间最大存储长度的映射关系,得到目标key表项对应的目标位置索引。之后,分支加速器可以根据目标位置索引从第二存储器所存储的多个AD数据中获取目标数据。继而,分支加速器可以将目标数据发送给处理器。处理器可以在分支加速器执行上述动作期间,并行处理其它线程,待接收到分支加速器返回的目标数据后,根据该目标数据继续执行目标条件指令所在的线程,从而实现分支加速。When the processor reaches the target conditional instruction, it can send the target key entry to the branch accelerator. The branch accelerator can find the storage location of the target key entry in the first memory, and then obtain the target location index corresponding to the target key entry according to the maximum storage length mapping relationship between the first memory and the second memory. After that, the branch accelerator may obtain the target data from the plurality of AD data stored in the second memory according to the target position index. Then, the branch accelerator can send the target data to the processor. The processor can process other threads in parallel during the execution of the above actions by the branch accelerator, and after receiving the target data returned by the branch accelerator, continue to execute the thread where the target conditional instruction is located according to the target data, thereby realizing branch acceleration.
然而,不同的条件指令之间key表项的长度有可能会出现差异。当key表项的数据长度差异较大时,由于第一存储器的最大存储长度与第二存储器的最大存储长度之间需要保持映射关系,因此会造成第一存储器和/或第二存储器中存储资源的浪费,致使第一存储器和/或第二存储器的存储密度不高。However, there may be differences in the length of key entries between different conditional instructions. When the data length of the key table entry differs greatly, since the maximum storage length of the first memory and the maximum storage length of the second memory need to maintain a mapping relationship, the storage resources in the first memory and/or the second memory will be caused. As a result, the storage density of the first memory and/or the second memory is not high.
例如,第一存储器的最大存储长度为40bit,第二存储器的最大存储长度为16bit。假设第一存储器中配置有40×20bit 2的存储空间,其中,该存储空间的存储宽度为20bit。则,根据映射关系,第二存储器中将配置有16×20bit 2的存储空间。若第一存储器中即存储有40bit长度的key表项,又存储有80bit长度的key表项时,则其中每个80bit长度的key表项将占据2bit的存储宽度。而每个80bit的key表项实际只对应一个AD数据,也就只需要占用第二存储器中1bit存储宽度的存储空间。在此情况下,每个80bit的key表项都将浪费第二存储器中1bit存储宽度的存储空间。 For example, the maximum storage length of the first memory is 40 bits, and the maximum storage length of the second memory is 16 bits. It is assumed that a storage space of 40×20 bit 2 is configured in the first memory, and the storage width of the storage space is 20 bits. Then, according to the mapping relationship, a 16×20 bit 2 storage space will be configured in the second memory. If the first memory stores both a 40-bit key entry and an 80-bit key entry, each of the 80-bit key entry will occupy a storage width of 2 bits. Each 80-bit key entry actually corresponds to only one AD data, which only needs to occupy a storage space with a storage width of 1 bit in the second memory. In this case, each 80-bit key entry will waste storage space with a storage width of 1 bit in the second memory.
再例如,将第一存储器的最大存储长度配置为80bit,第二存储器的最大存储长度为16bit。在此情况下,当第一存储器中即存储有40bit长度的key表项,又存储有80bit长度的key表项时,虽然第二存储器的存储资源可以得到充分利用,但第一存储器中,每个40bit长度的key表项也将占据80×1bit 2的存储空间,因此又会浪费第一存储器中的存储空间。 For another example, the maximum storage length of the first memory is configured to be 80 bits, and the maximum storage length of the second memory is 16 bits. In this case, when the first memory stores both 40-bit key entries and 80-bit key entries, although the storage resources of the second memory can be fully utilized, each A 40-bit length key entry will also occupy 80×1bit 2 storage space, so the storage space in the first memory will be wasted.
综上,目前的分支加速器中存储器(第一存储器和/或第二存储器)的存储密度不高,还有待进一步研究。In summary, the storage density of the memory (the first memory and/or the second memory) in the current branch accelerator is not high, and further research is needed.
发明内容Summary of the invention
本申请提供一种数据查找系统及数据查找方法,以提高数据查找系统中存储器的存储密度。This application provides a data search system and a data search method to improve the storage density of the memory in the data search system.
第一方面,本申请实施例提供一种数据查找系统,该数据查找系统可以是分支加速器,也可以是集成了分支加速器的芯片。示例性的,本申请实施例所提供的数据查找系统可以包括:控制器、第一存储器和第二存储器,其中,第一存储器为内容寻址存储器(Content Addressable Memory,CAM);第一存储器包括多个关键字key区域,其中,每个key区域包括多个key表项;第二存储器包括多个关联数据AD区域,其中,每个AD区域包括多个AD数据;控制器可以接收用于查找目标数据的目标key表项和位置指示信息,该位置指示信息可以指示与目标数据关联的目标key区域和目标AD区域;控制器可以使用目标key表项在目标key区域中进行匹配查找,得到匹配的表项位置;控制器进而可以根据匹配的表项位置,从目标AD区域中得到目标数据。In the first aspect, an embodiment of the present application provides a data search system. The data search system may be a branch accelerator or a chip integrated with the branch accelerator. Exemplarily, the data search system provided in the embodiments of the present application may include: a controller, a first memory, and a second memory, where the first memory is a content addressable memory (CAM); the first memory includes Multiple key key areas, where each key area includes multiple key entries; the second memory includes multiple associated data AD areas, where each AD area includes multiple AD data; the controller can receive for searching The target key entry and location indication information of the target data, the location indication information can indicate the target key area and the target AD area associated with the target data; the controller can use the target key entry to perform a matching search in the target key area to obtain a match The position of the entry; the controller can then obtain the target data from the target AD area according to the position of the matching entry.
本申请实施例中由于位置指示信息可以指示目标key区域,因此控制器可以根据位置指示信息从第一存储器中确定目标key区域,进而可以得到目标key表项在目标key区域中的相对位置,也就是匹配的表项位置。在本申请实施例中,位置指示信息可以指示目标AD区域,因此控制器可以根据位置指示信息从第二存储器中确定目标AD区域。又因为本申请实施例中第一存储器为CAM存储器,因此目标key表项在目标key区域中的匹配的表项位置,可以等效于目标数据在目标AD区域中的相对位置。进而,控制器可以根据匹配的表项位置,从目标AD区域中得到目标数据。本申请实施例中,控制器不再需要根据第一存储器的最大存储长度与第二存储器的最大存储长度之间的映射关系,计算目标数据的位置索引,因此可以根据实际应用场景灵活配置第一存储器和第二存储器的存储空间,进而有利于提高在第一存储器中key表项的长度不一致的情况下,第一存储器和/或第二存储器的存储密度。In the embodiment of the present application, since the location indication information can indicate the target key area, the controller can determine the target key area from the first memory according to the location indication information, and then the relative position of the target key entry in the target key area can be obtained. It is the position of the matching table entry. In the embodiment of the present application, the position indication information may indicate the target AD area, so the controller may determine the target AD area from the second memory according to the position indication information. Also, because the first memory in the embodiment of the present application is a CAM memory, the matching entry position of the target key entry in the target key area may be equivalent to the relative position of the target data in the target AD area. Furthermore, the controller can obtain the target data from the target AD area according to the position of the matched entry. In the embodiment of the present application, the controller no longer needs to calculate the location index of the target data according to the mapping relationship between the maximum storage length of the first memory and the maximum storage length of the second memory. Therefore, the first memory can be flexibly configured according to actual application scenarios. The storage space of the memory and the second memory further helps to increase the storage density of the first memory and/or the second memory when the lengths of the key entries in the first memory are inconsistent.
在一种可能的实现方式中,上述目标key表项可以用于执行目标条件指令。本申请实施例所提供的数据查找系统还包括处理器,该处理器可以根据第一存储器和第二存储器的配置信息,以及目标条件指令,得到上述位置指示信息,其中,配置信息包括多个条件指令、多个key区域和多个AD区域之间的对应关系,该目标条件指令对应的key区域为上述目标key区域,该目标条件指令对应的AD区域为上述目标AD区域;处理器进而向控制器发送目标key表项和位置指示信息。在此情况下,控制器、第一存储器和第二存储器可以作为分支加速器,为处理器提供分支加速的辅助功能。In a possible implementation manner, the above-mentioned target key entry can be used to execute the target conditional instruction. The data search system provided by the embodiment of the present application further includes a processor. The processor can obtain the above-mentioned position indication information according to the configuration information of the first memory and the second memory, and the target condition instruction, wherein the configuration information includes multiple conditions. The corresponding relationship between the instruction, multiple key areas and multiple AD areas, the key area corresponding to the target conditional instruction is the aforementioned target key area, and the AD area corresponding to the target conditional instruction is the aforementioned target AD area; the processor further controls The device sends the target key entry and location indication information. In this case, the controller, the first memory, and the second memory can be used as branch accelerators to provide auxiliary functions of branch acceleration for the processor.
在一种可能的实现方式中,控制器还可以向处理器发送目标数据。处理器在接收到目标数据后,可以根据目标数据继续执行上述目标条件指令。示例性的,在本申请实施例中,该目标数据可以是指令计数器,目标条件指令包括多个分支指令,处理器可以获取目标条件指令中,与目标数据对应的分支指令,并继续执行该分支指令。In a possible implementation, the controller may also send target data to the processor. After receiving the target data, the processor can continue to execute the above-mentioned target conditional instruction according to the target data. Exemplarily, in the embodiment of the present application, the target data may be an instruction counter, the target conditional instruction includes multiple branch instructions, and the processor may obtain the branch instruction corresponding to the target data in the target conditional instruction, and continue to execute the branch instruction.
在一种可能的实现方式中,处理器还可以接收上述配置信息。具体来说,可以由安装有编译器的装置根据处理器有可能执行的多个条件指令配置第一存储器和第二存储器的存储空间。其中,安装有编译器的装置既可以是处理器本身,也可以除处理器之外的其它装置,本申请实施例对此并不多作限制。在由除处理器之外的其它装置配置第一存储器和第二存储器的存储空间时,该装置可以向处理器发送第一存储器和第二存储器的配置信息,处理器可以根据所接收到的配置信息指示控制器查找数据。In a possible implementation manner, the processor may also receive the foregoing configuration information. Specifically, the storage space of the first memory and the second memory may be configured by a device installed with a compiler according to multiple conditional instructions that may be executed by the processor. The device installed with the compiler may be the processor itself, or other devices other than the processor, which is not limited in the embodiment of the present application. When the storage space of the first memory and the second memory is configured by a device other than the processor, the device can send the configuration information of the first memory and the second memory to the processor, and the processor can according to the received configuration The information instructs the controller to look for data.
在一种可能的实现方式中,配置信息还可以包括多个key区域的深度信息;处理器还可以根据配置信息,获取目标key区域的深度信息,并向控制器发送深度信息;控制器还可以根据位置指示信息和深度信息,分别从第一存储器中确定目标key区域,从第二存储器中确定目标AD区域。其中,深度信息可以理解为目标key区域中key表项的数量。目标key区域中key表项的数量与目标AD区域中AD数据的数量相同,因此深度信息也可以理解为目标AD区域中AD数据的数量。因此,控制器在查找目标key区域时,可以根据位置指示信息和深度信息,分别从第一存储器中确定目标key区域,从第二存储器中确定目标AD区域。In a possible implementation, the configuration information may also include depth information of multiple key areas; the processor may also obtain the depth information of the target key area according to the configuration information, and send the depth information to the controller; the controller may also According to the position indication information and the depth information, the target key area is determined from the first memory, and the target AD area is determined from the second memory. Among them, the depth information can be understood as the number of key entries in the target key area. The number of key entries in the target key area is the same as the number of AD data in the target AD area, so the depth information can also be understood as the number of AD data in the target AD area. Therefore, when the controller searches for the target key area, it can respectively determine the target key area from the first memory and the target AD area from the second memory according to the position indication information and the depth information.
在一种可能的实现方式中,配置信息还包括多个key区域的存储长度;处理器还可以根据配置信息,确定目标key区域对应的存储长度,并向控制器发送第一长度指示信息,该第一长度指示信息可以指示目标key区域的存储长度;控制器可以根据位置指示信息、深度信息以及第一长度指示信息,从第一存储器中确定目标key区域。In a possible implementation manner, the configuration information further includes the storage length of multiple key areas; the processor may also determine the storage length corresponding to the target key area according to the configuration information, and send the first length indication information to the controller. The first length indication information may indicate the storage length of the target key area; the controller may determine the target key area from the first memory according to the position indication information, the depth information, and the first length indication information.
在一种可能的实现方式中,每个AD区域中,一个或多个AD数据位于第二存储器的同一行存储单元。采用本申请实施例所提供的存储方式有利于进一步提高第二存储器的存储密度。In a possible implementation manner, in each AD area, one or more AD data are located in the same row of memory cells in the second memory. Adopting the storage method provided by the embodiment of the present application is beneficial to further increase the storage density of the second memory.
在一种可能的实现方式中,配置信息还包括每个AD区域中,每个AD数据的长度信息;处理器还可以根据配置信息,获取与目标AD区域对应的AD长度消息,其中,AD长度消息包括目标AD区域中一个或多个AD数据的数据长度信息,每个数据长度信息用于指示每个数据长度信息对应的AD数据的数据长度;向控制器发送AD长度消息。In a possible implementation manner, the configuration information further includes length information of each AD data in each AD area; the processor may also obtain an AD length message corresponding to the target AD area according to the configuration information, where the AD length The message includes data length information of one or more AD data in the target AD area, and each data length information is used to indicate the data length of the AD data corresponding to each data length information; the AD length message is sent to the controller.
当一个或多个AD数据位于第二存储器的同一行存储单元时,位于同一行存储单元的AD数据将难以区分,进而导致控制器无法从目标AD区域中获取目标数据。有鉴于此,本申请实施例中处理器向控制器发送AD长度消息,使得控制器可以根据AD长度消息将目标数据与其它数据进行区分,从而可以获取目标数据。When one or more AD data are located in the same row of memory cells in the second memory, the AD data located in the same row of memory cells will be difficult to distinguish, which will cause the controller to be unable to obtain the target data from the target AD area. In view of this, the processor in the embodiment of the present application sends an AD length message to the controller, so that the controller can distinguish the target data from other data according to the AD length message, so that the target data can be obtained.
在一种可能的实现方式中,配置信息还可以包括每个key区域的起始存储地址,以及每个AD区域的起始存储地址;上述位置指示信息可以包括目标key区域的起始存储地址和目标AD区域的起始存储地址。In a possible implementation, the configuration information may also include the starting storage address of each key area and the starting storage address of each AD area; the above position indication information may include the starting storage address of the target key area and The start storage address of the target AD area.
在一种可能的实现方式中,控制器可以根据匹配的表项位置获取AD长度消息中,目标数据之前的AD数据的数据长度;根据目标AD区域的起始存储地址,以及目标数据之前的AD数据的数据长度,确定目标数据的起始存储地址;根据目标数据的起始存储地址,从目标AD区域中获取目标数据。In a possible implementation manner, the controller can obtain the data length of the AD data before the target data in the AD length message according to the position of the matched entry; according to the start storage address of the target AD area, and the AD before the target data The data length of the data determines the starting storage address of the target data; according to the starting storage address of the target data, the target data is obtained from the target AD area.
在一种可能的实现方式中,处理器还可以根据配置信息,确定目标数据的数据长度,并向控制器发送第二长度指示信息,该第二长度指示信息可以指示目标数据的数据长度;在此情况下,控制器可以根据目标数据的起始存储地址,按照目标数据的数据长度,从目标AD区域中获取目标数据。In a possible implementation manner, the processor may also determine the data length of the target data according to the configuration information, and send second length indication information to the controller, where the second length indication information may indicate the data length of the target data; In this case, the controller can obtain the target data from the target AD area according to the starting storage address of the target data and the data length of the target data.
第二方面,本申请实施例提供一种数据查找方法,该方法可以应用于第一方面中任一项所提供的数据查找系统。示例性的,本申请实施例所提供的数据查找方法主要包括:控制器接收用于查找目标数据的目标key表项和位置指示信息,位置指示信息用于指示第一存储器中与目标数据关联的目标key区域,和第二存储器中与目标数据关联的目标AD区域,第一存储器为内容寻址存储器CAM,第一存储器包括多个关键字key区域,其中,每个key区域包括多个key表项,第二存储器包括多个关联数据AD区域,其中,每个AD 区域包括多个AD数据;控制器使用目标key表项在目标key区域中进行匹配查找,得到匹配的表项位置;控制器根据匹配的表项位置,从目标AD区域中得到目标数据。In the second aspect, an embodiment of the present application provides a data search method, which can be applied to the data search system provided in any one of the first aspects. Exemplarily, the data search method provided in the embodiment of the present application mainly includes: the controller receives a target key entry used to search the target data and position indication information, and the position indication information is used to indicate the data associated with the target data in the first memory. The target key area and the target AD area associated with the target data in the second memory. The first memory is the content addressable memory CAM. The first memory includes multiple key key areas, where each key area includes multiple key tables. Item, the second memory includes multiple associated data AD areas, where each AD area includes multiple AD data; the controller uses the target key entry to perform a matching search in the target key area to obtain the location of the matching entry; the controller According to the position of the matched entry, the target data is obtained from the target AD area.
在一种可能的实现方式中,目标key表项用于执行目标条件指令,控制器接收用于查找目标数据的目标key表项和位置指示信息之前,还包括:处理器根据第一存储器和第二存储器的配置信息,以及目标条件指令,得到位置指示信息,配置信息包括多个条件指令、多个key区域和多个AD区域之间的对应关系,目标条件指令对应的key区域为目标key区域,目标条件指令对应的AD区域为目标AD区域;处理器向控制器发送目标key表项和位置指示信息。In a possible implementation manner, the target key entry is used to execute the target conditional instruction, and before the controller receives the target key entry and the position indication information used to find the target data, it further includes: the processor according to the first memory and the first memory 2. The configuration information of the memory and the target conditional instruction to obtain the position indication information. The configuration information includes the correspondence between multiple conditional instructions, multiple key areas and multiple AD areas. The key area corresponding to the target conditional instruction is the target key area. , The AD area corresponding to the target conditional instruction is the target AD area; the processor sends the target key entry and position indication information to the controller.
在一种可能的实现方式中,控制器根据匹配的表项位置,从目标AD区域中得到目标数据之后,还包括:控制器向处理器发送目标数据。In a possible implementation manner, after the controller obtains the target data from the target AD area according to the matched entry position, the method further includes: the controller sends the target data to the processor.
在一种可能的实现方式中,处理器根据第一存储器和第二存储器的配置信息,以及目标条件指令,得到位置指示信息之前,还包括:处理器接收配置信息。In a possible implementation manner, before the processor obtains the location indication information according to the configuration information of the first memory and the second memory and the target condition instruction, the method further includes: the processor receives the configuration information.
在一种可能的实现方式中,配置信息还包括多个key区域的深度信息;控制器使用目标key表项在目标key区域中进行匹配查找,得到匹配的表项位置之前,还包括:处理器根据配置信息,获取目标key区域的深度信息,并向控制器发送深度信息;控制器根据位置指示信息和深度信息,从第一存储器中确定目标key区域,以及从第二存储器中确定目标AD区域。In a possible implementation manner, the configuration information further includes depth information of multiple key areas; the controller uses the target key entry to perform a matching search in the target key area, and before obtaining the position of the matching entry, it also includes: a processor According to the configuration information, obtain the depth information of the target key area and send the depth information to the controller; the controller determines the target key area from the first memory and the target AD area from the second memory according to the position indication information and the depth information .
在一种可能的实现方式中,配置信息还包括多个key区域的存储长度;控制器使用目标key表项在目标key区域中进行匹配查找,得到匹配的表项位置之前,还包括:处理器根据配置信息,确定目标key区域对应的存储长度,并向控制器发送第一长度指示信息,第一长度指示信息用于指示目标key区域的存储长度;控制器根据位置指示信息和深度信息,从第一存储器中确定目标key区域,包括:控制器根据位置指示信息、深度信息以及第一长度指示信息,从第一存储器中确定目标key区域。In a possible implementation manner, the configuration information further includes the storage length of multiple key areas; the controller uses the target key entry to perform a matching search in the target key area, and before obtaining the position of the matching entry, it also includes: a processor According to the configuration information, the storage length corresponding to the target key area is determined, and the first length indication information is sent to the controller. The first length indication information is used to indicate the storage length of the target key area; the controller reads from the position indication information and depth information. Determining the target key area in the first memory includes: the controller determines the target key area from the first memory according to the position indication information, the depth information, and the first length indication information.
在一种可能的实现方式中,每个AD区域中,一个或多个AD数据位于第二存储器的同一行存储单元。In a possible implementation manner, in each AD area, one or more AD data are located in the same row of memory cells in the second memory.
在一种可能的实现方式中,配置信息还包括每个AD区域中,每个AD数据的长度信息;控制器根据匹配的表项位置,从目标AD区域中得到目标数据之前,还包括:处理器根据配置信息,获取与目标AD区域对应的AD长度消息,AD长度消息包括目标AD区域中一个或多个AD数据的数据长度信息,其中,每个数据长度信息用于指示每个数据长度信息对应的AD数据的数据长度;处理器向控制器发送AD长度消息。In a possible implementation manner, the configuration information also includes length information of each AD data in each AD area; before the controller obtains the target data from the target AD area according to the matching entry position, it also includes: processing The device obtains the AD length message corresponding to the target AD area according to the configuration information. The AD length message includes data length information of one or more AD data in the target AD area, where each data length information is used to indicate each data length information The data length of the corresponding AD data; the processor sends an AD length message to the controller.
在一种可能的实现方式中,配置信息还包括每个key区域的起始存储地址,以及每个AD区域的起始存储地址;位置指示信息包括目标key区域的起始存储地址和目标AD区域的起始存储地址。In a possible implementation, the configuration information also includes the starting storage address of each key area and the starting storage address of each AD area; the location indication information includes the starting storage address of the target key area and the target AD area The starting storage address.
在一种可能的实现方式中,控制器根据匹配的表项位置,从目标AD区域中得到目标数据,包括:根据匹配的表项位置获取AD长度消息中,目标数据之前的AD数据的数据长度;根据目标AD区域的起始存储地址,以及目标数据之前的AD数据的数据长度,确定目标数据的起始存储地址;根据目标数据的起始存储地址,从目标AD区域中获取目标数据。In a possible implementation manner, the controller obtains the target data from the target AD area according to the position of the matching entry, including: obtaining the data length of the AD data before the target data in the AD length message according to the position of the matching entry ; According to the starting storage address of the target AD area and the data length of the AD data before the target data, the starting storage address of the target data is determined; according to the starting storage address of the target data, the target data is obtained from the target AD area.
在一种可能的实现方式中,控制器根据匹配的表项位置,从目标AD区域中得到目标数据之前,还包括:处理器根据配置信息,确定目标数据的数据长度,并向控制器发送第 二长度指示信息,第二长度指示信息用于指示目标数据的数据长度;根据目标数据的起始存储地址,从目标AD区域中获取目标数据,包括:控制器根据目标数据的起始存储地址,按照目标数据的数据长度,从目标AD区域中获取目标数据。In a possible implementation manner, before the controller obtains the target data from the target AD area according to the position of the matched table entry, it further includes: the processor determines the data length of the target data according to the configuration information, and sends the first data length to the controller. Two length indication information, the second length indication information is used to indicate the data length of the target data; obtaining the target data from the target AD area according to the starting storage address of the target data, including: the controller according to the starting storage address of the target data, According to the data length of the target data, the target data is obtained from the target AD area.
本申请的这些方面或其它方面在以下实施例的描述中会更加简明易懂。These and other aspects of the application will be more concise and understandable in the description of the following embodiments.
附图说明Description of the drawings
图1为本申请实施例提供的一种数据查找系统结构示意图;FIG. 1 is a schematic structural diagram of a data search system provided by an embodiment of this application;
图2为本申请实施例提供的一种第一存储器的存储结构示意图;2 is a schematic diagram of a storage structure of a first memory provided by an embodiment of the application;
图3为本申请实施例提供的一种key区域的存储结构示意图;FIG. 3 is a schematic diagram of a storage structure of a key area provided by an embodiment of the application;
图4为本申请实施例提供的一种第二存储器的存储结构示意图;4 is a schematic diagram of a storage structure of a second memory provided by an embodiment of the application;
图5为本申请实施例提供的一种数据查找方法流程示意图;FIG. 5 is a schematic flowchart of a data search method provided by an embodiment of the application;
图6为本申请实施例提供的一种数据长度与长度标识之间的对应关系示意图;FIG. 6 is a schematic diagram of a correspondence relationship between a data length and a length identifier provided by an embodiment of this application;
图7为本申请实施例提供的一种AD长度消息的结构示意图;FIG. 7 is a schematic structural diagram of an AD length message provided by an embodiment of this application;
图8为本申请实施例提供的一种Kswitch指令结构示意图。FIG. 8 is a schematic diagram of a Kswitch instruction structure provided by an embodiment of the application.
具体实施方式Detailed ways
下面将结合附图,对本申请实施例进行详细描述。The embodiments of the present application will be described in detail below in conjunction with the accompanying drawings.
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述。方法实施例中的具体操作方法也可以应用于装置实施例或系统实施例中。需要说明的是,在本申请的描述中“至少一个”是指一个或多个,其中,多个是指两个或两个以上。鉴于此,本发明实施例中也可以将“多个”理解为“至少两个”。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,字符“/”,如无特殊说明,一般表示前后关联对象是一种“或”的关系。另外,需要理解的是,在本申请的描述中,“第一”、“第二”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。In order to make the purpose, technical solutions, and advantages of the present application clearer, the present application will be further described in detail with reference to the accompanying drawings. The specific operation method in the method embodiment can also be applied to the device embodiment or the system embodiment. It should be noted that in the description of this application, "at least one" refers to one or more, and multiple refers to two or more. In view of this, in the embodiments of the present invention, “a plurality of” may also be understood as “at least two”. "And/or" describes the association relationship of the associated objects, indicating that there can be three types of relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone. In addition, the character "/", unless otherwise specified, generally indicates that the associated objects before and after are in an "or" relationship. In addition, it should be understood that in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing description, and cannot be understood as indicating or implying relative importance, nor can it be understood as indicating Or imply the order.
需要指出的是,本申请实施例中的存储器皆可以理解为二维存储阵列,任一数据的存储长度可以理解为数据在存储阵列的长度方向(存储阵列的行方向)上占据的比特位数。与存储长度对应的存储宽度,可以理解为数据在存储阵列的宽度方向(存储阵列的列方向)上占据的比特位数。任一数据的存储长度和存储宽度定义了该数据的存储空间。为了便于表述,本申请实施例接下来以a×b bit 2表示存储空间的大小,其中a表示存储空间长度方向的比特数,也就是存储长度,b表示存储空间在宽度方向的比特数,也就是存储宽度。 It should be pointed out that the memory in the embodiments of the present application can be understood as a two-dimensional storage array, and the storage length of any data can be understood as the number of bits occupied by the data in the length direction of the storage array (the row direction of the storage array) . The storage width corresponding to the storage length can be understood as the number of bits occupied by data in the width direction of the storage array (column direction of the storage array). The storage length and storage width of any data define the storage space of the data. For ease of presentation, the following embodiments of this application use a×b bit 2 to represent the size of the storage space, where a represents the number of bits in the length direction of the storage space, that is, the storage length, and b represents the number of bits in the width direction of the storage space. It is the storage width.
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
图1示例性示出了一种本申请实施例所提供的一种数据查找系统结构示意图。该数据查找系统可以是分支加速器,也可以是集成有分支加速器的芯片、或片上系统等。示例性的,本申请实施例中数据查找系统可以是中央处理器(central processing unit,CPU)、图形处理器(graphics processing unit,GPU)等运算量较大的处理芯片,处理器100和分支加速器200集成于芯片中,以提高芯片的运算速度。Fig. 1 exemplarily shows a schematic structural diagram of a data search system provided by an embodiment of the present application. The data search system can be a branch accelerator, a chip integrated with a branch accelerator, or a system-on-chip. Exemplarily, the data search system in the embodiment of the present application may be a processing chip with a large amount of calculation such as a central processing unit (CPU), a graphics processing unit (GPU), the processor 100, and a branch accelerator. 200 is integrated in the chip to increase the computing speed of the chip.
如图1所示,数据查找系统包括控制器201、第一存储器202和第二存储器203。其中,控制器201分别与第一存储器202和第二存储器203连接,控制器201包括第一存储器202的控制电路和第二存储器203的控制电路,控制器201可以查找第一存储器202和第二存储器203。As shown in FIG. 1, the data search system includes a controller 201, a first memory 202 and a second memory 203. The controller 201 is connected to the first memory 202 and the second memory 203 respectively. The controller 201 includes a control circuit of the first memory 202 and a control circuit of the second memory 203. The controller 201 can search for the first memory 202 and the second memory 203. Storage 203.
在数据查找系统是集成有分支加速器的芯片、或片上系统的情况下,如图1所示,数据查找系统还可以包括处理器100。处理器100可以是具备运算能力的逻辑电路。示例性的,处理器100中可以包括算术逻辑单元(arithmetic and logic unit,ALU),通过ALU可以实现算术运算、逻辑运算等运算功能。In the case where the data search system is a chip integrated with a branch accelerator or a system on a chip, as shown in FIG. 1, the data search system may further include a processor 100. The processor 100 may be a logic circuit with computing capability. Exemplarily, the processor 100 may include an arithmetic and logic unit (ALU), and arithmetic operations, logic operations, and other operational functions can be implemented through the ALU.
在本申请实施例中,处理器100与控制器201之间可以通过控制总线互连,使得处理器100与分支加速器200之间可以进行信息传递。In the embodiment of the present application, the processor 100 and the controller 201 may be interconnected through a control bus, so that information can be transferred between the processor 100 and the branch accelerator 200.
处理器100在执行运算功能时,往往需要执行条件指令。其中,条件指令可以包括多个分支指令。常见的条件指令有切换(switch)指令、多个如果(if)和否则(else)组成的多层嵌套的指令等等。以多个if和else组成的多层嵌套的指令为例,其伪码可以表示为:When the processor 100 executes arithmetic functions, it often needs to execute conditional instructions. Among them, the conditional instruction may include multiple branch instructions. Common conditional instructions include switch instructions, multiple nested instructions composed of multiple if (if) and otherwise (else), and so on. Take a multi-level nested instruction composed of multiple if and else as an example, its pseudo code can be expressed as:
Figure PCTCN2019128897-appb-000001
Figure PCTCN2019128897-appb-000001
由上述伪码可见,该条件指令包括4个关键词(key)表项(entry),分别为key表项1至4。其中,key表项4可以理解为排除key表项1至3之后的、唯一的表项,因此在本申请实施例中并未直接示出。如上例条件分支指令所示,key表项1与分支指令1对应,key表项2与分支指令2对应,key表项3与分支指令3对应,key表项4(else)与分支指令4对应。It can be seen from the above pseudo code that the conditional instruction includes 4 key entries, which are key entries 1 to 4, respectively. Among them, the key entry 4 can be understood as the only entry after the key entries 1 to 3 are excluded, so it is not directly shown in the embodiment of the present application. As shown in the above conditional branch instruction, key entry 1 corresponds to branch instruction 1, key entry 2 corresponds to branch instruction 2, key entry 3 corresponds to branch instruction 3, and key entry 4 (else) corresponds to branch instruction 4. .
处理器100在运行上述条件指令之前,往往会先获取目标key表项,例如,处理器100可以生成目标key表项,也可以接收其它设备输入的目标key表项,本申请实施例对此并不多作限制。The processor 100 often obtains the target key entry before running the above-mentioned conditional instruction. For example, the processor 100 may generate the target key entry, or may receive the target key entry input by other devices. No restrictions.
之后,处理器100可以执行CMP(compare)指令,将目标key表项与key表项1至4依次逐个匹配,直至匹配成功。示例性的,若目标key表项与key表项2匹配成功,例如,目标key表项为key表项2,则处理器100便可以继续执行分支指令2。After that, the processor 100 may execute a CMP (compare) instruction to match the target key table entry with key table entries 1 to 4 one by one until the matching is successful. Exemplarily, if the target key entry matches the key entry 2 successfully, for example, the target key entry is the key entry 2, then the processor 100 can continue to execute the branch instruction 2.
然而,在执行CMP指令的过程中,会严重浪费处理器100的运算资源。而采用集成 了分支加速器的数据查找系统,便可以节省条件指令对处理器100造成的运算压力,有助于提高处理器100的运算速度和多线程处理能力。However, in the process of executing the CMP instruction, the computing resources of the processor 100 will be seriously wasted. The use of a data search system integrated with a branch accelerator can save the computational pressure on the processor 100 caused by conditional instructions and help improve the computational speed and multi-thread processing capability of the processor 100.
示例性的,控制器201可以接收处理器100发送的目标key表项,根据接收到的目标key表项查找第一存储器202和第二存储器203,从而得到目标key表项对应的目标数据。Exemplarily, the controller 201 may receive the target key entry sent by the processor 100, and search the first memory 202 and the second memory 203 according to the received target key entry, so as to obtain the target data corresponding to the target key entry.
其中,目标key表项对应的目标数据,在可能的实施例中可以为目标key表项对应的目标分支指令,也可以为与目标key表项和目标分支指令对应的指令计数器(program counter,PC),本申请实施例对此并不多作限制。在目标数据为PC的情况下,处理器100存储有多个分支指令,处理器100在接收到控制器201返回的目标数据后,可以根据目标数据从存储的分支指令中读取并执行目标数据对应的分支指令,也就是目标分支指令。Among them, the target data corresponding to the target key entry may be a target branch instruction corresponding to the target key entry, or an instruction counter (program counter, PC) corresponding to the target key entry and the target branch instruction in a possible embodiment. ), the embodiment of the application does not limit this. When the target data is a PC, the processor 100 stores multiple branch instructions. After receiving the target data returned by the controller 201, the processor 100 can read and execute the target data from the stored branch instructions according to the target data. The corresponding branch instruction is the target branch instruction.
具体来说,第一存储器202可以为内容寻址存储器(Content Addressable Memory,CAM),当前比较常见的是三元内容可寻址存储器(ternary content addressable memory,TCAM)。第一存储器202中存储有多个群组(group)。每个群组与一个条件指令对应。对于每个群组,其中包括该群组所对应的条件指令的多个key表项。示例性的,假设该条件指令为switch指令,则第一存储器的存储结构可以如下表一所示:Specifically, the first memory 202 may be a content addressable memory (Content Addressable Memory, CAM), and currently more common is a ternary content addressable memory (TCAM). A plurality of groups are stored in the first memory 202. Each group corresponds to a conditional instruction. For each group, multiple key entries of the conditional command corresponding to the group are included. Exemplarily, assuming that the conditional instruction is a switch instruction, the storage structure of the first memory may be as shown in Table 1 below:
表一Table I
Figure PCTCN2019128897-appb-000002
Figure PCTCN2019128897-appb-000002
如表一所示,第一存储器202中存储有M个群组,如group 1、group 2、……、group M,M为大于1的整数。M个群组分别对应有M个switch指令,如group 1与switch指令1对应,group 2与switch指令2对应,group M与switch指令M对应。As shown in Table 1, M groups are stored in the first memory 202, such as group 1, group 2, ..., group M, where M is an integer greater than 1. M groups correspond to M switch commands, for example, group 1 corresponds to switch command 1, group 2 corresponds to switch command 2, and group M corresponds to switch command M.
对于每个switch指令来说,switch指令的key可以具有多个key表项,且该多个key表项分别与该switch指令的多个分支指令一一对应。以表一中的switch指令1为例,switch指令1的key包括16个key表项(key表项11、key表项12、……、key表项116),该16个key表项与switch指令1的16个分支指令一一对应。switch指令2至switch指令M同理,不再赘述。For each switch instruction, the key of the switch instruction may have multiple key entries, and the multiple key entries respectively correspond to multiple branch instructions of the switch instruction. Take the switch instruction 1 in Table 1 as an example. The key of switch instruction 1 includes 16 key entries (key entry 11, key entry 12, ..., key entry 116), and the 16 key entries are the same as switch The 16 branch instructions of instruction 1 correspond one-to-one. The same is true for switch instruction 2 to switch instruction M, and will not be repeated here.
目前,每个group中的每一个key表项,皆可以通过位置索引与第二存储器203中的AD数据实现一一对应。以group 1中key表项11为例,key表项11可以通过位置索引11与第二存储器203中的AD数据11对应,也就是说,在第一存储器202中存储有key表项11,该key表项11与位置索引11对应,在第二存储器203中,存储有AD数据11,该AD 数据11也与位置索引11对应。At present, each key entry in each group can achieve a one-to-one correspondence with the AD data in the second memory 203 through a location index. Taking the key entry 11 in group 1 as an example, the key entry 11 can correspond to the AD data 11 in the second storage 203 through the position index 11, that is, the key entry 11 is stored in the first storage 202. The key entry 11 corresponds to the position index 11. In the second memory 203, AD data 11 is stored, and the AD data 11 also corresponds to the position index 11.
其中,key表项11与位置索引11之间的对应关系,可以是控制器201根据key表项11的存储地址,以及第一存储器202的最大存储长度与第二存储器203的最大存储长度之间的映射关系,计算得到的。位置索引11与AD数据11之间的对应关系,可以理解为,位置索引11可以指示AD数据11在第二存储器203中的存储地址,也就是说,控制器201可以根据位置索引11确定AD数据11在第二存储器203中的存储地址,从而可以读取AD数据11。The correspondence between the key entry 11 and the position index 11 may be the storage address of the controller 201 according to the key entry 11, and between the maximum storage length of the first memory 202 and the maximum storage length of the second memory 203 The mapping relationship is calculated. The corresponding relationship between the position index 11 and the AD data 11 can be understood as that the position index 11 can indicate the storage address of the AD data 11 in the second memory 203, that is, the controller 201 can determine the AD data according to the position index 11. 11 is the storage address in the second memory 203, so that the AD data 11 can be read.
处理器100在执行条件指令时,可以向分支加速器200发送目标key表项,控制器201可以根据目标key表项查找第一存储器202。在命中目标key表项后,假设key表项11命中了目标key表项,则根据key表项11在第一存储器202中的存储地址,以及第一存储器202的最大存储长度与第二存储器203的最大存储长度之间的映射关系,计算得到位置索引11。控制器201根据位置索引11从第二存储器203读取AD数据11。When the processor 100 executes the conditional instruction, it can send the target key entry to the branch accelerator 200, and the controller 201 can search the first memory 202 according to the target key entry. After hitting the target key entry, assuming that the key entry 11 hits the target key entry, according to the storage address of the key entry 11 in the first memory 202, and the maximum storage length of the first memory 202 and the second memory 203 The mapping relationship between the maximum storage length of, the position index 11 is calculated. The controller 201 reads the AD data 11 from the second memory 203 according to the position index 11.
控制器201将AD数据11返回处理器100,处理器100可以根据AD数据11获取AD数据11对应的分支指令,并继续执行该分支指令。由上述过程可见,分支加速器200可以代替处理器100确定目标key表项对应的AD数据,因此可以省去处理器100执行CMP指令的过程,从而有利于降低处理器100在执行条件指令时的运算压力。The controller 201 returns the AD data 11 to the processor 100, and the processor 100 can obtain the branch instruction corresponding to the AD data 11 according to the AD data 11, and continue to execute the branch instruction. It can be seen from the above process that the branch accelerator 200 can replace the processor 100 to determine the AD data corresponding to the target key entry, so the process of executing the CMP instruction by the processor 100 can be omitted, which is beneficial to reduce the calculation of the processor 100 when executing conditional instructions. pressure.
应理解,对于同一switch指令,其中的多个key表项的数据长度相同。而对于不同的switch指令,其key表项的数据长度可能会有所不同。由于目前,第一存储器202的最大存储长度与第二存储器203的最大存储长度之间需要保持映射关系,致使第一存储器202中所存储的key表项的数据长度长短不一时,将会导致第一存储器202和/或第二存储器203的存储资源浪费,第一存储器202和/或第二存储器203的存储密度还有待进一步提高。It should be understood that for the same switch instruction, the data length of multiple key entries therein is the same. For different switch instructions, the data length of the key table entry may be different. At present, the mapping relationship between the maximum storage length of the first memory 202 and the maximum storage length of the second memory 203 needs to be maintained. As a result, the data lengths of the key entries stored in the first memory 202 are not the same, which will result in the first memory 202. The storage resources of the first memory 202 and/or the second memory 203 are wasted, and the storage density of the first memory 202 and/or the second memory 203 needs to be further improved.
具体来说,第一存储器202配置有最大存储长度,该最大存储长度限制了一个key表项在第一存储器202中的存储长度。例如,在最大存储长度为40bit的情况下,对于数据长度不大于40bit的key表项,则占据40×1bit 2的存储空间。而对于如80bit的key表项,则占据40×2bit 2的存储空间。 Specifically, the first storage 202 is configured with a maximum storage length, and the maximum storage length limits the storage length of a key entry in the first storage 202. For example, in the case where the maximum storage length is 40 bits, for a key entry with a data length of not more than 40 bits, it occupies a storage space of 40×1 bit 2. For an 80-bit key entry, it occupies 40×2bit 2 storage space.
第二存储器203中也配置有最大存储长度,该最大存储长度限制了AD数据在第二存储器203中的最大存储长度,而且,1bit存储宽度只能存储1个AD数据。The second memory 203 is also configured with a maximum storage length, which limits the maximum storage length of AD data in the second memory 203, and a 1-bit storage width can only store one AD data.
当第一存储器202中存储有数据长度不一致的key表项时,第一存储器202的最大存储长度与第二存储器203的最大存储长度之间的映射关系,将会限制第一存储器202和/或第二存器的存储密度的进一步提高。When the first storage 202 stores key entries with inconsistent data lengths, the mapping relationship between the maximum storage length of the first storage 202 and the maximum storage length of the second storage 203 will limit the first storage 202 and/or The storage density of the second memory is further improved.
示例性的,例如表一所示的group 1中key表项11至116的数据长度为40bit,group 2中key表项21至216的长度为数据长度为80bit。Exemplarily, as shown in Table 1, the data length of key entries 11 to 116 in group 1 is 40 bits, and the length of key entries 21 to 216 in group 2 is 80 bits.
假设第一存储器202的最大存储长度为40bit,第二存储器203的最大存储长度为16bit,也就是说,第一存储器202中每40bit的存储长度可以映射为第二存储器203中16bit的存储长度。第一存储器202配置有2000bit 2的存储空间,其中,最大存储宽度为50bit,可以存储共2000bit的key表项数据,相应的,第二存储器203中配置有800bit 2(16×50bit 2)的存储空间。 Assuming that the maximum storage length of the first memory 202 is 40 bits, and the maximum storage length of the second memory 203 is 16 bits, that is, every 40 bits of storage length in the first memory 202 can be mapped to the storage length of 16 bits in the second memory 203. The first memory 202 is configured with a 2000bit 2 storage space, where the maximum storage width is 50bit, and can store a total of 2000bit key entry data. Correspondingly, the second memory 203 is configured with 800bit 2 (16×50bit 2 ) storage space.
在此情况下,根据上述映射关系,group 1在第二存储器203中映射有16×16bit 2的存储空间,group2在第二存储器203中映射有16×32bit 2的存储空间。而根据表一可见,group 1和group 2皆包括16个key表项,也就是说,group 2只需要用到第二存储器203中16 ×16bit 2的存储空间。因此造成第二存储器203中部分存储资源浪费,致使第二存储器203的存储密度较低。 In this case, according to the foregoing mapping relationship, group 1 is mapped to the second memory 203 with a 16×16 bit 2 storage space, and group 2 is mapped to the second memory 203 with a 16×32 bit 2 storage space. According to Table 1, it can be seen that both group 1 and group 2 include 16 key entries, that is, group 2 only needs to use the storage space of 16×16bit 2 in the second memory 203. Therefore, some storage resources in the second memory 203 are wasted, resulting in a lower storage density of the second memory 203.
再假设,第一存储器202的最大存储长度为80bit,第二存储器203的最大存储长度为16bit。例如第二存储器203中配置有800bit 2(16×50bit2)的存储空间,则第一存储器202配置有4000bit 2(80×50bit 2)的存储空间。 It is also assumed that the maximum storage length of the first memory 202 is 80 bits, and the maximum storage length of the second memory 203 is 16 bits. For example, the second memory 203 is configured with a storage space of 800 bit 2 (16×50 bit 2 ), and the first memory 202 is configured with a storage space of 4000 bit 2 (80×50 bit 2 ).
在此情况下,根据上述映射关系,group 1在第二存储器203中映射有16×16bit 2的存储空间,group2在第二存储器203中映射有16×16bit 2的存储空间。虽然并未浪费第二存储器203的存储资源,但在第一存储器202中,group 1的数据总量为40×16bit,但其却占据了80×16bit 2的存储空间,因此又会浪费第一存储器202的存储资源,致使第一存储器202的存储密度较低。 In this case, according to the mapping relationship, group 1 is mapped in the second memory 203 has a memory space of 16 × 16bit 2, group2 mapped in the second memory 203 has a memory space of 16 × 16bit 2. Although the storage resources of the second memory 203 are not wasted, in the first memory 202, the total amount of data in group 1 is 40×16bit, but it occupies the storage space of 80×16bit 2 , so it will waste the first memory. The storage resources of the memory 202 cause the storage density of the first memory 202 to be low.
综上,目前的数据查找系统中存储器(第一存储器202和/或第二存储器203)的存储密度还有待进一步提高。有鉴于此,本申请实施例提供一种数据查找系统,即使第一存储器202的最大存储长度和第二存储器203的最大存储长度不再需要保持映射关系,控制器201也能够查找到目标key表项对应的目标数据,从而可以更加灵活地配置第一存储器202和第二存储器203的存储结构,因此本申请实施例有利于提高第一存储器202和/或第二存储器203的存储密度。In summary, the storage density of the memory (the first memory 202 and/or the second memory 203) in the current data search system needs to be further improved. In view of this, the embodiment of the present application provides a data search system. Even if the maximum storage length of the first memory 202 and the maximum storage length of the second memory 203 no longer need to maintain a mapping relationship, the controller 201 can still find the target key table. According to the target data corresponding to the item, the storage structure of the first memory 202 and the second memory 203 can be configured more flexibly. Therefore, the embodiment of the present application is beneficial to improve the storage density of the first memory 202 and/or the second memory 203.
在一个可能的示例中,如图2所示,本申请实施例中第一存储器202存储有多个key区域(key区域A、B、C、D、XX和YY),每个key区域中包括多个key表项。在一种可能的实现方式中,该多个key区域与多个条件指令对应,需要指出的是,多个key区域与多个条件指令之间可以是一对一、一对多和多对一中任一种对应关系。In a possible example, as shown in FIG. 2, the first memory 202 in the embodiment of the present application stores multiple key areas (key areas A, B, C, D, XX, and YY), and each key area includes Multiple key entries. In a possible implementation, the multiple key areas correspond to multiple conditional instructions. It should be pointed out that the multiple key areas and multiple conditional instructions can be one-to-one, one-to-many, and many-to-one. Any one of the corresponding relationships.
示例性的,一对多可以理解为一个key区域对应多个条件指令。例如,多个条件指令具有相同的key表项,在此情况下,多个条件指令便可以对应于同一个key区域。需要指出的是,对应于同一个key区域的多个条件指令可以具有不同的分支指令,也就是说对应于同一个key区域的多个条件指令,也可以分别对应于不同的AD区域。Exemplarily, one-to-many can be understood as a key area corresponding to multiple conditional instructions. For example, multiple conditional instructions have the same key entry. In this case, multiple conditional instructions can correspond to the same key area. It should be pointed out that multiple conditional instructions corresponding to the same key area may have different branch instructions, that is, multiple conditional instructions corresponding to the same key area may also correspond to different AD areas.
多对一可以理解为多个key区域对应同一个条件指令。例如,一个条件指令的多个key表项可以分为多个key区域存储。Many-to-one can be understood as multiple key areas corresponding to the same conditional command. For example, multiple key entries of a conditional instruction can be divided into multiple key areas for storage.
一对一可以理解为一个key区域对应一个条件指令。例如图2中,key区域A与指令A对应,key区域B与指令B对应,key区域C与指令C对应,key区域D与指令D对应,key区域XX与指令XX对应,key区域YY与指令YY对应,其中,指令A、指令B、指令C、指令D、指令XX和指令YY皆为条件指令。One-to-one can be understood as a key area corresponding to a conditional command. For example, in Figure 2, key area A corresponds to instruction A, key area B corresponds to instruction B, key area C corresponds to instruction C, key area D corresponds to instruction D, key area XX corresponds to instruction XX, and key area YY corresponds to instruction YY corresponds, where instruction A, instruction B, instruction C, instruction D, instruction XX, and instruction YY are all conditional instructions.
第二存储器203存储有多个关联数据(associated data,AD)区域,每个AD区域中包括多个AD数据。在一种可能的实现方式中,该多个AD区域与第一存储器202中的多个key区域对应,需要指出的是,多个AD区域与多个key区域之间可以是一对一、一对多和多对一中任一种对应关系。The second memory 203 stores multiple associated data (AD) areas, and each AD area includes multiple AD data. In a possible implementation manner, the multiple AD areas correspond to multiple key areas in the first memory 202. It should be pointed out that there can be one-to-one or one-to-one relationship between multiple AD areas and multiple key areas. Either the corresponding relationship between many-to-many and many-to-one.
示例性的,一对多可以理解为一个AD区域对应多个key区域。例如,多个条件指令具有不同的key表项,但却具有相同的分支指令,在此情况下,该多个条件指令分别对应的key区域便可以对应于同一个AD区域。Exemplarily, one-to-many can be understood as one AD area corresponding to multiple key areas. For example, multiple conditional instructions have different key entries but the same branch instruction. In this case, the key areas corresponding to the multiple conditional instructions can correspond to the same AD area.
多对一可以理解为多个AD区域对应同一个key区域。例如,多个条件指令具有相同的key表项,但却具有不同的分支指令,在此情况下,该多个条件指令便可以对应于同一个key区域,但该key区域可以对应于多个AD区域。Many-to-one can be understood as multiple AD areas corresponding to the same key area. For example, multiple conditional instructions have the same key entry but different branch instructions. In this case, the multiple conditional instructions can correspond to the same key area, but the key area can correspond to multiple ADs. area.
一对一可以理解为一个AD区域对应一个key区域。例如,图2中,key区域A与AD区域A对应,key区域B与AD区域B对应,key区域C与AD区域C对应,key区域D与AD区域D对应,key区域XX与AD区域XX对应,key区域YY与AD区域对应。One-to-one can be understood as one AD area corresponds to one key area. For example, in Figure 2, key area A corresponds to AD area A, key area B corresponds to AD area B, key area C corresponds to AD area C, key area D corresponds to AD area D, and key area XX corresponds to AD area XX , The key area YY corresponds to the AD area.
为了便于理解,除特别说明的情况下,本申请实施例接下来皆以多个条件指令、多个key区域和多个AD区域之间为一对一的对应关系进行说明。其它对应关系的场景皆可以同样适用。For ease of understanding, unless otherwise specified, the embodiments of the present application are described in the following with a one-to-one correspondence between multiple conditional commands, multiple key areas, and multiple AD areas. The scenarios of other corresponding relationships can be equally applicable.
示例性的,key区域A存储有指令A的N个key表项,N为大于或等于的整数。AD区域A中存储有指令A的N个AD数据,该N个AD数据与指令A的N个分支指令一一对应。Exemplarily, the key area A stores N key entries of the command A, and N is an integer greater than or equal to. The AD area A stores N AD data of instruction A, and the N AD data corresponds to the N branch instructions of instruction A one-to-one.
在一种可能的实现方式中,key区域A中的第i个key表项与AD区域A中的第i个AD数据相对应,i为[1,N]中的整数。也就是说,key区域A中的N个key表项,与AD区域A中的N个AD数据一一对应,第i个key表项在key区域A中的相对位置,与第i个AD数据在AD区域A中的相对位置相同。In a possible implementation manner, the i-th key entry in the key area A corresponds to the i-th AD data in the AD area A, and i is an integer in [1,N]. That is to say, the N key entries in the key area A correspond to the N AD data in the AD area A, and the relative position of the i-th key entry in the key area A is the same as the i-th AD data The relative position in AD area A is the same.
也可以理解为,N个key表项和N个AD数据按照相同的存储顺序,分别存储于key区域A和AD区域A中。例如,图3示例性示出了key区域A中8个key表项的存储顺序。如图3所示,key区域A包括8个key表项,且8个key表项按照A1至A8的顺序依次存储。图4示例性示出了AD区域A中8个AD数据(AD数据1至8)的存储顺序,如图4所示,AD区域A的8个AD数据按照1至8的顺序依次存储。其中,AD数据1至8,依次分别与key表项A1至A8对应,即key表项A1对应AD数据1,key表项A2对应AD数据2,等等。It can also be understood that the N key entries and the N AD data are stored in the key area A and the AD area A in the same storage order. For example, FIG. 3 exemplarily shows the storage order of 8 key entries in the key area A. As shown in Figure 3, the key area A includes 8 key entries, and the 8 key entries are sequentially stored in the order of A1 to A8. FIG. 4 exemplarily shows the storage order of the 8 AD data (AD data 1 to 8) in the AD area A. As shown in FIG. 4, the 8 AD data in the AD area A are sequentially stored in the order of 1 to 8. Among them, AD data 1 to 8 correspond to key entries A1 to A8 respectively, that is, key entry A1 corresponds to AD data 1, key entry A2 corresponds to AD data 2, and so on.
应理解,上述存储顺序是在第一存储器202和第二存储器203的读取顺序的基础上定义的。例如,第一存储器202和第二存储器203的读取顺序是由左到右,由上到下,在此情况下,图3所示的第一存储器202和图4所示的第二存储器203具有相同的存储顺序。可以理解,第一存储器202和第二存储器203的读取顺序也可以是由右到左,由下到上,等等,本申请实施例对此不再一一列举。It should be understood that the foregoing storage order is defined on the basis of the reading order of the first memory 202 and the second memory 203. For example, the reading order of the first memory 202 and the second memory 203 is from left to right and from top to bottom. In this case, the first memory 202 shown in FIG. 3 and the second memory 203 shown in FIG. 4 Have the same storage order. It can be understood that the reading order of the first memory 202 and the second memory 203 may also be from right to left, from bottom to top, etc., which are not listed one by one in the embodiment of the present application.
其它key区域与AD区域之间的对应关系同理,对此不再赘述。此外,第二存储器203中也可能会存在一些未使用区域。The corresponding relationship between other key areas and AD areas is the same, and will not be repeated here. In addition, there may also be some unused areas in the second memory 203.
需要指出的是,本申请实施例中处理器100可以根据第一存储器202和第二存储器203的,指示控制器201查找数据。具体来说,在本申请实施例中可以由处理器100配置上述第一存储器202和第二存储器203的存储结构,也可以由其它装置配置第一存储器202和第二存储器203的存储结构。示例性的,可以由安装有编译器的其它装置配置第一存储器202和第二存储器203的存储结构,在此情况下,该装置可以将第一存储器202和第二存储器203的配置信息发送给处理器100,使处理器100可以根据配置信息,指示控制器201查找数据。It should be pointed out that in this embodiment of the present application, the processor 100 may instruct the controller 201 to search for data according to the first memory 202 and the second memory 203. Specifically, in the embodiment of the present application, the processor 100 may configure the storage structures of the first memory 202 and the second memory 203, or other devices may configure the storage structures of the first memory 202 and the second memory 203. Exemplarily, the storage structure of the first memory 202 and the second memory 203 may be configured by another device installed with a compiler. In this case, the device may send the configuration information of the first memory 202 and the second memory 203 to The processor 100 enables the processor 100 to instruct the controller 201 to search for data according to the configuration information.
示例性的,本申请实施例所提供的数据查找方法可以如图5所示,主要包括以下步骤:Exemplarily, the data search method provided in the embodiment of the present application may be as shown in FIG. 5, and mainly includes the following steps:
S501:处理器100向控制器201发送目标key表项和位置指示信息。S501: The processor 100 sends the target key entry and location indication information to the controller 201.
其中,目标key表项可以是用于执行目标条件指令的key表项。在本申请实施例中,位置指示信息可以指示目标key区域和目标AD区域。其中,目标key区域可以理解为第一存储器202中,与目标条件指令对应的key区域,目标AD区域可以理解为第二存储器中,与目标key区域对应的AD区域。Among them, the target key entry may be a key entry used to execute the target conditional instruction. In the embodiment of the present application, the location indication information may indicate the target key area and the target AD area. The target key area can be understood as the key area corresponding to the target conditional instruction in the first memory 202, and the target AD area can be understood as the AD area corresponding to the target key area in the second memory.
在一种可能的实现方式中,配置信息中包括多个条件指令、多个key区域和多个AD区域之间的对应关系。处理器100可以根据配置信息,确定目标条件指令对应的key区域为目标key区域,目标条件指令对应的AD区域为目标AD区域。由于本申请实施例中位置指示信息可以直接指示目标key区域和目标AD区域,因此即使个条件指令、多个key区域和多个AD区域之间不是一对一的对应关系,也并不影响控制器201根据位置指示信息查找目标数据。In a possible implementation manner, the configuration information includes the correspondence between multiple conditional instructions, multiple key areas, and multiple AD areas. The processor 100 may determine, according to the configuration information, the key area corresponding to the target conditional instruction as the target key area, and the AD area corresponding to the target conditional instruction as the target AD area. Since the position indication information in the embodiment of the present application can directly indicate the target key area and the target AD area, even if there is no one-to-one correspondence between a conditional command, multiple key areas, and multiple AD areas, it does not affect the control. The device 201 searches for the target data according to the position indication information.
S502:控制器201使用目标key表项在目标key区域中进行匹配查找,得到匹配的表项位置。在本申请实施例中,匹配的表项位置可以理解为目标key表项在目标key区域中的相对位置,也可以理解为目标key表项在目标key区域中的存储顺序。S502: The controller 201 uses the target key entry to perform a matching search in the target key area to obtain the location of the matching entry. In the embodiment of the present application, the position of the matched entry can be understood as the relative position of the target key entry in the target key area, and can also be understood as the storage order of the target key entry in the target key area.
S503:控制器201根据匹配的表项位置,从目标AD区域中得到目标数据。由于本申请实施例中,目标key区域内第i个key表项在目标key区域内的相对位置,与第i个AD数据在目标AD区域内的相对位置相同,因此,根据匹配的表项位置可以从目标AD区域中的匹配的表项位置得到目标key表项对应的AD数据,也就是目标数据。S503: The controller 201 obtains target data from the target AD area according to the matched entry position. In the embodiment of this application, the relative position of the i-th key entry in the target key area in the target key area is the same as the relative position of the i-th AD data in the target AD area. Therefore, according to the position of the matched entry The AD data corresponding to the target key entry can be obtained from the position of the matching entry in the target AD area, that is, the target data.
一般来说,控制器201在得到目标数据后,还可以继续执行S504,向处理器100返回目标数据。使得处理器100可以继续执行该目标数据对应的目标分支指令。Generally speaking, after the controller 201 obtains the target data, it may continue to execute S504 and return the target data to the processor 100. The processor 100 can continue to execute the target branch instruction corresponding to the target data.
接下来,对本申请实施例所提供的位置指示信息作进一步的示例性说明。在本申请实施例中,位置指示信息既可以包括目标key区域和目标AD区域的区域标识,也可以包括多个key区域的起始存储地址和多个AD区域的起始存储地址。也就是说,处理器100可以通过起始存储地址向控制器201指示目标key区域和目标AD区域。Next, the position indication information provided by the embodiment of the present application will be further exemplified. In the embodiment of the present application, the location indication information may include the area identifiers of the target key area and the target AD area, or may include the start storage addresses of multiple key areas and the start storage addresses of multiple AD areas. That is, the processor 100 can indicate the target key area and the target AD area to the controller 201 through the initial storage address.
示例性的,多个条件指令、多个key区域的起始存储地址和多个AD区域的起始存储地址之间的对应关系,可以如下表二所示:Exemplarily, the correspondence between multiple conditional instructions, the starting storage addresses of multiple key areas, and the starting storage addresses of multiple AD areas can be as shown in Table 2 below:
表二Table II
Figure PCTCN2019128897-appb-000003
Figure PCTCN2019128897-appb-000003
以指令A为例,指令A与key区域A和AD区域A对应,则如表二所示,key区域A的起始存储地址为地址A,AD区域A的起始存储地址为地址a。指令A对应的位置指示信息可以指示地址A和地址a。Taking instruction A as an example, instruction A corresponds to key area A and AD area A. As shown in Table 2, the initial storage address of key area A is address A, and the initial storage address of AD area A is address a. The location indication information corresponding to instruction A may indicate address A and address a.
又例如指令B,指令B与key区域B和AD区域B对应,则如表二所示,key区域B的起始存储地址为地址B,AD区域B的起始存储地址为地址b。指令B对应的位置指示信息可以指示地址B和地址b。表二中,其它条件指令与起始存储地址之间的对应关系皆可以参考指令A和指令B,对此不再赘述。Another example is instruction B, instruction B corresponds to key area B and AD area B, as shown in Table 2, the initial storage address of key area B is address B, and the initial storage address of AD area B is address b. The location indication information corresponding to instruction B may indicate address B and address b. In Table 2, the corresponding relationship between other conditional instructions and the initial storage address can refer to instruction A and instruction B, which will not be repeated.
有鉴于此,处理器100可以根据配置信息获取目标key区域和目标AD区域的起始存储地址,并通过位置指示信息直接向控制器201指示目标key区域和目标AD区域的起始 存储地址。使得控制器201可以根据位置指示信息直接确定目标key区域和目标AD区域的存储位置。In view of this, the processor 100 can obtain the start storage addresses of the target key area and the target AD area according to the configuration information, and directly indicate the start storage addresses of the target key area and the target AD area to the controller 201 through the position indication information. This allows the controller 201 to directly determine the storage location of the target key area and the target AD area according to the location indication information.
假设目标key区域为key区域A,如图3所示,key区域A的左上角比特位的存储地址为ad11,右上角比特位的存储地址为ad18,左下角比特位的存储地址为ad81,右下角比特位的存储地址为ad88。key区域A包括8个key表项,因此,key区域A的深度信息为8。key区域A的起始存储地址可以是图3中ad11、ad18、ad81和ad88中的任一个。AD区域A的起始位置信息同理,不再赘述。Assuming that the target key area is key area A, as shown in Figure 3, the storage address of the upper left bit of the key area A is ad11, the storage address of the upper right bit is ad18, and the storage address of the lower left bit is ad81, right The storage address of the lower corner bit is ad88. The key area A includes 8 key entries, so the depth information of the key area A is 8. The initial storage address of the key area A can be any one of ad11, ad18, ad81, and ad88 in FIG. 3. The same is true for the starting position information of AD area A, and will not be repeated.
控制器201可以根据目标key区域的起始存储地址从第一存储器202中确定目标key区域,并进一步确定目标key表项在目标key区域中匹配的表项位置。The controller 201 may determine the target key area from the first memory 202 according to the initial storage address of the target key area, and further determine the entry position of the target key entry in the target key area.
例如,控制器201可以由目标key区域的起始存储地址开始匹配查找目标key区域,从而确定目标key表项在目标key区域中的匹配的表项位置。示例性的,目标key区域为图3所示的key区域A,控制器201可以从目标key区域的起始存储地址(地址A为ad11)开始,依次将目标key表项与key表项A1至A8匹配,假设目标key表项与key表项A5匹配成功,也可以理解为,目标key表项为key表项A5,则可以确定目标key表项在目标key区域(key区域A)中的匹配的表项位置为5。For example, the controller 201 may start to match and search the target key area from the initial storage address of the target key area, thereby determining the position of the matching entry of the target key entry in the target key area. Exemplarily, the target key area is the key area A shown in FIG. 3, and the controller 201 may start from the starting storage address of the target key area (address A is ad11), and sequentially connect the target key entry and the key entry A1 to A8 match. Assuming that the target key entry matches the key entry A5 successfully, it can also be understood that the target key entry is the key entry A5, then the match of the target key entry in the target key area (key area A) can be determined The entry position of is 5.
控制器201继而可以根据目标AD区域的起始存储地址从第二存储器203中确定目标AD区域,并进一步根据匹配的表项位置从目标AD区域中得到目标数据。例如,控制器201可以由目标AD区域的起始存储地址开始,确定相对位置与匹配的表项位置一致的AD数据为目标数据。The controller 201 can then determine the target AD area from the second memory 203 according to the initial storage address of the target AD area, and further obtain target data from the target AD area according to the matching entry position. For example, the controller 201 may start from the initial storage address of the target AD area, and determine that the AD data whose relative position is consistent with the position of the matched entry is the target data.
示例性的,假设目标AD区域为AD区域A,控制器201可以从目标AD区域的起始存储地址(地址a)开始,确定自此之后的第5个AD数据为目标数据,因此控制器201可以确定AD区域A中的第5个AD数据(AD数据5)为目标数据。Exemplarily, assuming that the target AD area is AD area A, the controller 201 can start from the starting storage address (address a) of the target AD area, and determine that the fifth AD data thereafter is the target data. Therefore, the controller 201 It can be determined that the fifth AD data (AD data 5) in the AD area A is the target data.
由图5所示的流程可见,本申请实施例中控制器201可以直接根据位置指示信息从第一存储器202中确定目标key区域,以及从第二存储器203中确定目标AD区域。利用目标key表项在目标key区域中的匹配的表项位置从目标AD区域中得到目标数据。本申请实施例中,控制器201不再需要根据第一存储器202的最大存储长度和第二存储器203的最大存储长度之间的映射关系,计算目标数据的位置索引,因此可以更加灵活地配置第一存储器202和第二存储器203的存储结构,进而有利于提高在第一存储器202中key表项的长度不一致的情况下,第一存储器202和/或第二存储器203的存储密度。It can be seen from the process shown in FIG. 5 that the controller 201 in the embodiment of the present application can directly determine the target key area from the first memory 202 and determine the target AD area from the second memory 203 according to the location indication information. The target data is obtained from the target AD area by using the matching entry position of the target key entry in the target key area. In the embodiment of the present application, the controller 201 no longer needs to calculate the position index of the target data according to the mapping relationship between the maximum storage length of the first memory 202 and the maximum storage length of the second memory 203, so the first memory can be configured more flexibly. The storage structure of the first memory 202 and the second memory 203 further helps to increase the storage density of the first memory 202 and/or the second memory 203 when the lengths of the key entries in the first memory 202 are inconsistent.
此外,本申请实施例中处理器100通过位置指示信息,可以直接指示目标key区域和目标AD区域,使得控制器201可以根据位置指示信息从第一存储器202中确定目标key区域,以及从第二存储器203中确定目标AD区域,省去了控制器201遍历第一存储器202和第二存储器203的过程,从而有利于提高控制器201的查找速度,从整体上提高数据查找系统的性能。In addition, in the embodiment of the present application, the processor 100 can directly indicate the target key area and the target AD area through the position indication information, so that the controller 201 can determine the target key area from the first memory 202 according to the position indication information, and from the second The target AD area is determined in the memory 203, eliminating the need for the controller 201 to traverse the first memory 202 and the second memory 203, thereby helping to increase the search speed of the controller 201 and improve the performance of the data search system as a whole.
而且,不是目标key区域的其它key区域中也有可能包含了与目标key表项相同的key表项,若控制器201直接遍历第一存储器202进行查找,还有可能出现误匹配。而本申请实施例通过位置指示信息指示key区域,还有利于防止控制器201误判,从而有利于提高数据查找系统的准确性。Moreover, other key areas that are not the target key area may also contain the same key entry as the target key entry. If the controller 201 directly traverses the first memory 202 to find it, a mismatch may also occur. However, in the embodiment of the present application, the key area is indicated by the position indication information, which is also beneficial to prevent the controller 201 from misjudgment, thereby improving the accuracy of the data search system.
在一种可能的实现方式中,配置信息中还可以包括第一存储器202中多个key区域的 深度信息。每个key区域的深度信息可以理解为该key区域中key表项的数量。可以理解,存在对应关系的key区域和AD区域之间,key区域中key表项的数量和AD区域中AD数据的数量相同,因此深度信息也可以理解为AD区域中AD数据的数量。In a possible implementation manner, the configuration information may also include depth information of multiple key regions in the first memory 202. The depth information of each key area can be understood as the number of key entries in the key area. It can be understood that between the key area and the AD area that have a corresponding relationship, the number of key entries in the key area is the same as the number of AD data in the AD area, so the depth information can also be understood as the number of AD data in the AD area.
控制器201在匹配查找目标key区域时,可以根据深度信息确定目标key区域中key表项的数量。控制器201在查找目标AD区域时,也可以根据深度信息确定目标AD区域中AD数据的数量。因此,控制器201可以更为准确地确定目标key区域和目标AD区域。When the controller 201 matches and searches the target key area, it may determine the number of key entries in the target key area according to the depth information. When searching for the target AD area, the controller 201 may also determine the amount of AD data in the target AD area according to the depth information. Therefore, the controller 201 can more accurately determine the target key area and the target AD area.
在本申请实施例中,key表项在第一存储器202中具有灵活的存储方式。例如,可以由1个或多个key表项占据1bit的存储宽度,即1个或多个key表项可以位于第一存储器202的同一行存储单元,也可以由1个key表项占据多bit的存储宽度。In the embodiment of the present application, the key entry has a flexible storage manner in the first memory 202. For example, one or more key entries can occupy a storage width of 1 bit, that is, one or more key entries can be located in the same row of storage units in the first memory 202, or one key entry can occupy multiple bits. The storage width.
例如,第一存储器202的最大存储长度为40bit。若key区域中key表项的数据长度为20bit,则key区域中可以由两个key表项占据40×1bit 2的存储区域,其中,存储宽度为1bit。若key区域中key表项的数据长度为80bit,则key区域中1个key表项占据40×2bit 2的存储区域,其中,存储宽度为2bit。采用上述存储方式,可以更为灵活地使用第一存储器202的存储空间,有利于进一步提高第一存储器202的存储密度。 For example, the maximum storage length of the first memory 202 is 40 bits. If the data length of the key entry in the key area is 20 bits, the storage area of 40×1 bit 2 can be occupied by two key entries in the key area, where the storage width is 1 bit. If the data length of the key entry in the key area is 80 bits, one key entry in the key area occupies a 40×2bit 2 storage area, where the storage width is 2 bits. With the foregoing storage method, the storage space of the first memory 202 can be used more flexibly, which is beneficial to further increase the storage density of the first memory 202.
应理解,本申请实施例中,key表项的存储长度与数据长度可能相同,也可能不同。如上例中,在第一存储器202的最大存储长度为40bit的情况下,对于数据长度为20bit的key表项,其存储长度也为20bit。而对于数据长度为80bit的key表项,其存储长度则为40bit。It should be understood that, in this embodiment of the present application, the storage length of the key entry and the data length may be the same or different. As in the above example, when the maximum storage length of the first memory 202 is 40 bits, for a key entry with a data length of 20 bits, the storage length is also 20 bits. For a key entry with a data length of 80 bits, the storage length is 40 bits.
为了使控制器201可以更加准确地识别出第一存储器202中的目标key区域,在一种可能的实现方式中,配置信息中还可以包括多个key区域的存储长度。处理器100可以根据配置信息,获取目标key区域的存储长度,并向控制器发送第一长度信息。该第一长度信息可以指示目标key区域在第一存储器202中的存储长度。In order to enable the controller 201 to more accurately identify the target key area in the first memory 202, in a possible implementation manner, the configuration information may also include the storage length of multiple key areas. The processor 100 may obtain the storage length of the target key area according to the configuration information, and send the first length information to the controller. The first length information may indicate the storage length of the target key area in the first memory 202.
本申请实施例通过第一长度指示信息,指示目标key区域的存储长度,使得控制器201可以根据位置指示信息所指示的存储长度,从第一存储器202中准确识别到目标key区域的存储区域,有利于从整体上提高数据查找系统的准确性。In the embodiment of the present application, the storage length of the target key area is indicated by the first length indication information, so that the controller 201 can accurately identify the storage area of the target key area from the first memory 202 according to the storage length indicated by the location indication information. It helps to improve the accuracy of the data search system as a whole.
在本申请实施例中,同一个AD区域中N个AD数据的数据长度可能相同,也可能不相同。为了进一步提高第二存储器203的存储密度,在本申请实施例中,任一AD区域中,一个或多个AD数据可以位于第二存储器203的同一行存储单元,也就是说该1个或多个AD数据占据1bit的存储宽度。In the embodiment of the present application, the data length of the N pieces of AD data in the same AD area may be the same or different. In order to further improve the storage density of the second memory 203, in the embodiment of the present application, in any AD area, one or more AD data may be located in the same row of storage cells of the second memory 203, that is to say, the one or more Each AD data occupies a storage width of 1bit.
例如图4中,可以按照由左到右,由上到下的顺序存储AD区域A的8个AD数据。其中,AD区域A左上角的地址为AD区域A的起始存储地址。当第一行(第一个单位最大存储区域)中存储了AD数据1后,第一行仍有空间继续存储AD数据2和AD数据3。当第一行存储了AD数据3后,第一行已没有空间存储AD数据4,继而在第二行(第二个单位最大存储区域)的左侧继续存储AD数据4。当第二行存储了AD数据4后,第二行仍有空间继续存储AD数据5至7。当第二行存储了AD数据7后,第二行已没有空间存储AD数据8,继而在第三行存储AD数据8。For example, in FIG. 4, the 8 AD data of the AD area A can be stored in the order from left to right and top to bottom. Among them, the address in the upper left corner of AD area A is the initial storage address of AD area A. When AD data 1 is stored in the first row (the largest storage area of the first unit), there is still room for the first row to continue to store AD data 2 and AD data 3. After the AD data 3 is stored in the first row, the first row has no space to store the AD data 4, and then the AD data 4 continues to be stored on the left side of the second row (the second unit largest storage area). After the AD data 4 is stored in the second row, there is still room for the second row to continue to store the AD data 5 to 7. After the AD data 7 is stored in the second row, the second row has no space to store the AD data 8, and then the AD data 8 is stored in the third row.
采用上述存储方式,使得AD区域A共占用了3bit存储宽度。若采用目前的每一个AD数据单独占用1bit存储宽度的存储方式,则AD区域A将占用8bit的存储宽度。由此 可见,本申请实施例所提供的存储方式可以进一步提高第二存储器203的存储密度。With the above-mentioned storage method, the AD area A occupies a total of 3bit storage width. If the current storage method in which each AD data individually occupies 1 bit storage width is adopted, the AD area A will occupy 8 bits of storage width. It can be seen that the storage method provided by the embodiment of the present application can further increase the storage density of the second memory 203.
在此情况下,为了便于控制器201从目标AD区域中得到目标数据,在一种可能的实现方式中,配置信息中还可以包括每个AD区域中,每个AD数据的长度信息。处理器100还可以根据配置信息,得到目标AD区域对应的AD长度消息。其中,AD长度消息可以包括目标AD区域中一个或多个AD数据的数据长度信息。处理器100向控制器201发送该AD长度信息。In this case, in order to facilitate the controller 201 to obtain the target data from the target AD area, in a possible implementation manner, the configuration information may also include length information of each AD data in each AD area. The processor 100 may also obtain the AD length message corresponding to the target AD area according to the configuration information. The AD length message may include data length information of one or more AD data in the target AD area. The processor 100 sends the AD length information to the controller 201.
示例性的,配置信息中可以包括不同数据长度对应的长度标识。例如,第二存储器203中所存储的AD数据共存在4种数据长度,则配置信息中该4种数据长度对应的长度标识可以如图6所示。Exemplarily, the configuration information may include length identifiers corresponding to different data lengths. For example, the AD data stored in the second memory 203 has four data lengths, and the length identifiers corresponding to the four data lengths in the configuration information may be as shown in FIG. 6.
其中,共存在4种数据长度的AD数据。如第一种数据长度对应的长度标识为0,属于第一种数据长度的AD数据包括控制信息(图6中ctrl)和两个指令计数器信息(图6中PC),其中,9b表示控制信息共9bit,21b表示一个指令计数器信息共21bit。又例如第二种数据长度对应的长度标识为1,属于第二种数据长度的AD数据包括ctrl信息、4个PC信息,以及一个保留(图6中RSV)信息。其中,RSV信息为9bit。第三种数据长度和第四种数据长度与前述类似,不再赘述。Among them, there are 4 kinds of data length AD data. For example, the length identifier corresponding to the first data length is 0, and the AD data belonging to the first data length includes control information (ctrl in Figure 6) and two instruction counter information (PC in Figure 6), where 9b represents control information A total of 9 bits, 21b represents a total of 21 bits of information about an instruction counter. For another example, the length identifier corresponding to the second type of data length is 1, and the AD data belonging to the second type of data length includes ctrl information, 4 pieces of PC information, and one piece of reserved (RSV in FIG. 6) information. Among them, the RSV information is 9 bits. The third data length and the fourth data length are similar to the foregoing, and will not be repeated.
基于图6中所示的数据长度与长度标识,图6还示例性示出了一个AD区域的存储结构。如图6所示,该AD区域共包括20个AD数据,其中,一个或多个AD数据占据1bit的存储宽度。Based on the data length and length identification shown in FIG. 6, FIG. 6 also exemplarily shows the storage structure of an AD area. As shown in FIG. 6, the AD area includes a total of 20 AD data, among which one or more AD data occupies a storage width of 1 bit.
在此情况下,处理器100所发送的AD长度消息可以携带该20个AD数据的数据长度标识。示例性的,该AD长度消息可以包括如图7所示的比特位图,其中,每个指示位占据2bit,可以表示一个AD数据的长度标识。图7所示的比特位图,共20个指示位(AT0至AT19),按照从左到右的顺序,可以依次携带AD区域中第1个至第20个AD数据的长度标识。以图6所示的AD区域为例,该AD区域对应的AD长度消息中所携带的比特位图可以是0000000000000100010001000001010010100011。In this case, the AD length message sent by the processor 100 may carry the data length identifier of the 20 AD data. Exemplarily, the AD length message may include a bitmap as shown in FIG. 7, where each indicator bit occupies 2 bits, which may represent a length identifier of AD data. The bitmap shown in FIG. 7 has a total of 20 indicator bits (AT0 to AT19), which can carry the length identifiers of the first to the 20th AD data in the AD area in order from left to right. Taking the AD area shown in FIG. 6 as an example, the bitmap carried in the AD length message corresponding to the AD area may be 0000000000000100010001000001010010100011.
应理解,在AD长度消息可携带的比特位数足够的情况下,可以由AD长度消息指示目标AD区域中每一个AD数据的数据长度。在AD长度消息可携带的比特位数不足的情况下,在一种可能的实现方式中,可以将AD区域中多余的AD数据配置为统一数据长度。例如,对于图7所示的AD长度消息,最多指示20个AD数据的数据长度。则,若AD区域的深度信息大于20,如AD区域B包括25个AD数据,则前20个AD数据可以灵活配置存储结构,后5个AD数据则配置为统一的存储长度。It should be understood that if the number of bits that can be carried in the AD length message is sufficient, the AD length message may indicate the data length of each AD data in the target AD area. In the case that the number of bits that can be carried in the AD length message is insufficient, in a possible implementation manner, the redundant AD data in the AD area can be configured as a uniform data length. For example, for the AD length message shown in FIG. 7, the data length of 20 AD data is indicated at most. Then, if the depth information of the AD area is greater than 20, for example, the AD area B includes 25 AD data, the first 20 AD data can be flexibly configured with a storage structure, and the last 5 AD data can be configured with a uniform storage length.
在另一种可能的实现方式中,也可以发送多个AD长度消息,以指示目标AD区域中每个AD数据的数据长度。例如,AD区域B包括25个AD数据,而一个AD长度消息最多可以指示13个AD数据的数据长度,在此情况下,处理器100可以发送两个AD长度消息。其中一个AD长度消息指示第1个至第13个AD数据的数据长度,另一个AD长度消息指示第14个至第25个AD数据的数据长度。In another possible implementation manner, multiple AD length messages may also be sent to indicate the data length of each AD data in the target AD area. For example, the AD area B includes 25 AD data, and one AD length message can indicate the data length of 13 AD data at most. In this case, the processor 100 can send two AD length messages. One of the AD length messages indicates the data length of the first to thirteenth AD data, and the other AD length message indicates the data length of the 14th to the 25th AD data.
本申请实施例中,AD长度消息也可以称为关联数据类型(AD Type,ADT)指令。图7示例性示出了AD长度消息的一种具体结构,1至49表示AD长度消息的比特位数。AD长度消息携带有起始指示信息(pocode),用于指示本消息为AD长度消息。此外,AD长度消息还携带有起始指示位置信息(Ad_start),用于指示该ADT指令所指示的第一个AD数据的起始存储地址。In the embodiment of the present application, the AD length message may also be referred to as an associated data type (AD Type, ADT) command. Fig. 7 exemplarily shows a specific structure of the AD length message, and 1 to 49 indicate the number of bits of the AD length message. The AD length message carries initial indication information (pocode), which is used to indicate that this message is an AD length message. In addition, the AD length message also carries start indication position information (Ad_start), which is used to indicate the start storage address of the first AD data indicated by the ADT instruction.
如上例中,处理器100发送了两个AD长度消息,其中一个AD长度消息中的Ad_start用于指示目标AD区域中第一个AD数据的起始存储地址,另一个AD长度消息中的Ad_start用于指示目标AD区域中第14个AD数据的起始存储地址。As in the above example, the processor 100 sends two AD length messages. Ad_start in one AD length message is used to indicate the starting storage address of the first AD data in the target AD area, and Ad_start in the other AD length message is used It indicates the starting storage address of the 14th AD data in the target AD area.
在一种可能的实现方式中,可以由空指令携带该AD长度消息,以降低指令开销。In a possible implementation manner, the AD length message can be carried by a null instruction to reduce instruction overhead.
在本申请实施例中,控制器201可以根据AD长度消息和匹配的表项位置,从目标AD区域中得到目标数据。示例性的,控制器201可以根据匹配的表项位置和AD长度消息,确定目标AD区域中位于目标数据之前的AD数据的数据长度。进而可以根据目标AD区域的起始存储地址和位于目标数据之前的AD数据的数据长度,确定目标数据的起始存储地址。In the embodiment of the present application, the controller 201 may obtain the target data from the target AD area according to the AD length message and the matching entry position. Exemplarily, the controller 201 may determine the data length of the AD data before the target data in the target AD area according to the matched entry position and the AD length message. Furthermore, the starting storage address of the target data can be determined according to the starting storage address of the target AD area and the data length of the AD data located before the target data.
假设图4所示的AD区域为目标AD区域,当前匹配的表项位置为5,则控制器201可以根据AD长度消息得到AD数据1至4的数据长度,根据AD数据1至4的数据长度之和便可以确定目标数据(AD数据5)与目标AD区域的起始存储地址之间的地址间隔。从而可以根据目标AD区域的起始存储地址,便可以得到目标数据的起始存储地址。Assuming that the AD area shown in FIG. 4 is the target AD area, and the current matching entry position is 5, the controller 201 can obtain the data length of AD data 1 to 4 according to the AD length message, and according to the data length of AD data 1 to 4 The sum can determine the address interval between the target data (AD data 5) and the start storage address of the target AD area. Therefore, the starting storage address of the target data can be obtained according to the starting storage address of the target AD area.
在一种可能的实现方式中,处理器100还可以根据配置信息,得到目标数据的数据长度信息,并向控制器201发送第二长度指示信息,该第二长度指示信息可以指示目标数据的数据长度。In a possible implementation manner, the processor 100 may also obtain data length information of the target data according to the configuration information, and send second length indication information to the controller 201, where the second length indication information may indicate the data of the target data length.
控制器201在确定目标数据的起始存储地址后,按照可以根据目标数据的长度信息,从第二存储器203中确定目标数据。可以理解,处理器100也可以不发送第二长度指示信息,在此情况下,控制器201也可以根据AD长度消息确定目标数据的长度信息。After the controller 201 determines the initial storage address of the target data, it determines the target data from the second memory 203 according to the length information of the target data. It can be understood that the processor 100 may not send the second length indication information. In this case, the controller 201 may also determine the length information of the target data according to the AD length message.
以图4所示的AD区域A为例,假设AD区域A的起始存储地址为a 0,目标数据在目标AD区域中的存储顺序为5。假设AD数据1至AD数据3的数据长度皆为20bit,AD数据4的数据长度为15bit。则,控制器101可以确定目标数据(AD数据5)的起始存储地址为a 0+75bit。控制器101进而根据目标数据的长度信息,确定目标数据为15bit,则,控制器101可以确定从a 0+75bit至a 0+90bit中得到目标数据。 Taking the AD area A shown in FIG. 4 as an example, it is assumed that the starting storage address of the AD area A is a 0 , and the storage order of the target data in the target AD area is 5. Assume that the data length of AD data 1 to AD data 3 are all 20 bits, and the data length of AD data 4 is 15 bits. Then, the controller 101 can determine that the initial storage address of the target data (AD data 5) is a 0 +75bit. The controller 101 further determines that the target data is 15 bits according to the length information of the target data. Then, the controller 101 can determine to obtain the target data from a 0 +75 bit to a 0 +90 bit.
在一个具体的实施例中,控制器201可以执行如下伪码,以查找目标数据:In a specific embodiment, the controller 201 may execute the following pseudo code to find the target data:
Figure PCTCN2019128897-appb-000004
Figure PCTCN2019128897-appb-000004
其中,AD_START为目标AD区域的起始存储地址,offset为目标key表项在目标key区域中匹配的表现位置,AD_TYPE[i]表示第i个AD数据的长度信息。AD_INDEX表示当前查找位置。Among them, AD_START is the starting storage address of the target AD area, offset is the performance position of the target key entry in the target key area, and AD_TYPE[i] represents the length information of the i-th AD data. AD_INDEX represents the current search position.
AD_INDEX=AD_INDEX>>2,即目标AD区域一行(最大存储长度)包括4个基础长度,该基础长度可以理解为,配置给AD数据的不同数据长度的最大公约数。根据 AD_TYPE(目标数据的长度信息)和AD_INDEX[1:0](表示基础长度)读取目标AD。AD_INDEX=AD_INDEX>>2, that is, one row (maximum storage length) of the target AD area includes 4 basic lengths, which can be understood as the greatest common divisor of different data lengths configured for AD data. Read the target AD according to AD_TYPE (length information of the target data) and AD_INDEX[1:0] (representing the basic length).
Figure PCTCN2019128897-appb-000005
Figure PCTCN2019128897-appb-000005
即,若目标数据的长度信息为0,则目标数据的数据长度为1个基础长度,若目标数据的长度信息为1,则目标数据的数据长度为2个基础长度,若目标数据的长度信息为2,则目标数据的数据长度为3个基础长度,若目标数据的长度信息为3,则目标数据的数据长度为4个基础长度。That is, if the length information of the target data is 0, the data length of the target data is 1 basic length, if the length information of the target data is 1, the data length of the target data is 2 basic lengths, if the length information of the target data If it is 2, the data length of the target data is 3 basic lengths, and if the length information of the target data is 3, the data length of the target data is 4 basic lengths.
在一种可能的实现方式中,本申请实施例中,目标key区域的起始存储地址、目标AD区域的起始存储地址、深度信息、目标key表项的存储宽度、第二长度指示信息等信息可以由图8所示的Kswitch指令携带。In a possible implementation manner, in this embodiment of the application, the starting storage address of the target key area, the starting storage address of the target AD area, depth information, the storage width of the target key entry, the second length indication information, etc. The information can be carried by the Kswitch command shown in Figure 8.
如图8所示,Kswitch指令的opcode用于指示该指令为Kswitch指令,其中,第二长度指示信息,用于指示目标数据的数据长度,Bucket start用于指示目标key区域的起始存储地址,AD_Start用于指示目标AD区域的起始存储地址,k_sz为第一长度指示信息,用于指示目标key区域的存储宽度,Bucket depth用于指示深度信息。As shown in Figure 8, the opcode of the Kswitch command is used to indicate that the command is a Kswitch command, where the second length indication information is used to indicate the data length of the target data, and the bucket start is used to indicate the starting storage address of the target key area. AD_Start is used to indicate the starting storage address of the target AD area, k_sz is the first length indication information, used to indicate the storage width of the target key area, and Bucket depth is used to indicate depth information.
在一种可能的实现方式中,处理器100可以为多核处理器,处理器100的多个内核可以指示控制器201并行查找目标数据。在此情况下,Kswitch指令中还可以包括内核标识(Slice ID,SLID),使得控制器201可以同时为多个内核查找目标数据。In a possible implementation manner, the processor 100 may be a multi-core processor, and multiple cores of the processor 100 may instruct the controller 201 to search for target data in parallel. In this case, the Kswitch instruction may also include a core identifier (Slice ID, SLID), so that the controller 201 can search for target data for multiple cores at the same time.
显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的保护范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to this application without departing from the protection scope of this application. In this way, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, then this application is also intended to include these modifications and variations.

Claims (22)

  1. 一种数据查找系统,其特征在于,包括:控制器、第一存储器和第二存储器,其中,所述第一存储器为内容寻址存储器CAM;A data search system, characterized by comprising: a controller, a first memory and a second memory, wherein the first memory is a content addressable memory CAM;
    所述第一存储器包括多个关键字key区域,其中,每个key区域包括多个key表项;The first memory includes multiple key key areas, where each key area includes multiple key entries;
    所述第二存储器包括多个关联数据AD区域,其中,每个AD区域包括多个AD数据;The second memory includes a plurality of associated data AD areas, wherein each AD area includes a plurality of AD data;
    所述控制器,用于:The controller is used for:
    接收用于查找目标数据的目标key表项和位置指示信息,所述位置指示信息用于指示与所述目标数据关联的目标key区域和目标AD区域;Receiving a target key entry and location indication information used to find target data, where the location indication information is used to indicate a target key area and a target AD area associated with the target data;
    使用所述目标key表项在所述目标key区域中进行匹配查找,得到匹配的表项位置;Use the target key entry to perform a matching search in the target key area to obtain the location of the matching entry;
    根据所述匹配的表项位置,从所述目标AD区域中得到所述目标数据。Obtain the target data from the target AD area according to the position of the matched entry.
  2. 根据权利要求1所述的数据查找系统,其特征在于,所述目标key表项用于执行目标条件指令;The data search system according to claim 1, wherein the target key entry is used to execute target conditional instructions;
    所述数据查找系统还包括处理器,所述处理器用于:The data search system further includes a processor, and the processor is configured to:
    根据所述第一存储器和所述第二存储器的配置信息,以及所述目标条件指令,得到所述位置指示信息,所述配置信息包括多个条件指令、所述多个key区域和所述多个AD区域之间的对应关系,所述目标条件指令对应的key区域为所述目标key区域,所述目标条件指令对应的AD区域为所述目标AD区域;The location indication information is obtained according to the configuration information of the first memory and the second memory, and the target conditional instruction. The configuration information includes multiple conditional instructions, the multiple key areas, and the multiple A corresponding relationship between two AD regions, the key region corresponding to the target conditional command is the target key region, and the AD region corresponding to the target conditional command is the target AD region;
    向所述控制器发送所述目标key表项和所述位置指示信息。Sending the target key entry and the location indication information to the controller.
  3. 根据权利要求2所述的数据查找系统,其特征在于,所述控制器还用于:The data search system according to claim 2, wherein the controller is further configured to:
    向所述处理器发送所述目标数据。Sending the target data to the processor.
  4. 根据权利要求2或3所述的数据查找系统,其特征在于,所述处理器还用于:The data search system according to claim 2 or 3, wherein the processor is further configured to:
    接收所述配置信息。Receiving the configuration information.
  5. 根据权利要求2至4中任一项所述的数据查找系统,其特征在于,所述配置信息还包括所述多个key区域的深度信息;The data search system according to any one of claims 2 to 4, wherein the configuration information further includes depth information of the multiple key regions;
    所述处理器还用于:The processor is also used for:
    根据所述配置信息,获取所述目标key区域的深度信息,并向所述控制器发送所述深度信息;Obtaining the depth information of the target key area according to the configuration information, and sending the depth information to the controller;
    所述控制器还用于:The controller is also used for:
    根据所述位置指示信息和所述深度信息,分别从所述第一存储器中确定所述目标key区域,从所述第二存储器中确定所述目标AD区域。According to the position indication information and the depth information, the target key area is determined from the first memory, and the target AD area is determined from the second memory.
  6. 根据权利要求5所述的数据查找系统,其特征在于,所述配置信息还包括所述多个key区域的存储长度;The data search system according to claim 5, wherein the configuration information further includes the storage length of the multiple key areas;
    所述处理器还用于:The processor is also used for:
    根据所述配置信息,确定所述目标key区域对应的存储长度,并向所述控制器发送第一长度指示信息,所述第一长度指示信息用于指示所述目标key区域的存储长度;Determine the storage length corresponding to the target key area according to the configuration information, and send first length indication information to the controller, where the first length indication information is used to indicate the storage length of the target key area;
    所述控制器具体用于:The controller is specifically used for:
    根据所述位置指示信息、所述深度信息以及所述第一长度指示信息,从所述第一存储器中确定所述目标key区域。The target key area is determined from the first memory according to the position indication information, the depth information, and the first length indication information.
  7. 根据权利要求2至6中任一项所述的数据查找系统,其特征在于,所述每个AD区 域中,一个或多个AD数据位于所述第二存储器的同一行存储单元。The data search system according to any one of claims 2 to 6, wherein in each AD area, one or more AD data are located in the same row of memory cells in the second memory.
  8. 根据权利要求7所述的数据查找系统,其特征在于,所述配置信息还包括每个AD区域中,每个AD数据的长度信息;The data search system according to claim 7, wherein the configuration information further includes length information of each AD data in each AD area;
    所述处理器还用于:The processor is also used for:
    根据所述配置信息,获取与所述目标AD区域对应的AD长度消息,所述AD长度消息包括所述目标AD区域中一个或多个AD数据的数据长度信息,其中,每个数据长度信息用于指示所述每个数据长度信息对应的AD数据的数据长度;According to the configuration information, an AD length message corresponding to the target AD area is acquired, where the AD length message includes data length information of one or more AD data in the target AD area, wherein each data length information is used To indicate the data length of the AD data corresponding to each data length information;
    向所述控制器发送所述AD长度消息。Sending the AD length message to the controller.
  9. 根据权利要求8所述的数据查找系统,其特征在于,所述配置信息还包括每个key区域的起始存储地址,以及每个AD区域的起始存储地址;The data search system according to claim 8, wherein the configuration information further includes the initial storage address of each key area and the initial storage address of each AD area;
    所述位置指示信息包括所述目标key区域的起始存储地址和所述目标AD区域的起始存储地址。The location indication information includes the start storage address of the target key area and the start storage address of the target AD area.
  10. 根据权利要求9所述的数据查找系统,其特征在于,所述控制器,具体用于:The data search system according to claim 9, wherein the controller is specifically configured to:
    根据所述匹配的表项位置获取所述AD长度消息中,所述目标数据之前的AD数据的数据长度;Acquiring the data length of the AD data before the target data in the AD length message according to the position of the matched entry;
    根据所述目标AD区域的起始存储地址,以及所述目标数据之前的AD数据的数据长度,确定所述目标数据的起始存储地址;Determining the starting storage address of the target data according to the starting storage address of the target AD area and the data length of the AD data before the target data;
    根据所述目标数据的起始存储地址,从所述目标AD区域中获取所述目标数据。According to the initial storage address of the target data, the target data is obtained from the target AD area.
  11. 根据权利要求10所述的数据查找系统,其特征在于,所述处理器还用于:The data search system according to claim 10, wherein the processor is further configured to:
    根据所述配置信息,确定所述目标数据的数据长度,并向所述控制器发送第二长度指示信息,所述第二长度指示信息用于指示所述目标数据的数据长度;Determine the data length of the target data according to the configuration information, and send second length indication information to the controller, where the second length indication information is used to indicate the data length of the target data;
    所述控制器,具体用于:The controller is specifically used for:
    根据所述目标数据的起始存储地址,按照所述目标数据的数据长度,从所述目标AD区域中获取所述目标数据。According to the initial storage address of the target data, and according to the data length of the target data, the target data is obtained from the target AD area.
  12. 一种数据查找方法,其特征在于,包括:A data search method, characterized in that it comprises:
    控制器接收用于查找目标数据的目标key表项和位置指示信息,所述位置指示信息用于指示第一存储器中与所述目标数据关联的目标key区域,和第二存储器中与所述目标数据关联的目标AD区域,所述第一存储器为内容寻址存储器CAM,所述第一存储器包括多个关键字key区域,其中,每个key区域包括多个key表项,所述第二存储器包括多个关联数据AD区域,其中,每个AD区域包括多个AD数据;The controller receives a target key entry used to find target data and position indication information, where the position indication information is used to indicate the target key area associated with the target data in the first memory, and the target key area in the second memory associated with the target The target AD area for data association, the first memory is a content addressable memory CAM, the first memory includes a plurality of key key areas, wherein each key area includes a plurality of key entries, the second memory It includes multiple associated data AD areas, where each AD area includes multiple AD data;
    所述控制器使用所述目标key表项在所述目标key区域中进行匹配查找,得到匹配的表项位置;The controller uses the target key entry to perform a matching search in the target key area to obtain the location of the matching entry;
    所述控制器根据所述匹配的表项位置,从所述目标AD区域中得到所述目标数据。The controller obtains the target data from the target AD area according to the position of the matched entry.
  13. 根据权利要求12所述的方法,其特征在于,所述目标key表项用于执行目标条件指令,控制器接收用于查找目标数据的目标key表项和位置指示信息之前,还包括:The method according to claim 12, wherein the target key entry is used to execute the target conditional instruction, and before the controller receives the target key entry and location indication information used to find the target data, the method further comprises:
    处理器根据所述第一存储器和所述第二存储器的配置信息,以及所述目标条件指令,得到所述位置指示信息,所述配置信息包括多个条件指令、所述多个key区域和所述多个AD区域之间的对应关系,所述目标条件指令对应的key区域为所述目标key区域,所述目标条件指令对应的AD区域为所述目标AD区域;The processor obtains the location indication information according to the configuration information of the first memory and the second memory, and the target conditional instruction. The configuration information includes multiple conditional instructions, the multiple key areas, and the For the correspondence between the multiple AD regions, the key region corresponding to the target conditional command is the target key region, and the AD region corresponding to the target conditional command is the target AD region;
    所述处理器向所述控制器发送所述目标key表项和所述位置指示信息。The processor sends the target key entry and the location indication information to the controller.
  14. 根据权利要求13所述的方法,其特征在于,所述控制器根据所述匹配的表项位置,从所述目标AD区域中得到所述目标数据之后,还包括:The method according to claim 13, wherein after the controller obtains the target data from the target AD area according to the position of the matched entry, the method further comprises:
    所述控制器向所述处理器发送所述目标数据。The controller sends the target data to the processor.
  15. 根据权利要求13或14所述的方法,其特征在于,处理器根据所述第一存储器和所述第二存储器的配置信息,以及所述目标条件指令,得到所述位置指示信息之前,还包括:The method according to claim 13 or 14, characterized in that, before the processor obtains the position indication information according to the configuration information of the first memory and the second memory, and the target condition instruction, it further comprises :
    所述处理器接收所述配置信息。The processor receives the configuration information.
  16. 根据权利要求13至15中任一项所述的方法,其特征在于,所述配置信息还包括所述多个key区域的深度信息;The method according to any one of claims 13 to 15, wherein the configuration information further includes depth information of the multiple key regions;
    所述控制器使用所述目标key表项在所述目标key区域中进行匹配查找,得到匹配的表项位置之前,还包括:The controller uses the target key entry to perform a matching search in the target key area, and before obtaining the position of the matching entry, the method further includes:
    所述处理器根据所述配置信息,获取所述目标key区域的深度信息,并向所述控制器发送所述深度信息;The processor obtains the depth information of the target key area according to the configuration information, and sends the depth information to the controller;
    所述控制器根据所述位置指示信息和所述深度信息,从所述第一存储器中确定所述目标key区域,以及从所述第二存储器中确定所述目标AD区域。The controller determines the target key area from the first memory and determines the target AD area from the second memory according to the position indication information and the depth information.
  17. 根据权利要求16所述的方法,其特征在于,所述配置信息还包括所述多个key区域的存储长度;The method according to claim 16, wherein the configuration information further includes the storage length of the multiple key areas;
    所述控制器使用所述目标key表项在所述目标key区域中进行匹配查找,得到匹配的表项位置之前,还包括:The controller uses the target key entry to perform a matching search in the target key area, and before obtaining the position of the matching entry, the method further includes:
    所述处理器根据所述配置信息,确定所述目标key区域对应的存储长度,并向所述控制器发送第一长度指示信息,所述第一长度指示信息用于指示所述目标key区域的存储长度;The processor determines the storage length corresponding to the target key area according to the configuration information, and sends first length indication information to the controller, where the first length indication information is used to indicate the size of the target key area Storage length
    所述控制器根据所述位置指示信息和所述深度信息,从所述第一存储器中确定所述目标key区域,包括:The controller determining the target key area from the first memory according to the position indication information and the depth information includes:
    所述控制器根据所述位置指示信息、所述深度信息以及所述第一长度指示信息,从所述第一存储器中确定所述目标key区域。The controller determines the target key area from the first memory according to the position indication information, the depth information, and the first length indication information.
  18. 根据权利要求13至17中任一项所述的方法,其特征在于,所述每个AD区域中,一个或多个AD数据位于所述第二存储器的同一行存储单元。The method according to any one of claims 13 to 17, wherein in each AD area, one or more AD data are located in the same row of memory cells in the second memory.
  19. 根据权利要求18所述的方法,其特征在于,所述配置信息还包括每个AD区域中,每个AD数据的长度信息;The method according to claim 18, wherein the configuration information further includes length information of each AD data in each AD area;
    所述控制器根据所述匹配的表项位置,从所述目标AD区域中得到所述目标数据之前,还包括:Before the controller obtains the target data from the target AD area according to the matched entry position, the method further includes:
    所述处理器根据所述配置信息,获取与所述目标AD区域对应的AD长度消息,所述AD长度消息包括所述目标AD区域中一个或多个AD数据的数据长度信息,其中,每个数据长度信息用于指示所述每个数据长度信息对应的AD数据的数据长度;The processor obtains an AD length message corresponding to the target AD area according to the configuration information, where the AD length message includes data length information of one or more AD data in the target AD area, wherein each The data length information is used to indicate the data length of the AD data corresponding to each data length information;
    所述处理器向所述控制器发送所述AD长度消息。The processor sends the AD length message to the controller.
  20. 根据权利要求19所述的方法,其特征在于,所述配置信息还包括每个key区域的起始存储地址,以及每个AD区域的起始存储地址;The method according to claim 19, wherein the configuration information further comprises the initial storage address of each key area and the initial storage address of each AD area;
    所述位置指示信息包括所述目标key区域的起始存储地址和所述目标AD区域的起始存储地址。The location indication information includes the start storage address of the target key area and the start storage address of the target AD area.
  21. 根据权利要求20所述的方法,其特征在于,所述控制器根据所述匹配的表项位置,从所述目标AD区域中得到所述目标数据,包括:The method according to claim 20, wherein the controller obtains the target data from the target AD area according to the position of the matched entry, comprising:
    根据所述匹配的表项位置获取所述AD长度消息中,所述目标数据之前的AD数据的数据长度;Acquiring the data length of the AD data before the target data in the AD length message according to the position of the matched entry;
    根据所述目标AD区域的起始存储地址,以及所述目标数据之前的AD数据的数据长度,确定所述目标数据的起始存储地址;Determining the starting storage address of the target data according to the starting storage address of the target AD area and the data length of the AD data before the target data;
    根据所述目标数据的起始存储地址,从所述目标AD区域中获取所述目标数据。According to the initial storage address of the target data, the target data is obtained from the target AD area.
  22. 根据权利要求21所述的方法,其特征在于,所述控制器根据所述匹配的表项位置,从所述目标AD区域中得到所述目标数据之前,还包括:22. The method according to claim 21, wherein before the controller obtains the target data from the target AD area according to the position of the matched entry, the method further comprises:
    所述处理器根据所述配置信息,确定所述目标数据的数据长度,并向所述控制器发送第二长度指示信息,所述第二长度指示信息用于指示所述目标数据的数据长度;The processor determines the data length of the target data according to the configuration information, and sends second length indication information to the controller, where the second length indication information is used to indicate the data length of the target data;
    根据所述目标数据的起始存储地址,从所述目标AD区域中获取所述目标数据,包括:Obtaining the target data from the target AD area according to the initial storage address of the target data includes:
    所述控制器根据所述目标数据的起始存储地址,按照所述目标数据的数据长度,从所述目标AD区域中获取所述目标数据。The controller obtains the target data from the target AD area according to the initial storage address of the target data and the data length of the target data.
PCT/CN2019/128897 2019-12-26 2019-12-26 Data searching system and data searching method WO2021128217A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/128897 WO2021128217A1 (en) 2019-12-26 2019-12-26 Data searching system and data searching method
CN201980102169.9A CN114730322A (en) 2019-12-26 2019-12-26 Data searching system and data searching method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/128897 WO2021128217A1 (en) 2019-12-26 2019-12-26 Data searching system and data searching method

Publications (1)

Publication Number Publication Date
WO2021128217A1 true WO2021128217A1 (en) 2021-07-01

Family

ID=76572958

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/128897 WO2021128217A1 (en) 2019-12-26 2019-12-26 Data searching system and data searching method

Country Status (2)

Country Link
CN (1) CN114730322A (en)
WO (1) WO2021128217A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090171651A1 (en) * 2007-12-28 2009-07-02 Jan Van Lunteren Sdram-based tcam emulator for implementing multiway branch capabilities in an xml processor
CN102841865A (en) * 2011-06-24 2012-12-26 上海芯豪微电子有限公司 High-performance caching system and method
CN103309950A (en) * 2013-05-22 2013-09-18 苏州雄立科技有限公司 Searching method for key value
CN104424129A (en) * 2013-08-19 2015-03-18 上海芯豪微电子有限公司 Cache system and method based on read buffer of instructions

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090171651A1 (en) * 2007-12-28 2009-07-02 Jan Van Lunteren Sdram-based tcam emulator for implementing multiway branch capabilities in an xml processor
CN102841865A (en) * 2011-06-24 2012-12-26 上海芯豪微电子有限公司 High-performance caching system and method
CN103309950A (en) * 2013-05-22 2013-09-18 苏州雄立科技有限公司 Searching method for key value
CN104424129A (en) * 2013-08-19 2015-03-18 上海芯豪微电子有限公司 Cache system and method based on read buffer of instructions

Also Published As

Publication number Publication date
CN114730322A (en) 2022-07-08

Similar Documents

Publication Publication Date Title
US9411778B2 (en) Multiprocessor system and synchronous engine device thereof
US9146777B2 (en) Parallel processing with solidarity cells by proactively retrieving from a task pool a matching task for the solidarity cell to process
US20160283111A1 (en) Read operations in memory devices
US20150242322A1 (en) Locating cached data in a multi-core processor
JPWO2013099414A1 (en) Register mapping method
US10048886B2 (en) Method and system providing file system for an electronic device comprising a composite memory device
US10733101B2 (en) Processing node, computer system, and transaction conflict detection method
US9715392B2 (en) Multiple clustered very long instruction word processing core
US9804896B2 (en) Thread migration across cores of a multi-core processor
TW201903602A (en) Graphics processing unit and method to process a graphics application
US20140201506A1 (en) Method for determining instruction order using triggers
CN104102549A (en) Method, device and chip for realizing mutual exclusion operation of multiple threads
US11934827B2 (en) Partition and isolation of a processing-in-memory (PIM) device
WO2018120933A1 (en) Storage and query method and device of data base
US20080022052A1 (en) Bus Coupled Multiprocessor
US9507725B2 (en) Store forwarding for data caches
WO2021128217A1 (en) Data searching system and data searching method
CN105183668B (en) Cache flush method and device
WO2021061269A1 (en) Storage control apparatus, processing apparatus, computer system, and storage control method
WO2016049808A1 (en) Cache directory processing method and directory controller of multi-core processor system
KR101967857B1 (en) Processing in memory device with multiple cache and memory accessing method thereof
US8683181B2 (en) Processor and method for distributing load among plural pipeline units
CN108733678B (en) Data searching method, device and related equipment
TWI646460B (en) Data processing circuit and data processing method
CN112579481B (en) Data processing method, data processing device and computing device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19957520

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19957520

Country of ref document: EP

Kind code of ref document: A1