Considering two cases:

  • Case 1: A top file where, depending on a parameter P, I make use of the generate statements to instantiate one of two possible architectures (of the same entity).

(Two architectures with one solution each)

  • Case 2: A top file where I instantiate one single entity E and pass it the parameter P. Thisentity E has generate statements to generate one of the two possible solutions depending on the value of parameter P.

(Only one architecture with two different solutions)

Both cases seem to be equal but I wonder which one is more correct or what happens under the hood? How does the build tool take it?

  • 1
    \$\begingroup\$ Have you heard about configurations? If yes, is there a reason you are not using these? \$\endgroup\$
    – DonFusili
    Commented Jul 23, 2019 at 12:11

1 Answer 1


It all comes down to the modularity and the reuse of your code. In the first case you decision is taken on the top file which in the future, in order for it to be modified, one must know the architectures of the instantiated entity and choose between them (note that in this case you are not limited just to two architecture but you can expand new architecture in the future). In the second case you are limited to max of two architecture but the top file needs to set one generic. In this case you cannot expand as easily as before, since you would need multiple generics for more architectures and usage of asserts to avoid more than one generic is set..., so i don't see it as a very good practice.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.