Before we start, one picture fixes every symbol we will reuse.
The one relation you will use over and over:
MLr=∏i=0n−1(Dr,i⊙Si)(product=AND)
Read it in English: "the row matches when all columns agree." A single disagreeing column makes one factor 0, and 0 times anything is 0 — the whole row dies. That is the wired-OR of mismatches doing its job.
CAM maps data → address: you feed a search word, you get back the address of a matching row. The block that collapses many possible HIGH match lines into one address is the Priority Encoder.
Recall Solution L1.2
(a) XOR (D⊕S) — outputs 1 when bits differ.
(b) XNOR (D⊙S) — outputs 1 when bits are equal.
(c) AND (the product ∏i). The row matches only if all per-column XNORs are 1.
Recall Solution L1.3
TCAM (Ternary CAM). It uses the ==don't-care X== symbol (implemented with a mask bit Mi), which matches both 0 and 1 — the foundation of Longest Prefix Matching.
Left side: "NOT (any bit mismatches)". Right side: "all bits agree". Enumerate the four agreement patterns of two columns, where ai=(Di⊙Si) and mismatch mi=ai:
a1a0
⋁m=m1∨m0
⋁m
a1∧a0
0 0
1∨1=1
0
0
0 1
1∨0=1
0
0
1 0
0∨1=1
0
0
1 1
0∨0=0
1
1
Columns "⋁m" and "a1∧a0" are identical → the identity holds. Both are 1 only when every column agrees.
Recall Solution L3.2
To drive a line HIGH only when matched, the circuit would first have to know which rows match — but computing that is the very thing we are trying to do. It is circular. The dynamic-logic escape is: assume everyone matches (precharge HIGH), then let each mismatching cell conditionally discharge its own line to LOW. A single NMOS pull-down path per cell suffices, no answer needed in advance. This is the precharge → evaluate style: fast, small, but it burns energy charging thousands of lines every search — the root of CAM's power cost.
Recall Solution L3.3
Three match lines (rows 1, 3, 5) go HIGH simultaneously — duplicates all match in parallel. A Priority Encoder must resolve this; with lowest-index priority the output is address 1.
A stuck-open mismatch transistor means that column can never pull the ML LOW, so the match line ignores that bit — it behaves as though every row had a don't-care there. Effect: rows will report matches even when that column disagrees, causing false hits (e.g. 1010 matching a 1011 search if bit-0 is the faulty column). This resembles a TCAM don't-care functionally, but the crucial difference: a TCAM don't-care is intentional and per-cell (mask bit Mi=1 chosen by software), while the fault is unintentional, column-wide, and unmaskable — a hardware defect, not a searchable feature.
Recall Solution L5.2
Average SRAM scan =R/2=1024/2=512 cycles. CAM =1 cycle. Speedup =512/1=512×.
The cost: CAM precharges and (partially) discharges every one of the 1024 match lines on every search, plus each cell carries 10–16 comparison transistors instead of a 6T Static RAM (SRAM) cell. So CAM trades large area + high dynamic power for that latency win — which is why it is reserved for latency-critical parallel search like a Translation Lookaside Buffer (TLB) or fully-associative Cache Memory, not general storage.
Recall Solution L5.3
Distinct prefix lengths from /0 to /32 inclusive =33.
If 4 prefixes match, 4 match lines are HIGH simultaneously. Determinism is guaranteed by the Priority Encoder combined with longest-prefix-first row ordering: many HIGH lines enter, exactly one address (the most specific rule) leaves.