Define global constant for HDL Coder

조회 수: 5 (최근 30일)
Pham Dang
Pham Dang 2015년 11월 18일
답변: Kiran Kintali 2020년 11월 1일
Hi, I use the HDL Coder Toolbox to generate Verilog code from my Matlab code.
I would like to use a global constant variable in my Matlab code in order to hardcode some values some specific global parameters. I know Verilog has a `define directive for global constant definition but the HDL Coder Toolbox does not allow the use of global statement in Matlab code.
Let's say my Matlab source code is :
global NROW_MATLAB_CODE ;
NROW_MATLAB_CODE = 31 ;
for kRow=1:NROW_MATLAB_CODE
% Process
end
Any idea of how to tell HDL Coder to insert a specific code line like `define NROW 5'd31 and make it use the string NROW wherever the variable NROW_MATLAB_CODE is used ?

답변 (1개)

Kiran Kintali
Kiran Kintali 2020년 11월 1일
Globals are not currently supported in HDL Coder. Use persistent variables instead.
Also see this example on how to
>> mlhdlc_demo_setup('comms_data_packet')
% Key design pattern covered in this example:
  1. Design illustrates the us of binary operands, such as bitxor
  2. Shows how to properly segment persistent variables for register an BRAM access
  3. Illustrates the use of fi math
  4. Shows how to properly format and store ROM data, e.g., padData
  5. Loading external data in the test bench

카테고리

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