Forum Discussion
Implementing CAM (Content Addressable Memory) on Cyclone III
Hi everyone,
I'm new at the Altera Forum and I'm also a newbie in using Altera FPGAs. In order to design a packet filter for a DVB application, I'm looking for a solution to implement a CAM (Content Addressable Memory) on a Cyclone-III FPGA. Can anyone help me with that? Thanks in advance Modellpilot23 Replies
- Altera_Forum
Honored Contributor
Thanks for the tips!! But I need a CAM with 64 words X 64 bits wide, what do you suggest for implement this kind of CAM?
Once more, thanks!!:) - Altera_Forum
Honored Contributor
Neither, at least with the design I posted, it's a 32x8 CAM. Be sure to look at it, since is uses different widths between reads and writes. On the write side, the data AND address are combined into a single write address. This implementation allows the write and read to occur in a single clock cycle.
It seems like a huge reduction from all the bits in an M9K down to just a 32x8 CAM, but that's because it's just a RAM. A CAM needs to look at all locations for a match, so if you really wanted to store a word at each location, then you would need a state-machine that reads every location and checks for a match, i.e. it would be MANY clock cycles for each read. Some designs can tolerate this, but it quickly becomes unmanagable. The one I posted is very straightforward in implementation(once you understand how it works), but is small. I've seen plenty of cases where users need a much larger CAM and find they're dedicating all of the memory to this function and hence this implementation doesn't work. - Altera_Forum
Honored Contributor
Hi, I have a doubt abou this. This CAM size that a M9K block can implement is number of words X number of bits of each word or it is number of bit address X number of bits of each word?
Thanks in advance!!!:) - Altera_Forum
Honored Contributor
Hi mehryar,
yes I wrote my CAM from scratch. Because the application required a very high performance for a dedicated context-specific filtering. Due to the use of this model in one of our products, I can't send you my design. Sorry! Modelpilot - Altera_Forum
Honored Contributor
Hi modelpilot,
Did you write your own CAM from scratch? or you used the CAM provided from RYSC? either ways can you send me your design ,if it is possible. I tried both the fast CAM from altera and parameterized CAM by RYSC but still I don’t know how to initialize it! - Altera_Forum
Honored Contributor
Hi mehryar,
unfortunately I can't help you regarding a question about the models of Rsyc or markman. After all I analyzed the usefull hints and realized a custom CAM implementation which is appropriate to the dedicated requirements of my application. Best regards, Modelpilot! - Altera_Forum
Honored Contributor
Greetings,
I have a problem filling the CAM with data ,does anybody know how I can initialize the CAM using the initial file ?or is there any other way ? please help me, Many thanks in advance - Altera_Forum
Honored Contributor
Hello,Modellpilot
I misunderstood u and you can find a 256x8 CAM in http://www.geocities.com/deepakgeorge2000/cam.htm (http://www.geocities.com/deepakgeorge2000/cam.htm) with VHDL code.Hope can help you. - Altera_Forum
Honored Contributor
An M9K can do a 32x8 CAM, so you'll basically change the parameters in M9K_CAM.vhd to do a 32x16 CAM(it needs to be a multiple of these dimensions), and then just tie off the extra ports. I built this quickly but believe it is correct. There is a presentation that is very old on this topic(it was done as Stratix was rolling out). I have a document that refers to it, so together you can use them for understanding. (Not the most professional delivery, but hey, if it works.) You can also just use the M9K_CAM.vhd and M9K.vhd files and just play with it yourself.
- Altera_Forum
Honored Contributor
I need a 24x12 CAM (means 5-bit address and 12-bit word size). It would be great if you could help me with a VHDL code :)
A version for M9Ks would be fine. But I think it is no big deal to adapt an example for M4Ks. Right? Thanks in advance!