Commit 7a976380 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

add helper script for writing tables to ROM

parent 133e1356
Loading
Loading
Loading
Loading
+82 −0
Original line number Diff line number Diff line
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
%    (C) 2022-2023 Baseline Development Group with portions copyright Dolby International AB, Ericsson AB,
%    Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
%    Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange,
%    Panasonic Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation. All Rights Reserved.
% 
%    This software is protected by copyright law and by international treaties.
%    The Baseline Development Group consisting of Dolby International AB, Ericsson AB,
%    Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
%    Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies OY, Orange,
%    Panasonic Corporation, Qualcomm Technologies, Inc., and VoiceAge Corporation retain full ownership
%    rights in their respective contributions in the software. No license of any kind, including but not
%    limited to patent license, of any foregoing parties is hereby granted by implication, estoppel or
%    otherwise.
% 
%    This software is provided "AS IS", without any express or implied warranties. The software is in the
%    development stage. It is intended exclusively for experts who have experience with such software and
%    solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
%    and/or fitness for a particular purpose are hereby disclaimed and excluded.
% 
%    Any dispute, controversy or claim arising under or in relation to providing this software shall be
%    submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
%    accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
%    the United Nations Convention on Contracts on the International Sales of Goods.
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function writeData3L(fid_source, startstring, data)
indices=size(data);

indent = 4;

fprintf(fid_source,startstring);
fprintf(fid_source,'=\n{');
for A = 1:indices(1)
    fprintf(fid_source,'\n');
    fprintf(fid_source,repmat(' ',1,indent));
    fprintf(fid_source,'{');
    for B = 1:indices(2)
        fprintf(fid_source,'\n');
        fprintf(fid_source,repmat(' ',1,indent*2));  
        fprintf(fid_source,'{');
        if( indices(3) > 10 ) 
            fprintf(fid_source,'\n');
            fprintf(fid_source,repmat(' ',1,indent*3));    
        end
        counter=1;
        for C = 1:indices(3)
            fprintf(fid_source,'%+ff',real(data(A,B,C)));
            if C < indices(3)
                if mod(counter,10) == 0
                    fprintf(fid_source,',');
                else
                    fprintf(fid_source,', ');
                end
            end
            if mod(counter,10) == 0 && counter ~= indices(3)
                fprintf(fid_source,'\n');
                fprintf(fid_source,repmat(' ',1,indent*3));
            end
            counter = counter+1;
        end
        if( indices(3) > 10 ) 
            fprintf(fid_source,'\n');
            fprintf(fid_source,repmat(' ',1,indent*2));
        end
        fprintf(fid_source,'}');
        if B < indices(2)
            fprintf(fid_source,',');
        end
    end
    fprintf(fid_source,'\n');
    fprintf(fid_source,repmat(' ',1,indent));
    fprintf(fid_source,'}');
    if A < indices(1)
        fprintf(fid_source,',');
    end
end
fprintf(fid_source,'\n};\n\n');

end % function