HDL Code Generation of a system that includes Model References results in the generated code for the referenced model having its name (entity) duplicated.
4 views (last 30 days)
Show older comments
James Price
on 10 Jan 2019
Commented: Sreejith Menon
on 14 Jan 2019
If I have a referenced model (e.g. adder) within a design (e.g. DUT); when I generate the code for DUT it contains the expected component instantion in DUT VHDL e.g. u_adder : adder however the generated VHDLfor the adder component is incorrectly named adder_adder.vhd with an enity name adder_adder therefore there is a mismatch in simulation/synthesis.
If you generate the code for adder standalone it will generate the correct filename adder.vhd with enitty name adder.
Please explain how you can generate VHDL code for designs that contain referenced models.
0 Comments
Accepted Answer
Sreejith Menon
on 11 Jan 2019
Hi James,
HDL Coder adds a prefix for the referenced model in the generated code. The default value of that prefix is the modelname_, where ‘modelname’ is the name of the referenced model. This is the reason for the adder_adder.vhd in your design.
You can always control the prefix using the HDL Block Property - ReferenceModelPrefix. (Right click on the referenced model > HDL Code > HDL Block Properties). If you provide an empty prefix, HDL Coder will not add a prefix to the submodel file name and you will get ‘adder.vhd’ with entity name ‘adder’. But if there are any name collisions between the different models that you use, this can result in compilation errors.
regards,
Sreejith
2 Comments
Sreejith Menon
on 14 Jan 2019
Hi James,
The default value is set to modelnameto avoid any name collisions. But you can easily change it to empty prefix using a simple script. ‘find_system’ will help you to find the ModelReference blocks in your design. You can use hdlset_param to set the value of 'ReferenceModelPrefix' to any prefix value. Please refer to our document if you have any doubts.
regards,
Sreejith
More Answers (0)
See Also
Categories
Find more on Speed Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!