[an error occurred while processing this directive]
|
--библиотеки
library IEEE;
use ieee.std_logic_arith.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
.
.
.
-- женерики
.
.
ConstArrayWidth : natural := 10
;ConstArrayDepth : natural := 4
-- порты
.
.
OutConst : out std_logic_vector(ConstArrayWidth-1 downto 0)
;InputAddr : in std_logic_vector(1 downto 0)--или
-- ;InputAddr : in std_logic_vector(log2(ConstArrayDepth)-1 downto 0)--если имеется библиотека с функцией LOG2
--в разделе обьявлений
type TConstType is array (0 to ConstArrayDepth-1) of std_logic_vector(ConstArrayWidth-1 downto 0);
signal ConstErray : TConstType :=(
conv_std_logic_vector(1023,ConstArrayWidth)-- Const(0)
,conv_std_logic_vector(825,ConstArrayWidth) -- Const(1)
,conv_std_logic_vector(665,ConstArrayWidth) -- Conts(2)
,conv_std_logic_vector(536,ConstArrayWidth) -- Const(3)
);
attribute syn_ramstyle : string; -- for Synplify only
attribute syn_ramstyle of ConstArray : signal is "block_ram";
signal Addr : integer range 0 to ConstArrayDepth-1;
.
.
.
-- в разделе описания
Addr <= conv_integer(unsigned(InputAddr)); -- без такого Synplify не захочет в Xilinx BlockRam упаковывать
-- в Altera кажися проканает и без ентого
OutConst <= ConstArray(Addr);
E-mail: info@telesys.ru