-- Package File Template
|
-- Package File Template
|
--
|
--
|
-- Purpose: This package defines supplemental types, subtypes,
|
-- Purpose: This package defines supplemental types, subtypes,
|
-- constants, and functions
|
-- constants, and functions
|
|
|
|
|
library IEEE;
|
library IEEE;
|
use IEEE.STD_LOGIC_1164.all;
|
use IEEE.STD_LOGIC_1164.all;
|
use IEEE.STD_LOGIC_ARITH.all;
|
use IEEE.STD_LOGIC_ARITH.all;
|
use IEEE.std_logic_unsigned.all;
|
use IEEE.std_logic_unsigned.all;
|
|
|
package outconverter is
|
package outconverter is
|
|
|
constant stage : natural := 3;
|
constant stage : natural := 3;
|
|
|
constant FFTDELAY:integer:=13+2*STAGE;
|
constant FFTDELAY:integer:=13+2*STAGE;
|
constant FACTORDELAY:integer:=6;
|
constant FACTORDELAY:integer:=6;
|
constant OUTDELAY:integer:=9;
|
constant OUTDELAY:integer:=9;
|
|
|
function counter2addr(
|
function counter2addr(
|
counter : std_logic_vector;
|
counter : std_logic_vector;
|
mask1:std_logic_vector;
|
mask1:std_logic_vector;
|
mask2:std_logic_vector
|
mask2:std_logic_vector
|
) return std_logic_vector;
|
) return std_logic_vector;
|
|
|
function outcounter2addr(counter : std_logic_vector) return std_logic_vector;
|
function outcounter2addr(counter : std_logic_vector) return std_logic_vector;
|
end outconverter;
|
end outconverter;
|
|
|
|
|
package body outconverter is
|
package body outconverter is
|
|
|
function counter2addr(
|
function counter2addr(
|
counter : std_logic_vector;
|
counter : std_logic_vector;
|
mask1:std_logic_vector;
|
mask1:std_logic_vector;
|
mask2:std_logic_vector
|
mask2:std_logic_vector
|
) return std_logic_vector is
|
) return std_logic_vector is
|
variable result :std_logic_vector(counter'range);
|
variable result :std_logic_vector(counter'range);
|
begin
|
begin
|
for n in mask1'range loop
|
for n in mask1'range loop
|
if mask1(n)='1' then
|
if mask1(n)='1' then
|
result( 2*n+1 downto 2*n ):=counter( 1 downto 0 );
|
result( 2*n+1 downto 2*n ):=counter( 1 downto 0 );
|
elsif mask2(n)='1' and n/=STAGE-1 then
|
elsif mask2(n)='1' and n/=STAGE-1 then
|
result( 2*n+1 downto 2*n ):=counter( 2*n+3 downto 2*n+2 );
|
result( 2*n+1 downto 2*n ):=counter( 2*n+3 downto 2*n+2 );
|
else
|
else
|
result( 2*n+1 downto 2*n ):=counter( 2*n+1 downto 2*n );
|
result( 2*n+1 downto 2*n ):=counter( 2*n+1 downto 2*n );
|
end if;
|
end if;
|
end loop;
|
end loop;
|
return result;
|
return result;
|
end counter2addr;
|
end counter2addr;
|
function outcounter2addr(counter : std_logic_vector) return std_logic_vector is
|
function outcounter2addr(counter : std_logic_vector) return std_logic_vector is
|
variable result :std_logic_vector(counter'range);
|
variable result :std_logic_vector(counter'range);
|
begin
|
begin
|
for n in 0 to STAGE-1 loop
|
for n in 0 to STAGE-1 loop
|
result( 2*n+1 downto 2*n ):=counter( counter'high-2*n downto counter'high-2*n-1 );
|
result( 2*n+1 downto 2*n ):=counter( counter'high-2*n downto counter'high-2*n-1 );
|
end loop;
|
end loop;
|
return result;
|
return result;
|
end outcounter2addr;
|
end outcounter2addr;
|
|
|
end outconverter;
|
end outconverter;
|
|
|