Most memory is stored and accessed in the same way.

Content is saved and then retrieved using a memory address.

This is generally useful and is almost universally used.

Article image

Unfortunately, there is a slight issue with this style of storage.

Its excellent if you know where the data you need is stored.

It doesnt perform well if you want to search for a specific entry.

Lets say you want to find a file; you remember its name but not which folder you saved.

And thats taking into account that file systems are stored as file names and addresses.

Unfortunately, implementing associative memory is very expensive.

This means it is only used in a few cases, typically in high-end networking hardware.

The associative name memory comes from the fact that its a hardware implementation of an associative software array.

Contents

Cell Structure

Associative memory is only used where extremely high performance is needed.

As such, its based on SRAM rather than DRAM.

As a starting point, this alone makes it expensive.

DRAM uses one transistor and one capacitor per bit, and SRAM uses a total of 6 transistors.

To efficiently search the content of a memory cell, each cell is modified to have comparison circuitry.

This adds a total of 4 more transistors to each cell.

This means associative memory is significantly less dense than SRAM, which is already an expensive form of storage.

Usage

Associative memory is expensive and optimized exclusively for matching content-based searches.

There are generally only two main places associative memory is used, web link switches and routers.

Networking hardware like switches and routers must offer high-performance levels to keep multiple gigabits of internet traffic flowing constantly.

Within a web link, MAC addresses are used to route traffic.

To ensure that each packet is sent to the right place, its destination MAC address is searched for.

In a traditional memory format, that would take some time, adding to every data pipe communications latency.

With associative memory, that search can be much faster.

Binary and Ternary

Most associative memory is based on binary, but some are based on ternary.

A ternary associative memory cell is similar to the binary one described above.

Instead of having one SRAM cell, however, it has two.

Both then together have the four extra transistors needed to perform the comparison.

The ternary cells second bit indicates care or dont care.

This adds a third state to the cell and overall search function.

It can now store a 1, 0, or X for dont care.

You may have multiple positive responses to a single search address in both of these.

Within both, you only want to take note of the most precise instruction.

As such, a search for 192.168.20.19 may match the following rules 192.168.20.16/28 and 192.168.0.0/16.

This allows you to apply the related access control rules preferentially.

As ternary associative memory is even more expensive than the binary form, it is even less common.

It can generally only be found in top-end routers and multi-layer switches.

Conclusion

Associative memory is a form of memory that works very differently from standard memory.

The ternary variant allows storing a third value, typically a 1, 0, or dont care.

This allows content to indicate that it should match even if the search term isnt precise.

Only devices that particularly benefit from it and where performance outweighs the upfront cost feature it.

As such, its typically exclusively found in enterprise-grade networking hardware.