#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);
}