LIBRARY ieee;
|
LIBRARY ieee;
|
USE ieee.std_logic_1164.all;
|
USE ieee.std_logic_1164.all;
|
USE IEEE.numeric_std.ALL;
|
USE IEEE.numeric_std.ALL;
|
|
|
|
|
|
|
ENTITY circuit IS
|
ENTITY circuit IS
|
-- Declarations
|
-- Declarations
|
PORT(
|
PORT(
|
clk : IN std_logic;
|
clk : IN std_logic;
|
reset : IN std_logic;
|
reset : IN std_logic;
|
fmin : IN std_logic_vector(7 downto 0);
|
fmin : IN std_logic_vector(7 downto 0);
|
dmout : OUT std_logic_vector (11 DOWNTO 0)
|
dmout : OUT std_logic_vector (11 DOWNTO 0)
|
);
|
);
|
END circuit ;
|
END circuit ;
|
|
|
|
|
ARCHITECTURE behavior OF circuit IS
|
ARCHITECTURE behavior OF circuit IS
|
|
|
-- Architecture declarations
|
-- Architecture declarations
|
|
|
-- Internal signal declarations
|
-- Internal signal declarations
|
SIGNAL d1 : signed(11 DOWNTO 0);
|
SIGNAL d1 : signed(11 DOWNTO 0);
|
SIGNAL d2 : signed(11 DOWNTO 0);
|
SIGNAL d2 : signed(11 DOWNTO 0);
|
SIGNAL dout : signed(7 DOWNTO 0);
|
SIGNAL dout : signed(7 DOWNTO 0);
|
SIGNAL output : signed(7 DOWNTO 0);
|
SIGNAL output : signed(7 DOWNTO 0);
|
|
|
|
|
|
|
-- Component Declarations
|
-- Component Declarations
|
COMPONENT multiplier
|
COMPONENT multiplier
|
PORT (
|
PORT (
|
clk : IN std_logic ;
|
clk : IN std_logic ;
|
reset : IN std_logic ;
|
reset : IN std_logic ;
|
input1 : IN std_logic_vector (7 DOWNTO 0);
|
input1 : IN std_logic_vector (7 DOWNTO 0);
|
input2 : IN signed (7 DOWNTO 0);
|
input2 : IN signed (7 DOWNTO 0);
|
output : OUT signed (7 DOWNTO 0)
|
output : OUT signed (7 DOWNTO 0)
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
COMPONENT fir
|
COMPONENT fir
|
PORT (
|
PORT (
|
clock : IN std_logic ;
|
clock : IN std_logic ;
|
reset : IN std_logic ;
|
reset : IN std_logic ;
|
data_in : IN signed (11 DOWNTO 0);
|
data_in : IN signed (11 DOWNTO 0);
|
data_out : OUT std_logic_vector (11 DOWNTO 0)
|
data_out : OUT std_logic_vector (11 DOWNTO 0)
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
COMPONENT loop_filter
|
COMPONENT loop_filter
|
PORT (
|
PORT (
|
clk : IN std_logic ;
|
clk : IN std_logic ;
|
reset : IN std_logic ;
|
reset : IN std_logic ;
|
c : IN signed (7 DOWNTO 0);
|
c : IN signed (7 DOWNTO 0);
|
d1 : OUT signed (11 DOWNTO 0);
|
d1 : OUT signed (11 DOWNTO 0);
|
d2 : OUT signed (11 DOWNTO 0)
|
d2 : OUT signed (11 DOWNTO 0)
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
COMPONENT nco
|
COMPONENT nco
|
PORT (
|
PORT (
|
clk : IN std_logic ;
|
clk : IN std_logic ;
|
reset : IN std_logic ;
|
reset : IN std_logic ;
|
din : IN signed (11 DOWNTO 0);
|
din : IN signed (11 DOWNTO 0);
|
dout : OUT signed (7 DOWNTO 0)
|
dout : OUT signed (7 DOWNTO 0)
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
|
|
BEGIN
|
BEGIN
|
-- Instance port mappings.
|
-- Instance port mappings.
|
I1 : multiplier
|
I1 : multiplier
|
PORT MAP (
|
PORT MAP (
|
clk => clk,
|
clk => clk,
|
reset => reset,
|
reset => reset,
|
input1 => fmin,
|
input1 => fmin,
|
input2 => dout,
|
input2 => dout,
|
output => output
|
output => output
|
);
|
);
|
I4 : fir
|
I4 : fir
|
PORT MAP (
|
PORT MAP (
|
clock => clk,
|
clock => clk,
|
reset => reset,
|
reset => reset,
|
data_in => d1,
|
data_in => d1,
|
data_out => dmout
|
data_out => dmout
|
);
|
);
|
I3 : loop_filter
|
I3 : loop_filter
|
PORT MAP (
|
PORT MAP (
|
clk => clk,
|
clk => clk,
|
reset => reset,
|
reset => reset,
|
c => output,
|
c => output,
|
d1 => d1,
|
d1 => d1,
|
d2 => d2
|
d2 => d2
|
);
|
);
|
I2 : nco
|
I2 : nco
|
PORT MAP (
|
PORT MAP (
|
clk => clk,
|
clk => clk,
|
reset => reset,
|
reset => reset,
|
din => d2,
|
din => d2,
|
dout => dout
|
dout => dout
|
);
|
);
|
|
|
|
|
END behavior;
|
END behavior;
|
|
|