필터 지우기
필터 지우기

Generate C code for HLS?

조회 수: 5 (최근 30일)
MathWorks HDL Coder Team
MathWorks HDL Coder Team 2021년 2월 1일
편집: MathWorks HDL Coder Team 2022년 3월 21일
Can I generate C code from MATLAB and Simulink and then feed it into a high-level synthesis (HLS) tool to generate HDL?

채택된 답변

MathWorks HDL Coder Team
MathWorks HDL Coder Team 2021년 2월 1일
편집: MathWorks HDL Coder Team 2022년 3월 21일
While HLS does take C/C++ as an input, it typically requires some amount of hardware specification to successfully generate HDL. MATLAB Coder and Simulink Coder produce code intended for C/C++ compilers. So the code contains constructs that C/C++ compilers know how to implement in software but is too ambiguous for an HLS tool to automatically implement in fixed-resource hardware. Examples include unbounded loops, dynamically-sized arrays, dynamic memory allocation, pointers, and recursion.
Even in simpler cases where the generated C/C++ can run through HLS, it can be challenging for an HLS tool to generate efficient hardware without some amount of hardware specification. For instance whether a loop is completely unrolled into parallel hardware threads vs not unrolled to conserve hardware resources, or some balance of the two. Other examples include FIR filter architectures, complex multiplication implementations in FFTs, insertion of registers to break up long timing paths, and optimizing fixed-point data types for efficient resource usage.
Most HLS tools support SystemC® (IEEE Std. 1666™-2011) for adding these hardware constructs to C code in so you can simulate this functionality before running it through HLS. Some HLS tools let you describe hardware implementations as non-executable compiler directives, or “pragmas”, which results in this new functionality being added during HLS so simulation results often differ between pre- and post-HLS. But manually editing C/C++ generated from Simulink or MATLAB introduces manual coding error risks and guarantees that the functionality will differ from what you simulated in MATLAB or Simulink.
(Update March 2022) Starting with R2022a, you can generate synthesizable SystemC code from streaming MATLAB algorithms https://www.mathworks.com/help/hdlcoder/systemc-code-generation-from-matlab.html

추가 답변 (1개)

Kiran Kintali
Kiran Kintali 2022년 3월 21일
SystemC Code Generation from MATLAB
Generate Synthesizable SystemC Code from MATLAB® algorithms for use with Cadence Stratus HLS Workflows

카테고리

Help CenterFile Exchange에서 Code Generation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by