如何存储重复的输出函数(Matlab函数块仿真软件)?万博1manbetx

9的观点(30天)
我尝试自我引导实现硬件友好peak-finder教程。(//www.tianjin-qmedu.com/matlabcentral/fileexchange/69651-hdl-coder-self-guided-tutorial)
功能块需要11个样品,比较那些与中间试样如果他们更小,那么它就是一个当地的马克斯。
检测发现国旗上升时(发现= true),但它并不显示检测到的位置= true。
函数运行多次,直到输入不改变,只有一个峰值检测时间,。
我想找出这个峰值位置。
我实现了一个持久的计数器所以每次函数运行它增加了柜台的+ 1,这一次发现是正确的,这是位置(+ / -一个常数)。所以它的一个基本条件:
如果检测到= = true
peak_loc =计数器;
结束
问题是我需要分配函数输出(peak_loc)也在其他条件下,但这覆盖变量下一次函数运行时,因为之前的峰值检测函数运行。
有人可以帮忙吗?
(我的想法是将这些函数输出存储在一个数组,然后找到“真正”的位置,将峰值的位置,但还会有其他的问题条件)

接受的答案

Kiran Kintali
Kiran Kintali 2021年8月1日
编辑:Kiran Kintali 2021年8月1日
%硬件友好峰仪的实现
%
%函数输入:
% * WindowLen - non-tunable参数定义在模型- >编辑数据万博1manbetx
% * threhold -输入端口(连接到常数)
% * DataBuff -输入端口(缓冲使用仿真软件完成块)万博1manbetx
%
%输出函数:
% *“发现”设置当MidSample当地马克斯
% *”指数”64位的索引值,当检测到峰值的位置很高
函数(MidSample、检测、索引)= fcn (WindowLen、阈值、DataBuff)
% # codegen
持续的计数器;
如果isempty(柜台)
counter = uint64 (0);
结束
counter = counter + 1;
指数=计数器;
MidIdx =装天花板(WindowLen / 2);
%比较窗口中的每个值中间样品通过减法
MidSample = DataBuff (MidIdx);
CompareOut = DataBuff - MidSample;%这是一个向量
%如果所有值结果是负面的和中间的样品
%大于一个阈值,这是一个当地的马克斯
如果所有(CompareOut < = 0) & & (MidSample >阈值)
发现= true;
其他的
发现= false;
结束
2的评论

登录置评。

更多的答案(2)

Kiran Kintali
Kiran Kintali 2021年8月2日
编辑:Kiran Kintali 2021年8月2日
> > makehdl (“pulse_detector_v4_with_index /脉冲探测器”)
# # #生成高密度脂蛋白“pulse_detector_v4_with_index /脉冲探测器”。
# # #使用模型pulse_detector_v4_with_index HDL代码生成的配置设置参数。
# # #运行高密度脂蛋白检查模型“pulse_detector_v4_with_index”。
# # #开始模型的编译“pulse_detector_v4_with_index”
# # #应用高密度脂蛋白对模型优化“pulse_detector_v4_with_index”
# # #开始生成模型。
# # #模型一代完成。
# # #开始硬件描述语言(VHDL)代码生成“pulse_detector_v4_with_index”。
# # #工作pulse_detector_v4_with_index /脉冲探测器/计算能力hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ Compute_Power.vhd。
# # #工作pulse_detector_v4_with_index /脉冲探测器/地方/ MATLAB函数峰值hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ MATLAB_Function.vhd。
# # #工作pulse_detector_v4_with_index /脉冲探测器/当地峰hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ Local_Peak.vhd。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / FilterCoef hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterCoef.vhd。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / FilterCoef hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterCoef_block.vhd。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / FilterCoef hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterCoef_block1.vhd。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / subFilter / FilterTapSystolicWvldin hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterTapSystolicWvldin.vhd。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / subFilter hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ subFilter.vhd。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器优化高密度脂蛋白/ FilterBank hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterBank.vhd。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ Discrete_FIR_Filter_HDL_Optimized.vhd。
# # #工作在pulse_detector_v4_with_index /脉冲探测器hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ Pulse_Detector.vhd。
# # #生成包文件hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ Pulse_Detector_pkg.vhd。
# # #代码一代“pulse_detector_v4_with_index”完成。
# # #生成在pulse_detector_v4_with_index_codegen_rpt.html HTML文件代码生成报告
# # #创建Pulse_Detector_report.html HDL代码生成检查报告
# # #高密度脂蛋白检查“pulse_detector_v4_with_index”完成0错误,0警告,2消息。
# # #高密度脂蛋白代码生成完成。
> > makehdl (“pulse_detector_v4_with_index /脉冲探测器”,“targetlang”,“verilog”)
# # #生成高密度脂蛋白“pulse_detector_v4_with_index /脉冲探测器”。
# # #使用模型pulse_detector_v4_with_index HDL代码生成的配置设置参数。
# # #运行高密度脂蛋白检查模型“pulse_detector_v4_with_index”。
# # #开始模型的编译“pulse_detector_v4_with_index”
# # #开始生成模型。
# # #模型一代完成。
# # #开始Verilog代码生成“pulse_detector_v4_with_index”。
# # #工作pulse_detector_v4_with_index /脉冲探测器/计算能力hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ Compute_Power.v。
# # #工作pulse_detector_v4_with_index /脉冲探测器/地方/ MATLAB函数峰值hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ MATLAB_Function.v。
# # #工作pulse_detector_v4_with_index /脉冲探测器/当地峰hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ Local_Peak.v。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / FilterCoef hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterCoef.v。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / FilterCoef hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterCoef_block.v。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / FilterCoef hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterCoef_block1.v。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / subFilter / FilterTapSystolicWvldin hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterTapSystolicWvldin.v。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化/ FilterBank / subFilter hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ subFilter.v。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器优化高密度脂蛋白/ FilterBank hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ FilterBank.v。
# # #工作pulse_detector_v4_with_index /脉冲探测器/离散冷杉滤波器HDL优化hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ Discrete_FIR_Filter_HDL_Optimized.v。
# # #工作在pulse_detector_v4_with_index /脉冲探测器hdl_prj \ hdlsrc \ pulse_detector_v4_with_index \ Pulse_Detector.v。
# # #代码一代“pulse_detector_v4_with_index”完成。
# # #生成在pulse_detector_v4_with_index_codegen_rpt.html HTML文件代码生成报告
# # #创建Pulse_Detector_report.html HDL代码生成检查报告
# # #高密度脂蛋白检查“pulse_detector_v4_with_index”完成0错误,0警告,2消息。
# # #高密度脂蛋白代码生成完成。
> >
我没有看到错误w.r。代码生成器。你用的什么版本的MATLAB ?
你可以更新“发现”让其他中scenerios MATLAB代码中的逻辑。
是的,你应该能够合成此代码使用合成工具针对FPGA和ASIC。
5个评论
优素福Abdelsalam
优素福Abdelsalam 2021年8月3日
另一个问题:如果我使用FPGA数据捕获捕获数据从FPGA与DSP系统工具箱逻辑分析仪,我需要索引输出吗?与逻辑分析仪(因为我看到的地方 发现= 1 我手动定位)。

登录置评。


Kiran Kintali
Kiran Kintali 2021年8月3日
> >你有个主意如何检测多个山峰不只一个?
你可以考虑启用多个延迟级联的方式来存储更多的山峰?

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!