I have a TCAM (ternary Content Adressible memory) and Id like to see what data structures I can use to describe it.
For simplicity lets say I have data[31:0] and addr[31:0] and mask[31:0].
I need to be able to query the address based on the data(so I guess we can use an associative array).
but since we also need to use the mask where if the mask bit is set then the corresponding addr bit is checked else it is a don't care.
data[31:0] = 0x0000_ABCD
addr[31:0] = 0xCAFE_CAFE
mask[31:0] = 0x0000_FFFF
Now a query for data[31:0] = 0x????_ABCD should return 0xCAFE_CAFE where ? represents 0,1,X (since mask is 0 for msb 16 bits)
I thought of using an assoc array like this
I saw an example in this post below where u have used an assoc array as shown below.
but im not sure if that is the right way to go about for this problem.
Thanks for the help