当前位置:网站首页>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 核的使用。
边栏推荐
- 五、 无线通信网
- [beauty of software engineering - column notes] 19 | as a programmer, you should have product awareness
- 【Leetcode刷题】数组1——双指针
- 虹科Automation softPLC | MoDK运行环境与搭建步骤(1)——运行环境简介
- 子网数、主机数与子网掩码的关系
- 虹科分享 | 如何测试与验证复杂的FPGA设计(1)——面向实体或块的仿真
- Official tutorial redshift 07 instances and proxy
- Official tutorial redshift 03 parameters and general instructions of various GI
- Simple code to realize PDF to word document
- Leetcode 3. longest substring without repeated characters
猜你喜欢

服务器135、137、138、139、445等端口解释和关闭方法

Leetcode 13. Roman numeral to integer

Redshift 2.6.41 for maya2018 水印去除

UE4 高光官方参考值

Leetcode 167. sum of two numbers II - input ordered array

官方教程 Redshift 04 渲染参数

模型空间下的旋转和世界空间下的旋转

官方教程 Redshift 03 各种GI的参数和常规使用说明

基于udp通信的在线多人聊天室

Abstract encapsulation inheritance polymorphism
随机推荐
Leetcode - Tips
Leetcode 977. Square of ordered array
Self study understanding of [chain forward star]
Maya aces workflow configuration (Arnold and redshift map configuration specification - restore the correct effect of the map under the SP aces process) PS restore the rendered map under the aces proc
【Leetcode刷题】数组1——双指针
Abstract encapsulation inheritance polymorphism
官方教程 Redshift 03 各种GI的参数和常规使用说明
OSPF理论介绍
MySQL interview questions
官方教程 Redshift 01 基础理论知识和基础特性学习
[beauty of software engineering - column notes] 16 | how to write project documents?
Official tutorial redshift 09 camera
八、 网络安全
MySql-面试题
Redshift restore SP effect - SP map export settings and map import configuration
虹科 | 使用JESD204串行接口高速桥接模拟和数字世界
Unity初学1——角色移动控制(2d)
Vivado IP核之浮点数开方 Floating-point
[beauty of software engineering - column notes] 20 | how to deal with the headache of requirement change?
unsigned right shift