blooz
Advanced Member level 2
What's the possible formats for initializing a memory core.I s there any scripts to generate some random binary data for an arbitrary Memory size
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sure, you can write script in MATLAB to do that.
Format for Xilinx coefficient file looks something like this:
memory_initialization_radix=2;
memory_initialization_vector=
00000000,
00000000,
00000000,
00000000,
00000000,
00000000,
00000000,
00000000;
Hope this helps
%Script to generate a .coe file for memory initialisation
clc
fid=fopen('mem2.coe','wt');
x=0;
fprintf(fid,' %b',x);
d=input('Please enter depth of memory ');
w=input('Please enter the width of memory ');
range=power(2,w);
r=randint(1,d,range);
temp=dec2hex(r',(w/4));
fprintf(fid,';The data memory generated is \n ');
fprintf(fid,'MEMORY_INITIALIZATION_RADIX=16;\n ');
fprintf(fid,'MEMORY_INITIALIZATION_VECTOR= ');
d=d-2;
display('temporary-Assignment')
size(temp)
temp
for i=1:d-1
fprintf(fid,'%d,\n',temp(i,:));
end
fprintf(fid,';');
fclose(fid);
%Script to generate a .coe file for memory initialisation
clc
fid=fopen('mem2.coe','wt');
x=0;
fprintf(fid,' %b',x);
d=input('Please enter depth of memory ');
w=input('Please enter the width of memory ');
range=power(2,w);
r=randint(1,d,range);
temp=dec2hex(r',(w/4));
fprintf(fid,';The data memory generated is \n ');
fprintf(fid,'MEMORY_INITIALIZATION_RADIX=16;\n ');
fprintf(fid,'MEMORY_INITIALIZATION_VECTOR= ');
d=d-2;
for i=1:d+1
fprintf(fid,'%s,\n',temp(i,:));
end
i=d+2;
fprintf(fid,'%s;',temp(i,:));
temp
fclose(fid);