178 Hardware Reference Manual
Intel
®
IXP2800 Network Processor
Microengines
One possible way to use the result of a lookup is to dispatch to the proper code using instruction:
jump[register, label#],defer [3]
where the register holds the result of the lookup. The State bits can be used to differentiate cases
where the data associated with the CAM entry is in flight, or is pending a change, etc. Because the
lookup result was loaded into bits[11:3] of the destination register, the jump destinations are spaced
eight instructions apart. This is a balance between giving enough space for many applications to
complete their task without having to jump to another region, versus consuming too much Control
Store. Another way to use the lookup result is to branch on just the hit miss bit, and use the entry
number as a base pointer into a block of Local Memory.
When enabled, the CAM lookup result is loaded into Local_Addr as follows:
LM_Addr[5:0] = 0 ([1:0] are read-only bits)
LM_Addr[9:6] = lookup result [6:3] (entry number)
LM_Addr[11:10] = constant specified in instruction
This function is useful when the CAM is used as a cache, and each entry is associated with a block
of data in Local Memory. Note that the latency from when CAM_Lookup executes until the
LM_Addr is loaded is the same as when LM_Addr is written by a Local_CSR_Wr instruction.
The Tag and State bits for a given entry can be read by instructions:
CAM_Read_Tag[dest_reg, entry_reg]
CAM_Read_State[dest_reg, entry_reg]
The Tag value and State bits value for the specified entry is written into the destination register,
respectively for the two instructions (the State bits are placed into bits [11:8] of dest_reg, with all
other bits 0). Reading the tag is useful in the case where an entry needs to be evicted to make room
for a new value — the lookup of the new value results in a miss, with the LRU entry number
returned as a result of the miss. The
CAM_Read_Tag instruction can then be used to find the value
that was stored in that entry. An alternative would be to keep the tag value in a GPR. These two
instructions can also be used by debug and diagnostic software. Neither of these modify the state of
the LRU pointer.
Note: The following rules must be adhered to when using the CAM.
• CAM is not reset by Microengine reset. Software must either do a CAM_clear prior to using
the CAM to initialize the LRU and clear the tags to 0, or explicitly write all entries with
CAM_write.
• No two tags can be written to have the same value. If this rule is violated, the result of a lookup
that matches that value will be unpredictable, and LRU state is unpredictable.
The value, 0x00000000 can be used as a valid lookup value. However, note that the
CAM_clear
instruction puts 0x00000000 into all tags.To avoid violating rule 2 after doing
CAM_clear, it is
necessary to write all entries to unique values prior to doing a lookup of 0x00000000. An algorithm
for debug software to determine the contents of the CAM is shown in Example 26.