R
Rick C
Guest
I use a generic to pass into the code a clock frequency as a real number in MHz. When an entity needs to measure time it can use that value to set clock counts. To make life simple (or maybe the opposite, not sure) I set a default for each entity...
ENTITY Spkr_Drvr IS
GENERIC (
CLK_MHZ : REAL := 16.000
);
port(
....
I don\'t recall what made me adopt this method. But I believe I encountered an instance where the generic was not passed in for whatever reason. I would expect that to be flagged as an error. But I expect it wasn\'t.
Anyway, I would expect a value passed into an entity to take the value passed in and over ride the default value in the generic declaration. Is that what will happen? I will have at least two levels of this. If the top level gets a different value passed into it during simulation or in synthesis, will the value passed in take precedence?
--
Rick C.
- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209
ENTITY Spkr_Drvr IS
GENERIC (
CLK_MHZ : REAL := 16.000
);
port(
....
I don\'t recall what made me adopt this method. But I believe I encountered an instance where the generic was not passed in for whatever reason. I would expect that to be flagged as an error. But I expect it wasn\'t.
Anyway, I would expect a value passed into an entity to take the value passed in and over ride the default value in the generic declaration. Is that what will happen? I will have at least two levels of this. If the top level gets a different value passed into it during simulation or in synthesis, will the value passed in take precedence?
--
Rick C.
- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209