- Ratio and gain are set at synthesis time (simpler)
git-svn-id: http://moon:8086/svn/vhdl/trunk@176 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
+12
-32
@@ -33,10 +33,8 @@ ENTITY ddc IS
|
||||
lo_nbits_phase : integer := 20;
|
||||
lo_nbits_freq : integer := 20;
|
||||
cic_nstages : integer := 3;
|
||||
cic_max_ratio : integer := 4096;
|
||||
cic_max_diff_delay : integer := 2;
|
||||
cic_scale_nbits_min : integer := 9;
|
||||
cic_scale_nbits_max : integer := 32
|
||||
cic_ratio : integer := 64;
|
||||
cic_scale_nbits : integer := 18
|
||||
);
|
||||
PORT
|
||||
(
|
||||
@@ -46,9 +44,6 @@ ENTITY ddc IS
|
||||
lo_nco_en : in std_logic;
|
||||
lo_freq_in : in unsigned(lo_nbits_freq-1 downto 0);
|
||||
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_scale_nbits_max;
|
||||
din_i : in sfixed;
|
||||
din_q : in sfixed;
|
||||
dout_i : out sfixed;
|
||||
@@ -92,10 +87,8 @@ ARCHITECTURE behavior OF ddc IS
|
||||
GENERIC
|
||||
(
|
||||
nstages : integer;
|
||||
ratio_max : integer;
|
||||
scale_nbits_min : integer;
|
||||
scale_nbits_max : integer;
|
||||
max_diff_delay : integer;
|
||||
ratio : integer;
|
||||
scale_nbits : integer;
|
||||
in_width : integer;
|
||||
in_width_frac : integer;
|
||||
out_width : integer;
|
||||
@@ -106,9 +99,6 @@ ARCHITECTURE behavior OF ddc IS
|
||||
clk : in std_logic;
|
||||
rst : in std_logic;
|
||||
vld_in : in std_logic;
|
||||
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 scale_nbits_max;
|
||||
din : in sfixed;
|
||||
dout : out sfixed;
|
||||
vld_out : out std_logic
|
||||
@@ -122,8 +112,8 @@ ARCHITECTURE behavior OF ddc IS
|
||||
|
||||
constant cic_nbits_in : integer := lo_nbits_out;
|
||||
constant cic_nbits_in_frac : integer := lo_nbits_out_frac;
|
||||
constant cic_nbits_out : integer := nbits_out;
|
||||
constant cic_nbits_out_frac : integer := nbits_out_frac;
|
||||
constant cic_nbits_out : integer := nbits_out+1;
|
||||
constant cic_nbits_out_frac : integer := nbits_out_frac+1;
|
||||
|
||||
SIGNAL mix_dout_i : sfixed(shi(lo_nbits_out, lo_nbits_out_frac) downto slo(lo_nbits_out, lo_nbits_out_frac));
|
||||
SIGNAL mix_dout_q : sfixed(shi(lo_nbits_out, lo_nbits_out_frac) downto slo(lo_nbits_out, lo_nbits_out_frac));
|
||||
@@ -137,8 +127,8 @@ ARCHITECTURE behavior OF ddc IS
|
||||
BEGIN
|
||||
|
||||
dout_vld <= dec_dout_vld_i and dec_dout_vld_q;
|
||||
dout_i <= dec_dout_i;
|
||||
dout_q <= dec_dout_q;
|
||||
dout_i <= resize(dec_dout_i, shi(nbits_out, nbits_out_frac), slo(nbits_out, nbits_out_frac), fixed_wrap, fixed_round);
|
||||
dout_q <= resize(dec_dout_q, shi(nbits_out, nbits_out_frac), slo(nbits_out, nbits_out_frac), fixed_wrap, fixed_round);
|
||||
|
||||
-- Instantiate the Unit Under Test (UUT)
|
||||
inst_mixer: mix
|
||||
@@ -171,10 +161,8 @@ BEGIN
|
||||
GENERIC MAP
|
||||
(
|
||||
nstages => cic_nstages,
|
||||
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,
|
||||
ratio => cic_ratio,
|
||||
scale_nbits => cic_scale_nbits,
|
||||
in_width => cic_nbits_in,
|
||||
in_width_frac => cic_nbits_in_frac,
|
||||
out_width => cic_nbits_out,
|
||||
@@ -185,9 +173,6 @@ BEGIN
|
||||
clk => clk,
|
||||
rst => rst,
|
||||
vld_in => mix_dout_vld,
|
||||
ratio => cic_ratio,
|
||||
diff_delay => cic_diff_delay,
|
||||
shift_in => cic_shift_in,
|
||||
din => mix_dout_i,
|
||||
dout => dec_dout_i,
|
||||
vld_out => dec_dout_vld_i
|
||||
@@ -197,10 +182,8 @@ BEGIN
|
||||
GENERIC MAP
|
||||
(
|
||||
nstages => cic_nstages,
|
||||
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,
|
||||
ratio => cic_ratio,
|
||||
scale_nbits => cic_scale_nbits,
|
||||
in_width => cic_nbits_in,
|
||||
in_width_frac => cic_nbits_in_frac,
|
||||
out_width => cic_nbits_out,
|
||||
@@ -211,9 +194,6 @@ BEGIN
|
||||
clk => clk,
|
||||
rst => rst,
|
||||
vld_in => mix_dout_vld,
|
||||
ratio => cic_ratio,
|
||||
diff_delay => cic_diff_delay,
|
||||
shift_in => cic_shift_in,
|
||||
din => mix_dout_q,
|
||||
dout => dec_dout_q,
|
||||
vld_out => dec_dout_vld_q
|
||||
|
||||
Reference in New Issue
Block a user