OpenCores
URL https://opencores.org/ocsvn/artificial_neural_network/artificial_neural_network/trunk

Subversion Repositories artificial_neural_network

[/] [artificial_neural_network/] [trunk/] [test_bench/] [octave/] [wb_gen.m] - Diff between revs 8 and 12

Show entire file | Details | Blame | View Log

Rev 8 Rev 12
Line 33... Line 33...
  fprintf(fileid,'    %i => (\n',k-1);
  fprintf(fileid,'    %i => (\n',k-1);
  for(i=1:size(cell2mat(wbMat(k,1)),2))  % neurons
  for(i=1:size(cell2mat(wbMat(k,1)),2))  % neurons
    fprintf(fileid,'      %i => (\n',i-1);
    fprintf(fileid,'      %i => (\n',i-1);
    for(j=1:size(cell2mat(wbMat(k,1)),1))    % inputs
    for(j=1:size(cell2mat(wbMat(k,1)),1))    % inputs
      fprintf(fileid,'        %i => real2stdlv(NbitW,%1.4f)',j-1, cell2mat(wbMat(k,1))(j,i));
      fprintf(fileid,'        %i => real2stdlv(NbitW,%1.4f)',j-1, cell2mat(wbMat(k,1))(j,i));
      if j != size(cell2mat(wbMat(k,1)),1)
      if j ~= size(cell2mat(wbMat(k,1)),1)
        fprintf(fileid,',\n');
        fprintf(fileid,',\n');
      else
      else
        fprintf(fileid,',\n        others =>(others => ''0'')\n');
        fprintf(fileid,',\n        others =>(others => ''0'')\n');
      end;
      end;
    end;
    end;
    if i != size(cell2mat(wbMat(k,1)),2)
    if i ~= size(cell2mat(wbMat(k,1)),2)
      fprintf(fileid,'      ),\n');
      fprintf(fileid,'      ),\n');
    else
    else
      fprintf(fileid,'      ),\n      others=>(others =>(others => ''0''))\n');
      fprintf(fileid,'      ),\n      others=>(others =>(others => ''0''))\n');
    end;
    end;
  end;
  end;
  if k != NLayers
  if k ~= NLayers
    fprintf(fileid,'    ),\n');
    fprintf(fileid,'    ),\n');
  else
  else
    fprintf(fileid,'    )\n');
    fprintf(fileid,'    )\n');
  end;
  end;
end;
end;
Line 59... Line 59...
fprintf(fileid,'  (\n');
fprintf(fileid,'  (\n');
for(k=1:NLayers)
for(k=1:NLayers)
  fprintf(fileid,'    %i => (\n',k-1);
  fprintf(fileid,'    %i => (\n',k-1);
  for(j=1:length(cell2mat(wbMat(k,2))))    % inputs
  for(j=1:length(cell2mat(wbMat(k,2))))    % inputs
    fprintf(fileid,'      %i => real2stdlv(NbitW,(2.0**LSB_OUT)*(%1.4f))',j-1, cell2mat(wbMat(k,2))(j));
    fprintf(fileid,'      %i => real2stdlv(NbitW,(2.0**LSB_OUT)*(%1.4f))',j-1, cell2mat(wbMat(k,2))(j));
    if j != length(cell2mat(wbMat(k,2)))
    if j ~= length(cell2mat(wbMat(k,2)))
      fprintf(fileid,',\n');
      fprintf(fileid,',\n');
    else
    else
      fprintf(fileid,',\n      others =>(others => ''0'')\n');
      fprintf(fileid,',\n      others =>(others => ''0'')\n');
    end;
    end;
  end;
  end;
  if k != NLayers
  if k ~= NLayers
    fprintf(fileid,'    ),\n');
    fprintf(fileid,'    ),\n');
  else
  else
    fprintf(fileid,'    )\n');
    fprintf(fileid,'    )\n');
  end;
  end;
end;
end;
fprintf(fileid,'  );\n');
fprintf(fileid,'  );\n');
 
 
 
 
% fprintf(fileid,'    constant b0_init : ramd_type0 :=\n');
 
% fprintf(fileid,'    (\n');
 
% for(i=1:length(nn_data.b1))
 
%     fprintf(fileid,'      %i => real2stdlv(NbitW,(2.0**LSB_OUT)*(%.4f))',i-1,nn_data.b1(i));
 
%     if i != length(nn_data.b1)
 
%       fprintf(fileid,',\n');
 
%     else
 
%       fprintf(fileid,'\n');
 
%     end;
 
 
 
% end;
 
% fprintf(fileid,'    );\n');
 
 
 
% fprintf(fileid,'    constant b1_init : ramd_type1 :=\n');
 
% fprintf(fileid,'    (\n');
 
% for(i=1:length(nn_data.b2))
 
%     fprintf(fileid,'      %i => real2stdlv(NbitW,(2.0**LSB_OUT)*(%.4f))',i-1,nn_data.b2(i));
 
%     if i != length(nn_data.b2)
 
%       fprintf(fileid,',\n');
 
%     else
 
%       fprintf(fileid,'\n');
 
%     end;
 
% end;
 
% fprintf(fileid,'    );\n');
 
 
 
% fprintf(fileid,'    constant b2_init : ramd_type2 :=\n');
 
% fprintf(fileid,'    (\n');
 
% for(i=1:length(nn_data.b3))
 
%     fprintf(fileid,'      %i => real2stdlv(NbitW,(2.0**LSB_OUT)*(%.4f))',i-1,nn_data.b3(i));
 
%     if i != length(nn_data.b3)
 
%       fprintf(fileid,',\n');
 
%     else
 
%       fprintf(fileid,'\n');
 
%     end;
 
% end;
 
% fprintf(fileid,'    );\n');
 
 
 
fprintf(fileid,'end wb_init;\n');
fprintf(fileid,'end wb_init;\n');
fclose(fileid);
fclose(fileid);
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2020 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.