一、我对FIFO 和 IP核的理解
1.什么是FIFO
FIFO是英文First In First Out 的缩写,是一种先进先出的数据缓存器,相关详细介绍请自行网络。
2.什么是IP核
首先,可以确定的是IP就是 Intellectual Property(知识产权)的缩写。Quartus中提供的IP核就是已经设计好的模块化电路或者接口函数。其中一部分模块化电路需要根据实际需求配置参数,然后就生成了对应的IP核。
二、FIFO IP核的生成过程
1.在菜单栏中点击Tools>IP catalog,调出IP核目录面板。
IP 目录在Quartus软件界面的右侧(默认情况下)。
在搜索框中输入FIFO,软件会在IP目录中显示对应的FIFO IP核,双击此FIFO核进入参数编辑界面。
2.FIFO IP核相关设置
2.1 在弹出的界面输入实体名,点击确定。
IP Parameter Editor界面如下:
2.2 参数设置有哪些内容:
a. Width,Click,Synchronization
b.SCFIFO Option
c.DCFIFO 1
d.DCFIFO 2
e.Rdreq Option,Blk Type
f.Optimization,Circuitry Protection
下面对这6项设置详细说明:
a. Width,Click,Synchronization
设置位宽和位深,选择读写是同步时钟还是异步时钟。
位宽就是一次写入或读出的位数,一般是一个字节(8bit)的倍数,此处我们选择位宽16bit。
位深就是FIFO寄存器的容量,此处我们选择4096 words。
do you want a common clock for reading and writing the fifo?
Yes,synchronize both reading and writing to 'clock'.
creat one set of full/empty control signals.
你想要一个读写fifo的普通时钟吗?
是,将读写同步到“时钟”。
创建一组满/空控制信号。
右上角的Block Symbol会实时根据设置显示端口。
fifo_input:
data[15..0]:写入的数据
Wrreq: 写使能信号
rdreq:读使能信号
clock:同步时钟
fifo_output:
q [15..0]:读出的数据
usedw[11..0]: almost full 和almost empty的参考值
full:满标志
empty:空标志
注意: 由于此时选择的是同步时钟,所以参数设置卡的c(DCFIFO 1)和d(DCFIFO 2)两项无法修改,这两项是有关异步时钟设置的。
选择异步时钟:读和写各有一个控制时钟信号.
do you want a common clock for reading and writing the fifo?
No,synchronize reading and writing to 'rdclk' and 'wrclk',respectively.
Creat a set of full/empty control signals for each clock.
否,分别将读取和写入同步到“rdclk”和“wrclk”。
为每个时钟创建一组满/空控制信号。
注意:选择异步时钟时,会出现红色框的附件项,可以修改读出位宽。此处我们选择默认设置。
异步时钟条件下的端口如下:
b.SCFIFO Option 单时钟设置
full、empty是满、空标志位。
usedw[ ] (number of words in the FIFO),FIFO中双字节剩余数量。作为almost full 和almost empty的参考值。
Asynchronous clear(异步清零)
Synchronous clear (同步清零)
根据实际设计,勾选或者取消勾选。
c.DCFIFO 1 双时钟设置 1
有关异步时钟和FIFO稳定性能的选择设置,默认选择中间一档。此处我只是做了简单翻译,如果有更明确的解析,请留言。
total latency,clock synchronization,metastability protection,area,and fmax option must be set as a group.
总延迟、时钟同步、亚稳态保护、面积和fmax选项必须设置为一个组。
total latency is the sum of two write clock rising and the number of read clocks selected below.
总延迟是两个写入时钟上升沿和下面选择的读取时钟数之和。
lowest latency but requires synchronized clock.
1 sync stages,no metastability protection,smallest size,good fmax
最低延迟,但需要同步时钟。
1 个同步状态,无亚稳态保护,最小尺寸,良好的fmax
minimal setting for unsynchronized clock.
2 sync stages,good metastability protection,medium size,good fmax
非同步时钟的最小设置。
2 个同步状态,良好的亚稳态保护,中等尺寸,良好的最大功率
best metastability protection,best fmax,unsynchronized clock.
3 or more sync stages,best metastability protection,largest size,best fmax
最佳亚稳态保护,最佳fmax,非同步时钟。
3 个或更多同步状态,最佳亚稳态保护,最大尺寸,最佳fmax
d.DCFIFO 2 双时钟设置 2
有关读和写的标志位选择,以及清零时钟的选择。根据实际设计勾选,或者默认勾选即可。
e.Rdreq Option,Blk Type
默认勾选即可。
normal synchronous FIFO mode.
the data becomes available after 'rdreq' is asserted.
'rdreq' acts as a read request.
正常同步FIFO模式。
在确定“rdreq”后,数据有效。
“rdreq”充当读取请求。
show-ahead synchronous FIFO mode
the data becomes available before 'rdreq' is asserted.
'rdreq' acts as a read acknowledge.
提前显示同步FIFO模式
在确定“rdreq”之前,数据有效。
“rdreq”用作读取确认。
f.Optimization,Circuitry Protection 有关电路优化和保护的 ,默认设置即可。
3. 生成Verilog或者VHDL代码
点击右下角的'Generate HDL...',弹出设置界面,可以选择生成的言语类型。
设置完成后,点击Generate,此处我是默认选择。
点击close,提示save system succiessfully
点击close,提示Generate successfully.