hx_x的个人空间 https://blog.eetop.cn/1305415 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

MATLAB读取Xilinx ILA核保存的.ila文件中的两列数据,并输出到文件保存

已有 2947 次阅读| 2018-5-20 23:29 |系统分类:芯片设计


ILA是VIVADO下的一个DEBUG- IP,类似于片上逻辑分析仪,通过在RTL设计中嵌入ILA核,可以抓取信号的实时波形,帮助我们定位问题。

write_hw_ila_data -csv_file wave [current_hw_ila_data] 保存的.ila格式的包,解压后,数据在.csv文件中

%% Open the Text File for Reading
InputFile = 'waveform.csv';
fid = fopen(InputFile,'r');  % Open text file

C = textscan(fid,'%s','delimiter','\n','headerlines',1);
fclose(fid);
disp(C);       %{131072x1 cell}
len = length(C{1});

%% Fetch Data from ILA File
for k = 1:1:len
%     k
    lenofcell = length(C{1}{k});
%     disp(lenofcell);
%     disp(data(k));
%     disp(C{1}{k});
%     disp(C{1}{k}(1,lenofcell-8:lenofcell-3));
%     data(k) = hex2dec(C{1}{k}(1,lenofcell-8:lenofcell-3));
%     disp(data(k));
%     disp(dec2hex(data(k),6));

% Bit and operation to take the lowest bit of data
%     comp1(k) = bitand(data(k),a);

% bitshift(A,k) returns A shifted to the left by k bits,
% equivalent to multiplying by 2k.   
%     comp2(k) = bitand(bitshift(data(k),-1),a);

%     i = 1+floor(k/2);
    i = k;
   
%     disp(C{1}{k}(1,lenofcell-62));
%     class(C{1}{k}(1,lenofcell-64))
    comp1(i) = str2num(C{1}{k}(1,lenofcell-2));     % sdm_out1
%     disp(comp1(i));

%     disp(C{1}{k}(1,lenofcell-60));
    comp2(i) = str2num(C{1}{k}(1,lenofcell));     % sdm_out2   
%     disp(comp2(i));

end;


%% Output Data to File
OutputFile = strcat('SDM_OUT',InputFile(length(InputFile)-6:length(InputFile)-4));
fid = fopen(OutputFile,'wt');    %写入文件路径
m = N;
n = 2;
 for i=1:1:m
   for j=1:1:n
      if j==n
        fprintf(fid,'%g\n',comp2(i));
      else
        fprintf(fid,'%g\t',comp1(i));
      end
   end
end
fclose(fid);
% disp('OutputtoFile is over!');




点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 6

    获赞
  • 4

    评论
  • 1431

    访问数
关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-23 16:18 , Processed in 0.012985 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部