用MATLAB编写VIVADO的coe文件

  我在此举一个实例说明,我在此创建一个h矩阵,并将此矩阵写在rom1.coe文件中 。
h=randint(4,50);
fid1 = fopen('rom1.coe','w+');
fprintf(fid1,'memory_initialization_radix = 2;\n');
fprintf(fid1,'memory_initialization_vector =\n');
for i=1:4
    fprintf(fid1,'%x',h(i,:));
    fprintf(fid1,'\n');
end
fclose(fid1);
    结果如下
memory_initialization_radix = 2;
memory_initialization_vector =
10110001111001011001110101011011011010011000000101
10011000100000001011100100111000100101000001100100
01101001100100100111011111011100000010100101000110
00100110000000111010010010100101000111001101000011

你可能感兴趣的:(vivado入门)