diff --git a/matlab/write_polyfir_coeffs.m b/matlab/write_polyfir_coeffs.m new file mode 100644 index 0000000..bf2544a --- /dev/null +++ b/matlab/write_polyfir_coeffs.m @@ -0,0 +1,13 @@ +function write_polyfir_coeffs(file, coeffs) + + +coeff_format = 'library ieee;\nUSE ieee.std_logic_1164.all;\nUSE work.POLY_FIR_PKG.all;\npackage coeff_fir is\n CONSTANT fir_coeffs_generated : vect_polyfir_coeffs_in := ('; +for i=1:(length(coeffs)-1) + coeff_format = strcat(coeff_format,'X"%02x", '); +end +coeff_format = strcat(coeff_format,'X"%02x");\nend package coeff_fir;'); +fcoeff = fopen(file,'w'); +fprintf(fcoeff,coeff_format,typecast(int8(coeffs),'uint8')); +fclose(fcoeff); + +end \ No newline at end of file