OpenCores
URL https://opencores.org/ocsvn/wb_vga/wb_vga/trunk

Subversion Repositories wb_vga

[/] [wb_vga/] [trunk/] [TestBench/] [palette_TB.vhd] - Diff between revs 4 and 8

Only display areas with differences | Details | Blame | View Log

Rev 4 Rev 8
library ieee,wb_tk,wb_vga;
library ieee,wb_tk,wb_vga;
use ieee.NUMERIC_STD.all;
use ieee.NUMERIC_STD.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use wb_tk.technology.all;
use wb_tk.technology.all;
use wb_tk.wb_test.all;
use wb_tk.wb_test.all;
use wb_tk.all;
use wb_tk.all;
use wb_vga.all;
use wb_vga.all;
 
 
entity wb_pal_ram_tb is
entity wb_pal_ram_tb is
        generic(
        generic(
                cpu_dat_width: positive := 32;
                cpu_dat_width: positive := 32;
                cpu_adr_width: positive := 8;
                cpu_adr_width: positive := 8;
                v_dat_width: positive := 16;
                v_dat_width: positive := 16;
                v_adr_width: positive := 8
                v_adr_width: positive := 8
    );
    );
end wb_pal_ram_tb;
end wb_pal_ram_tb;
 
 
architecture TB of wb_pal_ram_tb is
architecture TB of wb_pal_ram_tb is
        component wb_pal_ram
        component wb_pal_ram
        generic (
        generic (
                cpu_dat_width: positive := cpu_dat_width;
                cpu_dat_width: positive := cpu_dat_width;
                cpu_adr_width: positive := cpu_adr_width;
                cpu_adr_width: positive := cpu_adr_width;
                v_dat_width: positive := v_dat_width;
                v_dat_width: positive := v_dat_width;
                v_adr_width: positive := v_adr_width
                v_adr_width: positive := v_adr_width
        );
        );
        port (
        port (
    -- Wishbone interface to CPU (write-only support)
    -- Wishbone interface to CPU (write-only support)
                clk_i: in std_logic;
                clk_i: in std_logic;
                rst_i: in std_logic := '0';
                rst_i: in std_logic := '0';
                adr_i: in std_logic_vector (cpu_adr_width-1 downto 0);
                adr_i: in std_logic_vector (cpu_adr_width-1 downto 0);
    --          sel_i: in std_logic_vector ((cpu_dat_width/8)-1 downto 0) := (others => '1');
    --          sel_i: in std_logic_vector ((cpu_dat_width/8)-1 downto 0) := (others => '1');
                dat_i: in std_logic_vector (cpu_dat_width-1 downto 0);
                dat_i: in std_logic_vector (cpu_dat_width-1 downto 0);
                dat_oi: in std_logic_vector (cpu_dat_width-1 downto 0) := (others => '-');
                dat_oi: in std_logic_vector (cpu_dat_width-1 downto 0) := (others => '-');
                dat_o: out std_logic_vector (cpu_dat_width-1 downto 0);
                dat_o: out std_logic_vector (cpu_dat_width-1 downto 0);
                cyc_i: in std_logic;
                cyc_i: in std_logic;
                ack_o: out std_logic;
                ack_o: out std_logic;
                ack_oi: in std_logic := '-';
                ack_oi: in std_logic := '-';
                err_o: out std_logic;
                err_o: out std_logic;
                err_oi: in std_logic := '-';
                err_oi: in std_logic := '-';
    --          rty_o: out std_logic;
    --          rty_o: out std_logic;
    --          rty_oi: in std_logic := '-';
    --          rty_oi: in std_logic := '-';
                we_i: in std_logic;
                we_i: in std_logic;
                stb_i: in std_logic;
                stb_i: in std_logic;
    -- Interface to the video output
    -- Interface to the video output
            blank: in std_logic;
            blank: in std_logic;
            v_dat_i: in std_logic_vector(v_adr_width-1 downto 0);
            v_dat_i: in std_logic_vector(v_adr_width-1 downto 0);
            v_dat_o: out std_logic_vector(v_dat_width-1 downto 0)
            v_dat_o: out std_logic_vector(v_dat_width-1 downto 0)
        );
        );
        end component;
        end component;
 
 
-- Wishbone interface to CPU (write-only support)
-- Wishbone interface to CPU (write-only support)
        signal clk_i: std_logic;
        signal clk_i: std_logic;
        signal rst_i: std_logic := '0';
        signal rst_i: std_logic := '0';
        signal adr_i: std_logic_vector (cpu_adr_width-1 downto 0);
        signal adr_i: std_logic_vector (cpu_adr_width-1 downto 0);
        signal dat_i: std_logic_vector (cpu_dat_width-1 downto 0);
        signal dat_i: std_logic_vector (cpu_dat_width-1 downto 0);
        signal dat_oi: std_logic_vector (cpu_dat_width-1 downto 0) := (others => '-');
        signal dat_oi: std_logic_vector (cpu_dat_width-1 downto 0) := (others => '-');
        signal dat_o: std_logic_vector (cpu_dat_width-1 downto 0);
        signal dat_o: std_logic_vector (cpu_dat_width-1 downto 0);
        signal cyc_i: std_logic;
        signal cyc_i: std_logic;
        signal ack_o: std_logic;
        signal ack_o: std_logic;
        signal ack_oi: std_logic := '-';
        signal ack_oi: std_logic := '-';
        signal err_o: std_logic;
        signal err_o: std_logic;
        signal err_oi: std_logic := '-';
        signal err_oi: std_logic := '-';
        signal we_i: std_logic;
        signal we_i: std_logic;
        signal stb_i: std_logic;
        signal stb_i: std_logic;
-- Interface to the video output
-- Interface to the video output
    signal blank: std_logic;
    signal blank: std_logic;
    signal v_dat_i: std_logic_vector(v_adr_width-1 downto 0);
    signal v_dat_i: std_logic_vector(v_adr_width-1 downto 0);
    signal v_dat_o: std_logic_vector(v_dat_width-1 downto 0);
    signal v_dat_o: std_logic_vector(v_dat_width-1 downto 0);
begin
begin
 
 
        -- Unit Under Test port map
        -- Unit Under Test port map
        UUT : wb_pal_ram
        UUT : wb_pal_ram
                port map (
                port map (
                clk_i => clk_i,
                clk_i => clk_i,
                rst_i => rst_i,
                rst_i => rst_i,
                adr_i => adr_i,
                adr_i => adr_i,
                dat_i => dat_i,
                dat_i => dat_i,
                dat_oi => dat_oi,
                dat_oi => dat_oi,
                dat_o => dat_o,
                dat_o => dat_o,
                cyc_i => cyc_i,
                cyc_i => cyc_i,
                ack_o => ack_o,
                ack_o => ack_o,
                ack_oi => ack_oi,
                ack_oi => ack_oi,
                err_o => err_o,
                err_o => err_o,
                err_oi => err_oi,
                err_oi => err_oi,
                we_i => we_i,
                we_i => we_i,
                stb_i => stb_i,
                stb_i => stb_i,
 
 
            blank => blank,
            blank => blank,
            v_dat_i => v_dat_i,
            v_dat_i => v_dat_i,
            v_dat_o => v_dat_o
            v_dat_o => v_dat_o
        );
        );
 
 
        clk: process is
        clk: process is
        begin
        begin
                clk_i <= '0';
                clk_i <= '0';
                wait for 25ns;
                wait for 25ns;
                clk_i <= '1';
                clk_i <= '1';
                wait for 25ns;
                wait for 25ns;
        end process;
        end process;
 
 
        reset: process is
        reset: process is
        begin
        begin
                rst_i <= '1';
                rst_i <= '1';
                wait for 150ns;
                wait for 150ns;
                rst_i <= '0';
                rst_i <= '0';
                wait;
                wait;
        end process;
        end process;
 
 
        gen_v_output: process is
        gen_v_output: process is
            variable addr: std_logic_vector(v_adr_width-1 downto 0) := (others => '0');
            variable addr: std_logic_vector(v_adr_width-1 downto 0) := (others => '0');
        begin
        begin
            blank <= '0';
            blank <= '0';
            wait until clk_i'EVENT and clk_i = '1';
            wait until clk_i'EVENT and clk_i = '1';
            v_dat_i <= addr;
            v_dat_i <= addr;
--          if (addr = "1111") then
--          if (addr = "1111") then
--              blank <= '1';
--              blank <= '1';
--                  wait until clk_i'EVENT and clk_i = '1';
--                  wait until clk_i'EVENT and clk_i = '1';
--          addr := (v_adr_width'RANGE => '0');
--          addr := (v_adr_width'RANGE => '0');
--          else
--          else
                addr := add_one(addr);
                addr := add_one(addr);
--          end if;
--          end if;
    end process;
    end process;
 
 
        dat_oi <= (others => 'U');
        dat_oi <= (others => 'U');
        ack_oi <= 'U';
        ack_oi <= 'U';
        err_oi <= 'U';
        err_oi <= 'U';
 
 
        master: process is
        master: process is
                variable i: integer := 0;
                variable i: integer := 0;
            variable addr: std_logic_vector(cpu_adr_width-1 downto 0) := (others => '0');
            variable addr: std_logic_vector(cpu_adr_width-1 downto 0) := (others => '0');
            variable data: std_logic_vector(cpu_dat_width-1 downto 0) := (others => '0');
            variable data: std_logic_vector(cpu_dat_width-1 downto 0) := (others => '0');
        begin
        begin
                we_i <= '0';
                we_i <= '0';
                cyc_i <= '0';
                cyc_i <= '0';
                stb_i <= '0';
                stb_i <= '0';
                adr_i <= (others => '0');
                adr_i <= (others => '0');
                dat_i <= (others => '0');
                dat_i <= (others => '0');
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
                wait until clk_i'EVENT and clk_i = '1';
 
 
        for i in 0 to 511 loop
        for i in 0 to 511 loop
                    wr_val(clk_i, adr_i,dat_o,dat_i,we_i,cyc_i,stb_i,ack_o,addr,data);
                    wr_val(clk_i, adr_i,dat_o,dat_i,we_i,cyc_i,stb_i,ack_o,addr,data);
                    addr := add_one(addr);
                    addr := add_one(addr);
                    data := add_one(data);
                    data := add_one(data);
                end loop;
                end loop;
                wait;
                wait;
        end process;
        end process;
 
 
end TB;
end TB;
 
 
configuration TB_wb_pal_ram of wb_pal_ram_tb is
configuration TB_wb_pal_ram of wb_pal_ram_tb is
        for TB
        for TB
                for UUT : wb_pal_ram
                for UUT : wb_pal_ram
                        use entity wb_vga.wb_pal_ram(wb_pal_ram);
                        use entity wb_vga.wb_pal_ram(wb_pal_ram);
                end for;
                end for;
        end for;
        end for;
end TB_wb_pal_ram;
end TB_wb_pal_ram;
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.