- moved common functions to fixed_util_pkg
git-svn-id: http://moon:8086/svn/vhdl/trunk@160 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -4,6 +4,7 @@ use IEEE.STD_LOGIC_1164.ALL;
|
|||||||
use ieee.numeric_std.all;
|
use ieee.numeric_std.all;
|
||||||
use IEEE.MATH_REAL.ALL;
|
use IEEE.MATH_REAL.ALL;
|
||||||
use work.fixed_pkg.all;
|
use work.fixed_pkg.all;
|
||||||
|
use work.fixed_util_pkg.all;
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
package nco_pkg is
|
package nco_pkg is
|
||||||
@@ -11,9 +12,9 @@ package nco_pkg is
|
|||||||
constant tpd : time := 0 ns;
|
constant tpd : time := 0 ns;
|
||||||
|
|
||||||
-- Global set arithmetic rounding mode
|
-- Global set arithmetic rounding mode
|
||||||
constant pi : real := 3.141592653589793e+000;
|
-- constant pi : real := 3.141592653589793e+000;
|
||||||
constant sqrt2 : real := 1.414213562373095e+000;
|
-- constant sqrt2 : real := 1.414213562373095e+000;
|
||||||
constant sqrt2_inv : real := 7.071067811865475e-001;
|
-- constant sqrt2_inv : real := 7.071067811865475e-001;
|
||||||
|
|
||||||
type real_array_t is array (natural range <>) of real;
|
type real_array_t is array (natural range <>) of real;
|
||||||
type natural_array_t is array (natural range <>) of natural;
|
type natural_array_t is array (natural range <>) of natural;
|
||||||
@@ -27,13 +28,6 @@ package nco_pkg is
|
|||||||
q_d : real;
|
q_d : real;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type debug_mix_out_t is record
|
|
||||||
i_in : real;
|
|
||||||
q_in : real;
|
|
||||||
i_out : real;
|
|
||||||
q_out : real;
|
|
||||||
end record;
|
|
||||||
|
|
||||||
constant lfsr_poly : natural_array_t(3 to 24) :=
|
constant lfsr_poly : natural_array_t(3 to 24) :=
|
||||||
(
|
(
|
||||||
12, -- 3
|
12, -- 3
|
||||||
@@ -66,10 +60,10 @@ package nco_pkg is
|
|||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
-- Constructor helpers
|
-- Constructor helpers
|
||||||
-- Use: variable v8u6 : ufixed_t(ufixed(8,6)'range);
|
-- Use: variable v8u6 : ufixed_t(ufixed(8,6)'range);
|
||||||
function uproto (nbits : integer; nbits_frac : integer) return ufixed;
|
-- function uproto (nbits : integer; nbits_frac : integer) return ufixed;
|
||||||
|
|
||||||
-- Use: variable v8s6 : sfixed_t(sfixed(8,6)'range);
|
-- Use: variable v8s6 : sfixed_t(sfixed(8,6)'range);
|
||||||
function sproto (nbits : integer; nbits_frac : integer) return sfixed;
|
-- function sproto (nbits : integer; nbits_frac : integer) return sfixed;
|
||||||
|
|
||||||
end; -- package nco_pkg;
|
end; -- package nco_pkg;
|
||||||
|
|
||||||
@@ -107,18 +101,18 @@ package body nco_pkg is
|
|||||||
|
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
-- Constuctor helpers
|
-- Constuctor helpers
|
||||||
function uproto (nbits : integer; nbits_frac : integer) return ufixed is
|
-- function uproto (nbits : integer; nbits_frac : integer) return ufixed is
|
||||||
constant result : ufixed (nbits-nbits_frac-1 downto -nbits_frac) := (others => '0');
|
-- constant result : ufixed (nbits-nbits_frac-1 downto -nbits_frac) := (others => '0');
|
||||||
begin
|
-- begin
|
||||||
return result(nbits-nbits_frac-1 downto -nbits_frac);
|
-- return result(nbits-nbits_frac-1 downto -nbits_frac);
|
||||||
end uproto;
|
-- end uproto;
|
||||||
|
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
function sproto (nbits : integer; nbits_frac : integer) return sfixed is
|
-- function sproto (nbits : integer; nbits_frac : integer) return sfixed is
|
||||||
constant result : sfixed (nbits-nbits_frac downto -nbits_frac+1) := (others => '0');
|
-- constant result : sfixed (nbits-nbits_frac downto -nbits_frac+1) := (others => '0');
|
||||||
begin
|
-- begin
|
||||||
return result(nbits-nbits_frac downto -nbits_frac+1);
|
-- return result(nbits-nbits_frac downto -nbits_frac+1);
|
||||||
end sproto;
|
-- end sproto;
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
end; -- package nco_pkg;
|
end; -- package nco_pkg;
|
||||||
|
|||||||
Reference in New Issue
Block a user