Megafunction

altcam (Content-Addressable Memory) Megafunction



Content-addressable memory (CAM) Megafunction. The data contained in a CAM is a set of patterns that can be searched in a single-clock cycle. If the input pattern given to the CAM matches one of the patterns stored in the CAM, the address of the matching stored pattern is generated. The altcam megafunction allows each stored pattern bit to be specified as a binary "1" bit, binary "0" bit, or a don't care bit. Comparing a stored pattern bit that is specified as don't care with its corresponding input pattern bit will always result in a match. The altcam megafunction is available for APEX 20KC, APEX 20KE, APEX II, ARM®-based Excalibur, and Mercury devices only.

Altera® recommends instantiating this function as described in Using the MegaWizard® Plug-In Manager.

This topic contains the following information:

 

AHDL Function Prototype (port name and order also apply to Verilog HDL):

FUNCTION altcam (pattern(WIDTH-1)..0], wrx[(WIDTH-1)..0], wrxused, wrdelete,
      wraddress[(WITHAD-1)..0], wren, inclock, inclocken, inaclr, outclock, outclocken,
      outaclr, mstart, mnext)
   WITH (WIDTH, WIDTHAD, NUMWORDS, LPM_FILE, LPM_FILEX, MATCH_MODE, OUTPUT_REG, OUTPUT_ACLR,
      PATTERN_REG, PATTERN_ACLR, WRADDRESS_ACLR, WRX_REG, WRX_ACLR, WRCONTROL_ACLR, USE_EAB,
      CARRY_CHAIN_SIZE, USE_WYSIWYG)
   RETURNS (maddress[(WITHAD-1)..0], mbits[(NUMWORDS-1)..0],
      mfound, mcount[(WITHAD-1)..0], rdbusy, wrbusy);

 

VHDL Component Declaration:

COMPONENT altcam
   GENERIC (WIDTH: NATURAL := 1;
      WIDTHAD: NATURAL := 1;
      NUMWORDS: NATURAL := 1;
      LPM_FILE: STRING := "UNUSED";
      LPM_FILEX: STRING := "UNUSED";
      MATCH_MODE: STRING := "MULTIPLE";
      OUTPUT_REG: STRING := "UNREGISTERED";
      OUTPUT_ACLR: STRING := "OFF";
      PATTERN_REG: STRING := "INCLOCK";
      PATTERN_ACLR: STRING := "ON";
      USE_EAB: STRING := "ON";
      WRADDRESS_ACLR: STRING := "ON";
      WRX_REG: STRING := "UNUSED";
      WRX_ACLR: STRING := "UNUSED";
      WRCONTROL_ACLR: STRING := "OFF";	  
      USE_WYSIWYG: STRING := "ON");
	  
   PORT (pattern:  IN STD_LOGIC_VECTOR (WIDTH-1 DOWNTO 0);
      wrx: IN STD_LOGIC_VECTOR (WIDTH-1 DOWNTO 0) := (OTHERS => '0');
      wren, inclock: IN STD_LOGIC;
      wraddress: IN STD_LOGIC_VECTOR (WIDTHAD-1 DOWNTO 0);
      inclocken, mstart, outclocken, wrxused: IN STD_LOGIC := '1';
      wrdelete, inaclr,  mnext, outclock, outaclr: IN STD_LOGIC := '0';
      maddress, mcount: OUT STD_LOGIC_VECTOR (WIDTHAD-1 DOWNTO 0);
      mbits: OUT STD_LOGIC_VECTOR (NUMWORDS-1 DOWNTO 0);
      mfound, rdbusy, wrbusy: OUT STD_LOGIC);	         	  	  	  
END COMPONENT;  	    	   

 

VHDL LIBRARY-USE Declaration

LIBRARY altera_mf
USE altera_mf.altera_mf_components.all;

 

Port Descriptions:

INPUT PORTS

Port Name Required Description Comments
pattern[] Yes Input pattern to be searched or written. Input port WIDTH wide.
wrx[] No Indicates which pattern bits should be treated as don't care bits. A 1 in a bit position indicates that the corresponding pattern bit should be treated as a don't care bit (will not affect matching). A 0 in a bit position indicates that the corresponding pattern bit is not a don't care bit (is used for matching). Used only during a write operation. Input port WIDTH wide. If the wrx[] port is registered, the value of the WRX_REG parameter should be set to "INCLOCK". If the wrx[] port is unregistered, the value of the WRX_REG parameter should be set to "UNREGISTERED" or "UNUSED".
wrxused No Indicates whether the wrx[] port is used. If false, writing takes two clock cycles to complete; if true, writing takes three clock cycles. If asserted during a write cycle, the value of the wrx[] port is used. Otherwise, the value of the wrx[] port is ineffective.
wrdelete No Indicates that the pattern at the wraddress[] port should be deleted. Deleting a pattern takes two clock cycles. In order to successfully delete the content stored in the location specified by the wraddress[] port, wrdelete must be asserted during the same two clock cycles as wren and wraddress[]. The pattern[], wrx[], and wrxused ports are ignored during delete cycles.
wraddress[] No Write address input to the CAM. Input port WIDTHAD wide.
wren No Write enable input. The wren port must be asserted for a write or delete operation, otherwise a read (match) operation occurs.
inclock Yes Positive-edge-triggered clock.  
inclocken No If omitted, the default is 1.  
inaclr No Asynchronous clear for registers that use the inclock port.  
mstart No Triggers a new CAM search in multiple-match modes, and forces maddress[] to the first matching CAM address search pattern. Not available for single-match mode, but required for multiple-match mode. In fast multiple-match mode, this port is required if the mnext port is used, otherwise the mstart port has no effect. In both multiple-match and fast multiple-match mode, when the mstart port is connected, it must be asserted to start a valid match cycle. The mstart input must go from low to high for at least one inclock cycle to trigger a new read operation, but can stay high or go low after the first two inclock cycles complete. The next read operation begins only when the mstart input changes from low to high again.
mnext No In multiple-match modes, advances the maddress[] port to the next CAM address that matches the search pattern. Not available for single-match mode. The mnext input must not go high during the first two inclock cycles after the mstart input transitions from low to high, otherwise the outputs are not guaranteed to be correct for the current and the next inclock cycles. The mnext input can go high or low during a read operation. When the mnext input is high, the CAM matches that follow the first match, if any, are delivered to the outputs.
outclock No Clock for CAM outputs. Used only if OUTPUT_REG="OUTCLOCK". If OUTPUT_REG="UNREGISTERED" or "INCLOCK", this port must remain unconnected.
outclocken No If omitted, the default is 1. Used only if OUTPUT_REG="OUTCLOCK". If OUTPUT_REG="UNREGISTERED" or "INCLOCK", this port must remain unconnected.
outaclr No Asynchronous clear for input registers that use the outclock port. Used only if OUTPUT_REG="OUTCLOCK". If OUTPUT_REG="UNREGISTERED" or "INCLOCK", this port must remain unconnected.

OUTPUT PORTS

Port Name Required Description Comments
maddress[] No Encoded address of current match. Output port WITHAD wide. One of the output ports must be present. Altera recommends using either a combination of the maddress[] and mfound output ports, or the mbits[] output port.
mbits[] No Address of the found match. Output port [NUMWORDS-1..0] wide. One of the output ports must be present. Altera recommends using either a combination of the maddress[] and mfound output ports, or the mbits[] output port.
mfound No Indicates at least one match. One of the output ports must be present. Altera recommends using either a combination of the maddress[] and mfound output ports, or the mbits[] output port.
mcount[] No Total number of matches. Output port WITHAD wide. One of the output ports must be present. Altera recommends using either a combination of the maddress[] and mfound output ports, or the mbits[] output port.
rdbusy No Indicates that read ports must hold their current value. One of the output ports must be present. Altera recommends using either a combination of the maddress[] and mfound output ports, or the mbits[] output port.
wrbusy No Indicates that write ports must hold their current value. One of the output ports must be present. Altera recommends using either a combination of the maddress[] and mfound output ports, or the mbits[] output port.

 

Parameter Descriptions:

Parameter Type Required Description
WIDTH Integer Yes Width of the input pattern and stored patterns.
WIDTHAD Integer Yes Width of wraddress[] port. WIDTHAD should be equal to CEIL [LOG2(NUMWORDS)].
NUMWORDS Integer Yes Number of words stored in memory. Indicates the width of the mbits[] port. In general, this value should be 2 ^ (WIDTHAD-1) < NUMWORDS <= 2 ^ WIDTHAD.
LPM_FILE String No Name of the Memory Initialization File (.mif) or Hexadecimal (Intel-Format) File (.hex) containing RAM initialization data ("<file name>"), or "UNUSED". If omitted, contents default to "never match". The wren port must be registered to support memory initialization.
LPM_FILEX String No Name of the second HEX File containing RAM initialization data ("<filename_xu.hex>"). If omitted, the default is "UNUSED". Bits that are 1 in this file change the meaning of the bits in the first HEX File such that the 0 bits in the first file become don't care bits, and the 1 bits become "never-match" bits in CAM patterns. The 0 bits in this file preserve the normal meaning of the corresponding bits in the first HEX File.
MATCH_MODE String Yes Selects between single-match mode and one of two multiple-match modes. The values are "SINGLE", "MULTIPLE", and "FAST_MULTIPLE". If omitted, the default is "MULTIPLE".
OUTPUT_REG String No Indicates whether the outputs should be registered. Values are "UNREGISTERED", "INCLOCK", and "OUTCLOCK". If omitted, the default is "UNREGISTERED".
OUTPUT_ACLR String No Indicates whether the outaclr port should affect the output registers. Values are "ON" and "OFF". If omitted, the default is "ON".
PATTERN_REG String No Indicates whether pattern[] should be registered. Values are "UNREGISTERED", and "INCLOCK". If omitted, the default is "INCLOCK".
PATTERN_ACLR String No Indicates whether the inaclr port should affect the pattern[] registers. Values are "ON" and "OFF". If omitted, the default is "ON".
USE_EAB String No Altera-specific parameter. Values are "ON", "OFF", and "UNUSED". If omitted, the default is "ON". This parameter is reserved for future use.
WRADDRESS_ACLR String No Indicates whether the inaclr port should affect the wraddress[] registers. Values are "ON" and "OFF". If omitted, the default is "ON".
WRX_REG String No Indicates whether the wrx[] and wrxused ports should be registered. This parameter must be specified if the wrx[] and wrxused ports are used. Values are "UNREGISTERED", "INCLOCK", and "UNUSED". If omitted, the default is "UNUSED".
WRX_ACLR String No Indicates whether the inaclr port affects the wrx[] and wrxused registers. This parameter must be specified if the wrx[] and wrxused ports are used. Values are "ON" "OFF", and "UNUSED". If omitted, the default is "UNUSED".
WRCONTROL_ACLR String No Indicates whether the inaclr port affects the wren register. Values are "ON" and "OFF". If omitted, the default is "ON".
USE_WYSIWYG String No If this parameter is turned on a carry look-ahead circuit that uses more area but produces faster circuits will be used. Values are "ON" and "OFF". If omitted, the default is "ON".

 

Resource Usage:

One Embedded System Block (ESB) allows a 32-word x 32-bit CAM. The altcam megafunction is available for APEX 20KC, APEX 20KE, APEX II, ARM-based Excalibur, and Mercury devices. The following table shows the resource usage for the altcam megafunction:

Match Mode CAM Patterns per ESB CAM Pattern Bits per ESB
Single 32 32
Multiple 32 31
Fast Multiple 16 32

 

Example: The altcam megafunction, with WITHAD=7 (128 words) and WIDTH=64, uses the following resources:

Number of ESBs Mode
8 Single-match mode
12 Multiple-match mode
16 Fast multiple-match mode

NOTE This topic prints best in Landscape orientation.


Back to Top

- PLDWorld -

 

Created by chm2web html help conversion utility.