use STD.textio.all;--added for time and strings
|
use STD.textio.all;--added for time and strings
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_misc.all;
|
use ieee.std_logic_misc.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use IEEE.std_logic_textio.all;--added for time and strings
|
use IEEE.std_logic_textio.all;--added for time and strings
|
|
|
-- Add your library and packages declaration here ...
|
-- Add your library and packages declaration here ...
|
use work.ahb_package.all;
|
use work.ahb_package.all;
|
|
|
entity uut_stimulator is
|
entity uut_stimulator is
|
generic (
|
generic (
|
stim_type: in uut_params_t:= (bits32,retry,master,'0',single,2,4,hprot_posted,2048,1,0,'0');
|
stim_type: in uut_params_t:= (bits32,retry,master,'0',single,2,4,hprot_posted,2048,1,0,'0');
|
enable: in integer:= 0;
|
enable: in integer:= 0;
|
eot_enable: in integer:= 0);
|
eot_enable: in integer:= 0);
|
port(
|
port(
|
hclk : in std_logic;
|
hclk : in std_logic;
|
hresetn : in std_logic;
|
hresetn : in std_logic;
|
amba_error: in std_logic;
|
amba_error: in std_logic;
|
eot_int: in std_logic;
|
eot_int: in std_logic;
|
conf: out conf_type_t;
|
conf: out conf_type_t;
|
sim_end: out std_logic
|
sim_end: out std_logic
|
);
|
);
|
end uut_stimulator;
|
end uut_stimulator;
|
|
|
--}} End of automatically maintained section
|
--}} End of automatically maintained section
|
|
|
architecture rtl of uut_stimulator is
|
architecture rtl of uut_stimulator is
|
|
|
signal cycle : std_logic;
|
signal cycle : std_logic;
|
signal counter: integer range 0 to 127;
|
signal counter: integer range 0 to 127;
|
|
|
begin
|
begin
|
|
|
process
|
process
|
begin
|
begin
|
if hresetn = '0' then
|
if hresetn = '0' then
|
counter <= 1;
|
counter <= 1;
|
else
|
else
|
if(counter > 15) then
|
if(counter > 15) then
|
assert false report "* Simulator Exit.." severity warning;
|
assert false report "* Simulator Exit.." severity warning;
|
sim_end <= '1';
|
sim_end <= '1';
|
wait;
|
wait;
|
else
|
else
|
sim_end <= '0';
|
sim_end <= '0';
|
counter <= counter+1;
|
counter <= counter+1;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
if (eot_enable/=1) then
|
if (eot_enable/=1) then
|
wait for 4000 ns;
|
wait for 4000 ns;
|
else
|
else
|
wait until (eot_int='1' or amba_error='1');--write
|
wait until (eot_int='1' or amba_error='1');--write
|
wait until (eot_int='1' or amba_error='1');--read
|
wait until (eot_int='1' or amba_error='1');--read
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
cycle_pr:process
|
cycle_pr:process
|
begin
|
begin
|
if cycle/='1' then
|
if cycle/='1' then
|
cycle <= '1';
|
cycle <= '1';
|
if (eot_enable/=1) then
|
if (eot_enable/=1) then
|
wait for 2000 ns;
|
wait for 2000 ns;
|
else
|
else
|
wait until (eot_int='1' or amba_error='1');
|
wait until (eot_int='1' or amba_error='1');
|
end if;
|
end if;
|
else
|
else
|
cycle <= '0';
|
cycle <= '0';
|
if (eot_enable/=1) then
|
if (eot_enable/=1) then
|
wait for 2000 ns;
|
wait for 2000 ns;
|
else
|
else
|
wait until (eot_int='1' or amba_error='1');
|
wait until (eot_int='1' or amba_error='1');
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
|
|
process
|
process
|
variable hburst: std_logic_vector(2 downto 0);
|
variable hburst: std_logic_vector(2 downto 0);
|
begin
|
begin
|
if (counter<=16) then
|
if (counter<=16) then
|
|
|
conf.write <= '0';
|
conf.write <= '0';
|
wait for 30 ns;
|
wait for 30 ns;
|
conf.write <= '1';
|
conf.write <= '1';
|
|
|
conf.addr <= dma_type_addr;
|
conf.addr <= dma_type_addr;
|
|
|
case stim_type.hburst_cycle is
|
case stim_type.hburst_cycle is
|
when '1' =>
|
when '1' =>
|
hburst := stim_type.hburst_tb;
|
hburst := stim_type.hburst_tb;
|
when others =>
|
when others =>
|
hburst := conv_std_logic_vector(counter,3);
|
hburst := conv_std_logic_vector(counter,3);
|
end case;
|
end case;
|
conf.wdata <= "000000000000000000"&
|
conf.wdata <= "000000000000000000"&
|
stim_type.split_tb&stim_type.prior_tb&stim_type.hsize_tb&hburst&stim_type.hprot_tb&cycle&stim_type.locked_request;
|
stim_type.split_tb&stim_type.prior_tb&stim_type.hsize_tb&hburst&stim_type.hprot_tb&cycle&stim_type.locked_request;
|
wait for 10 ns;
|
wait for 10 ns;
|
|
|
conf.addr <= dma_extadd_addr;
|
conf.addr <= dma_extadd_addr;
|
--conf.wdata(31 downto 12)<=stim_type.high_addr_tb;
|
--conf.wdata(31 downto 12)<=stim_type.high_addr_tb;
|
case stim_type.ext_addr_incr_tb is
|
case stim_type.ext_addr_incr_tb is
|
when 1 =>--fixed ext addr
|
when 1 =>--fixed ext addr
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.base_tb ,32);
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.base_tb ,32);
|
when 2 =>--increasing by 4, page fault if base near end of slave address space
|
when 2 =>--increasing by 4, page fault if base near end of slave address space
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.base_tb+(counter-1)*4 ,32);
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.base_tb+(counter-1)*4 ,32);
|
when others =>--growing by incr_tb-4 (0,1,2,3,4,5, ETC.)
|
when others =>--growing by incr_tb-4 (0,1,2,3,4,5, ETC.)
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.base_tb+(counter-1)*(stim_type.ext_addr_incr_tb-4) ,32);
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.base_tb+(counter-1)*(stim_type.ext_addr_incr_tb-4) ,32);
|
end case;
|
end case;
|
wait for 10 ns;--external address
|
wait for 10 ns;--external address
|
|
|
conf.addr <= dma_intadd_addr;
|
conf.addr <= dma_intadd_addr;
|
case stim_type.int_addr_incr_tb is
|
case stim_type.int_addr_incr_tb is
|
when 1 =>--fixed int addr
|
when 1 =>--fixed int addr
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.int_base_tb,32);
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.int_base_tb,32);
|
when 2 =>--increasing by 4, page fault if base near end of slave address space
|
when 2 =>--increasing by 4, page fault if base near end of slave address space
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.int_base_tb+(counter-1)*4 ,32);
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.int_base_tb+(counter-1)*4 ,32);
|
when others =>--growing by incr_tb-4 (0,1,2,3,4,5, ETC.)
|
when others =>--growing by incr_tb-4 (0,1,2,3,4,5, ETC.)
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.int_base_tb+(counter-1)*(stim_type.int_addr_incr_tb-4) ,32);
|
conf.wdata(31 downto 0)<= conv_std_logic_vector(stim_type.int_base_tb+(counter-1)*(stim_type.int_addr_incr_tb-4) ,32);
|
end case;
|
end case;
|
wait for 10 ns;--internal address
|
wait for 10 ns;--internal address
|
|
|
conf.addr <= dma_intmod_addr;
|
conf.addr <= dma_intmod_addr;
|
conf.wdata <= conv_std_logic_vector(stim_type.intmod_tb ,32);
|
conf.wdata <= conv_std_logic_vector(stim_type.intmod_tb ,32);
|
wait for 10 ns;--modifier
|
wait for 10 ns;--modifier
|
|
|
if enable=1 then
|
if enable=1 then
|
conf.addr <= dma_count_addr;
|
conf.addr <= dma_count_addr;
|
conf.wdata <= conv_std_logic_vector(counter,32);
|
conf.wdata <= conv_std_logic_vector(counter,32);
|
wait for 10 ns;--dma count
|
wait for 10 ns;--dma count
|
else
|
else
|
wait for 10 ns;--dma count
|
wait for 10 ns;--dma count
|
end if;
|
end if;
|
|
|
conf.write <= '0';
|
conf.write <= '0';
|
conf.addr <= "0000";
|
conf.addr <= "0000";
|
conf.wdata <= (others => '-');
|
conf.wdata <= (others => '-');
|
|
|
if (eot_enable/=1) then
|
if (eot_enable/=1) then
|
wait until cycle'event;
|
wait until cycle'event;
|
else
|
else
|
wait until (eot_int='1' or amba_error='1');
|
wait until (eot_int='1' or amba_error='1');
|
end if;
|
end if;
|
else
|
else
|
wait;
|
wait;
|
end if;
|
end if;
|
--if counter=16 then wait; end if;
|
--if counter=16 then wait; end if;
|
|
|
end process;
|
end process;
|
|
|
|
|
assert (amba_error/='1') report "###ERROR in AMBA operation!!!" severity error;
|
assert (amba_error/='1') report "###ERROR in AMBA operation!!!" severity error;
|
|
|
end rtl;
|
end rtl;
|
|
|