MAX II的UFM模块使用实例

更新时间:2023-11-14 04:15:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

MAX II的UFM

查看MAX II器件的Chip Planner:

其左下角这块黑色区域是用户不可用资源区,而在这片不可用区域里有一块

绿色的方块是可用的。这块不可用的黑色区域叫做CFM block(配置Flash存储区),而那个绿色方块叫做UFM(用户可用的Flash存储区)。对于后者是我们今天讨论的重点,先看以下官方对此存储区作用的描述:

MAX II devices feature a single UFM block, which can be used l

ike a serial EEPROM for storing non-volatile information up to 8,192 bits. The UFM block connects to the logic array through the MultiTrac

k interconnect,allowing any LE to interface to the UFM block. Figure 2–15 shows the UFM block and interface signals. The logic array is used to create customer interface or protocol logic to interface the UFM block data outside of the device. The UFM block offers the following features:

■ Non-volatile storage up to 16-bit wide and 8,192 total bits ■ Two sectors for partitioned sector erase

■ Built-in internal oscillator that optionally drives logic array

■ Program, erase, and busy signals ■ Auto-increment addressing

■ Serial interface to logic array with programmable interface

也就是说,MAX II其实是内嵌了一块8Kbit的Flash。这个Flash原则上是

不占用MAX II的其它可用逻辑资源的,不过这有个大前提:用户读写这块存储区使用altera本身的串行接口(遵循特定的通信协议)。但是这个协议也太繁

琐了(个人感觉),因此,对于这块存储区读写接口altera提供了三种通用的接口供用户选择。 ■ I2C ■ SPI ■ Parallel

■ None (Altera Serial Interface)

最后一种就是不需要占用器件额外逻辑资源的接口,上面三种是需要消耗器件逻辑资源的接口。笔者添加了一个并行接口做测试,占用了EMP240内部86个LEs,对于资源比较紧张的应用还是很划不来的。

更多详细的关于UFM的信息请大家参考altera提供的MAX II datasheet。

下面介绍一个使用并行接口读写UFM的实例,以及功能仿真。

新建一个工程,名为ufmtest,顶层模块ufmtest.v,代码如下:

);

databus,addr,

nerase,nread,nwrite, data_valid,nbusy

module ufmtest(

inout[15:0] databus; //Flash数据总线

input[8:0] addr; input nerase; input nread; input nwrite;

//Flash地址总线

//擦除Flash某一扇区信号 //读Flash信号 //写Flash信号

//Flash数据输出有效信号 //Flash忙信号

output data_valid; output nbusy;

assign databus = nwrite ? dataout:16'hzzzz; //写信号有效时,Flash数据总线作为输入

assign datain = databus; //写入Flash数据总线连接

wire[15:0] datain;

//Flash写入数据 //Flash读出数据

wire[15:0] dataout;

//例化UFM(Flash)模块

para_ufm para_ufm_inst (

.addr ( addr ),

.datain ( datain ), .nerase ( nerase), .nread ( nread ), .nwrite ( nwrite),

.data_valid ( data_valid ), .dataout ( dataout ), .nbusy ( nbusy ) );

endmodule

但是在例化UFM模块之前,大家需要先在MegaWizard Plug-In Manager

里添加一个Flash模块。步骤如下:

1,点击菜单栏里的Tools?MegaWizard Plug-In Manager。弹出如下,点击next。

2,接着选择Memory Compiler下的Flash Memory,然后在What name do you want for the output file?下路径的最后添加输出文件名为para_ufm,点击next.

3,接下来一路Next,需要更改设置的地方如下(我也不多废话,大家一看都明白):

本文来源:https://www.bwwdw.com/article/vp4v.html

Top