Altera提供FPGA, CPLD和ASIC解决方案
  • 下载
  • 文档资料
  • 产品
    • 器件
    • 设计软件
    • IP
    • 开发套件/电缆
    • 设计和支持服务
    • 资料
  • 最终市场
    • 汽车
    • 广播
    • 计算机和存储
    • 消费类
    • 工业
    • 医疗
    • 军事和航空航天
    • 测试和测量
    • 无线通信
    • 有线通信
  • 技术中心
    • DSP
    • 外部存储器
    • 嵌入式处理
    • 收发器
    • 并行I/O
    • 信号完整性
    • 系统集成
  • 教育与活动
    • 培训中心
    • 大学计划
    • 网络研讨会和视频
    • 演示
    • 活动日程
  • 支持
    • 设计和支持资源指南
    • 知识数据库
    • 器件
    • 软件
    • IP
    • 开发套件和电缆
    • 设计范例
    • 参考设计
    • 下载
    • 用户社区和论坛
    • mySupport
  • 公司介绍
    • 关于我们
    • 客户成功案例
    • 合作伙伴
    • 新闻中心
    • 投资者关系
    • 保护环境
    • 职位招聘
    • 联系我们
  • 在线购买
    • 器件
    • 设计软件
    • 开发和教育套件
    • 电缆和可编程硬件
    • IP
  • 全部页面
  • 产品型号
  • 知识数据库
  • 支持&技术资料
  • 论坛 & Wiki

Quartus Design Example: Single-Match CAM (altcam)

主页 > 支持 > 设计范例 > Quartus II软件工程 > Quartus Design Example: Single-Match CAM (altcam)

This example implements a MegaWizard®-generated CAM block with 64 32-bit words.

Single-match CAM blocks have two address matching schemes: unencoded and encoded. In the case of the 64x32 CAM example the unencoded match address is a 64-bit bus (mbits[63..0]). When the CAM block matches an input data value to an address location, it will assert the bit of the mbits bus that corresponds to a match address. For example, if there is a match at address location 5, bit 5 of the mbits bus will drive high. The unencoded address is valid 2 clock cycles after a data input is applied to the CAM block.

A 64-word encoded CAM block outputs a 6-bit (log2(64)) encoded match address (maddress[5..0]). The maddress bus displays the binary encoded match address for an input pattern.

The design and simulation files used in this example can be downloaded by clicking on the link below.

Download single_match.exe

The use of this design is governed by, and subject to, the terms and conditions of the Altera Hardware Reference Design License Agreement.

Reading from an Initialized Single-Match CAM block

CAM blocks can be initialized with a Hexadecimal file (.hex) with a memory initialization file (.mif), or you directly write to a CAM block. Figure 1 shows a simulation example for a CAM block that has been initialized with a MIF file. This example illustrates a pre-loaded CAM block that matches the data value of 4 at maddress = 3, a CAM block miss for a value of 0, a match for 999 at maddress = 63, a match for 202 at maddress = 52, a miss for 0, and a match for 11 at maddress = 0.

Figure 1. Vector Waveform File (read.vwf) Illustration

Figure 1

A read is initiated by driving the write enable signal (wren) low and applying the pattern input. If a match is found, the mfound signal will be asserted one clock cycle after an input pattern has been applied to the CAM block.

Note: This simulation example assumes that the CAM block was pre-loaded with initial.mif.

Writing to a Single-Match CAM Block

Figure 1 shows the process of writing to a 64-word CAM block.

A write operation is performed by asserting wren and write address (wraddress) for two clock cycles.

Altera's CAM blocks also have support for "don't care" bits. The simulation example illustrates writing "don't care" values to address location 0. "Don't care" write operations require three clock cycles to complete. The wrxused signal is asserted and held for three clock cycles to indicate that the CAM block will be writing a "don't care" value. Any bits in the wrx bus that are set to 1, indicate that bit position will be a "don't care" bit.

Figure 2. Vector Waveform File (write.vwf) Illustration

Figure 2

The above example writes a value of 15 (HEX "0000000F") to address location 0 and it sets a "don't care" value of 240 (HEX "000000F0") at location 0. Therefore, all values of "000000XF" will produce a match at location 0 (where 0 < X < F). This scenario is illustrated in the write.vwf simulation where patterns 255 and 79 drive maddress to 0. The simulation then writes a value of 9 at address location 1. When a data value of 9 is later applied to the CAM block, a match is found at maddress = 1.

Deleting a value from the CAM Block

Word values can be deleted from a CAM block through the wrdelete signal. To delete a value, wren and wrdelete should be held high for two clock cycles, during which wraddress should indicate the address containing the word that will be deleted. See Figure 3.

The delete.vwf simulation writes a value of 9 at address location 1. This value is then deleted by asserting wren and wrdelete for two clock cycles while wraddress = 1. The data value 9 no longer produces a match after the delete operation.

A delete operation is equivalent to setting a never match address. The address location that is a deleted never matches an input pattern until a data value is subsequently written to the CAM block at that address location.

Figure 3. Vector Waveform File (delete.vwf) Illustration

Figure 3

Design Examples Disclaimer

These design examples may only be used within Altera Corporation devices and remain the property of Altera. They are being provided on an “as-is” basis and as an accommodation; therefore, all warranties, representations, or guarantees of any kind (whether express, implied, or statutory) including, without limitation, warranties of merchantability, non-infringement, or fitness for a particular purpose, are specifically disclaimed. Altera expressly does not recommend, suggest, or require that these examples be used in combination with any other product not provided by Altera.

给本页评分


  • 产品
    • MAX/MAX II
    • Stratix/Stratix GX
    • Nios II
  • 功能
    • 算法
    • 存储器
    • 总线及I/O
    • 逻辑
    • 接口与外设
    • DSP
    • 通信
    • PLL & Clocking
  • 设计输入方法
    • Quartus II软件工程
    • Tcl
    • VHDL
    • Verilog HDL
    • C Code 范例
    • DSP Builder
    • TimeQuest
    • 片内调试
      • SignalTap II
  • 仿真工具
    • Mentor Graphics ModelSim
    • Cadence NCsim
    • Synopsys VCS
  • 旧范例
    • 图形编辑器
    • AHDL
    请填写反馈意见
    产品 | 最终市场 | 技术中心 | 教育与活动 | 支持 | 公司介绍 | 在线购买
    联系我们 | 站点帮助 | 网站导航 | 个人信息 | 法律申明
    Copyright © 1995-2010 Altera International Limited. 版权所有
    Altera Forum
    Altera
    论坛
    RSS
    RSS
    Flickr
    Flickr
    Email Updates
    电邮新闻