用MATLAB編寫VIVADO的coe檔案

cuterabbitbaby發表於2017-08-25
  我在此舉一個例項說明,我在此建立一個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

相關文章