---------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 03/10/2021 11:15:39 AM -- Design Name: -- Module Name: ctrl_reg_tb - Behavioral -- Project Name: -- Target Devices: -- Tool Versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.numeric_std.ALL; use work.ngFEC_pack.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 leaf cells in this code. entity ctrl_reg_tb is -- Port ( ); end ctrl_reg_tb; architecture Behavioral of ctrl_reg_tb is signal ipb_rst : std_logic := '1'; signal ipb_clk : std_logic := '0'; signal ipb_write : std_logic := '0'; signal match : std_logic := '0'; signal ipb_addr : unsigned(6 downto 0) := (others => '0'); signal ctrl_reg : array_128x32bit := (others => (others => '0')); signal ipb_mosi : ipb_wbus; signal ipb_miso : ipb_rbus; begin uut: entity work.ipb_user_control_regs --===========================================-- port map ( clk => ipb_clk, reset => ipb_rst, ipb_mosi_i => ipb_mosi, ipb_miso_o => ipb_miso, regs_o => ctrl_reg ); ipb_clk <= not ipb_clk after 16 ns; process(ipb_clk, ipb_rst) begin if(ipb_rst = '1')then ipb_addr <= "0000000"; ipb_write <= '0'; match <= '0'; elsif(ipb_clk'event and ipb_clk = '1')then ipb_addr <= ipb_addr + 1; if(ipb_addr = "1111111")then ipb_write <= not ipb_write; end if; if(ipb_mosi.ipb_wdata = ipb_miso.ipb_rdata)then match <= '1'; else match <= '0'; end if; end if; end process; ipb_mosi.ipb_strobe <= not ipb_rst; ipb_mosi.ipb_write <= ipb_write; ipb_mosi.ipb_addr <= x"000000" & '0' & std_logic_vector(ipb_addr); ipb_mosi.ipb_wdata <= ipb_mosi.ipb_addr(7downto 0) & ipb_mosi.ipb_addr(7downto 0) & ipb_mosi.ipb_addr(7downto 0) & ipb_mosi.ipb_addr(7downto 0); stim_proc: process begin -- hold reset state for 100 ns. wait for 160 ns; ipb_rst <= '0'; end process; end Behavioral;