1.Restructured skills: Consolidated skills with the same attributes into single skills, creating two distinct categories—relatively fixed skills and skills requiring maintenance. 2.Merged memory system contents into corresponding skills: Ensured that memory serves only as a record of the source/origin of skill rules, rather than storing the rules themselves. 3.Updated CLAUDE.md and README.md files
1.Restructured skills: Consolidated skills with the same attributes into single skills, creating two distinct categories—relatively fixed skills and skills requiring maintenance.
2.Merged memory system contents into corresponding skills: Ensured that memory serves only as a record of the source/origin of skill rules, rather than storing the rules themselves.
3.Updated CLAUDE.md and README.md files
FT-M7004 DSP 高性能算子 LASM 代码生成工具
将 C/C++/Python 算法描述转换为 FT-M7004 DSP 的 LASM 线性汇编代码,自动优化流水线调度。
用户输入 系统输出 ──────── ─────── C算子API/需求描述 .la 源代码 ↓ ↓ Claude Code 处理 lasm.exe 编译 (ft7004-lasm skill) ↓ ↓ .asm 汇编文件 9步强制流程: ↓ Step 0 触发判断 dspsim.exe 仿真 Step 0→1 前置确认 ↓ Step 1 算法分析 仿真结果 Step 2 决策匹配+库函数 Step 3 详细查阅指令 Step 4 编写LASM代码 Step 4.5 易错指令检查 Step 5 覆盖审计 Step 6 尾数处理 Step 7 编译验证
向 Claude Code 描述算子需求时,请提供:
请生成一个 [算子名] 算子: - 功能:[计算公式,如 Y[i] = alpha * X[i] + Y[i]] - 参数:[C函数签名,如 void axpy(float *Y, float *X, float alpha, int N)] - 数据位置:[AM空间 / DDR空间需DMA搬运] - 数据对齐:[16字节对齐] - 是否需要尾数处理:[N不保证32倍数]
用户需自行管理空间使用,向量计算不能访问越界:
0x10000000
0x20000000
0x81000000
关键规则:向量ldst指令只能访问AM空间,DDR数据必须先通过DMA搬运到AM。
autolasm/ ├── CLAUDE.md # 项目配置(Claude Code) ├── README.md # 本文件 ├── Business_Requirements.md # 业务需求 ├── 7004_LASM/LASM_20250714/ # LASM 工具链 │ ├── bin/lasm.exe # 线性汇编器 │ ├── bin/dspsim.exe # DSP仿真器 │ ├── bin/layout.json # 内存布局配置 │ ├── doc/ # 用户手册PDF │ └── sample/ # 工具链示例 ├── lib/ # 库函数 │ ├── math.la # 数学库(sdiv, sqrt, sin等) │ └── csl.la # 系统控制库(DMA, 核配置等) ├── .claude/skills/ft7004-lasm/ # LASM Skill文档 │ ├── skill.yaml # Workflow定义 │ ├── entry.md # 快速入口 │ ├── fixed/ # 固定规则层 │ │ ├── architecture.md # 架构约束(地址空间/寄存器/参数对) │ │ ├── decision-guide.md # 指令决策(4层15章) │ │ ├── programming-guide.md # 编程指南(LASM语法/模式) │ │ └── usage-checklist.md # 易错检查清单 │ ├── maintainable/ # 可维护规则层 │ │ ├── operator-interface.md # 算子接口模板 │ │ └── library-verification.md # 库函数+编译验证 │ ├── FT-M7004V_DSP_INST.md # 完整指令集参考 │ └── templates/ # 代码模板(vadd/vsub/vscal/dot等)
# 在.la文件所在目录执行 cd <.la文件目录> ../../7004_LASM/LASM_20250714/bin/lasm.exe <input>.la \ --layout ../../7004_LASM/LASM_20250714/bin/layout.json \ --output <input>.asm
cd 7004_LASM/LASM_20250714 ./bin/dspsim.exe output.asm
sdiv
@icall sdiv, a, b, = q, r
vfdivs32
@icall vfdivs32, vr_a, vr_b, = vr_c
vfsqrts32
@icall vfsqrts32, vr_a, = vr_res
vreduc16_sum_fp32
@icall vreduc16_sum_fp32, vr_a, = sum
get_am_addr
@icall get_am_addr, = am_l, am_h
Sync_DMA_Trans
@icall Sync_DMA_Trans, src_l, src_h, dst_l, dst_h, size, tunnel
sys_bar
@icall sys_bar, id, num
SMOVIL 3, R0; SMVCGC R0, CVCCR; SNOP 5
MIT
让AI agent和大模型自动将高级语言生成7004线性汇编代码,以提高DSP代码性能、简化程序员对线性汇编和汇编编程的学习成本,使DSP编程变得更简单。
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
AutoLasm
FT-M7004 DSP 高性能算子 LASM 代码生成工具
将 C/C++/Python 算法描述转换为 FT-M7004 DSP 的 LASM 线性汇编代码,自动优化流水线调度。
工作流程
用户输入格式
向 Claude Code 描述算子需求时,请提供:
地址空间约束
用户需自行管理空间使用,向量计算不能访问越界:
0x100000000x200000000x81000000关键规则:向量ldst指令只能访问AM空间,DDR数据必须先通过DMA搬运到AM。
项目结构
编译与验证
编译
仿真
Skill 文档体系
库函数
math.la — 数学库
sdiv@icall sdiv, a, b, = q, rvfdivs32@icall vfdivs32, vr_a, vr_b, = vr_cvfsqrts32@icall vfsqrts32, vr_a, = vr_resvreduc16_sum_fp32@icall vreduc16_sum_fp32, vr_a, = sumcsl.la — 系统控制库
get_am_addr@icall get_am_addr, = am_l, am_hSync_DMA_Trans@icall Sync_DMA_Trans, src_l, src_h, dst_l, dst_h, size, tunnelsys_bar@icall sys_bar, id, num关键约束
SMOVIL 3, R0; SMVCGC R0, CVCCR; SNOP 5License
MIT