aobosong
Newbie level 5
Hello all.
This is my first VHDL design. I am running two separate ADPLLs, referenced to one reference.
The idea is that one ADPLL will generate a sine and cosine signal phase locked to the reference signal at the same frequency and the other PLL will generate waves at twice the frequency.
I synthesized the design and run it on Altium Nanoboard3000 (Xilinx Spartan 3A) with only one ADPLL running, both performed okay on their own.
However, when I combine them, the first one generates the correct frequency (same as the reference) but the second ADPLL generated a higher frequency than it should be :/
This is my first VHDL design. I am running two separate ADPLLs, referenced to one reference.
The idea is that one ADPLL will generate a sine and cosine signal phase locked to the reference signal at the same frequency and the other PLL will generate waves at twice the frequency.
I synthesized the design and run it on Altium Nanoboard3000 (Xilinx Spartan 3A) with only one ADPLL running, both performed okay on their own.
However, when I combine them, the first one generates the correct frequency (same as the reference) but the second ADPLL generated a higher frequency than it should be :/
Code:
--------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity adplls is
port
(
-- Basic Ports
clock : in std_logic; -- 100MHz clock to control PLLs and DCOs
adc_clock : in std_logic; -- the calcuations can only be done as fast the ADC is read into the device
reset : in std_logic; -- reset channel
ref_in : in std_logic; -- reference signal used in external reference set up
-- DCO 1 output signals for debug
dco1_sync_out : out std_logic; -- DCO1's sync output signal
dco1_freq : out std_logic_vector(29 downto 0); -- DCO1 frequency tuning word
-- DCO 2 output signals for debug
dco2_sync_out : out std_logic; -- DCO2's sync output signal
dco2_ndiv_out : out std_logic; -- Divided down DCO2's sync signal (N divider output)
dco2_freq : out std_logic_vector(29 downto 0); -- DCO2 frequency tuning word
);
End adplls;
------------------------------------------------------------
------------------------------------------------------------
architecture structure of adplls is
signal this_pll1_freq_tune : std_logic_vector(29 downto 0); -- frequency tuning word generated by PLL1
signal this_pll2_freq_tune : std_logic_vector(29 downto 0); -- frequency tuning word generated by PLL2
signal this_sig_in : std_logic_vector(17 downto 0); -- signal input
signal this_dco1_sin_out : std_logic_vector(17 downto 0); -- DCO1's sine signal output
signal this_dco1_cos_out : std_logic_vector(17 downto 0); -- DCO1's cosine signal output
signal this_dco1_sync_out : std_logic; -- DCO1's sync out signal
signal this_dco2_sin_out : std_logic_vector(17 downto 0); -- DCO2's sine signal output
signal this_dco2_cos_out : std_logic_vector(17 downto 0); -- DCO2's cosine signal output
signal this_dco2_sync_out : std_logic; -- DCO2's sync out signal
signal this_ndiv2_out : std_logic; -- n divider output signal
-- ADPLL
component all_digital_pll
port
(
clock : in std_logic; -- ADPLL Clock, nominally 100 MHz
reset : in std_logic; -- reset signal
ref_in : in std_logic; -- Reference signal input
sync_in : in std_logic; -- DCO sync signal input
freq : out std_logic_vector(29 downto 0) -- Frequency tuning word output
);
end component;
-- DCO
component digitally_controlled_oscillator
port
(
clock : in std_logic; -- DCO Clock, nominally 100 MHz
reset : in std_logic; -- DCO reset signal
freq_tune : in std_logic_vector(29 downto 0); -- frequency tuning word input
sync_output : out std_logic; -- sync output
sigout_I : out std_logic_vector(17 downto 0); -- in phase signal output
sigout_Q : out std_logic_vector(17 downto 0); -- quadrature signal output
);
end component;
-- N Divider
component n_divider
generic
(
N : integer := 2
);
port
(
clock : in std_logic; -- input signal
reset : in std_logic; -- reset signal
div_clkout : out std_logic -- divided output
);
end component;
begin
-------------------------------------
-- Channel 1 Instantiations
-------------------------------------
-- All digital phase lock loop
CHAN1_ADPLL : all_digital_pll
port map
(
clock => clock, -- 100 MHz clock
reset => reset, -- global reset
ref_in => ref_in, -- reference input signal
sync_in => this_dco1_sync_out, -- channel 1 is the fundamental channel, i.e. no n divider
-- the dco sync output goes directly into the PLL
freq => this_pll1_freq_tune -- output tuning word
);
-- Digitally Controlled Oscillators
CHAN1_DCO : digitally_controlled_oscillator
port map
(
clock => clock, -- 100 MHz clock
reset => reset, -- global reset
freq_tune => this_pll1_freq_tune , -- frequency tuning word input
sync_output => this_dco1_sync_out, -- DCO sync output
sigout_I => this_dco1_sin_out, -- DCO sine signal output
sigout_Q => this_dco1_cos_out -- DCO cosing signal output
);
-------------------------------------
-- Channel 2 Instantiations
-------------------------------------
-- All digital phase lock loop
CHAN2_ADPLL : all_digital_pll
port map
(
clock => clock, -- 100 MHz clock
reset => reset, -- global reset
ref_in => ref_in, -- reference input signal
sync_in => this_ndiv2_out, -- channel 2 is the 2nd harmonics channel, need a n divider
freq => this_pll2_freq_tune -- output tuning word
);
-- Digitally Controlled Oscillators
CHAN2_DCO : digitally_controlled_oscillator
port map
(
clock => clock, -- 100 MHz clock
reset => reset, -- global reset
freq_tune => this_pll2_freq_tune, -- frequency tuning word input
sync_output => this_dco2_sync_out, -- DCO sync output
sigout_I => this_dco2_sin_out, -- DCO sine signal output
sigout_Q => this_dco2_cos_out -- DCO cosing signal output
);
-- Channel 2 N divider
CHAN2_N_DIVIDER : n_divider
generic map
(
N => 2 -- N = 2
)
port map
(
clock => this_dco2_sync_out,
reset => reset,
div_clkout => this_ndiv2_out
);
dco1_sync_out <= this_dco1_sync_out;
dco2_sync_out <= this_dco2_sync_out;
dco2_ndiv_out <= this_ndiv2_out;
dco1_freq <= this_dco1_freq_tune;
dco2_freq <= this_dco2_freq_tune;
end structure;
------------------------------------------------------------