Z
zhangpei
I want to define a type related to entity generics, like an array in
the following codes. But It seems I have no places to put those
subtype/type statements in the entity. I can not use package to define
those subtype/type since there are related to entity generics.
Any solution or idea?
Thanks a lot,
Z
04/16/07
===============
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity ir is
-- Here is not correct
-- subtype MY_UNSIGNED is unsigned(EL_SIZE-1 downto 0);
-- type MY_UNSIGNED_VECTOR is array(natural range<>) of
MY_UNSIGNED;
generic (
EL_SIZE : POSITIVE := 16;
EL_COUNT : POSITIVE := 8
);
-- Here is not correct either
-- subtype MY_UNSIGNED is unsigned(EL_SIZE-1 downto 0);
-- type MY_UNSIGNED_VECTOR is array(natural range<>) of
MY_UNSIGNED;
port (
val_b : out MY_UNSIGNED_VECTOR (0 to EL_COUNT-1);
clk_i : in std_logic
...
);
end ir;
the following codes. But It seems I have no places to put those
subtype/type statements in the entity. I can not use package to define
those subtype/type since there are related to entity generics.
Any solution or idea?
Thanks a lot,
Z
04/16/07
===============
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity ir is
-- Here is not correct
-- subtype MY_UNSIGNED is unsigned(EL_SIZE-1 downto 0);
-- type MY_UNSIGNED_VECTOR is array(natural range<>) of
MY_UNSIGNED;
generic (
EL_SIZE : POSITIVE := 16;
EL_COUNT : POSITIVE := 8
);
-- Here is not correct either
-- subtype MY_UNSIGNED is unsigned(EL_SIZE-1 downto 0);
-- type MY_UNSIGNED_VECTOR is array(natural range<>) of
MY_UNSIGNED;
port (
val_b : out MY_UNSIGNED_VECTOR (0 to EL_COUNT-1);
clk_i : in std_logic
...
);
end ir;