Generic port length when integrating existing HDL code with Simulink model using BlackBox
Show older comments
When I integrate existing HDL code with Simulink model (as Black Box), how can I create a component declaration with generic ports length?
For example:
component my_component
generic(GENERIC_OUTPUT_LENGTH: natural := 8)
port (
A, B: in STD_LOGIC;
F : out STD_LOGIC_VECTOR(GENERIC_OUTPUT_LENGTH - 1 downto 0));
end component;
When i use the HDL coder to generate a VHDL code, (GENERIC_OUTPUT_LENGTH - 1 ) is replaced with the specific output port length. However bacuse I use 2 different instantiation (with different ports length) of the same block - the generated code require some correction before it can be synthesized.
Accepted Answer
More Answers (1)
Kiran Kintali
on 18 Jan 2020
0 votes
Have you used the GenericList parameter in HDLCoder?
Thanks

GenericList
Pass a cell array variable that contains cell arrays each with two or three strings, or enter a cell array of cell arrays that each contain two or three strings. The strings represent the name, value, and optional data type of a VHDL generic or Verilog parameter. The default data type is integer.
Default: none
Specifies a list of VHDL generic or Verilog parameter name-value pairs, each with an optional data type specification, to pass to a subsystem with a BlackBox implementation.
For example, in the HDL Block Properties dialog box, enter {'name','value','type'}, or, if the data type is integer, enter {'name','value'}.
To set GenericList using hdlset_param, at the command line, enter:
hdlset_param (blockname,'GenericList','{''name'',''value'',''type''}');
If the data type is integer, at the command line, enter:
hdlset_param (blockname,'GenericList','{''name'',''value''}');
4 Comments
evyatar d
on 20 Jan 2020
Moved: Stefanie Schwarz
on 31 May 2023
Kiran Kintali
on 20 Jan 2020
Moved: Stefanie Schwarz
on 31 May 2023
Can you share a model to describe your usecase? please also attach generated code and expected code with the blackbox settings used in the model.
Erdinc Atilgan
on 1 May 2021
Moved: Stefanie Schwarz
on 31 May 2023
Actually, the problem has been stated quite clearly. Despite this, I think the things are made difficult by you. You did not make any effort to create the problem mentioned, dear Kiran. The problem mentioned by evyatar is actually a serious problem. However, as staff, you did not understand the problem, and we will be waiting for a solution. I ran into the same problem and, like evyatar, I wrote a code that fixes the code created by HDL Coder. Could it be a more logical solution for us customers, dear Kiran, to direct the matter to someone who has a better understanding of the subject?
Kiran Kintali
on 31 May 2023
Hi Erdinc, If you have already tried the GenericList parameter and it did not meet your requirements, can you reach out to MathWorks tech support for additional support specific to your usecase? Thanks.
Categories
Find more on External Component Interfaces in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!