CN102663051A - Method and system for searching content addressable memory - Google Patents
Method and system for searching content addressable memory Download PDFInfo
- Publication number
- CN102663051A CN102663051A CN2012100894024A CN201210089402A CN102663051A CN 102663051 A CN102663051 A CN 102663051A CN 2012100894024 A CN2012100894024 A CN 2012100894024A CN 201210089402 A CN201210089402 A CN 201210089402A CN 102663051 A CN102663051 A CN 102663051A
- Authority
- CN
- China
- Prior art keywords
- word
- search
- cam
- son
- sram
- Prior art date
- Legal status (The legal status 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 status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 239000013598 vector Substances 0.000 claims description 50
- 230000008878 coupling Effects 0.000 claims 4
- 238000010168 coupling process Methods 0.000 claims 4
- 238000005859 coupling reaction Methods 0.000 claims 4
- 244000188472 Ilex paraguariensis Species 0.000 claims 2
- 230000003068 static effect Effects 0.000 abstract description 5
- 238000010586 diagram Methods 0.000 description 14
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 1
- 238000013468 resource allocation Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明提供一种搜索内容可寻址存储器的方法和系统。所述方法,包括:获取查找字;将查找字划分成N个子查找字,其中每个子查找字对应内容可寻址存储器CAM中一地址宽度等于该子查找字宽度的静态随机存储器SRAM;并行地以子查找字作为读地址在对应的在SRAM中进行读操作,得到每个子查找字所对应的SRAM上各存储地址对该子查找字的匹配结果;对得到的匹配结果进行合并处理,得到该查找字在CAM中的匹配结果。
The present invention provides a method and system for searching content addressable memory. The method includes: obtaining the search word; dividing the search word into N sub-search words, wherein each sub-search word corresponds to a static random access memory (SRAM) whose address width is equal to the width of the sub-search word in the content addressable memory CAM; in parallel Carry out read operation in corresponding SRAM with sub-search word as read address, obtain the matching result of each storage address on the SRAM corresponding to each sub-search word to this sub-search word; The matching result that obtains is merged processing, obtains this Find word matches in CAM.
Description
技术领域 technical field
本发明涉及集成电路设计领域,尤其涉及一种搜索内容可寻址存储器的方法和系统。The invention relates to the field of integrated circuit design, in particular to a method and system for searching content addressable memory.
背景技术 Background technique
CAM(Content Addressable Memory,内容可寻址存储器),是一种特殊类型的计算机存储器,被广泛运用于计算机和通信领域。标准的存储器RAM的功能为根据用户提供的读地址返回存储在该地址上的数据字。不同于RAM,CAM的功能为根据用户提供的一个数据字,搜索全部的存储以判断该数据字是否存储在其中。如果找到这个数据字,则返回匹配地址,即该数据字在存储器中的位置,因此CAM就是软件术语associative array的硬件具体化。CAM (Content Addressable Memory) is a special type of computer memory that is widely used in the fields of computers and communications. The function of standard memory RAM is to return the data word stored at the address according to the read address provided by the user. Unlike RAM, the function of CAM is to search all the storage to determine whether the data word is stored in it according to a data word provided by the user. If this data word is found, the matching address is returned, which is the location of the data word in memory, so CAM is the hardware embodiment of the software term associative array.
通常的CAM设计原理为在一个操作中搜索整个存储,即读出存储器中每一组数据,并将外部接收的数据与之逐一进行比较,然后根据比较结果对其进行优先译码,优先译码器产生一个二进制的匹配位置定位和一个匹配命中信号。常规的CAM实现方法有两种,一种为将数据存储在SRAM中,搜索时逐一读出静态随机存储器(SRAM)中的内容与查找字进行比较。另一种为将数据存储在Register搭建存储器组中,搜索时将查找字广播到每一组Register中进行比较,再由优先译码器根据各组的比较结果产生匹配位置和匹配命中信号。The usual CAM design principle is to search the entire storage in one operation, that is, read out each group of data in the memory, compare the externally received data with it one by one, and then perform priority decoding on it according to the comparison result. The register generates a binary match position fix and a match hit signal. There are two conventional CAM implementation methods, one is to store the data in the SRAM, and read out the content in the static random access memory (SRAM) one by one to compare with the search word when searching. The other is to store data in Registers and build memory groups. When searching, the search word is broadcast to each group of Registers for comparison, and then the priority decoder generates matching positions and matching hit signals according to the comparison results of each group.
但上述两种实现方法均存在不同程度的弊端,第一种方法受到RAM读端口数量的限制,且完成一个CAM搜索过程需要的延时很大,L=(存储器深度/RAM读端口个数)*Tclk,需要多个时钟周期。在RAM器件规格确定,端口不变的前提下,存储器深度越大,CAM搜索延迟也就越大。以一个1读1写两端口SRAM实现的CAM为例,若存储深度为64,则需要64个时钟周期才能完成一次搜索。第二种方法则受到资源和面积的约束,使用Register搭建的存储器组虽然能并行对查找字进行比较,但占用的芯片面积比同等容量的SRAM大。查找字数据宽度越大,这种面积差距就越明显,为芯片的资源分配和布局布线带来很大的挑战。But above-mentioned two kinds of implementation methods all have drawbacks in varying degrees, the first method is limited by the number of RAM read ports, and the delay required to complete a CAM search process is very large, L=(memory depth/RAM read port number) *Tclk, takes multiple clock cycles. On the premise that the specifications of the RAM device are determined and the ports remain unchanged, the greater the memory depth, the greater the CAM search delay. Taking a CAM implemented by a 1-read 1-write two-port SRAM as an example, if the storage depth is 64, it takes 64 clock cycles to complete a search. The second method is limited by resources and area. Although the memory group built by Register can compare the search words in parallel, it occupies a larger chip area than the SRAM with the same capacity. The larger the width of the search word data, the more obvious the difference in area, which brings great challenges to resource allocation and layout of the chip.
因此,如何快速CAM是一个亟待解决的问题。Therefore, how to fast CAM is an urgent problem to be solved.
发明内容 Contents of the invention
本发明提供一种搜索内容可寻址存储器的方法和系统,要解决的技术问题是如何快速搜索CAM。The invention provides a method and system for searching content addressable memory, and the technical problem to be solved is how to quickly search CAM.
为解决上述技术问题,本发明提供了如下技术方案:In order to solve the problems of the technologies described above, the present invention provides the following technical solutions:
一种搜索内容可寻址存储器CAM的方法,包括:A method of searching a content addressable memory (CAM), comprising:
获取查找字;get search word;
将查找字划分成N个子查找字,其中每个子查找字对应内容可寻址存储器CAM中一地址宽度等于该子查找字宽度的静态随机存储器SRAM;The search word is divided into N sub-search words, wherein each sub-search word corresponds to a static random access memory (SRAM) with an address width equal to the sub-search word width in the content addressable memory CAM;
并行地以子查找字作为读地址在对应的在SRAM中进行读操作,得到每个子查找字所对应的SRAM上各存储地址对该子查找字的匹配结果;Carry out read operation in parallel with sub-search word as read address in corresponding SRAM, obtain the matching result of each storage address on the SRAM corresponding to each sub-search word to this sub-search word;
对得到的匹配结果进行合并处理,得到该查找字在CAM中的匹配结果。The obtained matching results are merged to obtain the matching result of the search word in the CAM.
优选的,所述方法还具有如下特点:所述每个子查找字所对应的SRAM上各存储地址对该子查找字的匹配结果是通过如下方式得到的,包括:Preferably, the method also has the following characteristics: the matching result of each storage address on the SRAM corresponding to each sub-search word to the sub-search word is obtained in the following manner, including:
SRAM的每个存储地址上均对应一个长度等同于CAM搜索深度的位向量,其中位向量的每一位依次表示一个CAM有效入口,如果位向量某一位值等于1,表示CAM中同等位置上存在与子查找字相同的数据,搜索完成,匹配成功;如果位向量所有位都等于0,说明CAM中不存在与子查找字相同的数据,搜索完成,匹配失败。Each storage address of the SRAM corresponds to a bit vector whose length is equal to the search depth of the CAM, where each bit of the bit vector represents a valid CAM entry in turn. If a bit value of the bit vector is equal to 1, it means that the same position in the CAM If there is the same data as the sub-search word, the search is completed, and the match is successful; if all bits of the bit vector are equal to 0, it means that there is no data identical to the sub-search word in the CAM, the search is completed, and the match fails.
优选的,所述方法还具有如下特点:对得到的匹配结果进行合并处理,得到该查找字在CAM中的匹配结果包括:Preferably, the method also has the following characteristics: the obtained matching results are merged to obtain the matching results of the search word in the CAM including:
对得到的N个位向量进行逐位的与操作,得到该查找字在CAM中的匹配结果。Perform a bit-by-bit AND operation on the obtained N bit vectors to obtain the matching result of the search word in the CAM.
优选的,所述方法还具有如下特点:在得到该查找字在CAM中的匹配结果之后,还包括:Preferably, the method also has the following characteristics: after obtaining the matching result of the search word in the CAM, it also includes:
对得到的匹配结果进行缩减运算或操作,得到CAM的搜索匹配结果,如果结果为1,表示匹配成功;如果结果为0,表示匹配失败。Perform reduction operation or operation on the obtained matching result to obtain the CAM search matching result. If the result is 1, it means that the matching is successful; if the result is 0, it means that the matching fails.
优选的,所述方法还具有如下特点:在得到该查找字在CAM中的匹配结果之后,还包括:Preferably, the method also has the following characteristics: after obtaining the matching result of the search word in the CAM, it also includes:
对得到的匹配结果进行优先译码操作,得到一匹配项,该匹配项作为该查找字在CAM中的地址。A priority decoding operation is performed on the obtained matching result to obtain a matching item, and the matching item is used as the address of the search word in the CAM.
一种搜索内容可寻址存储器CAM的系统,包括:A system for searching content addressable memory (CAM), comprising:
获取装置,用于获取查找字;obtaining means for obtaining the search word;
划分装置,与所述获取装置相连,用于将查找字划分成N个子查找字,其中每个子查找字对应内容可寻址存储器CAM中一地址宽度等于该子查找字宽度的静态随机存储器SRAM;The division device is connected with the acquisition device, and is used to divide the search word into N sub-search words, wherein each sub-search word corresponds to a static random access memory (SRAM) whose address width is equal to the width of the sub-search word in the content addressable memory CAM;
读装置,与所述划分装置相连,用于并行地以子查找字作为读地址在对应的在SRAM中进行读操作,得到每个子查找字所对应的SRAM上各存储地址对该子查找字的匹配结果;The reading device is connected with the dividing device, and is used to use the sub-search word as the read address to perform a read operation in the corresponding SRAM in parallel, so as to obtain the information of each storage address on the SRAM corresponding to each sub-search word to the sub-search word matching result;
处理装置,用于对得到的匹配结果进行合并处理,得到该查找字在CAM中的匹配结果。The processing device is used to combine the obtained matching results to obtain the matching result of the search word in the CAM.
优选的,所述系统还具有如下特点:所述读装置通过如下方式得到每个子查找字所对应的SRAM上各存储地址对该子查找字的匹配结果,包括:Preferably, the system also has the following characteristics: the reading device obtains the matching result of each storage address on the SRAM corresponding to each sub-search word to the sub-search word in the following manner, including:
SRAM的每个存储地址上均对应一个长度等同于CAM搜索深度的位向量,其中位向量的每一位依次表示一个CAM有效入口,如果位向量某一位值等于1,表示CAM中同等位置上存在与子查找字相同的数据,搜索完成,匹配成功;如果位向量所有位都等于0,说明CAM中不存在与子查找字相同的数据,搜索完成,匹配失败。Each storage address of the SRAM corresponds to a bit vector whose length is equal to the search depth of the CAM, where each bit of the bit vector represents a valid CAM entry in turn. If a bit value of the bit vector is equal to 1, it means that the same position in the CAM If there is the same data as the sub-search word, the search is completed, and the match is successful; if all bits of the bit vector are equal to 0, it means that there is no data identical to the sub-search word in the CAM, the search is completed, and the match fails.
优选的,所述系统还具有如下特点:Preferably, the system also has the following characteristics:
所述处理装置,用于对得到的N个位向量进行逐位的与操作,得到该查找字在CAM中的匹配结果。The processing device is used to perform a bitwise AND operation on the obtained N bit vectors to obtain a matching result of the search word in the CAM.
优选的,所述系统还具有如下特点:所述系统还包括:Preferably, the system also has the following characteristics: the system also includes:
与操作装置,与所述处理装置相连,对得到的匹配结果进行缩减运算或操作,得到CAM的搜索匹配结果,如果结果为1,表示匹配成功;如果结果为0,表示匹配失败。The operation device is connected with the processing device, and the obtained matching result is reduced or operated to obtain the search matching result of the CAM. If the result is 1, it means that the matching is successful; if the result is 0, it means that the matching fails.
优选的,所述系统还具有如下特点:所述系统还包括:Preferably, the system also has the following characteristics: the system also includes:
优先译码装置,与所述处理装置相连,用于对得到的匹配结果进行优先译码操作,得到一匹配项,该匹配项作为该查找字在CAM中的地址。The priority decoding device is connected with the processing device, and is used for performing a priority decoding operation on the obtained matching result to obtain a matching item, and the matching item is used as the address of the search word in the CAM.
不同于通常的CAM实现方法,本发明提供的实施例不通过逐一比较存储数据和查找字的方法进行搜索,而是将查找字拆分成多个子查找字,拆分后的每个子查找字作为访问地址对SRAM进行读操作,地址数值等同于查找字的那一项存储字被选通,此操作即暗含一次完整搜索过程,且系统时间开销仅为存储器的读延迟。Different from the usual CAM implementation method, the embodiment provided by the present invention does not search by comparing the stored data and the search word one by one, but splits the search word into multiple sub-search words, and each sub-search word after splitting is used as The access address performs a read operation on the SRAM, and the storage word whose address value is equal to the search word is strobed. This operation implies a complete search process, and the system time overhead is only the read delay of the memory.
附图说明 Description of drawings
图1为本发明提供的搜索内容可寻址存储器的方法实施例的流程示意图;FIG. 1 is a schematic flowchart of an embodiment of a method for searching a content-addressable memory provided by the present invention;
图2为本发明中划分查找字的示意图;Fig. 2 is the schematic diagram of dividing search word in the present invention;
图3为本发明中位向量的示意图;Fig. 3 is the schematic diagram of the median vector of the present invention;
图4为本发明提供的对得到的位向量进行处理的示意图;FIG. 4 is a schematic diagram of processing the obtained bit vector provided by the present invention;
图5为本发明中缩减和优先译码操作的处理方式的示意图;Fig. 5 is a schematic diagram of the processing mode of reduction and priority decoding operations in the present invention;
图6为本发明中搜索CAM的系统的结构示意图。FIG. 6 is a schematic structural diagram of a system for searching a CAM in the present invention.
具体实施方式 Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图及具体实施例对本发明作进一步的详细描述。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined arbitrarily with each other.
图1为本发明提供的搜索内容可寻址存储器的方法实施例的流程示意图。图1所示方法实施例,包括:FIG. 1 is a schematic flowchart of an embodiment of a method for searching a content-addressable memory provided by the present invention. The method embodiment shown in Figure 1 includes:
步骤101、获取查找字;
步骤102、将查找字划分成N个子查找字,其中每个子查找字对应内容可寻址存储器CAM中一地址宽度等于该子查找字宽度的SRAM;
其中SRAM的地址宽度的大小为SRAM的存储空间大小对2取对数的结果;例如,存储空间大小为256的SRAM,其地址宽度为8。The address width of the SRAM is the logarithm of the storage space size of the SRAM to 2; for example, the address width of an SRAM with a storage space size of 256 is 8.
步骤103、并行地以划分后子查找字作为读地址,在对应的在SRAM中进行读操作,得到每个子查找字所对应的SRAM上各存储地址对该子查找字的匹配结果;
步骤104、对得到的匹配结果进行合并处理,得到该查找字在CAM中的匹配结果。
不同于通常的CAM实现方法,本发明提供的方法实施例不通过逐一比较存储数据和查找字的方法进行搜索,而是将查找字拆分成多个子查找字,拆分后的每个子查找字作为访问地址对SRAM进行读操作,地址数值等同于查找字的那一项存储字被选通,此操作即暗含一次完整搜索过程,且系统时间开销仅为存储器的读延迟。Different from the usual CAM implementation method, the method embodiment provided by the present invention does not search by comparing the stored data and the search word one by one, but splits the search word into multiple sub-search words, and each sub-search word after splitting The SRAM is read as the access address, and the storage word whose address value is equal to the search word is strobed. This operation implies a complete search process, and the system time overhead is only the read delay of the memory.
下面对本发明提供的方法实施例作进一步说明:The method embodiment provided by the present invention is described further below:
以通用1R1W SRAM存储器为例进行说明,其中该SRAM的存储数据宽度等同于CAM搜索深度,即CAM最多可容纳的被搜索数据的个数。Take the general-purpose 1R1W SRAM memory as an example, where the storage data width of the SRAM is equivalent to the CAM search depth, that is, the maximum number of searched data that the CAM can hold.
整个CAM所包括多个SRAM存储体,如深度为256的SRAM和深度为128的SRAM。The entire CAM includes multiple SRAM storage banks, such as SRAM with a depth of 256 and SRAM with a depth of 128.
当搜索内容数值较大,即查找字数据宽度较大时,若以整个搜索内容单一编址将造成SRAM深度过大(等同于查找字的宽度)。因此将查找字划分为N个子查找字,每个子查找字对应一片地址宽度等于该子查找字宽度的SRAM存储器。When the value of the search content is large, that is, the data width of the search word is large, if the entire search content is single-addressed, the SRAM depth will be too large (equal to the width of the search word). Therefore, the search word is divided into N sub-search words, and each sub-search word corresponds to a piece of SRAM memory whose address width is equal to the width of the sub-search word.
图2为本发明中划分查找字的示意图。在图2所示示意图中,以8为基数将查找字(SearchWord)划分为N个子查找字(SubWord)其中,在查找字宽度为39时,则划分成5份,每个子查找字的宽度依次为8、8、8、8、7。即前四个子查找字对应存储空间为28的SRAM,最后一个对应存储空间为27的SRAM。Fig. 2 is a schematic diagram of dividing search words in the present invention. In the schematic diagram shown in Figure 2, the search word (SearchWord) is divided into N sub-search words (SubWord) with a base of 8. When the search word width is 39, it is divided into 5 parts, and the width of each sub-search word is in turn For 8, 8, 8, 8, 7. That is, the first four sub-search words correspond to an SRAM with a storage space of 28 , and the last one corresponds to an SRAM with a storage space of 27 .
在得到划分后的子查找字后,以子查找字为读地址,在各个子查找字对应的SRAM进行并行进行读操作。After the divided sub-search words are obtained, the sub-search words are used as read addresses, and the SRAM corresponding to each sub-search word is read in parallel.
其中,SRAM的每个存储地址上均对应一个长度等同于CAM搜索深度的位向量,其中位向量的每一位依次表示一个CAM有效入口,通过配置位向量的每一位的数值来表示该SRAM中同等位置上是否存在与该子查找字相同的数据。Among them, each storage address of the SRAM corresponds to a bit vector whose length is equal to the search depth of the CAM, where each bit of the bit vector represents a CAM valid entry in turn, and the SRAM is represented by configuring the value of each bit of the bit vector Whether there is the same data as the sub-search word at the same position in .
具体来说,SRAM中存储的内容为宽度等同于CAM搜索深度的位向量,位向量的每一位均指代一个CAM有效入口,1表示该入口有效,0表示无效。位向量中为1的位在位向量中的位置即指示该有效入口在CAM中的匹配地址。位向量某一位值等于1,说明CAM中同等位置上存在与子查找字相同的数据,搜索完成,匹配成功。位向量所有位都等于0,说明CAM中不存在与子查找字相同的数据,搜索完成,匹配失败。Specifically, the content stored in the SRAM is a bit vector whose width is equal to the search depth of the CAM, and each bit of the bit vector refers to a valid entry of the CAM, 1 indicates that the entry is valid, and 0 indicates that the entry is invalid. The position of the bit that is 1 in the bit vector in the bit vector indicates the matching address of the valid entry in the CAM. A certain bit value of the bit vector is equal to 1, indicating that the same data as the sub-search word exists in the same position in the CAM, the search is completed, and the matching is successful. All bits of the bit vector are equal to 0, indicating that there is no data identical to the sub-search word in the CAM, the search is completed, and the match fails.
图3为本发明中位向量的示意图。在图3所示示意图中,数据宽度等同于CAM搜索深度D的位向量,其中位向量的每一位均指代该SAM中一个有效入口,其中该位的属性值为1时,表示该入口有效;该位的属性值为0时,表示该入口无效。Fig. 3 is a schematic diagram of a bit vector in the present invention. In the schematic diagram shown in Figure 3, the data width is equivalent to the bit vector of the CAM search depth D, where each bit of the bit vector refers to a valid entry in the SAM, and when the attribute value of the bit is 1, it indicates the entry Valid; when the attribute value of this bit is 0, it means that the entry is invalid.
并行读出N个子查找字所对应的SRAM存储器中的位向量,每个位向量都代表了它所在查找字子查找字的匹配信息。对N个位向量的合并操作,即N输入的相同数据宽度的二进制操作数逐位与(&)操作,计算出一个完整宽度的查找字在CAM中的匹配信息。The bit vectors in the SRAM memory corresponding to the N sub-search words are read out in parallel, and each bit vector represents the matching information of the sub-search word where it is located. The merging operation of N bit vectors, that is, the bit-by-bit AND (&) operation of binary operands of the same data width input by N, calculates the matching information of a full-width search word in the CAM.
图4为本发明提供的对得到的位向量进行处理的示意图。在图4所示示意图中,对N个子查找字所对应的位向量(BitVecN)进行逐位“与”操作,当输出结果为1时,则计算出完整宽度的查找字所对应的位向量(BitVector)FIG. 4 is a schematic diagram of processing the obtained bit vector provided by the present invention. In the schematic diagram shown in Figure 4, the bit vector (BitVecN) corresponding to N sub-search words is carried out bit by bit "AND" operation, when the output result is 1, then calculate the bit vector corresponding to the search word of full width ( BitVector)
在合并操作完成后,对合并结果进行缩减运算或(|)操作和优先译码(pri-encoder)操作。合并位向量的缩减运算或操作的结果即为CAM的搜索匹配结果,1表示匹配成功,0表示匹配失败。合并位运算的优先译码操作的结果即为CAM的匹配项在CAM中的地址。After the merging operation is completed, a reduction operation or (|) operation and a priority decoding (pri-encoder) operation are performed on the merging result. The result of the reduction operation or operation of merging bit vectors is the search matching result of CAM, 1 indicates that the match is successful, and 0 indicates that the match fails. The result of the priority decoding operation of the merge bit operation is the address of the matching item of the CAM in the CAM.
图5为本发明中缩减和优先译码操作的处理方式的示意图。在图5所示示意图中,以合并操作所得位向量(BitVector)为操作数,分别进行优先译码和缩减运算或,计算出匹配的CAM有效入口地址(MatchedAddr)和CAM搜索匹配结果(IsMatched)。FIG. 5 is a schematic diagram of the processing manner of the reduction and priority decoding operations in the present invention. In the schematic diagram shown in Figure 5, the bit vector (BitVector) obtained by the merge operation is used as the operand, and the priority decoding and the reduction operation are performed respectively, and the matching CAM effective entry address (MatchedAddr) and the CAM search matching result (IsMatched) are calculated .
另外,CAM的写操作由逻辑控制单元进行控制:由优先译码器找到CAM空项,然后通过SRAM的写端口向地址等同于写入数据的存储字发起写操作,写入内容为该地址上原有存储字与写入对应的位为1,其余位为0的位向量进行逐位或操作的计算结果。In addition, the write operation of CAM is controlled by the logic control unit: the priority decoder finds the CAM empty item, and then initiates a write operation to the storage word whose address is equal to the written data through the write port of the SRAM, and the written content is the original value of the address. The bit vector corresponding to the stored word and the write is 1, and the other bits are 0, which is the calculation result of the bitwise OR operation.
本发明的方法实施例的有益效果是:基于SRAM实现,相对于基于Register的方式电路面积更小。以搜索内容编址的方式取代全遍历一一比对的方式,无需额外的比较逻辑。只需1个时钟周期即输出匹配结果和匹配数据地址,大大提高搜索效率,缩小了事务处理延迟,提高了系统的吞吐率。The beneficial effect of the method embodiment of the present invention is: the implementation based on SRAM has smaller circuit area than the method based on Register. The one-to-one comparison method of full traversal is replaced by the method of searching content addressing, without additional comparison logic. Only one clock cycle is needed to output the matching result and the matching data address, which greatly improves the search efficiency, reduces the transaction processing delay, and improves the system throughput.
与上述方法对应的,本发明还提供一种搜索内容可寻址存储器CAM的系统,包括:Corresponding to the above method, the present invention also provides a system for searching content addressable memory CAM, including:
获取装置,用于获取查找字;obtaining means for obtaining the search word;
划分装置,与所述获取装置相连,用于将查找字划分成N个子查找字,其中每个子查找字对应内容可寻址存储器CAM中一地址宽度等于该子查找字宽度的静态随机存储器SRAM;The division device is connected with the acquisition device, and is used to divide the search word into N sub-search words, wherein each sub-search word corresponds to a static random access memory (SRAM) whose address width is equal to the width of the sub-search word in the content addressable memory CAM;
读装置,与所述划分装置相连,用于并行地以子查找字作为读地址在对应的在SRAM中进行读操作,得到每个子查找字所对应的SRAM上各存储地址对该子查找字的匹配结果;The reading device is connected with the dividing device, and is used to use the sub-search word as the read address to perform a read operation in the corresponding SRAM in parallel, so as to obtain the information of each storage address on the SRAM corresponding to each sub-search word to the sub-search word matching result;
处理装置,用于对得到的匹配结果进行合并处理,得到该查找字在CAM中的匹配结果。The processing device is used to combine the obtained matching results to obtain the matching result of the search word in the CAM.
其中,所述读装置通过如下方式得到每个子查找字所对应的SRAM上各存储地址对该子查找字的匹配结果,包括:Wherein, the reading device obtains the matching result of each storage address on the SRAM corresponding to each sub-search word to the sub-search word in the following manner, including:
SRAM的每个存储地址上均对应一个长度等同于CAM搜索深度的位向量,其中位向量的每一位依次表示一个CAM有效入口,如果位向量某一位值等于1,表示CAM中同等位置上存在与子查找字相同的数据,搜索完成,匹配成功;如果位向量所有位都等于0,说明CAM中不存在与子查找字相同的数据,搜索完成,匹配失败。Each storage address of the SRAM corresponds to a bit vector whose length is equal to the search depth of the CAM, where each bit of the bit vector represents a valid CAM entry in turn. If a bit value of the bit vector is equal to 1, it means that the same position in the CAM If there is the same data as the sub-search word, the search is completed, and the match is successful; if all bits of the bit vector are equal to 0, it means that there is no data identical to the sub-search word in the CAM, the search is completed, and the match fails.
优选的,所述处理装置,用于对得到的N个位向量进行逐位的与操作,得到该查找字在CAM中的匹配结果。Preferably, the processing device is configured to perform a bitwise AND operation on the obtained N bit vectors to obtain a matching result of the search word in the CAM.
可选的,所述系统还包括:Optionally, the system also includes:
与操作装置,与所述处理装置相连,对得到的匹配结果进行缩减运算或操作,得到CAM的搜索匹配结果,如果结果为1,表示匹配成功;如果结果为0,表示匹配失败。The operation device is connected with the processing device, and the obtained matching result is reduced or operated to obtain the search matching result of the CAM. If the result is 1, it means that the matching is successful; if the result is 0, it means that the matching fails.
可选的,所述系统还包括:Optionally, the system also includes:
优先译码装置,与所述处理装置相连,用于对得到的匹配结果进行优先译码操作,得到一匹配项,该匹配项作为该查找字在CAM中的地址。The priority decoding device is connected with the processing device, and is used for performing a priority decoding operation on the obtained matching result to obtain a matching item, and the matching item is used as the address of the search word in the CAM.
下面以一应用实例进行说明:The following is an application example to illustrate:
图6为本发明中搜索CAM的系统的结构示意图。在图6所示系统中,该系统包括三个单元,即查找字区间划分单元、SRAM存储器单元和逻辑控制单元。其中查找字单元负责接收CAM搜索使能(SearchEn)和CAM搜索内容,并对CAM搜索内容,即查找字(SearchWord)进行区域划分,得到N个子区间。每个子区间对应1个子查找字(SubWord),以此驱动SRAM存储器单元的读操作地址。同时查找字划分单元输出各片SRAM的读使能信号,SRAM存储器单元接收到读使能信号有效即开始读操作,读出相应地址上的位向量(BitVecN),并且在端口上输出。逻辑控制单元在接收到存储器控制单元发出的N个位向量后对其进行合并,缩减和优先译码,计算出最终的搜索匹配结果(IsMatched)和匹配地址(MatchedAddr),并在端口上输出。FIG. 6 is a schematic structural diagram of a system for searching a CAM in the present invention. In the system shown in FIG. 6, the system includes three units, that is, a search word interval division unit, an SRAM memory unit and a logic control unit. The search word unit is responsible for receiving the CAM search enable (SearchEn) and the CAM search content, and divides the CAM search content, namely the search word (SearchWord), into N subsections. Each sub-interval corresponds to a sub-search word (SubWord), which drives the read operation address of the SRAM memory unit. Search word division unit to output the read enable signal of each chip SRAM simultaneously, SRAM memory unit receives read enable signal and starts read operation effectively, reads out the bit vector (BitVecN) on the corresponding address, and outputs on the port. After receiving the N bit vectors sent by the memory control unit, the logic control unit merges them, reduces them and first decodes them, calculates the final search matching result (IsMatched) and matching address (MatchedAddr), and outputs them on the port.
本发明的系统实施例的有益效果是:基于SRAM实现,相对于基于Register的方式电路面积更小。以搜索内容编址的方式取代全遍历一一比对的方式,无需额外的比较逻辑。只需1个时钟周期即输出匹配结果和匹配数据地址,大大提高搜索效率,缩小了事务处理延迟,提高了系统的吞吐率。The beneficial effect of the system embodiment of the present invention is: the implementation based on SRAM has smaller circuit area than the method based on Register. The one-to-one comparison method of full traversal is replaced by the method of searching content addressing, without additional comparison logic. Only one clock cycle is needed to output the matching result and the matching data address, which greatly improves the search efficiency, reduces the transaction processing delay, and improves the system throughput.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求所述的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope described in the claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210089402.4A CN102663051B (en) | 2012-03-29 | 2012-03-29 | Method and system for searching content addressable memory |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210089402.4A CN102663051B (en) | 2012-03-29 | 2012-03-29 | Method and system for searching content addressable memory |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN102663051A true CN102663051A (en) | 2012-09-12 |
| CN102663051B CN102663051B (en) | 2014-12-10 |
Family
ID=46772542
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201210089402.4A Active CN102663051B (en) | 2012-03-29 | 2012-03-29 | Method and system for searching content addressable memory |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN102663051B (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102937969A (en) * | 2012-10-12 | 2013-02-20 | 浪潮电子信息产业股份有限公司 | Method for quickly searching CAM (Central Address Memory) |
| CN107018078A (en) * | 2017-01-25 | 2017-08-04 | 华为技术有限公司 | Multi-branch jump co-processing method and device |
| CN109194566A (en) * | 2018-08-27 | 2019-01-11 | 惠州Tcl移动通信有限公司 | A kind of method of retransmission of information, storage medium and terminal device |
| CN115878863A (en) * | 2022-12-01 | 2023-03-31 | 杭州菲数科技有限公司 | Data searching method and data searching device |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1447941A (en) * | 2001-05-17 | 2003-10-08 | 梅姆考尔有限责任公司 | Searching words of different sizes |
| US20050071544A1 (en) * | 2003-09-29 | 2005-03-31 | International Business Machines Corporation | Segmented content addressable memory architecture for improved cycle time and reduced power consumption |
| US6928430B1 (en) * | 2002-04-23 | 2005-08-09 | Integrated Silicon Solution, Inc. | Prefix match search scheme |
| CN1702773A (en) * | 2004-05-25 | 2005-11-30 | 英特尔公司 | Programmable parallel lookup memory |
| CN1784678A (en) * | 2003-03-28 | 2006-06-07 | 柏树半导体公司 | System and method for efficiently searching a forwarding database that is split into a bounded number of sub-databases having a bounded size |
| CN101822027A (en) * | 2007-10-15 | 2010-09-01 | 爱立信电话股份有限公司 | Method and apparatus for efficient cam lookup for internet protocol addresses |
-
2012
- 2012-03-29 CN CN201210089402.4A patent/CN102663051B/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1447941A (en) * | 2001-05-17 | 2003-10-08 | 梅姆考尔有限责任公司 | Searching words of different sizes |
| US6928430B1 (en) * | 2002-04-23 | 2005-08-09 | Integrated Silicon Solution, Inc. | Prefix match search scheme |
| CN1784678A (en) * | 2003-03-28 | 2006-06-07 | 柏树半导体公司 | System and method for efficiently searching a forwarding database that is split into a bounded number of sub-databases having a bounded size |
| US20050071544A1 (en) * | 2003-09-29 | 2005-03-31 | International Business Machines Corporation | Segmented content addressable memory architecture for improved cycle time and reduced power consumption |
| CN1702773A (en) * | 2004-05-25 | 2005-11-30 | 英特尔公司 | Programmable parallel lookup memory |
| CN101822027A (en) * | 2007-10-15 | 2010-09-01 | 爱立信电话股份有限公司 | Method and apparatus for efficient cam lookup for internet protocol addresses |
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102937969A (en) * | 2012-10-12 | 2013-02-20 | 浪潮电子信息产业股份有限公司 | Method for quickly searching CAM (Central Address Memory) |
| CN107018078A (en) * | 2017-01-25 | 2017-08-04 | 华为技术有限公司 | Multi-branch jump co-processing method and device |
| CN107018078B (en) * | 2017-01-25 | 2020-08-07 | 华为技术有限公司 | Multi-branch jump co-processing method and device |
| CN109194566A (en) * | 2018-08-27 | 2019-01-11 | 惠州Tcl移动通信有限公司 | A kind of method of retransmission of information, storage medium and terminal device |
| CN115878863A (en) * | 2022-12-01 | 2023-03-31 | 杭州菲数科技有限公司 | Data searching method and data searching device |
| CN115878863B (en) * | 2022-12-01 | 2023-12-19 | 杭州菲数科技有限公司 | Data searching method and data searching device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN102663051B (en) | 2014-12-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11151140B2 (en) | Methods and apparatuses for reducing power consumption in a pattern recognition processor | |
| TWI409695B (en) | Systems, methods, and devices for configuring a device | |
| TWI486810B (en) | Counter operation in a state machine lattice | |
| US8938590B2 (en) | Indirect register access method and system | |
| US9697140B2 (en) | Encryption integrity check with CRC encryption in memory using a word count- and address-derived nonce | |
| US8209521B2 (en) | Methods of indirect register access including automatic modification of a directly accessible address register | |
| CN101572552B (en) | High-speed lossless data compression system based on content addressable memory | |
| WO2016169318A1 (en) | Access method, device and system for expanding memory | |
| US12175250B2 (en) | Computing device and method for fusing and executing vector instructions | |
| CN102663051B (en) | Method and system for searching content addressable memory | |
| TWI537980B (en) | Apparatuses and methods for writing masked data to a buffer | |
| CN102937969A (en) | Method for quickly searching CAM (Central Address Memory) | |
| KR20180080684A (en) | Method and system of searching for data stored in memory | |
| US8369120B2 (en) | Methods and apparatus for sum of address compare write recode and compare reduction | |
| CN101211346A (en) | Method for optimizing memorizer performance | |
| WO2016063667A1 (en) | Reconfigurable device | |
| CN107870885A (en) | Communication system, device and method | |
| US20170193376A1 (en) | Area/energy complex regular expression pattern matching hardware filter based on truncated deterministic finite automata (dfa) | |
| US10114585B2 (en) | Transaction elimination using metadata | |
| CN110580231B (en) | Processing circuit, buffer, memory and processor | |
| CN115113932A (en) | Register access method, processor and electronic device | |
| Levchenko et al. | Organization of pipeline operations in mapping unit of the dataflow parallel computing system | |
| JPH0359739A (en) | Memory system of information processing equipment | |
| JPH01211052A (en) | Hit detecting method for cache memory |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant |