- 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:
@@ -31,15 +31,13 @@ ENTITY tb_ddc IS
|
||||
(
|
||||
nbits_in : integer := 16;
|
||||
nbits_in_frac : integer := 14;
|
||||
nbits_out : integer := 18;
|
||||
nbits_out_frac : integer := 16;
|
||||
nbits_out : integer := 24;
|
||||
nbits_out_frac : integer := 22;
|
||||
lo_nbits_phase : integer := 20;
|
||||
lo_nbits_freq : integer := 20;
|
||||
cic_nstages : integer := 3;
|
||||
cic_max_ratio : integer := 4096;
|
||||
cic_max_diff_delay : integer := 1;
|
||||
cic_scale_nbits_min : integer := 9;
|
||||
cic_scale_nbits_max : integer := 32;
|
||||
cic_ratio : integer := 50;
|
||||
cic_scale_nbits : integer := 16;
|
||||
rfgen_nbits_phase : integer := 20;
|
||||
rfgen_nbits_freq : integer := 20
|
||||
);
|
||||
@@ -58,10 +56,8 @@ ARCHITECTURE behavior OF tb_ddc IS
|
||||
lo_nbits_phase : integer;
|
||||
lo_nbits_freq : integer;
|
||||
cic_nstages : integer;
|
||||
cic_max_ratio : integer;
|
||||
cic_max_diff_delay : integer;
|
||||
cic_scale_nbits_min : integer;
|
||||
cic_scale_nbits_max : integer
|
||||
cic_ratio : integer;
|
||||
cic_scale_nbits : integer
|
||||
);
|
||||
PORT
|
||||
(
|
||||
@@ -71,9 +67,6 @@ ARCHITECTURE behavior OF tb_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;
|
||||
@@ -131,9 +124,6 @@ ARCHITECTURE behavior OF tb_ddc IS
|
||||
SIGNAL ddc_nco_en : std_logic := '0';
|
||||
SIGNAL ddc_freq_in : unsigned(lo_nbits_freq-1 downto 0) := (others => '0');
|
||||
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-cic_scale_nbits_min;
|
||||
|
||||
--Outputs
|
||||
SIGNAL ddc_din_i : sfixed(shi(nbits_in, nbits_in_frac) downto slo(nbits_in, nbits_in_frac));
|
||||
@@ -188,10 +178,8 @@ BEGIN
|
||||
lo_nbits_phase => lo_nbits_phase,
|
||||
lo_nbits_freq => lo_nbits_freq,
|
||||
cic_nstages => cic_nstages,
|
||||
cic_max_ratio => cic_max_ratio,
|
||||
cic_max_diff_delay => cic_max_diff_delay,
|
||||
cic_scale_nbits_min => cic_scale_nbits_min,
|
||||
cic_scale_nbits_max => cic_scale_nbits_max
|
||||
cic_ratio => cic_ratio,
|
||||
cic_scale_nbits => cic_scale_nbits
|
||||
)
|
||||
PORT MAP
|
||||
(
|
||||
@@ -201,9 +189,6 @@ BEGIN
|
||||
lo_nco_en => ddc_nco_en,
|
||||
lo_freq_in => ddc_freq_in,
|
||||
lo_phase_in => ddc_phase_in,
|
||||
cic_ratio => ddc_ratio,
|
||||
cic_diff_delay => ddc_diff_delay,
|
||||
cic_shift_in => ddc_shift_in,
|
||||
din_i => ddc_din_i,
|
||||
din_q => ddc_din_q,
|
||||
dout_i => ddc_dout_i,
|
||||
@@ -310,7 +295,7 @@ BEGIN
|
||||
rfgen_q_out_f <= to_real(rfgen_dout_q);
|
||||
|
||||
tb : PROCESS
|
||||
file RESULT_FREQ: text open write_mode is "freq.txt";
|
||||
file RESULT_FREQ: text open write_mode is "ratio.txt";
|
||||
variable L: line;
|
||||
|
||||
BEGIN
|
||||
@@ -319,7 +304,7 @@ BEGIN
|
||||
wait for 4*PERIOD;
|
||||
rst <= '0';
|
||||
|
||||
fprint(RESULT_FREQ, L,"%s\n", REAL'image(flo));
|
||||
fprint(RESULT_FREQ, L,"%s\n", natural'image(cic_ratio));
|
||||
|
||||
wait for 2*PERIOD;
|
||||
-------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user