Line 89... |
Line 89... |
if clk_I'event and clk_I = '1' then
|
if clk_I'event and clk_I = '1' then
|
data1 <= data1 + 2;
|
data1 <= data1 + 2;
|
data2 <= data2 + 2;
|
data2 <= data2 + 2;
|
end if;
|
end if;
|
|
|
if sleep_I = '1' or chip_sel_I = '0' then
|
if sleep_I = '1' or chip_sel_I = '1' then
|
data_O <= (others => '0');
|
data_O <= (others => '0');
|
else
|
else
|
case sel_I is
|
case sel_I is
|
when '0' =>
|
when '0' =>
|
data_O <= data1;
|
data_O <= data1;
|
Line 231... |
Line 231... |
nSelectIn_I <= '0'; -- addStb
|
nSelectIn_I <= '0'; -- addStb
|
wait until Busy_O = '1';
|
wait until Busy_O = '1';
|
--wait for 30 ns;
|
--wait for 30 ns;
|
nSelectIn_I <= '1';
|
nSelectIn_I <= '1';
|
wait until Busy_O = '0';
|
wait until Busy_O = '0';
|
|
Data_IO <= (others => '0');
|
|
wait for 30 ns;
|
|
|
Data_IO <= in_data(7 downto 0); -- Data1
|
Data_IO <= in_data(7 downto 0); -- Data1
|
nAutoFd_I <= '0'; -- datStb
|
nAutoFd_I <= '0'; -- datStb
|
wait until Busy_O = '1';
|
wait until Busy_O = '1';
|
nAutoFd_I <= '1';
|
nAutoFd_I <= '1';
|
wait until Busy_O = '0';
|
wait until Busy_O = '0';
|
|
Data_IO <= (others => '0');
|
|
wait for 30 ns;
|
|
|
Data_IO <= in_data(15 downto 8); -- Data0
|
Data_IO <= in_data(15 downto 8); -- Data0
|
nAutoFd_I <= '0'; -- datStb
|
nAutoFd_I <= '0'; -- datStb
|
wait until Busy_O = '1';
|
wait until Busy_O = '1';
|
nAutoFd_I <= '1';
|
nAutoFd_I <= '1';
|
Line 262... |
Line 266... |
|
|
nStrobe_I <= '0'; -- '0' -> is write
|
nStrobe_I <= '0'; -- '0' -> is write
|
Data_IO <= in_address; -- Address
|
Data_IO <= in_address; -- Address
|
nSelectIn_I <= '0'; -- addStb
|
nSelectIn_I <= '0'; -- addStb
|
wait until Busy_O = '1';
|
wait until Busy_O = '1';
|
--wait for 30 ns;
|
wait for 30 ns; -- default
|
|
-- wait for 150 ns;
|
nSelectIn_I <= '1';
|
nSelectIn_I <= '1';
|
wait until Busy_O = '0';
|
wait until Busy_O = '0';
|
|
wait for 30 ns;
|
|
|
nStrobe_I <= '1'; -- '1' -> is read
|
nStrobe_I <= '1'; -- '1' -> is read
|
Data_IO <= (others => 'Z'); -- Data1
|
Data_IO <= (others => 'Z'); -- Data1
|
nAutoFd_I <= '0'; -- datStb
|
nAutoFd_I <= '0'; -- datStb
|
|
-- wait for 150 ns;
|
wait until (Busy_O = '1');
|
wait until (Busy_O = '1');
|
wait for 30 ns;
|
wait for 150 ns;
|
nAutoFd_I <= '1';
|
nAutoFd_I <= '1';
|
|
-- wait for 40 ns;
|
wait until (Busy_O = '0');
|
wait until (Busy_O = '0');
|
|
wait for 30 ns;
|
|
|
Data_IO <= (others => 'Z'); -- Data0
|
Data_IO <= (others => 'Z'); -- Data0
|
nAutoFd_I <= '0'; -- datStb
|
nAutoFd_I <= '0'; -- datStb
|
|
-- wait for 150 ns;
|
wait until (Busy_O = '1');
|
wait until (Busy_O = '1');
|
wait for 30 ns;
|
wait for 150 ns;
|
out_runflag <= Data_IO(6);
|
out_runflag <= Data_IO(6);
|
nAutoFd_I <= '1';
|
nAutoFd_I <= '1';
|
wait until (Busy_O = '0');
|
wait until (Busy_O = '0');
|
|
wait for 30 ns;
|
|
|
end procedure ReadData;
|
end procedure ReadData;
|
|
|
|
|
|
------------------------------------------------------------------------------------------------
|
|
-- Procedure for read from epp port
|
|
procedure ReadData2(
|
|
signal out_runflag: out std_logic;
|
|
--constant in_address: in std_logic_vector(7 downto 0);
|
|
signal Data_IO: inout std_logic_vector(7 downto 0);
|
|
signal nStrobe_I: out std_logic;
|
|
signal nSelectIn_I: out std_logic;
|
|
signal nAutoFd_I: out std_logic;
|
|
signal Busy_O: in std_logic
|
|
) is
|
|
begin
|
|
|
|
|
|
nStrobe_I <= '1'; -- '1' -> is read
|
|
Data_IO <= (others => 'Z'); -- Data1
|
|
nAutoFd_I <= '0'; -- datStb
|
|
-- wait for 150 ns;
|
|
wait until (Busy_O = '1');
|
|
-- wait for 150 ns;
|
|
nAutoFd_I <= '1';
|
|
--wait for 40 ns;
|
|
wait until (Busy_O = '0');
|
|
-- wait for 40 ns;
|
|
|
|
Data_IO <= (others => 'Z'); -- Data0
|
|
nAutoFd_I <= '0'; -- datStb
|
|
-- wait for 150 ns;
|
|
wait until (Busy_O = '1');
|
|
-- wait for 150 ns;
|
|
out_runflag <= Data_IO(6);
|
|
nAutoFd_I <= '1';
|
|
--wait for 40 ns;
|
|
wait until (Busy_O = '0');
|
|
-- wait for 40 ns;
|
|
|
|
end procedure ReadData2;
|
|
|
begin
|
begin
|
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
-- Init
|
-- Init
|
test_number <= 0;
|
test_number <= 0;
|
wait until tb_ParameterInitFlag;
|
wait until tb_ParameterInitFlag;
|
Line 296... |
Line 346... |
nSelectIn_I <= '0';
|
nSelectIn_I <= '0';
|
nStrobe_I <= '0';
|
nStrobe_I <= '0';
|
Data_IO <= (others => '0');
|
Data_IO <= (others => '0');
|
nAutoFd_I <= '1';
|
nAutoFd_I <= '1';
|
nInit_I <= '1';
|
nInit_I <= '1';
|
reset_I <= '1';
|
reset_I <= '0';
|
wait for 700 ns; -- PLL delay
|
wait for 700 ns; -- PLL delay
|
|
|
reset_I <= '0';
|
reset_I <= '1';
|
|
|
-- EPP Mode Negotiation
|
-- EPP Mode Negotiation
|
-- Standar timing and handshake
|
-- Standar timing and handshake
|
nStrobe_I <= '1';
|
nStrobe_I <= '1';
|
wait for 500 ns;
|
wait for 500 ns;
|
Line 449... |
Line 499... |
|
|
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
-- Test 6 - Trigger
|
-- Test 6 - Trigger
|
-- daq freq = ctrl freq/2 (default), trigger channel 1, level 70 %, continuous, skipper = 3,
|
-- daq freq = ctrl freq/2 (default), trigger channel 1, level 70 %, continuous, skipper = 3,
|
-- channels 1, buffer size = 150h, falling edge, full negative trigger offset
|
-- channels 1, buffer size = 150h, falling edge, full negative trigger offset
|
test_number <= 6;
|
-- test_number <= 6;
|
|
|
WriteData(X"01", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
|
-- WriteData(X"01", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
|
WriteData(X"02", X"0150", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
|
-- WriteData(X"02", X"0150", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
|
WriteData(X"03", X"02CD", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
|
-- WriteData(X"03", X"02CD", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
|
WriteData(X"04", X"FF6A", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R -150
|
-- WriteData(X"04", X"FF6A", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R -150
|
WriteData(X"00", B"00000_00011_1_1_1_1_1_1", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
|
-- WriteData(X"00", B"00000_00011_1_1_1_1_1_1", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
|
|
|
|
|
ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
i := 0;
|
-- i := 0;
|
while (i <= 200) loop
|
-- while (i <= 200) loop
|
ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
i := i + 1;
|
-- i := i + 1;
|
end loop;
|
-- end loop;
|
|
|
|
|
|
-- WriteData(X"01", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
|
|
|
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
-- Test 7 - One channel
|
-- Test 7 - One channel
|
-- daq freq = ctrl freq/2 (default), trigger channel 0, level 30 %, continuous, skipper = 5,
|
-- daq freq = ctrl freq/2 (default), trigger channel 0, level 30 %, continuous, skipper = 5,
|
-- channels 1, buffer size = 30, trigger offset 29, skipper = 10
|
-- channels 1, buffer size = 30, trigger offset 29, skipper = 10
|
Line 490... |
Line 544... |
|
|
------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------
|
-- Test 8 - Test write while working
|
-- Test 8 - Test write while working
|
-- daq freq = ctrl freq/2 (default), trigger channel 1, level 30 %, continuous, skipper = 5,
|
-- daq freq = ctrl freq/2 (default), trigger channel 1, level 30 %, continuous, skipper = 5,
|
-- channels 1, buffer size = 50
|
-- channels 1, buffer size = 50
|
|
--
|
|
-- test_number <= 8;
|
|
--
|
|
-- WriteData(X"01", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
|
|
-- WriteData(X"02", X"0150", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
|
|
-- WriteData(X"03", X"02CD", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
|
|
-- WriteData(X"04", X"FF6A", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R -150
|
|
-- WriteData(X"00", B"00000_00011_1_1_1_1_1_1", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
|
|
--
|
|
-- wait for 800 ns;
|
|
-- WriteData(X"01", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
--
|
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- i := 0;
|
|
-- while (i <= 200) loop
|
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- i := i + 1;
|
|
-- end loop;
|
|
|
|
|
|
-- ------------------------------------------------------------------------------------------------
|
|
-- Test 9 - Test read with full buffer
|
|
-- daq freq = ctrl freq/2 (default), w/o trigger, w/o skipper, channels 1 and 2,
|
|
-- buffer size = 50h, continuous
|
|
-- test_number <= 9;
|
|
--
|
|
-- WriteData(X"01", X"0003", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
|
|
-- WriteData(X"02", X"0050", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
|
|
-- WriteData(X"03", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
|
|
-- WriteData(X"04", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R
|
|
-- WriteData(X"00", X"0001", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
|
|
--
|
|
-- wait for 5000 ns;
|
|
-- i := 0;
|
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- while (i <= 25) loop
|
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- i := i + 1;
|
|
-- end loop;
|
|
--
|
|
-- -- big buffer
|
|
-- WriteData(X"01", X"0003", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
|
|
-- WriteData(X"02", X"03E8", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
|
|
-- WriteData(X"03", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
|
|
-- WriteData(X"04", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R
|
|
-- WriteData(X"00", X"0001", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
|
|
--
|
|
--
|
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- while (runflag = '1') loop
|
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- end loop;
|
|
--
|
|
|
|
|
|
------------------------------------------------------------------------------------------------
|
|
-- Test 10 - Test simple continuous
|
|
-- daq freq = ctrl freq/2 (default), trigger channel 1, level 70 %, continuous, skipper = 3,
|
|
-- channels 1, buffer size = 150h, falling edge, full negative trigger offset
|
|
test_number <= 10;
|
|
|
|
WriteData(X"01", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
|
|
WriteData(X"02", X"0050", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
|
|
WriteData(X"03", X"02CD", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
|
|
WriteData(X"04", X"FF6A", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R -150
|
|
WriteData(X"00", X"FFC1", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
|
|
--1111111111000011
|
|
--wait for 5000 ns;
|
|
|
|
|
|
|
|
test_number <= 11;
|
|
|
|
ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
while (runflag = '1') loop
|
|
ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
end loop;
|
|
|
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- i := 0;
|
|
-- while (i <= 50) loop
|
|
-- ReadData2(runflag, Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- i := i + 1;
|
|
-- end loop;
|
|
--
|
|
--
|
|
--
|
|
-- test_number <= 12;
|
|
-- WriteData(X"01", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
|
|
-- WriteData(X"02", X"0050", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
|
|
-- WriteData(X"03", X"01FF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
|
|
-- WriteData(X"04", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R -150
|
|
-- WriteData(X"00", X"FFC3", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
|
|
-- --1111 1111 1100 0011
|
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- i := 0;
|
|
-- while (i <= 150) loop
|
|
-- ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
-- i := i + 1;
|
|
-- end loop;
|
|
|
|
|
|
WriteData(X"01", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
|
|
wait for 1000 ns;
|
|
--
|
|
-- -- reading an address
|
|
--
|
|
WriteData(X"09", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
|
nStrobe_I <= '1'; -- '1' -> is read
|
|
Data_IO <= (others => 'Z'); -- Data0 -- Address
|
|
nSelectIn_I <= '0'; -- addStb
|
|
wait until Busy_O = '1';
|
|
wait for 30 ns; -- default
|
|
-- wait for 150 ns;
|
|
nSelectIn_I <= '1';
|
|
wait until Busy_O = '0';
|
|
wait for 30 ns;
|
|
|
|
|
wait for 100 ns;
|
wait for 100 ns;
|
|
|
tb_InitFlag <= false;
|
tb_InitFlag <= false;
|