Make declarations in the entity declarative part available in entity header and in the outside scope.
I (but from what I can see not only I) often have to create a package solely to declare types of the entity ports. This needs separate file, so there are entity.vhd
and entity_pkg.vhd
. I think that it would be more straightforward if types declared in the entity declarative part would be available in the entity header and in the outside scope.
Imagine this example works:
library ieee;
use ieee.std_logic_1164.all;
entity ent is
port (
clk_i : in std_logic;
d_i : my_type std_logic;
q_o : my_type std_logic
);
type my_type is record
a : std_logic;
b : std_logic;
end record;
end entity;
architecture rtl of ent is
begin
process (clk_i) is
begin
if rising_edge(clk_i) then
q_o.a <= d_i.a;
q_o.b <= d_i.b;
end if;
end process;
end architecture;
In the outter scope my_type
could be accessed like this: ent.my_type
.
The current order in the entity declaration is probably not optimal as it is:
generics
ports
declarations
and
generics
declarations
ports
would be more natural. However, this is a minor detail.
This is of course only a loose proposition. However, I find it really "clumsy" to have to write a package solely to define the type of ports of the entity.