Adaptive Noise Filter Cancellaton VHDL Code
Adaptive Noise Filter Cancellaton VHDL Code
----------------------------------------------------------------adaptivefilter.vhd
----------------------------------------------------------------library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity adaptivefilter is
port (
a1: in std_logic_vector(31 downto 0);
b1: in std_logic_vector(31 downto 0);
mu2: in std_logic_vector(31 downto 0);
ndfi: in std_logic;
rfdfi: out std_logic;
clk: in std_logic;
resultfi: out std_logic_vector(31 downto 0);
rdyfi: out std_logic);
end adaptivefilter;
architecture Behavioral of adaptivfilter is
signal xin0 : std_logic_vector(31 downto 0):=
"11000000000000000000000000000000";
signal xin1 : std_logic_vector(31 downto 0):=
"11000000000000000000000000000000";
signal wt0 : std_logic_vector(31 downto 0):=
"11000000000000000000000000000000";
signal wt1 : std_logic_vector(31 downto 0):=
"11000000000000000000000000000000";
signal rfdmul0, rfdmul1, rfdmul2, rfdmul3, rfdmul4, rfdad0, rfdad1, rfdad2,
rfdsub0 : std_logic:=1;
signal resultad0, resultad1, resultad2, resultmul0, resultmul1, resultmul2,
resultmul3, resultmul4, resultsub0 : std_logic_vector(31 downto 0):=
"11000000000000000000000000000000";
signal ndfi2, ndad, ndsub0, rdymul0, rdymul1, rdymul2, rdymul3, rdymul4,
rdyad0, rdyad1, rdyad2, rdysub0:std_logic:=0;
component fadder
port (
a: in std_logic_vector(31 downto 0);
b: in std_logic_vector(31 downto 0);
READ_NET: process
begin
wait until ndfi = 1;
xin1<=xin0;
xin0<=afi;
end process READ_NET;
READ_wt: process
begin
wait until rdyad2= 1;
wt0<=resultad1;
wt1<=resultad2;
end process READ_wt;
end Behavioral;
-----------------------------------------------------------testbench.vhd
-----------------------------------------------------------LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
USE ieee.numeric_std.ALL;
ENTITY testbench is
END testbench;
ARCHITECTURE behavior OF testbench IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT adaptivefilter
PORT(
a1 : IN std_logic_vector(31 downto 0);
b1 : IN std_logic_vector(31 downto 0);
mu2 : IN std_logic_vector(31 downto 0);
ndfi : IN std_logic;
rfdfi : OUT std_logic;
clk : IN std_logic;
resultfi : OUT std_logic_vector(31 downto 0);
rdyfi : OUT std_logic);
END COMPONENT;
signal a1 : std_logic_vector(31 downto 0) := (others => 0);
signal b1 : std_logic_vector(31 downto 0) := (others => 0);
signal mu2 : std_logic_vector(31 downto 0) :=
"00111110000110011001100110011010"; --(0.15)
signal
signal
signal
signal
signal
ndfi : std_logic := 0;
clk: std_logic := 0;
rfdfi : std_logic;
resultfi : std_logic_vector(31 downto 0);
rdyfi : std_logic;
b1 <="00111110100111100011011101111010" ;
wait for nd_period;
a1 <="10111111010011110001101110111101";
b1 <="10111111010011110001101110111101";
wait for nd_period;
a1 <="00111110100111100011011101111010";
b1 <="10111111010011110001101110111101";
wait for nd_period;
end process REA_NET;
END behavior;