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.

how to convert image(jpeg/bmp) to .coe file

Status
Not open for further replies.

praveenvanaparthy

Newbie level 6
Joined
Jun 19, 2011
Messages
14
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,283
Activity points
1,376
hi.

please tell me how to convert image to .coe file .
am using it for xilinx.

is this using matlab or any direct procedure is there using xilinx ise.
 

Hi,

fortunaltey I just wrote a very simple program for my purpose to write a .coe file unfortunately since I am stuck and obsessed with work now I cannot further look into detail or explain here.
The program is quite simple. What you can do is some how call your desired file and then write it to the file as I did...

#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
//#include <>

void main (){
int num;
FILE *file;
const int samples = 100;
const int points = 400;
int radix =16;

file = fopen("write_txt.coe", "a");
if(file == NULL) {
printf("Cannot open file");
exit(0);
}

fprintf(file, "; Sample memory initialization file for Dual Port Block Memory,\n");
fprintf(file, "; This .COE file specifies the contents for a block memory\n");
fprintf(file, "; of depth=%d, and width=%d. In this case, values are specified\n");
fprintf(file, "; in hexadecimal format.\n");
fprintf(file, "memory_initialization_radix=%d;", radix);
fprintf(file, "memory_initialization_vector= ");

for (num = 0; num < points; num ++)
{
if(num < points-1)
fprintf(file, "%x,\n ",num*samples);
else
fprintf(file, "%x;\n ",num*samples);
}
fclose(file);

}

This may not the best approach for your thing but for me I needed this you can have similar way etc.
but note that since this will only write .txt file hence when you call it for coe file it will generate error, so what you do is just save as the similar file with .coe extension

For how to write or read using visual studio 2010 see https://www.cplusplus.com/
while google for details of .coe syntax etc.
Bests,
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top