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.
-
\$\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\$Maxsash– Maxsash2019年10月24日 03:38:00 +00:00Commented 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\$Mitu Raj– Mitu Raj2019年10月24日 04:17:18 +00:00Commented 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\$Maxsash– Maxsash2019年10月24日 04:20:55 +00:00Commented Oct 24, 2019 at 4:20
-
1\$\begingroup\$ Give the full path of .mif file in the code ... \$\endgroup\$Mitu Raj– Mitu Raj2019年10月24日 04:25:26 +00:00Commented 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\$Maxsash– Maxsash2019年10月24日 04:41:51 +00:00Commented Oct 24, 2019 at 4:41
1 Answer 1
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'.