System Generator新手常见bug合集

本文作者近来从零开始学习使用System Generator进行信号处理,碍于网络上资源太少,遇到了大量bug,有些debug起来还算简单,有些确实难以处理,平白消耗了大量时间。故而记录在此。

本文面向纯粹的新手。本文会随时更新。

环境:22.1

在所有bug开始前,提示:

1、为了时序分析正常,模块的delay别全都弄成0或1!

2、觉得问题语焉不详,就去查看该模型所在路径下的“sysgen_error.log”文件,其中可能有更详细的问题描述。

一、Scope

1、问题:Scope不显示。

可能原因:检查仿真时间。新手会存在分不清仿真时间的问题,比如数据在from workspace模块是以采样率f_{s} ​​​​输入的,但是Gateway In里采样周期还是1,导致系统是以1Hz的仿真速度运行的,最终数据只有几个点是真正输入进来的。

2、问题:FFT后Scope不显示。

可能原因:仿真时间不够。FFT模块在接收N个数后才开始运算,过一段时间才能结束,然后逐个输出结果。根据FFT模块的运行方式(流水线、基2等等)可能会达到输入时间的数倍。

3、警告:Externally connected blocks are defined as blocks that directly drive Simulink/Non-SysGen blocks without going through a gateway. An example is the output port of a SysGen block connected to the input port of Simulink Scope. This feature will be removed in future releases of SysGen. The table below lists blocks with such connections. Modify the design by inserting gateway outs with 'Translate into output port' turned off. Also Sysgen blocks with ports which have Signal Logging turned on are classified as Externally connected blocks. For more details look into SysgenFeatureReport.htm. 

可能原因:Scope观察的那条线路没有与Gateway In/Out直接相连。一般不影响仿真结果。

二、Gatway In/Out

1、问题:The input ports on this block (Gateway In) must be driven by native simulink or non-Xilinx blocks.

可能原因:左侧没给输入或者左侧输入组件里没有正常运作。左侧输入可以不是Xilinx工具箱里的,最经典的是加from workspace,也可以加Simulink其他工具箱里的Step或者Chirp等等。如果采用from workspace的话,请严格检查输入信号的格式。

三、Fast Fourier Transformer

1、问题:The input ports on this block must be driven by other Xilinx blocks.

可能原因:这句话的本义是左侧输入端口没有用其他Xilinx模块全连接好。但是前面的模块出现问题,该模块没有输入,也可能会导致该问题。如果找不到问题,请去查看该模型所在路径下的“sysgen_error.log”文件,其中很可能有更详细的问题描述。

四、Delay

1、问题:This block contains internal state, but it is being driven only by constant signals. You must modify your design so that it is clear at what rate this block should be updated. You can do this by changing an upstream constant block to be a "sampled constant", or, if it is in a feedback loop, by adding an "Assert" block.

In the debugging of this problem, you may find it helpful to have the sample rates displayed on the Simulink diagram. This will happen if you open the System Generator block's dialog box, set its "Block Icon Display" control to "Sample Rates", and then update the diagram.

Error occurred during "Rate and Type Error Checking".

可能原因:如果Delay模块前面加了Constant块,而系统不确定该模块的采样周期,便会出现这种情况。有可能和(一)中提到的问题一样,还是仿真时间没设置好。可以将Constant块的采样常量选项选上,手动输入采样率。也有其他复杂情况,建议翻翻(三)中提到的“sysgen_error.log”文件。

五、Dual Port RAM

1、问题:Rates and types converged for the feedback path through these blocks. However, the solution contains unknowns.  Could not establish types for the blocks listed at the end of this message.

You may need to add an "Assert" block to instruct the system how to resolve rates and types.

Debugging can also be assisted by turning on the display of types, either by setting the Block Display control on the System Generator block or by turning on Simulink's "Format -> Signal Display -> Port Data Type" control.

可能原因:设计中有反馈路径,例如将双端口RAM的数据读出来与新进入的数据相加,再存入双端口RAM,读出和写入同时进行。系统判断不了这种路径里的速率或者数据类型,可以使用Assert提示程序,注意Assert只是“路牌”,不会改变设计。在路径里到处加上Assert,直到不再报错为止。

六、Convert

1、注意Convert和Reinterpret的区别。Convert会改动数据,例如Fix_20_0变成Fix_20_19,它会将整数部分全部截取掉;Reinterpret才能不改动原数据,随便切换小数点位置。

七、FIFO

1、问题:Specify output width option is available only for versal devices

Error occurred during "Rate and Type Error Checking".

可能原因:指定了输出位宽,但是非Versal设备不能指定输出位宽。其实FIFO的输出位宽和输入位宽匹配,如果不是特殊需要不要点指定输出位宽的选项。

八、Multipler

1、问题:整个电路不报错,但乘法器时序仿真始终不通过,表现为不管怎么改delay最终时序分析结果都很难变化,并且逻辑层级偏高;乱改一通让乘法器时序分析通过后,又会使FIFO或者双端RAM等时序不通过。

可能原因:不是乘法器的问题,比如你乘法器后面接了阶数相当高的滤波器,甚至几路滤波器并行滤波。如果是一个阶数相当高的滤波器,或许会在“sysgen_error.log”里报错称卷积核资源不足之类的错,如果是几路滤波器并行滤波,或许只会让时序分析不通过。如果你不确定是否是该问题,可以看看资源分析里dsp资源是否超标。如果连总的dsp资源都超标了,这个问题就更不必说了。

总结就是,超出了你所选择的板卡可同时调用的计算资源。改进方法有多利用Delay和FIFO等,让几路操作分时进行;降低数据位宽;降低滤波器阶数;修改FFT模块数据处理方式;或者直接选择一个资源更丰富的板卡。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值