43 use IEEE.std_logic_1164.
all;
44 use IEEE.std_logic_unsigned.
all;
45 use IEEE.std_logic_arith.
all;
87 function fMax(L, R :
integer)
return integer is
96 function fMin(L, R :
integer)
return integer is
105 function fLog2(
val :
INTEGER)
return natural is
106 variable res : natural;
108 for i in 0 to 31 loop
109 if (val <= (2 ** i)) then
120 constant cRatio : integer := cMaxWidth / cMinWidth;
125 type tRAM is array (0 to cMaxSize - 1) of std_logic_vector(cMinWidth - 1 downto 0);
129 shared variable vRAM : tRAM := (others => (others => '0'));
131 signal sRAM_DataA : std_logic_vector(gDataWidth_A - 1 downto 0) := (others => '0');
132 signal sRAM_DataB : std_logic_vector(gDataWidth_B - 1 downto 0) := (others => '0');
133 signal sRAM_DataAReg : std_logic_vector(gDataWidth_A - 1 downto 0) := (others => '0');
134 signal sRAM_DataBReg : std_logic_vector(gDataWidth_B - 1 downto 0) := (others => '0');
143 if rising_edge(piClkA) then
144 if (piEnA = '1') then
145 sRAM_DataA <= vRAM(conv_integer(piAddrA));
158 if rising_edge(piClkB) then
159 for i in 0 to cRatio - 1 loop
160 if (piEnB = '1') then
161 sRAM_DataB((i + 1) * cMinWidth - 1 downto i * cMinWidth) <=
162 vRAM(conv_integer(piAddrB & conv_std_logic_vector(i, fLog2(cRatio))));
164 vRAM(conv_integer(piAddrB & conv_std_logic_vector(i, fLog2(cRatio)))) :=
165 piDataB((i + 1) * cMinWidth - 1 downto i * cMinWidth);
in piAddrAstd_logic_vector( gAddrWidth_A- 1 downto 0)
out poDataAstd_logic_vector( gDataWidth_A- 1 downto 0)
in piDataAstd_logic_vector( gDataWidth_A- 1 downto 0)
out poDataBstd_logic_vector( gDataWidth_B- 1 downto 0)
in piAddrBstd_logic_vector( gAddrWidth_B- 1 downto 0)
in piDataBstd_logic_vector( gDataWidth_B- 1 downto 0)