TECHNICAL FIELD
The present invention relates generally to CAM devices and specifically to processing multiple flows in a CAM device.
BACKGROUND OF RELATED ART
Content addressable memory (CAM) devices are frequently used in network switching and routing applications to determine forwarding destinations for data packets, and are also used to provide more advanced network Quality of Service (QoS) functions such as traffic shaping, traffic policing, rate limiting, and so on. More recently, CAM devices have been deployed in network environments to implement intrusion detection systems and to perform deep packet inspection tasks. A CAM device can be instructed to compare a selected portion of an incoming packet with CAM words stored in an array within the CAM device.
More specifically, a CAM device includes a CAM array having a plurality of CAM cells organized in a number of rows and columns. Each row of CAM cells, which can be used to store a CAM word, is coupled to a corresponding match line that indicates match results for the row. Each column of CAM cells is typically coupled to one or more data lines or data line pairs that can be used to drive data into a selected CAM row during write operations and/or for providing a search key to the CAM rows during compare operations. During a compare operation, the search key (e.g., the comparand word) is provided to the CAM array and compared with the CAM words stored therein. For each CAM word that matches the search key, a corresponding match line is asserted to indicate the match result, which is typically stored in a match latch associated with the matching CAM row. If one or more of the match lines are asserted, a match flag is asserted to indicate the match condition, and a priority encoder determines the match address or index of the highest priority matching (HPM) entry in the CAM array.
Because today's networking components process numerous different flows (e.g., groups of packets originating from a common source) at the same time, effective deployment of CAM devices in network environments favors the ability to quickly switch between multiple flows. To switch a CAM device between different flows, search operations for the currently active first flow (F1) are paused, and the match data (also referred to as state information) of the first flow is read from the match latches and stored in an external state memory. Then, the packets of the awaiting second flow (F2) are provided to the CAM device, and search operations are commenced for the second flow. To switch back to the first flow, search operations for the second flow (F2) are paused, the state information of the second flow F2 is saved in the external state memory, and then the state information of the first flow F1 is restored to the CAM array (e.g., loaded back into the array's match latches) from the external state memory.
The speed with which a CAM device can switch between different flows is typically dependent upon the number of active states (e.g., match values of “1” indicating a match condition) present in the CAM array's match latches. For example, some techniques for saving state information generate the HPM addresses of all active states using the CAM device's priority encoder, and then sequentially output the HPM addresses to the state memory. Other techniques read the state information from the CAM array's match latches in a serial fashion to the external state memory. However, as the number of active states in CAM devices increases, these prior techniques are becoming increasingly insufficient to maintain ever-faster network line speeds. For example, CAM devices configured to store a number of non-deterministic finite automaton (NFA) that embody an access control list (ACL) typically store many thousands of states, of which hundreds or even a few thousand can be active at any given time. For such CAM devices, the time required to transfer state information between the CAM device and an associated external state memory can be significant, during which search operations are not performed in the CAM device. As a result, switching between flows in such CAM devices has an increasingly adverse effect upon device throughput.
Accordingly, there is a need to improve the speed with which state information can be transferred between the CAM device and an associated external state memory.
BRIEF DESCRIPTION OF THE DRAWINGS
The present embodiments are illustrated by way of example and not intended to be limited by the figures of the accompanying drawings, where:
FIG. 1 shows a block diagram of a search system in accordance with some of the present embodiments;
FIG. 2 shows a block diagram of a content addressable memory (CAM) device in accordance with some embodiments of FIG. 1;
FIG. 3 shows a block diagram of one embodiment of the CAM array of FIG. 2;
FIGS. 4A-4C are illustrative flow charts depicting an exemplary flow switch operation in accordance with some embodiments;
FIG. 5 shows a circuit diagram of a portion of one embodiment of the CAM array of FIG. 3;
FIG. 6A shows a circuit diagram of one embodiment of the pass gate of FIG. 5;
FIG. 6B shows another embodiment of the save state and restore read circuit of FIG. 5;
FIG. 7A shows a circuit diagram of a portion of another embodiment of the CAM array of FIG. 3;
FIG. 7B shows a functional block diagram of a portion of yet another embodiment of the CAM array of FIG. 3;
FIG. 8 is an illustrative flow chart depicting an exemplary flow switch operation in accordance with one embodiment of the CAM row of FIG. 7B; and
FIG. 9 shows a simplified block diagram of another embodiment of the CAM array of FIG. 2.
Like reference numerals refer to corresponding parts throughout the drawing figures.
DETAILED DESCRIPTION
A method and apparatus for more efficient switching between flows in a CAM device are disclosed. In the following description, for purposes of explanation, specific nomenclature is set forth to provide a thorough understanding of the present invention. However, it will be apparent to one skilled in the art that these specific details may not be required to practice the present invention. In other instances, well-known circuits and devices are shown in block diagram form to avoid obscuring the present invention unnecessarily. Additionally, the interconnection between circuit elements or blocks may be shown as buses or as single signal lines. Each of the buses may alternatively be a single signal line, and each of the single signal lines may alternatively be a bus. Further, the logic levels assigned to various signals in the description below are arbitrary, and therefore may be modified (e.g., reversed polarity) as desired. Accordingly, the present invention is not to be construed as limited to specific examples described herein but rather includes within its scope all embodiments defined by the appended claims.
Present embodiments allow a search engine to save and restore state information to and from an external state memory when switching between multiple input flows faster than conventional approaches by transferring the state information between the search engine and the external state memory in a parallel manner. More specifically, for CAM-based search engines configured according to present embodiments, the CAM array includes state information gating circuits that selectively allow state information stored in the CAM array's match latches to be transposed onto the array's bit lines and then read from the array using the array's sense amplifiers, thereby enabling the state information to be read from the array for storage in the external state memory in a parallel manner. Similarly, state information stored in the external memory can be written in parallel onto the array's bit lines via the array's write drivers, and then transposed from the bit lines into the rows' match latches via the gating circuits to restore the state information to the CAM device. In this manner, present embodiments utilize existing CAM array components (e.g., bit lines, sense amplifiers, and write drivers) to quickly transfer state information between the CAM array and the external state memory, thereby significantly increasing state information transfer speeds with the addition of minimal circuitry (e.g., the state information gating circuits).
FIG. 1 shows a search system 100 within which the present embodiments may be implemented. Search system 100 includes a search engine 110, a flow control circuit 120, and an external state memory 130. Search engine 110 stores a number of patterns to be searched for in search keys belonging to multiple flows. The flow control circuit 120 has an input to receive an input stream (e.g., incoming packets) from an input source (e.g., a blade or line card of a router or other network device), has a first output to provide search keys (SK) to search engine 110, has a second output to provide a flow switch control signal (CTR_FS) to search engine 110, and has a third output to provide a save state and restore control signal (CTR_SSR) to state memory 130. For some embodiments operation, flow control circuit 120 receives incoming packets belonging to various flows, extracts header information from each packet to identify which flow the packet belongs to, and forwards the packets to search engine 110 for search operations. As discussed in more detail below, when flow control circuit 120 detects that a packet to be sent to search engine 110 belongs to a different flow than the previously sent packet, flow control circuit 120 initiates a flow switch operation in search engine 110 (e.g., by asserting CTR_FS) and facilitates the transfer of state information between search engine 110 and state memory 130 (e.g., by asserting CTR_SSR).
For exemplary embodiments described herein, search engine 110 is a CAM device, although for alternate embodiments other search engines may be used. For example, FIG. 2 shows a CAM device 200 that is one embodiment of search engine 110. CAM device 200 includes a CAM array 210, an address decoder 220, a comparand register 230, a read/write circuit 240, a priority encoder circuit 250, and match logic 260. CAM array 210 includes any number of rows of CAM cells (not shown for simplicity in FIG. 2), where each row of CAM cells can be configured to store a data word. The CAM cells can be any suitable type of CAM cell including, for example, binary CAM cells, ternary CAM cells, and/or quaternary CAM cells. Further, while CAM array 210 is shown in FIG. 2 as a single CAM array, it may include any number of CAM array blocks that can be independently searched.
For some embodiments, CAM array 210 is of the type described in commonly-owned U.S. Pat. No. 7,643,353, which is incorporated by reference herein. For CAM arrays of the type described in U.S. Pat. No. 7,643,353, the rows of CAM cells are each selectively connected to a programmable routing structure (PRS) that can be configured to selectively route the match signal from any CAM row as an input match signal to itself and/or to any number of other arbitrarily selected CAM rows at the same time. The CAM array may also include a number of counter circuits that can be selectively connected to each other and/or to any number of the CAM rows by the PRS. In this manner, CAM arrays of the type disclosed in U.S. Pat. No. 7,643,353 can be configured to implement search operations for complex regular expressions having various metacharacters, quantifiers, and/or character classes.
More specifically, to store a complex regular expression in the CAM array disclosed in U.S. Pat. No. 7,643,353, the CAM array's PRS is programmed to implement a non-deterministic finite automaton (NFA) that embodies the complex regular expression, thereby mapping the NFA into the CAM array hardware. During search operations, the logic states of the match lines are indicative of the states of the corresponding NFA (e.g., where an asserted match line indicates that the corresponding state of the NFA is active, and a de-asserted match line indicates that the corresponding state of the NFA is inactive). In this manner, the match results stored in the CAM array's match latches can be used to indicate whether corresponding states of the NFA are active or inactive, thereby providing current state information for the NFA.
One or more instructions and related control signals may be provided to CAM device 200 from an instruction decoder (not shown for simplicity) to control read, write, compare, and other operations for CAM device 200. Other well-known signals that can be provided to CAM device 200, such as enable signals, clock signals, and power connections, are not shown for simplicity. Further, although not shown in FIG. 2, each row of CAM cells in CAM array 210 may have one or more validity bits to indicate whether the corresponding row (or any segment thereof) of CAM cells stores valid data. In addition, for some embodiments, the rows in CAM array 210 can be divided into a plurality of row segments, for example, to reduce the capacitive loading for each row or to provide multiple width/depth configurations for the array.
Each row of CAM cells (not shown in FIG. 2 for simplicity) in CAM array 210 is coupled to address decoder 220 via a corresponding word line WL, and to priority encoder 250 and well-known match logic 260 via a corresponding match line ML. For simplicity, the word lines and match lines are represented collectively in FIG. 2. Address decoder 220 is well-known, and includes circuitry to select corresponding rows in CAM array 210 for read, write, and/or other operations in response to an address received from an address bus ABUS using the word lines WL. For other embodiments, addresses may be provided to address decoder 220 from another suitable bus and/or circuitry.
The match lines ML provide match results for compare operations between comparand data (e.g., a search key) and data stored in CAM array 210. Priority encoder 250, which is well-known, uses the match results indicated on the match lines to determine the matching entry that has the highest priority number associated with it and generates the index or address of this highest priority match (HPM). In addition, priority encoder 250 may use the validity bits from CAM array 210 to generate the next free address that is available in CAM array 210 for storing new data. Although not shown in FIG. 2, for some embodiments, priority encoder 250 may provide the next free address to the address decoder 220.
Match logic 260, which is well-known, uses the match results indicated on the match lines to generate a match flag indicative of a match condition in CAM array 210. If there is more than one matching entry in CAM array 210, match logic 260 may generate a multiple match flag to indicate a multiple match condition. In addition, match logic 260 may use the validity bits from CAM array 210 to assert a full flag when all of the rows of CAM cells in CAM array 210 are filled with valid entries.
Each column of CAM cells (not shown in FIG. 2 for simplicity) in CAM array 210 is coupled to comparand register 230 via one or more corresponding comparand lines CL, and is coupled to read/write circuit 240 via one or more corresponding bit lines BL. For simplicity, the comparand lines CL and bit lines BL are represented collectively in FIG. 2. Comparand register 230 is well-known, and is configured to provide a search key (e.g., a comparand word) received from a comparand bus CBUS to CAM array 210 during compare operations with data stored therein. For other embodiments, the search key can be provided to CAM array 210 via another bus and/or circuit. Read/write circuit 240 includes well-known write drivers to write data received from a data bus DBUS to CAM array 210 via the bit lines, and includes well-known sense amplifiers to read data from CAM array 210 onto DBUS. For other embodiments, read/write circuit 240 may be coupled to a bus other than DBUS. Further, although not shown in FIG. 2 for simplicity, CAM device 200 can include a well-known global mask circuit (e.g., coupled to the comparand register 230) that can selectively mask the bits of the search key provided to the CAM array 210.
CAM array 210 also includes a plurality of match latches 212. Each match latch 212 is coupled to the match line ML of a corresponding row of CAM cells, and is used to store the match state of the corresponding CAM row during compare operations. For embodiments of CAM array 210 configured according to U.S. Pat. No. 7,643,353, the match states stored in the match latches 212 are indicative of corresponding states of the NFA(s) embodied by data stored in CAM array 210. In this manner, the match state information stored in the match latches 212 can be used to indicate whether each state of the NFA is active or inactive.
FIG. 2 also shows CAM device 200 coupled to the external state memory 130, which is configured to store state information for CAM array 210 during flow switch operations. For the exemplary embodiment of FIG. 2, state memory 130 is coupled to read/write circuit 240 via state data lines (SDL), each of which is associated with a corresponding column/bit line BL of CAM array 210. In this manner, state information read from CAM array 210 via bit lines BL by sense amplifiers within read/write circuit 240 can be forwarded in parallel to state memory 130 on the state data lines SDL, and state information read from state memory 130 via the data lines DL can be forwarded (e.g., restored) to CAM array 210 on bit lines BL by write drivers within read/write circuit 240.
State memory 130 can be any suitable type of memory element. For some embodiments, state memory 130 is a DRAM, although for alternate embodiments state memory 130 can be a Flash memory, EPROM, EEPROM, SRAM, or other suitable type of memory device. Further, for the exemplary embodiments described herein, state memory 130 is an external memory device, as depicted in FIG. 2. In this manner, a suitable memory device can be easily coupled to CAM array 210 and perform the functions of state memory 130. Of course, for other embodiments, state memory 130 can be formed on the same IC chip as CAM device 210 and/or search system 100.
FIG. 3 shows a portion of a CAM device 300 that is one embodiment of the CAM device 200 of FIG. 2. CAM device 300 is shown to include a CAM array 310, address decoder 220, comparand register 230, read/write circuit 240, and priority encoder 250. CAM array 310, which is one embodiment of CAM array 210 of FIG. 2, includes a plurality of CAM cells 312 arranged in a number of rows (R1-Rn) and columns (C1-Cn), includes a number of match latches 320(1)-320(n), and includes a number of state information gating circuits 330(1)-330(n). For the exemplary embodiment of FIG. 3, CAM array 310 includes the same number of rows and columns. However, for other embodiments, CAM array 310 may include a greater number of rows than columns, as discussed below with respect to FIG. 7. The CAM cells 312 can be any suitable type of CAM cell including, for example, binary, ternary, and/or quaternary CAM cells.
Each row of CAM array 310 includes a plurality of CAM cells 312, a match latch 320, and a state information gating circuit 330. More specifically, each row of CAM cells 312 is coupled to address decoder 220 via a corresponding word line WL, and is coupled to an associated match latch 320 via a corresponding match line ML. The word lines are selectively driven by address decoder 220 in response to an address to select one or more of rows of CAM cells 312 for writing or reading in a well-known manner. The match lines ML indicate match results of a compare operation performed in CAM array 310. The match latches 320, which can be any suitable register, latch, flip-flop, SRAM cell, DRAM cell, or other memory element, store the match results provided on the match lines ML and provide the match results to priority encoder 250. Although not shown for simplicity, for some embodiments, each match latch 320 can include a clock input to receive a match latch signal that causes the match latches 320 to latch the match signals provided on the match lines ML.
For exemplary embodiments described herein, the match lines ML are pre-charged to logic high (e.g., VDD) for compare operations, and if all CAM cells 312 in a row match the search key, the row's match line ML remains in its charged state to indicate the match condition. Conversely, if one or more CAM cell 312 in the row does not match the search key, those CAM cell(s) 312 discharge the match line ML toward ground potential (e.g., logic low) to indicate the mismatch condition.
Each column of CAM cells 312 is coupled to the comparand register 230 via a complementary comparand line pair CL/ CL, and to the read/write circuit 240 via a complementary bit line pair BL/ BL. The comparand register 230 includes a plurality of drivers (not shown for simplicity) that provide complementary comparand data to columns of CAM cells 312 during compare or search operations via the comparand line pairs CL/ CL. Although the comparand data present on a comparand line pair is generally referred to herein as being complementary comparand signals, a comparand line pair CL/ CL may be driven to the same logic state (e.g., logic low or high) to mask compare operations within an entire column of the CAM array 310. The read/write circuit 240 provides/receives complementary CAM data to/from the columns of CAM cells 312 via the bit line pairs BL/ BL. More specifically, read/write circuit 240 includes a plurality of well-known sense amplifiers (not shown for simplicity) to read data read from the bit line pairs BL/ BL, and includes a plurality of well-known write drivers (not shown for simplicity) to write data into the CAM array 310 via the bit line pairs BL/ BL. Read/write circuit 240 is coupled to the external state memory 130 (not shown in FIG. 3 for simplicity) via a number of state data line pairs SDL/ SDL, where state data line pair is associated with the bit line pair BL/ BL in a corresponding column of CAM array 310.
For other embodiments, the complementary comparand lines CL/ CL may be replaced by single-ended comparand lines, and/or the complementary bit lines BL/ BL may be replaced by single-ended bit lines. In addition, for other embodiments, the comparand lines can be omitted, and the bit lines can be used to provide comparand data to the CAM array for compare operations. For alternate embodiments, encoded comparand data can be provided to the CAM array for search operations, for example, as described in commonly-owned U.S. Pat. No. 7,133,312, which is incorporated by reference herein.
In accordance with the present embodiments, the state information gating circuit 330 in each CAM row includes a first port coupled to the match latch 320 in the row, and includes a second port coupled to the bit line pair of an associated column of the CAM array. More specifically, for each given CAM row, the gating circuit 330 is coupled to a data port of the match latch 320 in the given row, and is also coupled to the bit line pair BL/ BL of the associated column by a corresponding save state and restore bit line pair BL_SSR/ BL_SSR. For example, the gating circuit 330(1) in the first row (R1) of the array is coupled to the match latch 320(1) in the first row (R1) and is coupled to the bit line pair BL/ BL in the first column (C1), the gating circuit 330(2) in the second row (R2) of the array is coupled to the match latch 320(2) in the second row (R2) and is coupled to the bit line pair BL/ BL in the second column (C2), and so on, where the gating circuit 330(n) in the nth row (Rn) of the array is coupled to the match latch 320(n) in the nth row (Rn) and is coupled to the bit line pair BL/ BL in the nth column (Cn).
Each of state information gating circuits 330(1)-330(n) also includes a control input to receive a save state and restore enable signal SSR_EN that can be used to selectively couple the match latches 320(1)-320(n) in respective rows R1-Rn to the bit line pairs BL/ BL in respective columns C1-Cn. In this manner, the state information gating circuits 330 allow state information (e.g., match results) stored for rows of CAM array 310 to be transposed onto columns of the CAM array and then provided in parallel to the external state memory (not shown in FIG. 3 for simplicity) using the CAM array's bit line pairs. More specifically, state information for rows R1-Rn that is stored in the match latches 320(1)-320(n) can be simultaneously driven onto the bit line pairs BL/ BL from the SSR bit line pairs BL_SSR/ BL_SSR by respective gating circuits 330(1)-330(n) and thereafter read from the CAM array 310 in parallel by the sense amplifiers (not shown for simplicity) provided within read/write circuit 240, which in turn can output the state information in parallel from the CAM device 300 to the external state memory 130 (not shown in FIG. 3 for simplicity). Similarly, state information stored in the external state memory 130 can be provided in parallel to read/write circuit 240 and then driven in parallel onto the CAM array's bit line pairs BL/ BL by write drivers provided within read/write circuit 240, and then written in parallel to the match latches 320(1)-320(n) in corresponding rows R1-Rn by respective gating circuits 330(1)-330(n) and SSR bit line pairs BL_SSR/ BL_SSR.
A general operation of the exemplary embodiment of the search system depicted in FIGS. 1-3 is described below with respect to the illustrative flow charts of FIGS. 4A-4C. First, search data (e.g., a number of search keys) of a first flow are provided to and compared with data stored in the CAM array 310 to generate match results therein (401). More specifically, referring also to FIG. 3, the match results are provided on match lines ML and are stored as match values in corresponding match latches 320(1)-320(n). The match values stored in the match latches 320 for the first flow are collectively referred to as the first state information. Thus, for embodiments in which CAM array 310 stores patterns embodied by an NFA, the logic values of the state information stored in match latches 320(1)-320(n) indicate whether corresponding states of the NFA are active or inactive after processing the first search data.
Next, search data belonging to a second flow is received for processing in the search system (402). Because the second flow is different than the first flow, it is desirable to generate search results for the second flow that are independent of the first flow. Thus, before the second search data is searched for the patterns stored in the search engine 110, a flow switch operation is initiated to switch search operations from the first flow to the second flow (403), and then the first state information is saved into the external state memory (404). For some embodiments, flow control circuit 120 detects the change in flows and, in response thereto, asserts control signals CTR_FS and CTR_SSR to initiate the flow switch operation. Assertion of signal CTR_FS pauses search operations for the first flow and enables the state information to be read from the search engine. Assertion of signal CTR_SSR enables the state information read from the search engine to be saved in the external state memory 130.
An exemplary operation for saving the first state information from the CAM device 300 into state memory 130 is depicted in FIG. 4B. First, the control signal SSR_EN is driven to a read state that allows gating circuits 330(1)-330(n) to read the first state information stored in the match latches 320(1)-320(n) and transpose the first state information in parallel onto the bit line pairs BL/ BL in respective columns C1-Cn via corresponding signal line pairs BL_SSR/ BL_SSR (404a). For some embodiments, the control signal SSR_EN can be driven to a read state in response to assertion of CTR_FS by flow control circuit 120. After being transposed onto the bit line pairs BL/ BL, the first state information is then read in parallel by sense amplifiers within read/write circuit 240 (404b). Next, read/write circuit 240 outputs the first state information from the CAM device 300 to the external state memory 130 in parallel via state data line pairs SDL/ SDL (404c), and the first state information is saved in the state memory 130 (404d). For some embodiments, write operations to the external state memory 130 can be controlled by the control signal CTR_SSR generated by flow control circuit 120.
Referring again to FIG. 4A, after the first state information is stored in state memory 130, the second flow search data is compared with data stored in the CAM array 310 to generate match results therein (405). As described above, the match results are provided on match lines ML and are stored as match values in corresponding match latches 320(1)-320(n). The match values stored in the match latches 320 for the second flow are collectively referred to as the second state information.
Next, additional search data belonging to the first flow is received for processing in the search engine (406). Before search operations for the first search data are resumed in the search engine, a flow switch operation is initiated to switch from the second flow back to the first flow (407). For some embodiments, flow control circuit 120 detects the change in flows and, in response thereto, asserts control signal CTR_FS to initiate the flow switch operation, which pauses search operations for the second flow and enables the second state information to be read from the search engine.
The second state information is saved into the external state memory 130 in the manner described above with respect to FIG. 4B (408). Then, the first state information previously stored in state memory 130 is restored to the CAM array so that search operations for the first flow can continue at the same point they were discontinued during the previous flow switch operation (409).
An exemplary operation for restoring the first state information to the CAM array 310 is described below with respect to the illustrative flow chart of FIG. 4C. First, the first state information is read from state memory 130 and provided to read/write circuit 240 of the CAM device in parallel via the state data line pairs SDL/ SDL (409a). For some embodiments, read operations from state memory 130 can be controlled by the control signal CTR_SSR generated by flow control circuit 120. Next, write drivers within read/write circuit 240 drive the first state information received from the state data line pairs SDL/ SDL onto the bit line pairs BL/ BL of corresponding columns in the CAM array 310 (409b). The first state information is transposed in parallel from the bit line pairs BL/ BL in columns of the CAM array to the SSR bit line pairs BL_SSR/ BL_SSR in corresponding rows of the CAM array 310 (409c). Then, the first state information is written into the match latches 320(1)-320(n) by corresponding state information gating circuits 330(1)-330(n), thereby restoring the first state information to the CAM array 310 in a parallel manner (409d). For some embodiments, the control signal SSR_EN can be driven to a write state in response to assertion of CTR_FS by flow control circuit 120 to enable the gating circuits 330(1)-330(n) to write the state information into respective match latches 320(1)-320(n).
FIG. 5 shows a more detailed portion 500 of CAM array 210 in accordance with some embodiments. CAM portion 500 includes a row 501 and a column 502. The row 501 includes a binary CAM cell 510, a match latch 520, an SSR read circuit 530, an SSR write circuit 540, and a well-known pass gate 550. For simplicity, only one CAM cell 510 is shown in FIG. 5, although for actual embodiments, CAM row 501 and CAM column 502 can include any suitable number of CAM cells. Further, CAM cell 510 is depicted in FIG. 5 as a well-known binary CAM cell for simplicity. However, for actual embodiments, CAM cell 510 can be any suitable type of CAM cells including, for example, ternary and quaternary CAM cells.
As shown in FIG. 5, CAM cell 510 includes an SRAM cell 511 and a compare circuit 512. SRAM cell 511, which is well-known, is coupled to a complementary bit line pair BL/ BL associated with corresponding column 502 of the CAM array, and is coupled to a word line associated with the corresponding row 501. As known in the art, a data bit D is written to SRAM cell 511 by asserting the word line high (e.g., to VDD) and driving a value of D and its complement D on BL and BL, respectively. Compare circuit 512, which is well-known, is coupled to SRAM cell 511, to a match line ML for the row 501, and to a complementary comparand line pair CL/ CL associated with the corresponding column 502. Compare circuit 512 compares a comparand bit (e.g., a bit of the search key) with the data bit D stored in the cell 511, and indicates the match results on the match line ML. The match results on ML are provided to and stored in the match latch 520.
Match latch 520, which is one embodiment of match latch 320 of FIG. 3, is shown in FIG. 5 as a well-known SRAM cell that stores a match bit M and its complement M at nodes 521 and 522, respectively. Match latch 520 is coupled to the word line WL and coupled to a match bit line pair MBL/ MBL to enable testing functions, as well as to enable conventional serial read and write operations. Node 521 of match latch 520 is selectively coupled to the row's match line ML by pass gate 550 in response to a latch clock signal LCLK, where LCLK and its complement LCLK are provided to complementary control terminals of pass gate 550. In this manner, during compare operations, the data node 521 of match latch 520 is driven to the logic state indicated on the match line ML by pass gate 550, which causes the complementary data node 522 of match latch 520 to be driven to the complementary logic state. Although not shown for simplicity, for some embodiments, a suitable well-known gating circuit can be provided on the match line ML to selectively de-couple the CAM cells 510 from the match latch 520 (e.g., during ML pre-charging operations).
In accordance with present embodiments, the match latch 520 in row 501 is coupled to the bit line pair BL/ BL of column 502 via SSR bit line pair BL_SSR/ BL_SSR so that state information can be transferred between match latch 520 and the external state memory (not shown in FIG. 5 for simplicity) using the column's bit line pair. As described in more detail below, read operations from match latch 520 to the bit line pair BL/ BL are facilitated by SSR read circuit 530 in response to an SSR read enable signal SSR_REN, and write operations from the bit line pair BL/ BL to match latch 520 are facilitated by SSR write circuit 540 in response to an SSR write enable signal SSR_WEN. Together, SSR read circuit 530 and SSR write circuit 540 form one embodiment of state information gating circuits 330 of FIG. 3, and enable signals SSR_REN and SSR_WEN form one embodiment of control signal SSR_EN of FIG. 3.
More specifically, SSR read circuit 530 includes driver circuits 531-532 and NMOS transistors 533-534. NMOS transistor 533 is coupled between BL_SSR and ground potential, and has a gate selectively coupled to data node 521 of match latch 520 by driver circuit 531 in response to SSR_REN. NMOS transistor 534 is coupled between BL_SSR and ground potential, and has a gate selectively coupled to complementary data node 522 of match latch 520 by driver circuit 532 in response to SSR_REN. To read state information from match latch 520 to the external state memory via bit line pair BL/ BL, the word line WL is de-asserted (e.g., to logic low) to isolate data stored in CAM cell 510 from the bit lines BL/ BL during the read state information operation, the bit lines BL and BL are pre-charged (e.g., toward VDD), and SSR_REN is asserted (e.g., to logic high) to turn on driver circuits 531-532. Driver circuits 531 and 532 drive the gates of corresponding transistors 533 and 534 with the match bit M and the complementary match bit M, respectively. In response thereto, transistors 533 and 534 pull respective signal lines BL_SSR and BL_SSR to opposite logic states, which in turn drive respective signal lines BL and BL to opposite logic states to achieve a differential voltage indicative of the state information stored in the match latch 520. In this manner, the state information is transposed from row 501 of the CAM array to column 502 of the CAM array, thereby facilitating the parallel reading of state information from a number N of rows to the external state memory via a corresponding number N of columns.
For example, if M=1 and M=0, then driver circuit 531 drives the gate of transistor 533 to logic high (e.g., toward VDD) and driver circuit 532 drives the gate of transistor 534 to logic low (e.g., toward ground potential). In response thereto, transistor 533 turns on and pulls BL_SSR and BL to logic low, and transistor 534 turns off and does not discharge BL_SSR or BL. In this manner, BL remains in its pre-charged logic high state and BL is discharged to logic low, thereby creating a differential voltage between BL and BL representative of the M=1 value stored in the match latch 520. Conversely, if M=0 and M=1, then driver circuit 531 drives the gate of transistor 533 to logic low and driver circuit 532 drives the gate of transistor 534 to logic high. In response thereto, transistor 533 turns off and does not discharge BL_SSR or BL, and transistor 534 turns on and discharges BL_SSR and BL. In this manner, BL is discharged to logic low and BL remains in its pre-charged logic high state, thereby creating a differential voltage between BL and BL representative of the M=0 value stored in the match latch 520.
SSR write circuit 540 includes driver circuits 541-542 and NMOS transistors 543-544. NMOS transistor 543 is selectively coupled between BL_SSR and data node 521 of match latch 520 by driver circuit 541 in response to SSR_WEN. NMOS transistor 544 is selectively coupled between BL_SSR and complementary data node 522 of match latch 520 by driver circuit 542 in response to SSR_WEN. To write state information from the external memory to the match latch 520 via bit line pair BL/ BL, the word line WL is de-asserted (e.g., to logic low) to isolate data stored in CAM cell 510 from the bit lines BL/ BL during the write state information operation, the bit lines BL and BL are driven to a differential voltage indicative of the match value M to be written to match latch 520 by read/write circuit 240, and SSR_WEN is asserted (e.g., to logic high) to turn on driver circuits 541-542 and to turn on NMOS transistors 543-544. Thereafter, driver circuit 541 drives the logic value provided on BL to data node 521 of match latch 520 via BL_SSR, and driver circuit 542 drives the logic value provided on BL to complementary data node 522 of match latch 520 via BL_SSR. In this manner, the state information read from the external state memory into the CAM array is transposed from column 502 of the CAM array to row 501 of the CAM array, thereby facilitating the parallel writing of state information into a number N of rows of match latches 520 from a corresponding number N of columns of the array.
For example, to write a logic high match value (M=1) from the external state memory into the match latch 520, the write drivers within read/write circuit 240 (see also FIG. 3) drive BL to logic high and drive BL to logic low. The logic high value on BL is transposed onto BL_SSR, and in response thereto, driver circuit 541 drives data node 521 to logic high (e.g., to VDD) to store M=1 in match latch 520. The logic low value on BL is transposed onto BL_SSR, and in response thereto, driver circuit 542 drives complementary data node 522 to logic low (e.g., to ground potential) to store M=0 in match latch 520. Conversely, to write a logic low match value (M=0) from the external state memory into the match latch 520, the write drivers within read/write circuit 240 drive BL to logic low and drive BL to logic high. The logic low value on BL is transposed onto BL_SSR, and in response thereto, driver circuit 541 drives data node 521 to logic low (e.g., to ground potential) to store M=0 in match latch 520. The logic high value on BL is transposed onto BL_SSR, and in response thereto, driver circuit 542 drives complementary data node 522 to logic high (e.g., to VDD) to store M=1 in match latch 520.
Note that when SSR read circuit 530 is not being used to transfer state information from match latch 520 to the external memory via the array's bit lines, the signal SSR_REN is de-asserted to isolate match latch 520 from the bit lines. Similarly, when SSR write circuit 540 is not being used to transfer state information to match latch 520 from the external memory via the array's bit lines, the signal SSR_WEN is de-asserted to isolate match latch 520 from the bit lines.
FIG. 6A shows a pass gate 600 that is one embodiment of pass gate 550 of FIG. 5. Pass gate 600 includes an AND gate 601, a CMOS inverter 602, and NMOS transistors 611-614. Referring also to FIG. 5, the AND gate 601 includes a first input coupled to the match line ML, a second input to receive a data clock signal DCLK, and an output to generate a gated match signal MG. Transistor 611 is coupled between node 522 of match latch 520 and an intermediate pass gate node N1, and has a gate to receive the gated match signal MG. Transistor 612 is coupled between node 521 of match latch 520 and intermediate pass gate node N1, and has a gate to receive a complemented gated match signal MG generated in response to MG by the CMOS inverter 602. Transistors 613 and 614 are coupled between intermediate node N1 and ground potential, and have gates to receive LCLK and a state latch enable signal EN_SL, respectively. For other embodiments, transistor 614 can be omitted.
Pass gate 600 transfers the match signal on the match line ML to the match latch 520 as follows. Prior to compare operations in row 500, DCLK is de-asserted, which causes AND gate 601 to isolate the match line ML from the match latch 520. Further, LCLK and EN_SL are de-asserted to turn off respective transistors 613 and 614, thereby isolating the match latch 520 from ground potential. Once the match results are generated on the match line ML, DCLK is asserted to enable the AND gate 601 to output the match signal on ML as the gated match signal MG, and LCLK and EN_SL are asserted to turn on transistors 613 and 614. For example, if the match signal is logic high (e.g., indicating a match condition), the AND gate 601 drives MG to logic high, and in response thereto CMOS inverter 602 drives MG to logic low. The logic high state of MG turns on transistor 611, which in turn pulls node 522 of match latch 520 low toward ground potential through transistors 613 and 614. In this manner, M is driven to logic low, which in turn drives node 521 to logic high, thereby storing M=1 in the match latch. The logic low state of MG turns off transistor 612 and isolates node 521 of the match latch 520 from ground potential. Conversely, if the match signal is logic low (e.g., indicating a mismatch condition), the AND gate 601 drives MG to logic low, and in response thereto CMOS inverter 602 drives MG to logic high. The logic high state of MG turns on transistor 612, which in turn pulls node 521 of match latch 520 low toward ground potential through transistors 613 and 614. In this manner, M is driven to logic low, which in turn drives node 522 to logic high, thereby storing M=0 in the match latch. The logic low state of MG turns off transistor 611 and isolates node 522 of the match latch 520 from ground potential.
FIG. 6B shows an SSR read circuit 620 that is another embodiment of SSR read circuit 530 of FIG. 5. SSR read circuit 620 includes all the elements of SSR read circuit 530, and an additional NMOS transistor 535 coupled between the drains of NMOS transistors 533-534 and ground potential. Transistor 535, which has a gate to receive the control signal SSR_REN, provides isolation between 533-534 and ground potential.
FIG. 7A shows a more detailed portion 700 of CAM array 210 in accordance with some embodiments. CAM portion 700 includes a row 701 and a column 702. The row 701 includes CAM cell 510, a master match latch 720M, a slave match latch 720S, SSR read circuit 530, SSR write circuit 540, and pass gate 600 (see also FIG. 6A). CAM row 701 is similar to CAM row 501 of FIG. 5, except that match latch 520 is replaced by master/slave match latches 720M and 720S, which together form a flip-flop that is another embodiment of match latch 320 of FIG. 3. The flip-flop can store the match results for the corresponding CAM row for a full clock cycle (e.g., as opposed to a single latch that stores the results for only one phase of the clock signal), and therefore the match latches discussed above with respect to the exemplary embodiments FIGS. 3 and 5 are typically implemented as flip-flops in the manner depicted in FIG. 7A. Master match latch 720M stores a master match bit MM at its node 521M and stores the complement MM at its node 522M, and slave match latch 720S stores a slave match bit MS at its node 521S and the complement Ms at its node 522S. In this manner, the master match latch 720M stores the initial match state information, and the slave match latch 720S stores the final match state information.
The individual configuration and operation of master match latch 720M and slave match latch 720S are similar to that described above with respect to match latch 520 of FIG. 5, except that master match latch 720M is connected directly to SSR write circuit 540, and slave match latch 720S is connected directly to SSR read circuit 530. As a result, state information can be restored from external memory 130 to master match latch 720M via SSR write circuit 540, and state information can be saved to external memory 130 from slave match latch 720S via SSR read circuit 530, as described in more detail below.
For simplicity, only one CAM cell 510 is shown in FIG. 7A, although for actual embodiments, CAM row 701 and CAM column 702 can include any suitable number of CAM cells. As mentioned above with respect to FIG. 5, CAM cell 510 can be any suitable type of CAM cell including, for example, binary, ternary and/or quaternary CAM cell.
As shown in FIG. 7A, the master match latch 720M is coupled to the pass gate 600 in the manner described above with respect to FIG. 6A, and is also coupled to the slave match latch 720S. More specifically, node 521M of master match latch 720M is coupled to the gate of transistor 612S, and node 522M of master match latch 720M is coupled to the gate of transistor 611S so that the match bit MM stored in the master match latch 720M can be transferred to and stored in the slave match latch 720S as Ms in response to the complemented latch clock signal LCLK provided to the gate of transistor 613S. Together, transistors 611S-614S form a pass gate 710 that selectively transfers the match data MM stored in the master match latch 720M to the slave match latch 720S in response to LCLK.
During compare operations, the match results generated on the match line ML are first driven into the master match latch 720M during a first phase of LCLK, and are then transferred to the slave match latch 720S during a second phase of LCLK. More specifically, after match results are generated on the match line ML in response to compare operations in the CAM cells 510, DCLK is asserted and allows pass gate 600 to drive the resulting match signal on the match line ML as the match bit MM into master match latch 720M in response to a triggering edge of LCLK (e.g., in the manner described above with respect to FIG. 6A). Then, in response to the triggering edge of LCLK, which for some embodiments is 180 degrees out of phase with respect to LCLK, transistor 613S turns on and allows the match bit MM stored in master match latch 720M to be driven into the slave match latch 720S as the match bit MS, thereby transferring the match bit from the master match latch 720M to the slave match latch 720S one-half cycle after the match results are stored in the master match latch 720M.
Then, during flow switch operations, the master match latch 720M and the slave match latch 720S can be separately used to write state information into the CAM row 700 and to read state information from the CAM row 700, respectively. More specifically, to read state information from CAM row 700 to the external memory 130, the complementary match bits MS and Ms are provided from slave match latch 720S to SSR read circuit 530, which in turn drives the match bit onto the bit line pair BL/ BL via the SSR bit line pair BL_SSR/ BL_SSR in response to SSR_REN, as described above with respect to FIG. 5. To restore state information from the external memory 130 to the CAM row 700, the bit lines BL and BL are driven to a differential voltage indicative of the externally stored match value M by read/write circuit 240, and SSR_WEN is asserted to enable SSR write circuit 540 to write the match value received from the bit line pair BL/ BL via the SSR bit line pair BL_SSR/ BL_SSR to the master match latch 720M.
For another embodiment, an additional latch (e.g., SRAM cell) can be added to each CAM row and used as a cache memory to facilitate the transfer of state information between the CAM array and the external state memory 130 in a manner that virtually eliminates array down-time associated with flow switch operations. For example, FIG. 7B shows a simplified functional block diagram of a portion 750 of a CAM row that is a modified embodiment of CAM row 700 of FIG. 7A. CAM row 750 is shown to include pass gate 600, SSR read circuit 530, SSR write circuit 540, master match latch 720M, and slave match latch 720S of CAM row 700, and additionally includes a cache match latch 720C and switches SW1-SW2. Together, master match latch 720M and slave match latch 720S form a match flip-flop 751. Pass gate 600 has an input to receive the match results from the match line ML, and includes an output to provide the gated match signal MG to a first input of switch SW1, which includes a second input to receive a cached match signal MC from cache match latch 720C, a first output coupled to master match latch 720M, a second output coupled to SSR read circuit 530, and a control terminal to receive a corresponding first switch control signal CTR_SW1. The output of master match latch 720M provides the latched match bit MM to slave match latch 720S, which in turn has an output coupled to a first input of switch SW2. The second switch SW2 includes a second coupled to the output of SSR write circuit 540, an output coupled to an input of cache match latch 720C, and a control terminal to receive a corresponding second switch control signal CTR_SW2. For simplicity, the CAM cell 510, bit line pairs, and SSR bit line pair associated with row 750 are not shown in FIG. 7B.
An exemplary flow switch operation of CAM row 750 is described below with respect to the illustrative flow chart of FIG. 8. First, search data associated with a first flow F1 are compared with data stored in the CAM array to generate match results that will be stored in the match latch (801). More specifically, the match results are gated by pass gate 600 and then latched in master match latch 720M, and then forwarded to and latched in the slave match latch 720S. While the compare operation for F1 is performed, the flow control circuit 120 receives search data associated with the second flow F2, and initiates a flow switch operation (802). In response thereto, state information associated with the second flow F2 and previously stored in the external memory 130 is loaded into the CAM array and written into the cache match latch 720C by the SSR write circuit 540 (803). The signal CTR_SW2 is set to a state that causes SW2 to forward the F2 state information from SSR write circuit 540 to cache match latch 720C.
When the compare operation for F1 completes and the resulting F1 state information is stored in the master and slave match latches, the first switch SW1 routes the F2 state information from the cache match latch 720C as Mc to master match latch 720M for storage therein (804). In this manner, the F2 state information is restored to the master match latch 720M immediately after the F1 compare operation completes. Then, in a next clock cycle, the F1 state information stored in the slave match latch 720S is routed to the cache match latch 720C via the second switch SW2 under the control of CTR_SW2 (805). Next, the F1 state information stored in the cache match latch 720C is routed via the first switch SW1 (under control of CTR_SW1) to the SSR read circuit 530 (806), which in turn saves the F1 state information in the external memory 130 (807). While the F1 state information is being saved in the external memory 130, compare operations for the second flow F2 can be commenced using the F2 state information restored to the master match latch 720M (808). In this manner, compare operations for the second flow F2 can be started while the F1 state information is being transferred to the external memory 130, thereby minimizing array down-time during flow switch operations by performing state information transfers while compare operations are being performed. In other words, including the cache match latch 720C in each CAM row allows compare operations in the CAM array to continue uninterrupted while state information for different flows is exchanged between the CAM array and the external memory 130.
As mentioned, the exemplary CAM array 310 depicted in FIG. 3 includes the same number of rows and columns, and therefore there is a one-to-one correspondence between the bit line pairs BL/ BL in columns of the array and the SSR bit line pairs BL_SSR/ BL_SSR in rows of the array that allows state information stored in rows of the CAM array (e.g., in match latches 320(1)-320(n)) to be simultaneously transposed onto columns of the CAM array and read from the array via the bit line pairs BL/ BL in parallel in a single operation. However, actual embodiments of CAM array 210 of FIG. 2 typically a much greater number of rows than columns. For such embodiments, the bit line pair BL/ BL in each column is selectively coupled to a plurality of different rows via gating circuits 330 so that match information can be transferred between the external state memory 130 and a number Z of row groups in Z successive operations. For example, in one exemplary embodiment of CAM array 210 that includes X=256 rows and Y=64 columns, the rows of the array are grouped into Z=X/Y=4 groups of 64 rows. Within each row group, each of the 64 rows is coupled to a corresponding one of the 64 columns via the SSR bit lines and gating circuits 330. During save state and restore operations, data is transferred in parallel between the external state memory and a selected group of 64 rows using the bit lines corresponding to the 64 columns.
FIG. 9 depicts the multiplexed interconnections between the rows and columns of such an exemplary embodiment. CAM block 900, which is one embodiment of CAM array 210 of FIG. 2, includes X=256 rows R0-R255 and Y=64 columns C0-C63, wherein the rows are grouped into Z=X/Y=256/64=4 row groups 910(0)-910(3). Thus, the first row group 910(0) includes the first 64 rows R0-R63, the second row group 910(1) includes the second 64 rows R64-R127, and so on, where the last row group 910(3) includes the last 64 rows R192-R255. For simplicity, the CAM cells, word lines WL, comparand lines CL, match lines ML, comparand register 230, and read/write circuit 240 are not shown in FIG. 9. For the exemplary embodiment of FIG. 9, state information can be transferred between CAM block 900 and the external state memory 130 in 4 transfer cycles, where each transfer cycle facilitates the parallel transfer of state information between the state memory 130 and the 64 rows of a corresponding row group 910 via the bit line pairs in the 64 columns C0-C63. Each of row groups 910(0)-910(3) can be selected for state information transfers by selectively asserting the SSR enable signals (e.g., SSR_WEN and SSR_REN) provided to the gating circuits within the row group. For some embodiments, the SSR enable signals can be multiplexed to selectively enable state information transfers for each row group 910.
While particular embodiments have been shown and described, it will be obvious to those skilled in the art that changes and modifications may be made without departing from this disclosure in its broader aspects and, therefore, the appended claims are to encompass within their scope all such changes and modifications as fall within the true spirit and scope of this disclosure.
Further, it should be noted that the various circuits disclosed herein may be described using computer aided design tools and expressed (or represented), as data and/or instructions embodied in various computer-readable media, in terms of their behavioral, register transfer, logic component, transistor, layout geometries, and/or other characteristics. Formats of files and other objects in which such circuit expressions may be implemented include, but are not limited to, formats supporting behavioral languages such as C, Verilog, and VHDL, formats supporting register level description languages like RTL, and formats supporting geometry description languages such as GDSII, GDSIII, GDSIV, CIF, MEBES and any other suitable formats and languages. Computer-readable media in which such formatted data and/or instructions may be embodied include, but are not limited to, non-volatile storage media in various forms (e.g., optical, magnetic or semiconductor storage media).