Read large MNIST file in System Verilog

56 views
Skip to first unread message

Haval Elias

unread,
Jun 23, 2022, 11:55:47 PM6/23/22
to
Hi all,
I am trying to read the first 200 rows in MNIST file which contains grayscale data 0-255 in each column using $readmemh and I don't think it is reading the file correctly is there a better way to this? your help is really appreciated.
here is my testbench code in Verilog. also if possible how can I find the dot products between two rows? For example, sum of products of the first row with the second one?

`timescale 1ns / 1ns
module readmem_tb;
parameter num=3136;
reg [num:0] mem [0:2*num];
initial
$readmemh("MNIST200.txt", mem);
integer k;
initial
begin
#10;
$display("Contents of Mem after reading data file:");
for (k=0; k< 6; k=k+1)
$display("%d:%h",k,mem[k]);
end
endmodule

Reply all
Reply to author
Forward
0 new messages