0
\$\begingroup\$

My knowledge on the subject is bare-bones. I created a .coe file and used Block Memory Generator to get an .mif file. I need to store the contents in the block memory and then use it. Following is my code:

module read_file;
reg [15:0] music [0:255];
initial
$readmemh("blk_mem_gen_1.mif", music);
integer i;
initial begin for(i=0; i<16; i=i+1)
$display("music[%d] = %h", i, music[i]);
end
endmodule

As you can probably tell, I have no idea what I am doing. Please guide me through and point me to some resources if you happen to know some.

asked Oct 24, 2019 at 3:35
\$\endgroup\$
7
  • \$\begingroup\$ This is just to test if I can read data successfully. With $display I was hoping to get an output on Tcl console. My experience with Vivado is limited to 4-bit full adder using switches and LEDs. \$\endgroup\$ Commented Oct 24, 2019 at 3:38
  • 1
    \$\begingroup\$ so what happened when you compiled this ... were correct values read ? (I assume your coe file has contents which you added correctly) \$\endgroup\$ Commented Oct 24, 2019 at 4:17
  • \$\begingroup\$ @MituRaj No. There is no output in the console. Additionally from the Utilization report I can see that No Block RAM Tile is being utilized at all, which tells me I am doing something fundamentally wrong. \$\endgroup\$ Commented Oct 24, 2019 at 4:20
  • 1
    \$\begingroup\$ Give the full path of .mif file in the code ... \$\endgroup\$ Commented Oct 24, 2019 at 4:25
  • \$\begingroup\$ @MituRaj Thanks a lot! This seems to be working for now. Edit: I see output in the console now, though the Block RAM utilization is still zero. Any ideas? \$\endgroup\$ Commented Oct 24, 2019 at 4:41

1 Answer 1

2
\$\begingroup\$

Seems like your file path is causing problem. Specify full file path to .mif file

Anyway Vivado will synthesise only a distributed RAM for your array music. To use Block RAM, you have to generate one with initial values in a .coe file and instantiate it. But then, you can access the data only one at time in a clock cycle. You can't access multiple data in 'parallel'.

Useful link

answered Oct 24, 2019 at 6:36
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.