B
Brian Drummond
Guest
I have traditionally used components rather than directly instantiating
entities, mostly out of habit, (or should I say, following established
precedent
But now that I actually try direct instantiation, I am finding
surprises...
Simple example below ... I am instantiating two entities A_comp and
B_comp from two component libraries A and B - one by component
instantiation, the other directly. (Each entity asserts on elaboration,
so that I can see it in synthesis or simulation)
A (the component) just works (in Modelsim Actel Edition, 6.6) though I
would have expected a Use clause or embedded configuration to be
required. The library clause alone is enough to find it.
Xilinx XST, alarmingly, doesn't even need that ! (Some magic in the
project files finds it instead)
B (the entity) can only be instantiated from library Work, not the
library it is supposed to be in (and for this exercise, it has been
compiled into both)
Modelsim reports : "Illegal expanded name prefix" at b
and "Cannot find expanded name b.b_comp" even though b_comp is in library
B, and it has no trouble finding a.a_comp.
Is this expected behaviour, that the only valid library for direct
instantiation is "work"? And if so, why? It doesn't seem normal for the
VHDL language to single out one specific library name like this...
- Brian
entity Toplevel is
end Toplevel;
library A;
library B;
--use A.all;
--use B.all;
architecture Behavioral of Toplevel is
component A_comp
end component;
begin
A : A_comp;
B : entity B.B_comp(Behavioral);
B2 : entity work.B_comp(Behavioral);
end Behavioral;
--------------------------
entity A_comp is
end A_comp;
architecture Behavioral of A_comp is
function AA return boolean is
begin
assert false report "AA called" severity warning;
return True;
end function AA;
constant AAA : boolean := AA;
begin
end Behavioral;
--------------------------
entity B_comp is
end B_comp;
architecture Behavioral of B_comp is
function BB return boolean is
begin
assert false report "BB called" severity warning;
return True;
end function BB;
constant BBB : boolean := BB;
begin
end Behavioral;
--------------------------
entities, mostly out of habit, (or should I say, following established
precedent
But now that I actually try direct instantiation, I am finding
surprises...
Simple example below ... I am instantiating two entities A_comp and
B_comp from two component libraries A and B - one by component
instantiation, the other directly. (Each entity asserts on elaboration,
so that I can see it in synthesis or simulation)
A (the component) just works (in Modelsim Actel Edition, 6.6) though I
would have expected a Use clause or embedded configuration to be
required. The library clause alone is enough to find it.
Xilinx XST, alarmingly, doesn't even need that ! (Some magic in the
project files finds it instead)
B (the entity) can only be instantiated from library Work, not the
library it is supposed to be in (and for this exercise, it has been
compiled into both)
Modelsim reports : "Illegal expanded name prefix" at b
and "Cannot find expanded name b.b_comp" even though b_comp is in library
B, and it has no trouble finding a.a_comp.
Is this expected behaviour, that the only valid library for direct
instantiation is "work"? And if so, why? It doesn't seem normal for the
VHDL language to single out one specific library name like this...
- Brian
entity Toplevel is
end Toplevel;
library A;
library B;
--use A.all;
--use B.all;
architecture Behavioral of Toplevel is
component A_comp
end component;
begin
A : A_comp;
B : entity B.B_comp(Behavioral);
B2 : entity work.B_comp(Behavioral);
end Behavioral;
--------------------------
entity A_comp is
end A_comp;
architecture Behavioral of A_comp is
function AA return boolean is
begin
assert false report "AA called" severity warning;
return True;
end function AA;
constant AAA : boolean := AA;
begin
end Behavioral;
--------------------------
entity B_comp is
end B_comp;
architecture Behavioral of B_comp is
function BB return boolean is
begin
assert false report "BB called" severity warning;
return True;
end function BB;
constant BBB : boolean := BB;
begin
end Behavioral;
--------------------------