Define global constant for HDL Coder

5 visualizzazioni (ultimi 30 giorni)
Pham Dang
Pham Dang il 18 Nov 2015
Risposto: Kiran Kintali il 1 Nov 2020
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 ?

Risposte (1)

Kiran Kintali
Kiran Kintali il 1 Nov 2020
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

Categorie

Scopri di più su Code Generation in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by