rourabpaul
Member level 3
I have googled with this topic but didnt get any ultimate solution. Can i declare a array as a port??
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
package my_types_pkg is
type array8 is array (natural range <>) of std_logic_vector(7 downto 0);
end package;
library work;
use work.my_types_pkg.all;
package my_types_pkg is
type array8 is array (natural range <>) of std_logic_vector(data_length downto 0);
end package;
use work.my_types_pkg.all;
Entity blk1 is
Generic (data_length := 18);
port(
......
);
End blk1;
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
PACKAGE heap_arr_pkg IS
type array_UI is array (natural range <>) of signed (17 downto 0);
END;
USE work.heap_arr_pkg.all;
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
ENTITY comp_heap IS
-- Declarations
GENERIC( data_width : positive := 18;
array_width: positive := 49;
cnt_width : positive := 15);
PORT(
clk : IN std_logic;
rst : IN std_logic;
en : IN std_logic;
addr : IN unsigned (15 downto 0);
heapout: OUT array_UI (array_width downto 0)
);
END comp_heap ;
Yes, and vhdl2008 also supports having types as generics. then UI can be std_logic/signed/unsigned/records/etc...