Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

generic default values in vhdl

Status
Not open for further replies.

Binome

Full Member level 3
Joined
Nov 16, 2009
Messages
152
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Location
Lyon, France
Activity points
2,405
Hi,
I'm working with someone that is used to use default values in entities with no "generic map" in modules instanciation.
I think this is a bad way of using the generics: you can't reuse the modules with other values and it's difficult to read.
What do you think?
 

Re: Using generics in VHDL modules

Would be a problem if the instantiation is the only available IP documentation. Hopefully it's not.

It's quite common that IP has optional ports and different modes that aren't utilized in a specific design. My preferred way is to omit all unused ports and generics for sake of code readability (as far as they have useful defaults). Both for vendor and own IP.
 

I'm working with someone that is used to use default values in entities with no "generic map" in modules instanciation.
I think this is a bad way of using the generics: you can't reuse the modules with other values and it's difficult to read.
What do you think?
Unless the generics of the lower level module are brought out as generics of the upper level module, the upper level won't be reusable anyway even if the lower level is instantiated with a 'generic map'.

However, if the only thing needed to make that upper level reusable is to add generics, than add the generics to the upper level module and the generic map at the time when you would like to reuse the module. Until the time that you have an actual need to reuse the upper level module, it doesn't really matter if the module doesn't instantiate lower level modules with generics or not.

Kevin Jennings
 

It depends on the situation:

1. You add a generic that wasn't there before
A default value is good. It should give the same behaviour as the old version without the generic, so you don't break old code that use the entity.

2. Generics with an obvious default value.
One example is a generic that is used in simulation to reduce the simulation time. Maybe by reducing delay times or similar.
The generic can have a default value set for synthesis.

3. Generics without an obvious default value.
One example is a generic to specify a bus width. A default value should be avoided.
This is done the wrong way in System Verilog interfaces. There you MUST have a default value.
 
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top