THIS MY MAIN PRGRAM
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;
USE ieee.std_logic_unsigned.ALL;
USE ieee.math_real.ALL;
ENTITY I2C_modulator_tb IS
END I2C_modulator_tb;
ARCHITECTURE behavior OF I2C_modulator_tb IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT Modulator
PORT(
clock : IN std_logic;
reset : IN std_logic;
scl : IN std_logic;
sda : INOUT std_logic;
phaseLFullbridge : OUT std_ulogic_vector(2 downto 0);
phaseLHalfbridge : OUT std_ulogic_vector(2 downto 0);
indicator : out std_ulogic_vector(5 downto 0);
sync_out : out std_logic;
testbit2 : OUT std_logic
-- index2 : OUT std_logic_vector(10 downto 0);
-- index1 : OUT std_logic_vector(10 downto 0)
);
END COMPONENT;
--Inputs
signal clock : std_logic := '0';
signal reset : std_logic := '0';
signal scl : std_logic := '0';
--BiDirs
signal sda : std_logic;
--Outputs
signal sync_out : std_logic;
signal testbit2 : std_logic;
signal phaseLFullbridge : std_ulogic_vector(2 downto 0);
signal phaseLHalfbridge : std_ulogic_vector(2 downto 0);
signal indicator : std_ulogic_vector(5 downto 0);
-- signal index2 : std_logic_vector(10 downto 0);
-- signal index1 : std_logic_vector(10 downto 0);
-- Clock period definitions
constant clock_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: Modulator PORT MAP (
clock => clock,
reset => reset,
scl => scl,
sda => sda,
phaseLFullbridge => phaseLFullbridge,
phaseLHalfbridge => phaseLHalfbridge,
testbit2 => testbit2,
-- index2 => index2,
-- index1 => index1,
sync_out => sync_out,
indicator => indicator
);
-- Clock process definitions
clock_process

rocess
begin
clock <= '0';
wait for clock_period/2;
clock <= '1';
wait for clock_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
reset <= '1';
sda <= 'H';
scl <= '0';
wait for 100ns;
reset <= '0';
-- sda <= '1';
wait for clock_period * 1000;
wait for 100 ns;
wait for clock_period*10;
-- insert stimulus here
wait;
end process;
END;