G
gharaam
hello;
im asking when can i use generic
thanks
im asking when can i use generic
thanks
gharaam said:hello;
im asking when can i use generic
thanks
You use generics in an entity.
KJ
Andy said:To clarify, you declare generics on an entity (or component).
You can use generics anywhere you could use a deferred constant (i.e
they are not locally static)
You specify generic values either via the default value in the
declaration, or via the instantiation of the entity/component, or via
command line arguments for top-level generics.
Andy said:don't you have to have a "use <entity>" to specify a generic
map?
How do you specify a generic _on_ a configuration?
Andy said:Yes, that's the other use.
However, don't you have to have a "use <entity>" to specify a generic
map?
No.
How do you specify a generic _on_ a configuration?
Or am I just confused about what your configuration does?
(Entirely likely, since I
don't use them much anymore, in favor of entity instantiation and
generic records.)
I assume you are referring to my previous post. Due to the lack of any
quoting, it's not completely clear to me.
Like this:
CONFIGURATION tc_testcase_cfg OF tc IS
FOR testcase_arch
FOR testbench_i: testbench
USE CONFIGURATION tb_lib.testbench_cfg
GENERIC MAP
(
timebomb => 100 ms
);
END FOR;
END FOR;
END CONFIGURATION tc_testcase_cfg;
The code just as well could have read:
CONFIGURATION tc_testcase_cfg OF tc IS
FOR testcase_arch
FOR testbench_i: testbench
USE ENTITY tb_lib.testbench(tb_arch)
GENERIC MAP
(
timebomb => 100 ms
);
END FOR;
END FOR;
END CONFIGURATION tc_testcase_cfg;
The thing you miss then is the binding of the lower components of the
testbench.
What all configurations do: bind a component instantiation to a specific
entity/architecture pair.
If some joker (and that could well be me) adds another architecture to the
same entity, the last analyzed architecture is taken in the absence of a
configuration. With a configuration, such surprises are avoided. Granted: a
bit far fetched for most of us. But my reasoning is: if something can go
wrong, it will go wrong. Maybe not now, but perhaps later. Why not make
sure this cannot happen? And multiple architectures in an verification
environment are less seldom than in a design.
Configurations are only used by me in in testcases and testbenches, mainly
to pass generics and configure the testbench that way. And to make sure
what entity/architecture pairs are used.
Between entity instantiations, if-generates, and generics, I've
practically eliminated my use of configurations (as you can see, I'm a
little rusty!), and about the only time left that still I use a
component is when instantiating a primitive in the synthesis code.
Andy said:Thanks for the explanation. The syntax is confusing that the generic
map applies to testbench (the object that the configuration
configures), and not to the configuration itself (something inside
testbench). Now I understand.
I generally specify the architecture in the entity instantiation to
avoid the problems you mentioned regarding which architecture is bound
to an entity:
label: entity my_lib.my_entity(my_architecture)
Mike said:I'm not sure I do. Looks to me like
the base testbench entity is named tc
its architecture is testcase_arch
which instances another entity named testbench
which gets the 100 ms value,
Exactly.
if the library unit tc_testcase_cfg
is run instead of tc.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.