Files
bowei ea4541ee90 sync: SHANGHAI-U9 2026-07-27 三个 Simulink→RTL skill 转系统级 + 新增 simulink-rtl-redev
- simulink_rtl_dev / rtl-ip-replace: 从工程级 .claude/skills 迁到用户级并去工程耦合
  (模型名/Notes 文档依赖/工程实测基线移出; addpath 与脚本路径改用户级)
- rtl-ip-replace/scripts/gen_cmp_tb.py: Vivado 路径不再写死, 改读 VIVADO_PATH /
  XILINX_VIVADO (兼容 install root / bin / bin\vivado.bat 三种写法), 回落时提示
  去设 skills_env.md 的 VIVADO_PATH
- simulink-rtl-redev: 新增。原生模型改动后的仿真模型同步规范, 含两个实测过的工具
  check_sync.py (三条时序链新鲜度闸门) 与 measure_k.m (时域/频域/包络三估计器互证)
- sim-rtl-flow/SKILL.md: 加入 sync_sim:* 步骤, 引用上述三个 skill
2026-07-27 10:39:53 +08:00

51 lines
2.0 KiB
Matlab

function hits = hdl_block_search(varargin)
%HDL_BLOCK_SEARCH Find a native, RTL-generatable Simulink block (Task12-1 rule 1).
%
% hdl_block_search list every block in the HDL Coder library
% hdl_block_search('ram') blocks whose name matches a keyword
% hdl_block_search('sin','cos') several keywords (OR)
%
% Source of truth is the HDL Coder block library (hdlsllib) plus the HDL
% Optimized blocks of DSP HDL / Wireless HDL / Vision HDL: anything in there
% generates RTL directly, so it is a legal building block. Anything NOT in
% there needs checkhdl before you rely on it.
% Sub-libraries are listed individually: the top-level DSP HDL library holds
% links, which find_system will not walk into.
libs = {'hdlsllib', ... % HDL Coder baseline set
'dsphdlfiltering2', 'dsphdlmathfun2', ... % FIR/CIC/LMS/Biquad, CORDIC
'dsphdlxfrm2', 'dsphdlsigops2', 'dsphdlsrcs2', ...% FFT/IFFT, Farrow/NCO/resample
'whdllib', 'visionhdllib'};
hits = {};
for i = 1:numel(libs)
try
load_system(libs{i});
catch
continue
end
blks = find_system(libs{i}, 'SearchDepth', 5, 'Type', 'Block');
for k = 1:numel(blks)
nm = strrep(get_param(blks{k}, 'Name'), newline, ' ');
if isempty(varargin) || any(cellfun(@(p) ~isempty(regexpi(nm, p, 'once')), varargin))
hits{end+1, 1} = nm; %#ok<AGROW>
hits{end, 2} = blks{k}; %#ok<AGROW>
end
end
end
if isempty(hits)
fprintf(['no HDL library block matches %s\n' ...
'-> if you cannot build it from these blocks, rule 2 applies: name the Xilinx IP\n' ...
' that will implement it, prove the swap cycle-true, and file the exemption.\n'], ...
strjoin(varargin, ', '));
return
end
[~, ia] = unique(hits(:, 1));
hits = hits(sort(ia), :);
fprintf('%d HDL-generatable block(s):\n', size(hits, 1));
for k = 1:size(hits, 1)
fprintf(' %-42s %s\n', hits{k, 1}, hits{k, 2});
end
end