没有输出block ram !!

2019-03-25 10:27发布

大家好



  我用 Block Memory Generator 4.3产生一个 single port block ram.

I set:

Write Width:32

Read Width:32

Write Depth:128

Read Depth:128

Write First

Always Enable

Register Port A Output of Memory Core

Pipeline Stages within Mux :0



仿真结果是douta一直为0,请教高手问题出在了哪里,谢谢!

The module is:

module test5(clka, wea, addra, dina, douta
    );
input clka;
input wea;
input [6:0] addra;
input [31:0] dina;
output [31:0] douta;



Block_RAM BRAM (
  .clka(clk),
  .wea(wea), // Bus [0 : 0]
  .addra(addra), // Bus [6 : 0]
  .dina(dina), // Bus [31 : 0]
  .douta(douta)); // Bus [31 : 0]

endmodule



module test5_tb;

// Inputs
reg clka;
reg wea;
reg [6:0] addra;
reg [31:0] dina;

// Outputs
wire [31:0] douta;

// Instantiate the Unit Under Test (UUT)
test5 uut (
  .clka(clka),
  .wea(wea),
  .addra(addra),
  .dina(dina),
  .douta(douta)
);

initial begin
  // Initialize Inputs
  clka = 0;
  wea = 0;
  addra = 0;
  dina = 0;

  // Wait 100 ns for global reset to finish
  #100;
      addra = 23;
  #20;
  addra = 12;
  #10;
  wea = 1;
  dina = 256;
  #20;
  addra = 23;
  dina = 856;
  #30;
  wea = 0;
  #100;
      addra = 23;
  #20;
  addra = 12;
  
  // Add stimulus here

end
   always #5 clka = ~clka;   
endmodule 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
5条回答
tx_xy
1楼-- · 2019-03-25 18:09
< / 从你的代码来分析,读地址没有一次被写入,所以你读出来的值才会是0.

testbench不建议这么写,你可以做一个计数器,从0-20,在第一次从0计数到20的时候,把数据写入到地址0-20,在第二次从0计数到20的时候,从ram的地址0-20中把数读出来。

不知道我说明白了没有 ?
eeleader
2楼-- · 2019-03-25 23:18

楼上正解!

applelonger
3楼-- · 2019-03-26 01:53
谢谢! 我试试看 :)
applelonger
4楼-- · 2019-03-26 03:30
呵呵   表示不是很明白
高手多些提示!
还有,前面的代码为什么不行呢?
可以小小分析一下吗, 谢谢了!
eeleader
5楼-- · 2019-03-26 05:50
兄弟, 大家给你的是提示!而不是帮你设计!

一周热门 更多>