4.1.13 · D1Memory Technologies

Foundations — Content-addressable memory (CAM)

2,017 words9 min readBack to topic

This page is a toolbox check. Before you read the parent note CAM topic note, every symbol, gate, and idea it uses gets built here from the ground up — no prior notation assumed. If a smart 12-year-old can follow line one, we did our job.


The starting picture: a wall of labelled boxes

Memory — any memory — is a row of boxes. Each box holds some bits and each box has a number (its address).

Figure — Content-addressable memory (CAM)

Everything below exists to make that reverse arrow happen in parallel. Prerequisite ideas from Static RAM (SRAM) (how one bit is stored) sit underneath this whole page.


Symbol 1 — a single bit and what "" / "" mean

We will use two bits constantly:

  • — the stored bit sitting inside a memory cell (the "D" is for Data).
  • — the search bit you are looking for (the "S" is for Search).

Why give them different letters? Because the entire job of a CAM cell is to ask "is my stored the same as your incoming ?" — we must be able to name the two things we compare.


Symbol 2 — comparing two bits: same or different?

There are only four possible pairs of . Let's tabulate whether they agree:

agree?
0 0 ✅ yes
0 1 ❌ no
1 0 ❌ no
1 1 ✅ yes

Two useful signals fall right out of this table, and they are exact opposites of each other.

Why do we need both? A row matches only when every bit agrees. Later we'll see it's cheaper in hardware to hunt for disagreement (XOR) and let any single disagreement veto the match — so XOR is the workhorse, and XNOR () is the tidy way to write "this bit agrees."

Figure — Content-addressable memory (CAM)

Symbol 3 — the bar, the wedge, the vee: NOT, AND, OR

The parent note writes a scary-looking line:

Let's disarm every symbol.

The subscript is just a counter naming the bit position: is bit 0, is bit 1, and so on. In a full array we add a second subscript for the row: = the -th bit of the word stored in row .


Symbol 4 — De Morgan's Law: why "no mismatch" = "all match"

That double-equals in the parent's formula is not magic; it is one rule.

Apply it to the match line:

Read left to right: "NOT (any bit mismatches)" becomes "every bit does-not-mismatch" becomes "every bit is equal." That last equality uses — NOT-XOR is XNOR. This is the single most important algebraic move in the whole topic, and it comes straight from Boolean Algebra & De Morgan's Laws.


Symbol 5 — the Match Line and "precharge / discharge"

Figure — Content-addressable memory (CAM)

The subscript version just names the match line of row .


Symbol 6 — the don't-care and the mask bit

The per-bit TCAM rule is:

Read it: "bit counts as matched if it is masked (), or if it genuinely equals the search bit." A memory built from these — where each cell stores , , or — is a Ternary CAM (TCAM), the engine behind Longest Prefix Matching in routers.


Symbol 7 — the priority encoder and


How the pieces feed the topic

bit 0 or 1

compare two bits XOR and XNOR

De Morgan not any mismatch equals all match

Match Line precharge then discharge

one row match

mask bit and dont care X

TCAM per bit match

full array many rows

Priority Encoder picks one address

CAM data to address in O of 1


Equipment checklist

Test yourself — reveal only after answering out loud.

What does an address point to, and in which direction does RAM map?
The position number of a box; RAM maps address → data.
Which direction does CAM map?
data → address (the reverse of RAM).
outputs when?
When the two bits differ (XOR = "different?").
outputs when?
When the two bits are equal (XNOR = "same?").
What does the bar do?
Inverts it: NOT.
means? and means?
= AND (all inputs 1); = OR (at least one input 1).
State De Morgan for .
— "NOT (A or B)" = "(NOT A) and (NOT B)".
Why is ?
De Morgan turns "no mismatch anywhere" into "every bit equal."
What state is a match line in before a search, and what changes it?
Precharged HIGH (1); a mismatching cell discharges it to LOW (0).
What is a don't-care , really?
A matching rule (set by mask bit ) that matches both 0 and 1 — not a readable third value.
Why is a priority encoder needed?
Several rows may match at once; it picks one address by a fixed priority rule.
What does mean for CAM search?
Constant time regardless of the number of rows — all rows compare in parallel.

Ready? Now open the parent note CAM topic note and every symbol will already be an old friend.