- uses ieee_proposed.fixed_pkg

- din scaled to more fraction precision at integrator input.
  Number of integer bits are the same as din
- min_gain intrduced (reduces complexity of barrel shifter).
 Din always constant scaled by min_gain.


git-svn-id: http://moon:8086/svn/vhdl/trunk@172 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2008-12-30 06:03:56 +00:00
parent 75f8ddd340
commit 61d5c40cd2
5 changed files with 119 additions and 94 deletions
+18 -15
View File
@@ -16,8 +16,11 @@ use IEEE.STD_LOGIC_1164.ALL;
use IEEE.MATH_REAL.ALL;
USE ieee.numeric_std.ALL;
library ieee_proposed;
use ieee_proposed.math_utility_pkg.all;
use ieee_proposed.fixed_pkg.all;
library work;
use work.fixed_pkg.all;
use work.fixed_util_pkg.all;
ENTITY ddc IS
@@ -32,8 +35,8 @@ ENTITY ddc IS
cic_nstages : integer := 3;
cic_max_ratio : integer := 4096;
cic_max_diff_delay : integer := 2;
cic_max_width : integer := 32;
cic_max_width_frac : integer := 20
cic_scale_nbits_min : integer := 9;
cic_scale_nbits_max : integer := 32
);
PORT
(
@@ -45,7 +48,7 @@ ENTITY ddc IS
lo_phase_in : in unsigned(lo_nbits_phase-1 downto 0);
cic_ratio : in natural range 1 to cic_max_ratio;
cic_diff_delay : in natural range 1 to cic_max_diff_delay;
cic_shift_in : in natural range 0 to cic_max_width-1;
cic_shift_in : in natural range 0 to cic_scale_nbits_max;
din_i : in sfixed;
din_q : in sfixed;
dout_i : out sfixed;
@@ -89,10 +92,10 @@ ARCHITECTURE behavior OF ddc IS
GENERIC
(
nstages : integer;
max_ratio : integer;
ratio_max : integer;
scale_nbits_min : integer;
scale_nbits_max : integer;
max_diff_delay : integer;
max_width : integer;
max_width_frac : integer;
in_width : integer;
in_width_frac : integer;
out_width : integer;
@@ -103,9 +106,9 @@ ARCHITECTURE behavior OF ddc IS
clk : in std_logic;
rst : in std_logic;
vld_in : in std_logic;
ratio : in natural range 1 to max_ratio;
ratio : in natural range 1 to ratio_max;
diff_delay : in natural range 1 to max_diff_delay;
shift_in : in natural range 0 to max_width-1;
shift_in : in natural range 0 to scale_nbits_max;
din : in sfixed;
dout : out sfixed;
vld_out : out std_logic
@@ -168,10 +171,10 @@ BEGIN
GENERIC MAP
(
nstages => cic_nstages,
max_ratio => cic_max_ratio,
ratio_max => cic_max_ratio,
scale_nbits_min => cic_scale_nbits_min,
scale_nbits_max => cic_scale_nbits_max,
max_diff_delay => cic_max_diff_delay,
max_width => cic_max_width,
max_width_frac => cic_max_width_frac,
in_width => cic_nbits_in,
in_width_frac => cic_nbits_in_frac,
out_width => cic_nbits_out,
@@ -194,10 +197,10 @@ BEGIN
GENERIC MAP
(
nstages => cic_nstages,
max_ratio => cic_max_ratio,
ratio_max => cic_max_ratio,
scale_nbits_min => cic_scale_nbits_min,
scale_nbits_max => cic_scale_nbits_max,
max_diff_delay => cic_max_diff_delay,
max_width => cic_max_width,
max_width_frac => cic_max_width_frac,
in_width => cic_nbits_in,
in_width_frac => cic_nbits_in_frac,
out_width => cic_nbits_out,
+12 -9
View File
@@ -16,8 +16,11 @@ use IEEE.STD_LOGIC_1164.ALL;
use IEEE.MATH_REAL.ALL;
USE ieee.numeric_std.ALL;
library ieee_proposed;
use ieee_proposed.math_utility_pkg.all;
use ieee_proposed.fixed_pkg.all;
library work;
use work.fixed_pkg.all;
use work.fixed_util_pkg.all;
use work.cordic_pkg.all;
@@ -33,8 +36,8 @@ use work.cordic_pkg.all;
cic_nstages : integer := 3;
cic_max_ratio : integer := 1024;
cic_max_diff_delay : integer := 2;
cic_max_width : integer := 48;
cic_max_width_frac : integer := 16
cic_scale_nbits_min : integer := 9;
cic_scale_nbits_max : integer := 32
);
PORT
(
@@ -46,7 +49,7 @@ use work.cordic_pkg.all;
lo_phase_in : in unsigned(lo_nbits_phase-1 downto 0);
cic_ratio : in natural range 1 to cic_max_ratio;
cic_diff_delay : in natural range 1 to cic_max_diff_delay;
cic_shift_in : in natural range 0 to cic_max_width-1;
cic_shift_in : in natural range 0 to cic_scale_nbits_max;
din_i : in signed(nbits_in-1 downto 0);
din_q : in signed(nbits_in-1 downto 0);
dout_i : out signed(nbits_out-1 downto 0);
@@ -71,8 +74,8 @@ ARCHITECTURE behavior OF syn_ddc IS
cic_nstages : integer;
cic_max_ratio : integer;
cic_max_diff_delay : integer;
cic_max_width : integer;
cic_max_width_frac : integer
cic_scale_nbits_min : integer;
cic_scale_nbits_max : integer
);
PORT
(
@@ -84,7 +87,7 @@ ARCHITECTURE behavior OF syn_ddc IS
lo_phase_in : in unsigned(lo_nbits_phase-1 downto 0);
cic_ratio : in natural range 1 to cic_max_ratio;
cic_diff_delay : in natural range 1 to cic_max_diff_delay;
cic_shift_in : in natural range 0 to cic_max_width-1;
cic_shift_in : in natural range 0 to cic_scale_nbits_max;
din_i : in sfixed;
din_q : in sfixed;
dout_i : out sfixed;
@@ -115,8 +118,8 @@ BEGIN
cic_nstages => cic_nstages,
cic_max_ratio => cic_max_ratio,
cic_max_diff_delay => cic_max_diff_delay,
cic_max_width => cic_max_width,
cic_max_width_frac => cic_max_width_frac
cic_scale_nbits_min => cic_scale_nbits_min,
cic_scale_nbits_max => cic_scale_nbits_max
)
PORT MAP
(
+12 -9
View File
@@ -17,8 +17,11 @@ use IEEE.MATH_REAL.ALL;
USE ieee.numeric_std.ALL;
use std.textio.all; -- Imports the standard textio package.
library ieee_proposed;
use ieee_proposed.math_utility_pkg.all;
use ieee_proposed.fixed_pkg.all;
library work;
use work.fixed_pkg.all;
use work.fixed_util_pkg.all;
use work.cordic_pkg.all;
use work.PCK_FIO.all;
@@ -35,8 +38,8 @@ ENTITY tb_ddc IS
cic_nstages : integer := 3;
cic_max_ratio : integer := 4096;
cic_max_diff_delay : integer := 1;
cic_max_width : integer := 36;
cic_max_width_frac : integer := 16;
cic_scale_nbits_min : integer := 9;
cic_scale_nbits_max : integer := 32;
rfgen_nbits_phase : integer := 20;
rfgen_nbits_freq : integer := 20
);
@@ -57,8 +60,8 @@ ARCHITECTURE behavior OF tb_ddc IS
cic_nstages : integer;
cic_max_ratio : integer;
cic_max_diff_delay : integer;
cic_max_width : integer;
cic_max_width_frac : integer
cic_scale_nbits_min : integer;
cic_scale_nbits_max : integer
);
PORT
(
@@ -70,7 +73,7 @@ ARCHITECTURE behavior OF tb_ddc IS
lo_phase_in : in unsigned(lo_nbits_phase-1 downto 0);
cic_ratio : in natural range 1 to cic_max_ratio;
cic_diff_delay : in natural range 1 to cic_max_diff_delay;
cic_shift_in : in natural range 0 to cic_max_width-1;
cic_shift_in : in natural range 0 to cic_scale_nbits_max;
din_i : in sfixed;
din_q : in sfixed;
dout_i : out sfixed;
@@ -130,7 +133,7 @@ ARCHITECTURE behavior OF tb_ddc IS
SIGNAL ddc_phase_in : unsigned(lo_nbits_phase-1 downto 0) := (others => '0');
SIGNAL ddc_diff_delay : natural := 1;
SIGNAL ddc_ratio : natural := 64;
SIGNAL ddc_shift_in : natural := 18;
SIGNAL ddc_shift_in : natural := 18-cic_scale_nbits_min;
--Outputs
SIGNAL ddc_din_i : sfixed(shi(nbits_in, nbits_in_frac) downto slo(nbits_in, nbits_in_frac));
@@ -187,8 +190,8 @@ BEGIN
cic_nstages => cic_nstages,
cic_max_ratio => cic_max_ratio,
cic_max_diff_delay => cic_max_diff_delay,
cic_max_width => cic_max_width,
cic_max_width_frac => cic_max_width_frac
cic_scale_nbits_min => cic_scale_nbits_min,
cic_scale_nbits_max => cic_scale_nbits_max
)
PORT MAP
(