Generic port length when integrating existing HDL code with Simulink model using BlackBox

8 views (last 30 days)
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

Kiran Kintali
Kiran Kintali on 1 May 2021
The problem was reproduced and reported to the development team.
HDL Coder currently supports value generics (generic values that can be specificed and used as gain and constant values). HDL Coder does not support generics to be used to customize input and output types of a VHDL entity or Verilog module.
This limitation pertains to blackbox GenericList parameter and mask parameter as generics feature during HDL Code generation.
We are hoping to enhance the product and address this limtiation in HDL Coder in the upcoming releases.
  2 Comments
Lars Willeboordse
Lars Willeboordse on 19 Aug 2021
Edited: Lars Willeboordse on 19 Aug 2021
Hi Kiran,
I'm running into the same issue. Is there by any chance any update on this matter? maybe a timeframe for implementation?
additionally i would like to point out that it seems that passing strings in that same GenericList does not seem to be supported. Simply put it is missing the "" characters after rtl generation.
Best regards lars
Uday Kumar Gutta
Uday Kumar Gutta on 23 Aug 2021
Hi Lars,
We are actively working in this area; As of now, using generics to specify port length is only supported for RAM instantiations. we would like to connect with you on the usecases. Can you reach out to local support team at MathWorks and connect with us in the development team about next steps?
Thanks

Sign in to comment.

More Answers (1)

Kiran Kintali
Kiran Kintali on 18 Jan 2020
Have you used the GenericList parameter in HDLCoder?
Thanks
bbox_interface.png
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
Erdinc Atilgan
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
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.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!