Compile-time constants for HDL Coder

2 ビュー (過去 30 日間)
Anze Slosar
Anze Slosar 2022 年 8 月 31 日
回答済み: Seth Furman 2022 年 9 月 3 日
I want to know what is the right way to implement compile time constants into code that will eventually be compiled into VHDL.
I'm talking the equivalent of #define statements in C.
So far I found three possible answers:
  1. Pass everything as parameter
  2. Use global variables
  3. Use dedicated functions that just return the number.
Numbers 1 and 2 are not good, becuase compiler does not know it in advance and cannot e.g unfold loops if the number is e.g. always 2. I think 3 suffers from the same problem and coder already complained about "variable sizes", where the size is not really variable in reality.
Basically we're coding a digital filter that has some internal settings like FFT sizes and number of taps, etc. These will be FROZEN when thing is compiled for the final time, but in the mean time we want to experiment with different settings.
What is the way to do this?
(I know I can write a quick preprocessor in a more modern language, but I would rather not do this unless necessary).

採用された回答

Seth Furman
Seth Furman 2022 年 9 月 3 日

その他の回答 (0 件)

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by