URL
https://opencores.org/ocsvn/mips789/mips789/trunk
Subversion Repositories mips789
[/] [mips789/] [branches/] [avendor/] [tools/] [genmif.c] - Rev 53
Go to most recent revision | Compare with Previous | Blame | View Log
#include "stdio.h" void main(void) { int j=4,i=0 ; char str1[100],str2[111]; FILE*ff=fopen("code.txt","r"); FILE*ft ; for(j=0;j<4;++j) { if(j==0) ft=fopen("qu2_ram0.mif","w"); else if(j==1) ft=fopen("qu2_ram1.mif","w"); else if(j==2) ft=fopen("qu2_ram2.mif","w"); else if(j==3) ft=fopen("qu2_ram3.mif","w"); fprintf(ft,"WIDTH=8;\n"); fprintf(ft,"DEPTH=1024;\n\n"); fprintf(ft,"ADDRESS_RADIX=HEX;\n"); fprintf(ft,"DATA_RADIX=HEX;\n\n"); fprintf(ft,"CONTENT BEGIN \n"); rewind(ff); i=-1 ; while(fgets(str2,100,ff)) { ++i ; if(3==j) { str2[2]=0 ; fprintf(ft," %X : %s;\n",i,&str2[0]); } else if(2==j) { str2[4]=0 ; fprintf(ft," %X : %s;\n",i,&str2[2]); } else if(1==j) { str2[6]=0 ; fprintf(ft," %X : %s;\n",i,&str2[4]); } else if(0==j) { str2[8]=0 ; fprintf(ft," %X : %s;\n",i,&str2[6]); } } fprintf(ft,"END;"); } }
Go to most recent revision | Compare with Previous | Blame | View Log