# 高层次综合

高层次综合（High-level synthesis，HLS）是一种方法，它把用 C、C++、SystemC 或 OpenCL 编写的、不带时序的行为描述，转换为用 Verilog、VHDL 或 SystemC 编写的、带时序的寄存器传输级（RTL）实现。<sup>[1](https://re.public.polimi.it/retrieve/e0c31c09-de59-4599-e053-1705fe0aef77/TCADHLSEVAL2016.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 输入 / 输出 | 输入 C、C++ 或 SystemC；输出 VHDL、Verilog 和 SystemC 形式的 RTL <sup>[2](https://www.xilinx.com/support/documents/sw_manuals/xilinx2020_1/ug902-vivado-high-level-synthesis.pdf)</sup><sup> • </sup><sup>[1](https://re.public.polimi.it/retrieve/e0c31c09-de59-4599-e053-1705fe0aef77/TCADHLSEVAL2016.pdf)</sup> |
| 核心任务 | 调度、资源分配、绑定与有限状态机控制提取 <sup>[3](https://janders.eecg.utoronto.ca/1387_2015/readings/hls.pdf)</sup> |
| 关键指标 | 延迟、启动间隔（II）、时钟频率、LUT/FF/DSP/BRAM 用量 <sup>[2](https://www.xilinx.com/support/documents/sw_manuals/xilinx2020_1/ug902-vivado-high-level-synthesis.pdf)</sup> |
| 结果质量与 RTL 对比 | RTL 质量平均仍更好；HLS 开发时间约为三分之一，生产率高出四倍以上 <sup>[4](https://doi.org/10.1109/tcad.2018.2834439)</sup> |
| 默认循环处理 | 循环保持不展开；迭代次数大于 64 的循环默认自动流水线化（可通过 syn.compile.pipeline_loops 配置）<sup>[2](https://www.xilinx.com/support/documents/sw_manuals/xilinx2020_1/ug902-vivado-high-level-synthesis.pdf)</sup><sup> • </sup><sup>[5](https://www.xilinx.com/support/documents/sw_manuals/xilinx2022_2/ug1399-vitis-hls.pdf)</sup> |
| 不可综合的 C 特性 | 动态分配（malloc）、递归、系统调用和汇编代码 <sup>[6](https://www.uio.no/studier/emner/matnat/ifi/IN5200/h26/timeplan/hls.pdf)</sup> |

## 工作原理

HLS 从抽象的行为规格出发，找出一个能实现给定行为的 RTL 结构。<sup>[7](https://doi.org/10.1109/5.52214)</sup> 编译过程依次经过数据流图分析、资源分配和调度；调度为设计引入时间，并根据目标时钟频率插入寄存器。<sup>[6](https://www.uio.no/studier/emner/matnat/ifi/IN5200/h26/timeplan/hls.pdf)</sup> 调度阶段根据依赖是否满足、时钟周期、操作在目标器件上的延迟、可用资源以及用户指令，确定每个时钟周期执行哪些操作。<sup>[8](https://docs.amd.com/r/en-US/ug1399-vitis-hls/Understanding-High-Level-Synthesis-Scheduling-and-Binding)</sup> 随后，绑定为每个已调度的操作分配硬件资源，把加法、乘法、移位等运算符映射到具体的 RTL 实现，并为数组变量分配存储器或寄存器；当共享同一资源的多个操作永远不会落在同一周期时，绑定可以共享该资源。<sup>[8](https://docs.amd.com/r/en-US/ug1399-vitis-hls/Understanding-High-Level-Synthesis-Scheduling-and-Binding)</sup> 控制逻辑提取会生成一个有限状态机（FSM），其状态称为控制步（c-step），用来对已调度的操作排序。<sup>[8](https://docs.amd.com/r/en-US/ug1399-vitis-hls/Understanding-High-Level-Synthesis-Scheduling-and-Binding)</sup><sup> • </sup><sup>[6](https://www.uio.no/studier/emner/matnat/ifi/IN5200/h26/timeplan/hls.pdf)</sup>

延迟是函数计算出全部输出值所需的时钟周期数；启动间隔（II）是函数能够接受新输入之前所经历的周期数。<sup>[2](https://www.xilinx.com/support/documents/sw_manuals/xilinx2020_1/ug902-vivado-high-level-synthesis.pdf)</sup> 对于流水线化的循环，总延迟 = 迭代延迟 + II ×（元素个数 − 1），因此改善 II 能改善总延迟，但不能改善迭代延迟。<sup>[5](https://www.xilinx.com/support/documents/sw_manuals/xilinx2022_2/ug1399-vitis-hls.pdf)</sup>

## 实现方式

一套典型的流程包含七个步骤：编译规格；分配硬件资源（功能单元、存储、总线）；把操作调度到时钟周期；把操作绑定到功能单元；把变量绑定到存储元件；把传输绑定到总线；生成 RTL 架构。<sup>[3](https://janders.eecg.utoronto.ca/1387_2015/readings/hls.pdf)</sup> 在实践中，设计者用 C/C++/SystemC 编写算法，进行行为级验证，针对给定的时钟速度和约束生成 RTL，验证 RTL，并从同一份源码出发探索不同的架构。<sup>[5](https://www.xilinx.com/support/documents/sw_manuals/xilinx2022_2/ug1399-vitis-hls.pdf)</sup> 必需的约束包括时钟周期、时钟不确定性（未指定时默认为时钟周期的 12.5%）以及 FPGA 目标器件。<sup>[2](https://www.xilinx.com/support/documents/sw_manuals/xilinx2020_1/ug902-vivado-high-level-synthesis.pdf)</sup> C 代码中的数组会综合成块 RAM、LUT RAM 或 UltraRAM，顶层的数组参数则成为外部块 RAM 的端口。<sup>[2](https://www.xilinx.com/support/documents/sw_manuals/xilinx2020_1/ug902-vivado-high-level-synthesis.pdf)</sup><sup> • </sup><sup>[5](https://www.xilinx.com/support/documents/sw_manuals/xilinx2022_2/ug1399-vitis-hls.pdf)</sup>

## 起源

从行为描述自动生成数据通路的设计方法源于 20 世纪 70 年代的研究：卡内基梅隆大学设计自动化系统（CMU Design Automation System）是爱丽丝·C·帕克（Alice C. Parker）及其同事所做自动数据通路设计的一个实例，于 1979 年在 KiltHub 仓库（KiltHub Repository）中报道。<sup>[9](https://doi.org/10.5555/800292.811694)</sup> H. 特里基（H. Trickey）于 1987 年在《IEEE 集成电路与系统计算机辅助设计汇刊》（IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems）上报道了高层次硬件编译器 Flamel，<sup>[10](https://doi.org/10.1109/tcad.1987.1270270)</sup> N. 帕克（N. Park）与爱丽丝·C·帕克于 1988 年在同一期刊上报道了从行为规格综合流水线的软件包 Sehwa。<sup>[11](https://doi.org/10.1109/43.3169)</sup> 麦克法兰（McFarland）、帕克和坎波萨诺（Camposano）于 1990 年在《IEEE 会刊》（Proceedings of the IEEE）上发表的综述，至今仍是该领域的权威定义。<sup>[7](https://doi.org/10.1109/5.52214)</sup> 比尔格·兰德维尔（Birger Landwehr）、彼得·马韦德尔（Peter Marwedel）和赖纳·德默（Rainer Dömer）（1994）提出的 OSCAR 把调度、分配和资源绑定统一表述为一个整数规划问题。<sup>[12](https://doi.org/10.5555/198174.198220)</sup> 菲利普·库西（Philippe Coussy）及其同事面向 DSP 应用的高层次综合工具 GAUT 于 2008 年问世。<sup>[13](https://doi.org/10.1007/978-1-4020-8588-8_9)</sup> 转向基于 C 语言的潮流，伴随着 SPARK 等工具而来——SPARK 接受 ANSI-C 并生成可综合的 RTL VHDL，<sup>[14](https://cecs.uci.edu/technical_report/TR02-35.pdf)</sup> 也伴随着 LegUp 而来——LegUp 接受标准 C 程序，并将其编译为 FPGA 软处理器/加速器混合架构。<sup>[15](https://dl.acm.org/doi/10.1145/2514740)</sup>

## 变体

一款构建在 LLVM 编译器基础设施之上的 HLS 工具以 Vivado HLS 之名销售，其最后一个官方版本为 2020.1，现由 Vitis HLS 接替。<sup>[36](https://docs.amd.com/r/en-US/ug1399-vitis-hls/Migrating-from-Vivado-HLS-to-Vitis-HLS)</sup><sup> • </sup><sup>[16](https://jasonlau.io/research-papers/10.1145-3530775.pdf)</sup> Altera 于 2013 年推出基于 OpenCL 的 HLS 工具 Altera SDK for OpenCL；后来的 Intel HLS Compiler 已停止（PDN2404，最后发货时间为 2025 年 10 月），由 Intel oneAPI DPC++/C++ 编译器的 FPGA 支持包取而代之。<sup>[16](https://jasonlau.io/research-papers/10.1145-3530775.pdf)</sup>

Bambu 接受标准 C/C++ 以及来自 Clang/LLVM 和 GCC 的中间表示，默认使用表调度（List scheduling），另有一个以整数线性规划形式构建的推测式 SDC 调度器，并通过在加权兼容图上做团覆盖（clique covering）来绑定模块。<sup>[17](https://re.public.polimi.it/bitstream/11311/1189606/1/dac21_bambu.pdf)</sup><sup> • </sup><sup>[18](https://hpc.pnl.gov/SODA/tutorials/2023/Bambu-pact23.pdf)</sup> Dynamatic 通过 LLVM 从 C/C++ 生成动态调度（弹性）的数据流电路，在内存与控制依赖难以消歧的内核上优于 Vivado HLS，代价是切片开销。<sup>[19](https://www.epfl.ch/labs/lap/wp-content/uploads/2018/11/JosipovicFeb18_DynamaticallyScheduledHighLevelSynthesis_FPGA18.pdf)</sup> 包括 Vivado HLS、LegUp 和 PandA 在内的大多数商业与学术工具，都依赖静态的编译期调度，通常采用模调度（modulo scheduling）来最小化循环 II。<sup>[20](https://dynamo.ethz.ch/wp-content/uploads/2022/11/Josipovic_TCAD22_FromCCCodeToHighPerformanceDataflowCircuits.pdf)</sup>

基于 MLIR 的流程增加了多级优化和自动化设计空间探索。ScaleHLS 是一个基于 MLIR 的端到端 HLS 流程，带有分层的 HLSCpp 方言、多级（图、循环、指令）优化、解析式 QoR 估算器，以及一个在延迟—面积权衡的帕累托前沿上搜索的 DSE 引擎。<sup>[21](https://par.nsf.gov/servlets/purl/10419993)</sup> Bambu 通过 LLVM 降级支持 MLIR 输入，<sup>[18](https://hpc.pnl.gov/SODA/tutorials/2023/Bambu-pact23.pdf)</sup> 其并行加速器产品线从面向图分析的 Svelto（2021）起步，经面向并行多线程加速器的 SPARTA（2024），发展到使用 [TensorFlow](https://www.edgepedia.org/zh/tensorflow) 2.15、MLIR 和 Clang 18 的端到端机器学习加速器流程。<sup>[22](https://doi.org/10.1109/tc.2021.3057860)</sup><sup> • </sup><sup>[23](https://doi.org/10.1145/3677035)</sup><sup> • </sup><sup>[24](https://doi.org/10.1109/tc.2022.3211430)</sup><sup> • </sup><sup>[25](https://panda.deib.polimi.it/wp-content/uploads/Intro-Bambu-ISCA-2025.pdf)</sup> SODA 工具链把 Python 桥接到硅片。<sup>[26](https://doi.org/10.1109/mm.2022.3178580)</sup>

由大语言模型（LLM）驱动的 HLS 出现得更晚。HLSPilot 通过运行时剖析、内核识别、代码生成、DSE 以及软硬件协同设计，从串行 C/C++ 生成并优化 HLS 代码，其检索策略构建在 Vitis HLS 文档之上。<sup>[27](https://arxiv.org/pdf/2408.06810)</sup> HLStrans 数据集提供了超过 12.4 万对带综合标注的 C 程序与 HLS 程序，使用 LLM、蒙特卡洛树搜索以及基于 NSGA-II 的 DSE 构建。<sup>[28](https://arxiv.org/pdf/2507.04315)</sup> 由卢卡·科利尼（Luca Collini）、悉达多·加尔格（Siddharth Garg）和拉梅什·卡里（Ramesh Karri）提出的 C2HLSC（ACM TODAES，2025）将 LLM 用于弥合 C 到 HLS 的转换鸿沟。<sup>[29](https://doi.org/10.1145/3734524)</sup>

## 应用

CHStone 包含 12 个程序（四个算术、四个媒体、三个密码学、一个处理器），采用受限的 C 语言子集，不含浮点、结构体、动态分配和递归。<sup>[30](https://www.jstage.jst.go.jp/article/ipsjjip/17/0/17_0_242/_pdf/-char/ja)</sup> MachSuite 提供 19 个基准测试，涵盖 12 个内核。<sup>[31](https://people.eecs.berkeley.edu/~ysshao/assets/papers/machsuite.pdf)</sup> Rosetta 增加了全应用级基准测试，如逻辑回归、神经网络推理、人脸检测和光流，并带有应用级约束。<sup>[32](https://hj424.github.io/papers/rosetta_fpga2018.pdf)</sup>

FINN 框架会自动生成带有 UNROLL 编译指示和 II = 1 的 HLS 代码，完全展开的量化网络每秒可超过 2 亿次推理，延迟在纳秒量级。<sup>[16](https://jasonlau.io/research-papers/10.1145-3530775.pdf)</sup> hls4ml 把来自 PyTorch、Keras 和 ONNX 的模型转换为面向 Vitis HLS、Intel oneAPI 和 Catapult 的 HLS 代码，用于 FPGA 和 ASIC 部署。<sup>[33](http://dl.acm.org/doi/10.1145/3801979)</sup> Bambu 支持来自 AMD/Xilinx、Intel/Altera、Lattice Semiconductor 和 NanoXplore 的 FPGA 器件，并与 OpenRoad 开源硅编译器集成以进行 ASIC 原型验证。<sup>[17](https://re.public.polimi.it/bitstream/11311/1189606/1/dac21_bambu.pdf)</sup>

## 局限与替代方案

[动态内存分配](https://www.edgepedia.org/zh/dynamic-memory-allocation)（malloc）、递归函数、系统调用和汇编代码不可综合；任意精度数据类型取代了固定的 CPU 寄存器位宽。<sup>[6](https://www.uio.no/studier/emner/matnat/ifi/IN5200/h26/timeplan/hls.pdf)</sup> HLS 之后的资源用量往往与经过底层 RTL 综合和工艺映射后的结果相差很大，这一问题在量化的低位宽深度神经网络（DNN）上更为突出。<sup>[16](https://jasonlau.io/research-papers/10.1145-3530775.pdf)</sup> 有些工具对输入限制更严：ROCCC 只允许对整数数组做固定步长的完全嵌套循环，而 Altera 的 C2H 生成的加速器只能通过 Avalon 总线与 NIOS II 软处理器通信。<sup>[1](https://re.public.polimi.it/retrieve/e0c31c09-de59-4599-e053-1705fe0aef77/TCADHLSEVAL2016.pdf)</sup>

综合报告会给出面积（LUT、寄存器、块 RAM、DSP48）、延迟和 II。<sup>[2](https://www.xilinx.com/support/documents/sw_manuals/xilinx2020_1/ug902-vivado-high-level-synthesis.pdf)</sup> 结果在很大程度上取决于控制数组（用 RAM 还是寄存器）、循环（展开、部分展开或不展开）和函数（内联或不内联）的编译指示。<sup>[34](https://ieeexplore.ieee.org/document/10181987)</sup> 调整代码和约束，相比默认流程平均可带来约 1.6–2 倍的提升。<sup>[1](https://re.public.polimi.it/retrieve/e0c31c09-de59-4599-e053-1705fe0aef77/TCADHLSEVAL2016.pdf)</sup> 在 DATE 2023 上研究的 8×8 逆离散余弦变换（inverse DCT）基准中，一键式 Vivado HLS 产生的吞吐量约为初始手写 Verilog 的十八分之一，但在修改代码并加上 PIPELINE 编译指示后，设计达到了 Verilog 性能的 116.1%，面积为后者的 129.5%。<sup>[35](https://past.date-conference.com/proceedings-archive/2023/DATA/566.pdf)</sup> 对于神经网络，HLS 已被证明能达到与手写 RTL 相当的性能。<sup>[33](http://dl.acm.org/doi/10.1145/3801979)</sup> 对 2010 年以来 46 篇论文和 118 个应用的综述得出结论：RTL 的 QoR 平均仍更好，而 HLS 的开发时间约为 RTL 流程的三分之一，生产率高出四倍以上，使 HLS 适用于快速原型设计和较短的产品上市周期。<sup>[4](https://doi.org/10.1109/tcad.2018.2834439)</sup>

## References

1. [A Survey and Evaluation of FPGA High-Level Synthesis Tools (Nane et al., IEEE TCAD 2016)](https://re.public.polimi.it/retrieve/e0c31c09-de59-4599-e053-1705fe0aef77/TCADHLSEVAL2016.pdf)
2. [Vivado Design Suite User Guide: High-Level Synthesis (UG902)](https://www.xilinx.com/support/documents/sw_manuals/xilinx2020_1/ug902-vivado-high-level-synthesis.pdf)
3. [High-Level Synthesis chapter (Coussy/Morawiec-era overview, IEEE Design & Test 2009 material)](https://janders.eecg.utoronto.ca/1387_2015/readings/hls.pdf)
4. [Are We There Yet? A Study on the State of High-Level Synthesis](https://doi.org/10.1109/tcad.2018.2834439)
5. [Vitis High-Level Synthesis User Guide (UG1399, 2022.2)](https://www.xilinx.com/support/documents/sw_manuals/xilinx2022_2/ug1399-vitis-hls.pdf)
6. [High level synthesis: From C to RTL (University of Oslo course notes, IN5200)](https://www.uio.no/studier/emner/matnat/ifi/IN5200/h26/timeplan/hls.pdf)
7. [The high-level synthesis of digital systems (McFarland, Parker, Camposano, Proceedings of the IEEE, 1990)](https://doi.org/10.1109/5.52214)
8. [Understanding High-Level Synthesis Scheduling and Binding, Vitis HLS User Guide UG1399 (2026.1)](https://docs.amd.com/r/en-US/ug1399-vitis-hls/Understanding-High-Level-Synthesis-Scheduling-and-Binding)
9. [Alice C. Parker and colleagues (1979). The CMU Design Automation System - An Example of Automated Data Path Design. KiltHub Repository.](https://doi.org/10.5555/800292.811694)
10. [H. Trickey (1987). Flamel: A High-Level Hardware Compiler. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems.](https://doi.org/10.1109/tcad.1987.1270270)
11. [N. Park, A.C. Parker (1988). Sehwa: a software package for synthesis of pipelines from behavioral specifications. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems.](https://doi.org/10.1109/43.3169)
12. [Birger Landwehr, Peter Marwedel, Rainer Dömer (1994). OSCAR: optimum simultaneous scheduling, allocation and resource binding based on integer programming. .](https://doi.org/10.5555/198174.198220)
13. [Philippe Coussy and colleagues (2008). GAUT: A High-Level Synthesis Tool for DSP Applications. .](https://doi.org/10.1007/978-1-4020-8588-8_9)
14. [Coordinated Parallelizing Compiler Optimizations and High-Level Synthesis (SPARK technical report, UC Irvine)](https://cecs.uci.edu/technical_report/TR02-35.pdf)
15. [LegUp: An open-source high-level synthesis tool for FPGA-based processor/accelerator systems (ACM TECS 2013)](https://dl.acm.org/doi/10.1145/2514740)
16. [FPGA HLS Today: Successes, Challenges, and Opportunities (ACM TRETS, DOI 10.1145/3530775)](https://jasonlau.io/research-papers/10.1145-3530775.pdf)
17. [Invited: Bambu: an Open-Source Research Framework for the High-Level Synthesis of Complex Applications (DAC 2021)](https://re.public.polimi.it/bitstream/11311/1189606/1/dac21_bambu.pdf)
18. [Bambu tutorial slides (PACT 2023)](https://hpc.pnl.gov/SODA/tutorials/2023/Bambu-pact23.pdf)
19. [Dynamically Scheduled High-level Synthesis (FPGA 2018)](https://www.epfl.ch/labs/lap/wp-content/uploads/2018/11/JosipovicFeb18_DynamaticallyScheduledHighLevelSynthesis_FPGA18.pdf)
20. [From C/C++ Code to High-Performance Dataflow Circuits (IEEE TCAD 2022)](https://dynamo.ethz.ch/wp-content/uploads/2022/11/Josipovic_TCAD22_FromCCCodeToHighPerformanceDataflowCircuits.pdf)
21. [ScaleHLS: A New Scalable High-Level Synthesis Framework on Multi-Level Intermediate Representation](https://par.nsf.gov/servlets/purl/10419993)
22. [Marco Minutoli and colleagues (2021). Svelto: High-Level Synthesis of Multi-Threaded Accelerators for Graph Analytics. IEEE Transactions on Computers.](https://doi.org/10.1109/tc.2021.3057860)
23. [Giovanni Gozzi and colleagues (2024). SPARTA: High-Level Synthesis of Parallel Multi-Threaded Accelerators. ACM Transactions on Reconfigurable Technology and Systems.](https://doi.org/10.1145/3677035)
24. [Serena Curzel and colleagues (2022). End-to-End Synthesis of Dynamically Controlled Machine Learning Accelerators. IEEE Transactions on Computers.](https://doi.org/10.1109/tc.2022.3211430)
25. [Intro Bambu tutorial (ISCA 2025)](https://panda.deib.polimi.it/wp-content/uploads/Intro-Bambu-ISCA-2025.pdf)
26. [Nicolas Bohm Agostini and colleagues (2022). Bridging Python to Silicon: The SODA Toolchain. IEEE Micro.](https://doi.org/10.1109/mm.2022.3178580)
27. [HLSPilot: LLM-based High-Level Synthesis Framework](https://arxiv.org/pdf/2408.06810)
28. [HLStrans: C-to-HLS benchmark dataset for LLM-driven synthesis](https://arxiv.org/pdf/2507.04315)
29. [Luca Collini, Siddharth Garg, Ramesh Karri (2025). C2HLSC: Leveraging Large Language Models to Bridge the Software-to-Hardware Design Gap. ACM Transactions on Design Automation of Electronic Systems.](https://doi.org/10.1145/3734524)
30. [CHStone: A Benchmark Program Suite for Practical C-based High-Level Synthesis](https://www.jstage.jst.go.jp/article/ipsjjip/17/0/17_0_242/_pdf/-char/ja)
31. [MachSuite: Benchmarks for Accelerator Design and Custom Architectures](https://people.eecs.berkeley.edu/~ysshao/assets/papers/machsuite.pdf)
32. [Rosetta: A Realistic High-Level Synthesis Benchmark Suite for Software Programmable FPGAs](https://hj424.github.io/papers/rosetta_fpga2018.pdf)
33. [hls4ml: A Flexible, Open Source Platform for Deep Learning Acceleration on Reconfigurable Hardware (ACM TRETS)](http://dl.acm.org/doi/10.1145/3801979)
34. [CERTIFY: AutomatiC MEasuRing The QualIty oF High-Level SYnthesis (ISCAS 2023)](https://ieeexplore.ieee.org/document/10181987)
35. [High-Level Synthesis versus Hardware Construction (DATE 2023)](https://past.date-conference.com/proceedings-archive/2023/DATA/566.pdf)
36. [Migrating from Vivado HLS to Vitis HLS (docs.amd.com)](https://docs.amd.com/r/en-US/ug1399-vitis-hls/Migrating-from-Vivado-HLS-to-Vitis-HLS)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 计算机硬件 › 嵌入式与软处理器 › 嵌入式系统 › 嵌入式硬件设计与片上系统

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/high-level-synthesis

English original: https://www.edgepedia.org/high-level-synthesis
