How do I convert between enumeration and integer types for use with HDL Coder?
이전 댓글 표시
I am using enumerations in my model, and would like to generate HDL code. However, when I use a data type conversion block to convert between integer types and enumerations and try to generate HDL code, I get an error:
"Illegal conversion to/from an enumerated type in modelName/Data Type Conversion"
What is the recommended approach for converting between enums and integer types for HDL Coder?
채택된 답변
추가 답변 (1개)
Kiran Kintali
2021년 7월 9일
1 개 추천
Updated Answer (R2021a)
HDL Code Generation for Data Type Conversion block supports enumerated data types in R2021a release. See web(fullfile(docroot, 'hdlcoder/release-notes.html'))
You can now use enumerated signals at the ports of the Data Type Conversion block for HDL code generation. You can use the Data Type Conversion block to convert the enumeration data to integer or integer-to-enumeration data. Specify your enumerated data to your Data Type Conversion block.
See attached updated Example showing HDL friendly model.
카테고리
도움말 센터 및 File Exchange에서 External Component Interfaces에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!