FEATURE: Added END-BY-TRIG flag to window context RAM

This commit is contained in:
Oliver Bruendler
2018-09-05 08:53:43 +02:00
parent 1a78759524
commit d53b4c2c14
7 changed files with 76 additions and 32 deletions

View File

@ -169,6 +169,7 @@ architecture rtl of psi_ms_daq_daq_sm is
IrqFifoWrite : std_logic;
IrqFifoRead : std_logic;
StrIrq : std_logic_vector(Streams_g-1 downto 0);
EndByTrig : std_logic;
end record;
signal r, r_next : two_process_r;
@ -300,6 +301,7 @@ begin
v.State := ReadCtxStr_s;
v.HndlAfterCtxt := ProcResp0_s;
v.HndlStream := Dma_Resp.Stream;
v.EndByTrig := Dma_Resp.Trigger;
else
v.State := Idle_s;
end if;
@ -499,6 +501,7 @@ begin
v.CtxWin_Cmd.WenLo := '1';
v.CtxWin_Cmd.WenHi := '1';
v.CtxWin_Cmd.WdatLo := ShiftRight(r.HndlWinBytes(31 downto 0), log2(StreamWidth_g(r.HndlStream)/8)); -- cut-off guard bit and convert bytes to samples
v.CtxWin_Cmd.WdatLo(31) := r.EndByTrig;
v.CtxWin_Cmd.WdatHi := r.HndlWinLast;
when 1 =>
-- Stream Memory

View File

@ -64,6 +64,7 @@ package psi_ms_daq_tb_pkg is
constant REG_WIN_STRn_STEP : integer := MaxWindows_c*16#10#;
constant REG_WIN_WINn_STEP : integer := 16#10#;
constant REG_WIN_WINCNT : integer := 16#00#;
constant MSK_WIN_WINCNT_CNT : integer := 16#7FFFFFFF#;
constant REG_WIN_WINLAST : integer := 16#04#;
constant REG_WIN_TSLO : integer := 16#08#;
constant REG_WIN_TSHI : integer := 16#0C#;
@ -165,6 +166,13 @@ package psi_ms_daq_tb_pkg is
signal rqst : out TmemRqst_t;
signal rsp : in TmemResp_t;
val : out integer);
procedure HlIsTrigWin( str : in integer;
win : in integer;
signal clk : in std_logic;
signal rqst : out TmemRqst_t;
signal rsp : in TmemResp_t;
val : out boolean);
procedure HlClrWinCnt( str : in integer;
win : in integer;
@ -206,10 +214,10 @@ package body psi_ms_daq_tb_pkg is
--------------------------------------------------------
function IntAnd( int : in integer;
op : in integer) return integer is
variable intu, opu : unsigned(31 downto 0);
variable intu, opu : signed(31 downto 0);
begin
intu := to_unsigned(int, 32);
opu := to_unsigned(op, 32);
intu := to_signed(int, 32);
opu := to_signed(op, 32);
return to_integer(intu and opu);
end function;
@ -260,9 +268,9 @@ package body psi_ms_daq_tb_pkg is
wait until rising_edge(clk);
wait until rising_edge(clk);
if address mod 8 = 0 then
value := to_integer(unsigned(rsp.DATR(31 downto 0)));
value := to_integer(signed(rsp.DATR(31 downto 0)));
else
value := to_integer(unsigned(rsp.DATR(63 downto 32)));
value := to_integer(signed(rsp.DATR(63 downto 32)));
end if;
rqst.ENA <= '0';
end procedure;
@ -406,9 +414,23 @@ package body psi_ms_daq_tb_pkg is
variable v : integer;
begin
TmemRead32( REG_WIN_REGION+REG_WIN_WINCNT+REG_WIN_STRn_STEP*str+REG_WIN_WINn_STEP*win,
val, clk, rqst, rsp);
v, clk, rqst, rsp);
val := IntAnd(v, MSK_WIN_WINCNT_CNT);
end procedure;
procedure HlIsTrigWin( str : in integer;
win : in integer;
signal clk : in std_logic;
signal rqst : out TmemRqst_t;
signal rsp : in TmemResp_t;
val : out boolean) is
variable v : integer;
begin
TmemRead32( REG_WIN_REGION+REG_WIN_WINCNT+REG_WIN_STRn_STEP*str+REG_WIN_WINn_STEP*win,
v, clk, rqst, rsp);
val := v < 0;
end procedure;
procedure HlClrWinCnt( str : in integer;
win : in integer;
signal clk : in std_logic;

View File

@ -339,30 +339,30 @@ package body psi_ms_daq_daq_sm_tb_case_irq is
begin
-- Normal Order
WaitForCase(0, Clk);
ExpCtxFullBurstAuto( Stream => 0, Msg => "Wr0.0", NextWin => true,
ExpCtxFullBurstAuto( Stream => 0, Msg => "Wr0.0", NextWin => true, IsTrig => true,
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ProcDone(0) := '1';
-- Flipped Order
WaitForCase(1, Clk);
ExpCtxFullBurstAuto( Stream => 0, Msg => "Wr0.0", NextWin => true,
ExpCtxFullBurstAuto( Stream => 0, Msg => "Wr0.0", NextWin => true, IsTrig => true,
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ProcDone(0) := '1';
-- IRQ FIFO full
WaitForCase(2, Clk);
for i in 0 to 11 loop
ExpCtxFullBurstAuto( Stream => 0, NextWin => true,
ExpCtxFullBurstAuto( Stream => 0, NextWin => true, IsTrig => true,
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
end loop;
ExpCtxFullBurstAuto( Stream => 0, NextWin => true,
ExpCtxFullBurstAuto( Stream => 0, NextWin => true, IsTrig => true,
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ProcDone(0) := '1';
-- Multi-Stream
WaitForCase(3, Clk);
for i in 3 downto 0 loop
ExpCtxFullBurstAuto( Stream => i, NextWin => true,
ExpCtxFullBurstAuto( Stream => i, NextWin => true, IsTrig => true,
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
end loop;
ProcDone(0) := '1';

View File

@ -358,13 +358,13 @@ package body psi_ms_daq_daq_sm_tb_case_multi_window is
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr0.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr1.0",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr1.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr2.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr2.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr3.0",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr3.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr4.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
@ -376,13 +376,13 @@ package body psi_ms_daq_daq_sm_tb_case_multi_window is
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr0.2",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr0.2",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr1.0",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr1.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr2.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr2.1",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr2.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr3.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
@ -427,20 +427,20 @@ package body psi_ms_daq_daq_sm_tb_case_multi_window is
ExpCtxReadAuto( Stream => 2, Msg => "SW not ready 0.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
SplsWinStr_v(2)(0 to 2) := (others => 0);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.0", NextWin => true,
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.0", NextWin => true, IsTrig => true,
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr1.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr1.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr2.0",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr2.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxReadAuto( Stream => 2, Msg => "SW not ready 1.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxReadAuto( Stream => 2, Msg => "SW not ready 1.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
SplsWinStr_v(2)(0) := 0;
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr3.0",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr3.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxReadAuto( Stream => 2, Msg => "SW not ready 2.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
@ -453,15 +453,15 @@ package body psi_ms_daq_daq_sm_tb_case_multi_window is
-- Ringbuf without overwrite
WaitForCase(4, Clk);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.0", NextWin => true,
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.0", NextWin => true, IsTrig => true,
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr1.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr1.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr1.2",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr1.2",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr2.0",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr2.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxReadAuto( Stream => 2, Msg => "SW not ready 0.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
@ -470,7 +470,7 @@ package body psi_ms_daq_daq_sm_tb_case_multi_window is
SplsWinStr_v(2)(0) := 0;
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr3.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr3.1",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr3.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxReadAuto( Stream => 2, Msg => "SW not ready 1.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);

View File

@ -324,7 +324,7 @@ package body psi_ms_daq_daq_sm_tb_case_single_window is
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr1.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr2.0",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr2.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr3.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
@ -340,7 +340,7 @@ package body psi_ms_daq_daq_sm_tb_case_single_window is
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr1.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr2.0",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr2.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr3.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
@ -363,7 +363,7 @@ package body psi_ms_daq_daq_sm_tb_case_single_window is
-- Linear without overwrite, trigger
WaitForCase(3, Clk);
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, Msg => "Wr0.0",
ExpCtxFullBurstAuto( Stream => 2, NextWin => true, IsTrig => true, Msg => "Wr0.0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxReadAuto( Stream => 2, Msg => "SW not ready 0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
@ -380,7 +380,7 @@ package body psi_ms_daq_daq_sm_tb_case_single_window is
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.1",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.3", NextWin => true,
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.3", NextWin => true, IsTrig => true,
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxReadAuto( Stream => 2, Msg => "SW not ready 0",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);

View File

@ -210,18 +210,18 @@ package body psi_ms_daq_daq_sm_tb_case_timestamp is
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.1", NextWin => true, WriteTs => CheckWritten, Timstamp => X"FFFFFFFFFFFFFFFF", -- without trigger, no timestamp is sampled
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
-- second window trigger in first access
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr1.0", NextWin => true, WriteTs => CheckWritten, Timstamp => X"0000000000000200",
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr1.0", NextWin => true, IsTrig => true, WriteTs => CheckWritten, Timstamp => X"0000000000000200",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
-- third window trigger in second access
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr2.0", WriteTs => CheckNotWritten,
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr2.1", NextWin => true, WriteTs => CheckWritten, Timstamp => X"0000000000000400",
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr2.1", NextWin => true, IsTrig => true, WriteTs => CheckWritten, Timstamp => X"0000000000000400",
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ProcDone(0) := '1';
-- timestamp on different stream has no effect
WaitForCase(1, Clk);
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.1", NextWin => true, WriteTs => CheckWritten, Timstamp => X"FFFFFFFFFFFFFFFF", -- No Timestamp available
ExpCtxFullBurstAuto( Stream => 2, Msg => "Wr0.1", NextWin => true, IsTrig => true, WriteTs => CheckWritten, Timstamp => X"FFFFFFFFFFFFFFFF", -- No Timestamp available
Clk => Clk, CtxStr_Cmd => CtxStr_Cmd, CtxStr_Resp => CtxStr_Resp, CtxWin_Cmd => CtxWin_Cmd, CtxWin_Resp => CtxWin_Resp);
ProcDone(0) := '1';

View File

@ -75,6 +75,7 @@ package psi_ms_daq_daq_sm_tb_pkg is
Wincur : in integer := 0;
WinSel : in integer := -1;
SamplesWin : in integer;
WinIsTrig : in boolean := false;
signal Clk : in std_logic;
signal CtxStr_Cmd : in ToCtxStr_t;
signal CtxStr_Resp : out FromCtx_t;
@ -92,6 +93,7 @@ package psi_ms_daq_daq_sm_tb_pkg is
Wincur : in integer := 0;
WinNext : in integer := -1;
SamplesWin : in integer;
WinIsTrig : in boolean := false;
WinLast : in integer;
WriteTs : in CheckTs_t := DontCheck;
Timstamp : in std_logic_vector(63 downto 0) := (others => 'X');
@ -103,6 +105,7 @@ package psi_ms_daq_daq_sm_tb_pkg is
procedure ExpCtxUpdate( Stream : in integer;
TfSize : in integer; -- in bytes
NextWin : in boolean := false;
IsTrig : in boolean := false;
BufStart : in integer := 16#01230000#;
WinSize : in integer := 16#00100000#;
PtrBefore : in integer := 16#01238000#;
@ -197,6 +200,7 @@ package psi_ms_daq_daq_sm_tb_pkg is
procedure ExpCtxUpdateAuto( Stream : in integer;
NextWin : in boolean := false;
IsTrig : in boolean := false;
WriteTs : in CheckTs_t := DontCheck;
Timstamp : in std_logic_vector(63 downto 0) := (others => 'X');
signal Clk : in std_logic;
@ -208,6 +212,7 @@ package psi_ms_daq_daq_sm_tb_pkg is
procedure ExpCtxFullBurstAuto( Stream : in integer;
NextWin : in boolean := false;
IsTrig : in boolean := false;
WriteTs : in CheckTs_t := DontCheck;
Timstamp : in std_logic_vector(63 downto 0) := (others => 'X');
signal Clk : in std_logic;
@ -308,6 +313,7 @@ package body psi_ms_daq_daq_sm_tb_pkg is
Wincur : in integer := 0;
WinSel : in integer := -1;
SamplesWin : in integer;
WinIsTrig : in boolean := false;
signal Clk : in std_logic;
signal CtxStr_Cmd : in ToCtxStr_t;
signal CtxStr_Resp : out FromCtx_t;
@ -346,7 +352,12 @@ package body psi_ms_daq_daq_sm_tb_pkg is
StdlCompare(0, CtxWin_Cmd.WenLo, "ApplyContext.Win: WenLo asserted - " & Msg);
StdlCompare(0, CtxWin_Cmd.WenHi, "ApplyContext.Win: WenHi asserted - " & Msg);
case CtxWin_Cmd.Sel is
when CtxWin_Sel_WincntWinlast_c => CtxWin_Resp.RdatLo <= std_logic_vector(to_unsigned(SamplesWin, 32));
when CtxWin_Sel_WincntWinlast_c => CtxWin_Resp.RdatLo(30 downto 0) <= std_logic_vector(to_unsigned(SamplesWin, 31));
if WinIsTrig then
CtxWin_Resp.RdatLo(31) <= '1';
else
CtxWin_Resp.RdatLo(31) <= '0';
end if;
when others => report "###ERROR###: ApplyContext.Win: illegal CtxStr_Cmd.Sel - " & Msg severity error;
end case;
end if;
@ -363,6 +374,7 @@ package body psi_ms_daq_daq_sm_tb_pkg is
Wincur : in integer := 0;
WinNext : in integer := -1;
SamplesWin : in integer;
WinIsTrig : in boolean := false;
WinLast : in integer;
WriteTs : in CheckTs_t := DontCheck;
Timstamp : in std_logic_vector(63 downto 0) := (others => 'X');
@ -393,7 +405,8 @@ package body psi_ms_daq_daq_sm_tb_pkg is
IntCompare(Wincur, CtxWin_Cmd.Window, "ExpectContext.Win: Wrong Window number 0 - " & Msg);
StdlCompare(1, CtxWin_Cmd.WenLo, "ExpectContext.Win: WenLo not asserted in first cycle - " & Msg);
StdlCompare(1, CtxWin_Cmd.WenHi, "ExpectContext.Win: WenHi not asserted in first cycle - " & Msg);
StdlvCompareInt(SamplesWin, CtxWin_Cmd.WdatLo, "ExpectContext.Str: Wrong WIN_WINCNT - " & Msg);
StdlvCompareInt(SamplesWin, CtxWin_Cmd.WdatLo(30 downto 0), "ExpectContext.Win: Wrong WIN_WINCNT - " & Msg);
StdlCompare(Choose(WinIsTrig, 1, 0), CtxWin_Cmd.WdatLo(31), "ExpectContext.Win Wrong WIN_ISTRIG - " & Msg);
StdlvCompareInt(WinLast, CtxWin_Cmd.WdatHi, "ExpectContext.Str: Wrong WIN_WINLAST - " & Msg);
wait until rising_edge(Clk) and CtxStr_Cmd.WenHi = '1';
@ -426,6 +439,7 @@ package body psi_ms_daq_daq_sm_tb_pkg is
procedure ExpCtxUpdate( Stream : in integer;
TfSize : in integer; -- in bytes
NextWin : in boolean := false;
IsTrig : in boolean := false;
BufStart : in integer := 16#01230000#;
WinSize : in integer := 16#00100000#;
PtrBefore : in integer := 16#01238000#;
@ -500,6 +514,7 @@ package body psi_ms_daq_daq_sm_tb_pkg is
Wincur => Wincur,
WinNext => WinAfter_v,
SamplesWin => SampleswinAfter_v,
WinIsTrig => IsTrig,
WinLast => WinLastAfter_v,
WriteTs => WriteTs,
Timstamp => Timstamp,
@ -671,6 +686,7 @@ package body psi_ms_daq_daq_sm_tb_pkg is
procedure ExpCtxUpdateAuto( Stream : in integer;
NextWin : in boolean := false;
IsTrig : in boolean := false;
WriteTs : in CheckTs_t := DontCheck;
Timstamp : in std_logic_vector(63 downto 0) := (others => 'X');
signal Clk : in std_logic;
@ -686,6 +702,7 @@ package body psi_ms_daq_daq_sm_tb_pkg is
ExpCtxUpdate( Stream => Stream,
TfSize => AutoAccessSize_v(Stream),
NextWin => NextWin,
IsTrig => IsTrig,
BufStart => BufStart_c(Stream),
WinSize => AutoWinSize_v,
PtrBefore => PtrStr_v(Stream),
@ -725,6 +742,7 @@ package body psi_ms_daq_daq_sm_tb_pkg is
procedure ExpCtxFullBurstAuto( Stream : in integer;
NextWin : in boolean := false;
IsTrig : in boolean := false;
WriteTs : in CheckTs_t := DontCheck;
Timstamp : in std_logic_vector(63 downto 0) := (others => 'X');
signal Clk : in std_logic;
@ -743,6 +761,7 @@ package body psi_ms_daq_daq_sm_tb_pkg is
Msg => Msg);
ExpCtxUpdateAuto( Stream => Stream,
NextWin => NextWin,
IsTrig => IsTrig,
WriteTs => WriteTs,
Timstamp => Timstamp,
Clk => Clk,