当前位置:网站首页>Vivado IP核之RAM Block Memery Generator
Vivado IP核之RAM Block Memery Generator
2022-07-29 05:25:00 【迎风打盹儿】
Vivado IP核之RAM Block Memery Generator
前言
本次介绍vivado中RAM(Block Memery Generator)IP核的使用,希望对大家有所帮助。
提示:以下是本篇文章正文内容,均为作者本人原创,写文章实属不易,希望各位在转载时附上本文链接。
一、配置步骤
在vivado中搜索Block Memery Generator,找到该IP核后即可按照以下操作完成相应的配置。本次配置为单端口模式。
1.首先配置Basic界面,如图1所示。

2.其次配置Port A Options界面,如图2所示。

3.然后配置Other Options界面,如图3所示。这里可以添加初始化文件,即coe文件,用来初始化存储数据。

4.最后就是一个Summary界面,如图4所示,不需要我们配置,一个简介页面而已。

以上4个界面都配置完成后即可点击右下角OK按钮生成IP核。
二、仿真
1.顶层代码
建立一个顶层模块,命名为ram_read,用来例化刚才生成的IP核。
代码如下:
`timescale 1ns / 1ps
//
// Company: cq university
// Engineer: clg
// Create Date: 2022/07/27 16:43:07
// Design Name:
// Module Name: ram_read
// Project Name:
// Target Devices:
// Tool Versions: 2017.4
// Description:
// Dependencies:
// Revision:1.0
// Revision 0.01 - File Created
// Additional Comments:
//
//虽然是ram,本次将ram当rom使用
module ram_read(
input clk, //输入时钟信号
input rst_n, //输入复位信号
input start, //输入开始读信号
input [10 : 0] addr, //输入读地址
input [31 : 0] din, //本次用不到
output reg over, //输出读的数据有效信号
output reg [31 : 0] dout //输出读到的数据
);
//reg define
reg en; //读使能信号
reg we; //读写选择
reg [1:0] cnt; //计数器
//wire define
wire [31:0] data; //读的数据
always @(negedge clk or negedge rst_n)
begin
if(!rst_n)
cnt<=0;
else if( (start==1)&(cnt<3))
cnt<=cnt+1;
else
cnt<=0;
end
always @(negedge clk or negedge rst_n) //下降沿设定使能
begin
if(!rst_n)
begin en<=0;we<=0;end
else if(0<cnt<3)
begin en<=1;we<=0;end
else
begin en<=0;we<=0;end
end
always @(posedge clk or negedge rst_n) //上升沿读取稳定数据
begin
if(!rst_n)
begin over<=0;dout<=0;end
else if(cnt==3)
begin over<=1;dout<=data;end
else
begin over<=0;dout<=0;end
end
ram_sam_re_ip u1_ram_sam_re_ip ( //例化ram
.clka(clk), // input wire clka
.ena(en), // input wire ena
.wea(we), // input wire [0 : 0] wea
.addra(addr), // input wire [10 : 0] addra
.dina(din), // input wire [31 : 0] dina
.douta(data) // output wire [31 : 0] douta
);
endmodule
2.仿真代码
建立一个仿真模块,命名为ram_read_tb,用来仿真刚才顶层模块例化的IP核。
代码如下:
`timescale 1ns / 1ps
//
// Company: cq university
// Engineer: clg
// Create Date: 2022/07/27 16:52:23
// Design Name:
// Module Name: ram_read_tb
// Project Name:
// Target Devices:
// Tool Versions: 2017.4
// Description:
// Dependencies:
// Revision:1.0
// Revision 0.01 - File Created
// Additional Comments:
//
module ram_read_tb();
reg clk;
reg rst_n;
reg start;
reg [10 : 0] addr;
reg [31 : 0] din;
wire over;
wire [31 : 0] dout;
ram_read u1_ram_read(
.clk(clk),
.rst_n(rst_n),
.start(start),
.over(over),
.addr(addr),
.din(din),
.dout(dout)
);
always #5 clk=~clk;
initial begin
clk=1'b0;rst_n=1'b1;
#5; rst_n=1'b0;
#15; rst_n=1'b1;
start=1'b1;
addr=11'd0;
#30 start=1'b0;
end
endmodule
三、仿真分析
部分初始存储数据如图5所示, 仿真结果如图6所示,可见仿真结果正确,成功读出了地址为0的数据,由于输出缓冲,所以会有延迟。


总结
本次介绍就到这里,简单介绍了 vivado 中RAM IP 核的使用。
边栏推荐
猜你喜欢

Unity初学3——敌人的移动控制和掉血区域的设置(2d)

Leetcode 876. Intermediate node of linked list

Leetcode 7. integer inversion

Leetcode 26. delete duplicates in the ordered array

官方教程 Redshift 05 AOVs

虹科Automation softPLC | 虹科KPA MoDK运行环境与搭建步骤(3)——MoDK例程测试
![[beauty of software engineering - column notes] 17 | what is the need analysis? How to analyze?](/img/54/5ea29b125e3b871cd08d52ccc05d3a.png)
[beauty of software engineering - column notes] 17 | what is the need analysis? How to analyze?

Redshift 2.6.41 for maya2018 水印去除

Leetcode 1. sum of two numbers

STP生成树原理及选举规则举例
随机推荐
虹科分享 | FPGA 实现的直通与存储转发切换延迟
Redshift 2.6.41 for maya2018 水印去除
Single chain surface test questions
FTP的两种模式详解
Traditional model predictive control trajectory tracking - circular trajectory (function package has been updated)
UE4 高光官方参考值
Official tutorial redshift 07 instances and proxy
Official tutorial redshift 06 opt parameters
6898 changing matrix problem solution
Access、Hybrid和Trunk三种模式的理解
基于TCP的在线词典
虹科案例 | PAC:一种整合了softPLC控制逻辑、HMI和其他服务功能的集成控制解决方案
官方教程 Redshift 05 system参数详细解释
Maya ACES工作流程配置(Arnold 及 RedShift 贴图配置规范-还原出SP-Aces流程下贴图正确的效果) PS还原Aces流程下渲染的图
操作系统面试题
电脑系统没有standard tcp/ip port端口的处理操作
Leetcode 167. sum of two numbers II - input ordered array
电脑鼠标右键单击总是转圈圈怎么回事
Eight sorts ------------- heap sort
Unity初学4——帧动画以及主角攻击(2d)