Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] what 's the format of memory initialisation file .coe for single port memory .....

Status
Not open for further replies.

blooz

Advanced Member level 2
Joined
Dec 29, 2010
Messages
560
Helped
121
Reputation
242
Reaction score
116
Trophy points
1,343
Location
India
Activity points
4,985
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
 

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
 
  • Like
Reactions: blooz

    blooz

    Points: 2
    Helpful Answer Positive Rating
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

I have written a simple script to generate some random binary vectors for an arbitrary size memory.

The command Window output in matlab is perfect .but the coe file generated has some problem

any way can generate some random binary vectors to load as .coe file

Code:
%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);
 

corrected code for .coe file generator script in matlab

Code:
%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);
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top