You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VHDL修改记录字段函数在Vivado 2020.2仿真中破坏未触碰字段问题

问题根因

这是Vivado 2020.2版本的已知VHDL综合bug,该版本对「记录类型数组在函数内的部分字段赋值」逻辑推导存在缺陷:即使你已经对局部变量v_dp做了完整的初始赋值,综合器依然会错误丢失未在循环内显式赋值的re、im字段的驱动逻辑,导致输出异常。该bug仅存在于2020.2版本,2020.1及2021.1之后的版本均已修复,和你的代码逻辑本身无关。

修复方案

方案1(推荐)

升级Vivado版本至2021.1及以上,直接规避版本缺陷。

方案2(兼容2020.2版本)

修改函数实现,在循环内显式保留re、im字段的赋值,强制综合器识别这两个字段的驱动逻辑:

FUNCTION func_dp_stream_arr_combine_data_info_ctrl(dp : t_fft_sosi_arr_out; info, ctrl : t_fft_sosi_out) RETURN t_fft_sosi_arr_out IS
VARIABLE v_dp : t_fft_sosi_arr_out(dp'RANGE) := dp;       -- hold sosi data
BEGIN
FOR I IN dp'RANGE LOOP
  -- 显式保留数据字段,修复综合bug
  v_dp(I).re := dp(I).re;
  v_dp(I).im := dp(I).im;
  -- set sosi info
  v_dp(I).bsn     := info.bsn;      
  v_dp(I).channel := info.channel;  
  v_dp(I).empty   := info.empty;    
  v_dp(I).err     := info.err;      
  -- set sosi ctrl
  v_dp(I).valid := ctrl.valid;
  v_dp(I).sop   := ctrl.sop;
  v_dp(I).eop   := ctrl.eop;
  v_dp(I).sync  := ctrl.sync;
END LOOP;
RETURN v_dp;
END func_dp_stream_arr_combine_data_info_ctrl;

方案3(临时规避)

将函数调用替换为generate循环实现相同逻辑,绕开函数内数组处理的缺陷:

gen_combine : for I in nxt_src_out_arr'RANGE generate
  nxt_src_out_arr(I).re      <= snk_in_arr(I).re;
  nxt_src_out_arr(I).im      <= snk_in_arr(I).im;
  nxt_src_out_arr(I).bsn     <= out_sosi.bsn;
  nxt_src_out_arr(I).channel <= out_sosi.channel;
  nxt_src_out_arr(I).empty   <= out_sosi.empty;
  nxt_src_out_arr(I).err     <= out_sosi.err;
  nxt_src_out_arr(I).valid   <= out_sosi.valid;
  nxt_src_out_arr(I).sop     <= out_sosi.sop;
  nxt_src_out_arr(I).eop     <= out_sosi.eop;
  nxt_src_out_arr(I).sync    <= out_sosi.sync;
end generate gen_combine;

内容的提问来源于stack exchange,提问作者Fo0ty

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.02 10:18:04