BUGFIX: Fixed handling of TLAST remaining in DMA engine buffer
This commit is contained in:
@ -77,6 +77,7 @@ architecture rtl of psi_ms_daq is
|
||||
signal DmaSm_Resp : DaqDma2DaqSm_Resp_t;
|
||||
signal DmaSm_RespVld : std_logic;
|
||||
signal DmaSm_RespRdy : std_logic;
|
||||
signal DmaSm_HasLast : std_logic_vector(Streams_g-1 downto 0);
|
||||
|
||||
-- Input/Dma
|
||||
signal InpDma_Vld : std_logic_vector(Streams_g-1 downto 0);
|
||||
@ -112,6 +113,9 @@ architecture rtl of psi_ms_daq is
|
||||
signal CtxWin_Cmd : ToCtxWin_t;
|
||||
signal CtxWin_Resp : FromCtx_t;
|
||||
|
||||
-- Others
|
||||
signal Sm_HasLast : std_logic_vector(Streams_g-1 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
--------------------------------------------
|
||||
@ -199,7 +203,11 @@ begin
|
||||
|
||||
--------------------------------------------
|
||||
-- Control State Machine
|
||||
--------------------------------------------
|
||||
--------------------------------------------
|
||||
-- Detect end-of frame in input buffer or DMA buffer
|
||||
Sm_HasLast <= InpSm_HasTlast or DmaSm_HasLast;
|
||||
|
||||
-- Instantiation
|
||||
i_statemachine : entity work.psi_ms_daq_daq_sm
|
||||
generic map (
|
||||
Streams_g => Streams_g,
|
||||
@ -215,7 +223,7 @@ begin
|
||||
GlbEna => Cfg_GlbEna,
|
||||
StrEna => Cfg_StrEna,
|
||||
StrIrq => Stat_StrIrq,
|
||||
Inp_HasLast => InpSm_HasTlast,
|
||||
Inp_HasLast => Sm_HasLast,
|
||||
Inp_Level => InpSm_Level,
|
||||
Ts_Vld => InpSm_TsVld,
|
||||
Ts_Rdy => InpSm_TsRdy,
|
||||
@ -249,6 +257,7 @@ begin
|
||||
DaqSm_Resp => DmaSm_Resp,
|
||||
DaqSm_Resp_Vld => DmaSm_RespVld,
|
||||
DaqSm_Resp_Rdy => DmaSm_RespRdy,
|
||||
DaqSm_HasLast => DmaSm_HasLast,
|
||||
Inp_Vld => InpDma_Vld,
|
||||
Inp_Rdy => InpDma_Rdy,
|
||||
Inp_Data => InpDma_Data,
|
||||
|
@ -19,7 +19,7 @@ library work;
|
||||
------------------------------------------------------------------------------
|
||||
-- Entity Declaration
|
||||
------------------------------------------------------------------------------
|
||||
-- $$ testcases=aligned,unaligned,odd_size,no_data_read,input_empty,timetout,empty_timeout,trigger,cmd_full,data_full $$
|
||||
-- $$ testcases=aligned,unaligned,no_data_read,input_empty,empty_timeout,cmd_full,data_full,errors $$
|
||||
-- $$ processes=control,input,mem_cmd,mem_dat $$
|
||||
-- $$ tbpkg=work.psi_tb_txt_util,work.psi_tb_compare_pkg,work.psi_tb_activity_pkg $$
|
||||
entity psi_ms_daq_daq_dma is
|
||||
@ -37,6 +37,7 @@ entity psi_ms_daq_daq_dma is
|
||||
DaqSm_Resp : out DaqDma2DaqSm_Resp_t; -- $$ proc=control $$
|
||||
DaqSm_Resp_Vld : out std_logic; -- $$ proc=control $$
|
||||
DaqSm_Resp_Rdy : in std_logic; -- $$ proc=control $$
|
||||
DaqSm_HasLast : out std_logic_vector(Streams_g-1 downto 0); -- $$ proc=control $$
|
||||
|
||||
-- Input handling connections
|
||||
Inp_Vld : in std_logic_vector(Streams_g-1 downto 0); -- $$ proc=input $$
|
||||
@ -76,6 +77,8 @@ architecture rtl of psi_ms_daq_daq_dma is
|
||||
signal DatFifo_AlmFull : std_logic;
|
||||
signal Rem_RdBytes : std_logic_vector(2 downto 0);
|
||||
signal Rem_Data : std_logic_vector(63 downto 0);
|
||||
signal Rem_Trigger : std_logic;
|
||||
signal Rem_Last : std_logic;
|
||||
|
||||
-- Types
|
||||
type State_t is (Idle_s, RemRd1_s, RemRd2_s, Transfer_s, Done_s, Cmd_s);
|
||||
@ -90,6 +93,10 @@ architecture rtl of psi_ms_daq_daq_dma is
|
||||
RemWen : std_logic;
|
||||
RemWrBytes : std_logic_vector(2 downto 0);
|
||||
RemData : std_logic_vector(63 downto 0);
|
||||
RemTrigger : std_logic;
|
||||
RemLast : std_logic;
|
||||
RemWrTrigger : std_logic;
|
||||
RemWrLast : std_logic;
|
||||
State : State_t;
|
||||
HndlMaxSize : unsigned(15 downto 0);
|
||||
RdBytes : unsigned(15 downto 0);
|
||||
@ -101,9 +108,11 @@ architecture rtl of psi_ms_daq_daq_dma is
|
||||
FirstDma : std_logic_vector(Streams_g-1 downto 0);
|
||||
Mem_CmdVld : std_logic;
|
||||
Trigger : std_logic;
|
||||
Last : std_logic;
|
||||
DataSft : std_logic_vector(127 downto 0);
|
||||
NextDone : std_logic;
|
||||
DataWritten : std_logic;
|
||||
HasLast : std_logic_vector(Streams_g-1 downto 0);
|
||||
end record;
|
||||
signal r, r_next : two_process_r;
|
||||
|
||||
@ -113,7 +122,7 @@ begin
|
||||
-- Combinatorial Process
|
||||
--------------------------------------------
|
||||
p_comb : process( r, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp_Rdy, Inp_Vld, Inp_Data, Mem_CmdRdy, Mem_DatRdy,
|
||||
CmdFifo_Cmd, CmdFifo_Vld, DatFifo_AlmFull, Rem_RdBytes, Rem_Data)
|
||||
CmdFifo_Cmd, CmdFifo_Vld, DatFifo_AlmFull, Rem_RdBytes, Rem_Data, Rem_Trigger, Rem_Last)
|
||||
variable v : two_process_r;
|
||||
variable ThisByte_v : std_logic_vector(7 downto 0);
|
||||
variable RemSft_v : integer range 0 to 7;
|
||||
@ -138,6 +147,7 @@ begin
|
||||
v.StreamStdlv := std_logic_vector(to_unsigned(CmdFifo_Cmd.Stream, v.StreamStdlv'length));
|
||||
v.HndlAddress := CmdFifo_Cmd.Address;
|
||||
v.Trigger := '0';
|
||||
v.Last := '0';
|
||||
if CmdFifo_Vld = '1' then
|
||||
v.CmdFifo_Rdy := '1';
|
||||
v.State := RemRd1_s;
|
||||
@ -153,10 +163,14 @@ begin
|
||||
v.HndlSft := (others => '0');
|
||||
v.RdBytes := (others => '0');
|
||||
v.DataSft := (others => '0');
|
||||
v.RemTrigger := '0';
|
||||
v.RemLast := '0';
|
||||
else
|
||||
v.HndlSft := unsigned(Rem_RdBytes);
|
||||
v.DataSft(127 downto 64) := Rem_Data;
|
||||
v.RdBytes := resize(unsigned(Rem_RdBytes), v.RdBytes'length);
|
||||
v.RemTrigger := Rem_Trigger;
|
||||
v.RemLast := Rem_Last;
|
||||
end if;
|
||||
v.FirstDma(r.HndlStream) := '0';
|
||||
v.State := Transfer_s;
|
||||
@ -168,23 +182,26 @@ begin
|
||||
if r.WrBytes >= r.HndlMaxSize then
|
||||
v.State := Done_s;
|
||||
elsif DatFifo_AlmFull = '0' then
|
||||
if r.NextDone = '0' and Inp_Vld(r.HndlStream) = '1' then
|
||||
if r.NextDone = '0' and Inp_Vld(r.HndlStream) = '1' and r.RemLast = '0' then
|
||||
v.RdBytes := r.RdBytes + unsigned(Inp_Data(r.HndlStream).Bytes);
|
||||
end if;
|
||||
v.WrBytes := r.WrBytes + 8;
|
||||
-- Combinatorial handling because of fall-through interface at input
|
||||
if r.RdBytes < r.HndlMaxSize and r.NextDone = '0' then
|
||||
if r.RdBytes < r.HndlMaxSize and r.NextDone = '0' and r.RemLast = '0' then
|
||||
Inp_Rdy(r.HndlStream) <= '1';
|
||||
end if;
|
||||
-- Handling of last frame
|
||||
if Inp_Data(r.HndlStream).Last = '1' then
|
||||
if (Inp_Data(r.HndlStream).Last = '1') or (r.RemLast = '1') then
|
||||
-- Do one more word if not all data can be transferred in the current beat (NextDone = 1)
|
||||
if r.HndlSft + unsigned(Inp_Data(r.HndlStream).Bytes) <= 8 then
|
||||
if (r.HndlSft + unsigned(Inp_Data(r.HndlStream).Bytes) <= 8) or (r.RemLast = '1') then
|
||||
v.State := Done_s;
|
||||
else
|
||||
v.NextDone := '1';
|
||||
end if;
|
||||
v.Trigger := Inp_Data(r.HndlStream).IsTrig;
|
||||
if (Inp_Data(r.HndlStream).IsTrig = '1') or (r.RemTrigger = '1') then
|
||||
v.Trigger :='1';
|
||||
end if;
|
||||
v.Last := '1';
|
||||
end if;
|
||||
if r.NextDone = '1' or Inp_Vld(r.HndlStream) = '0' then
|
||||
v.State := Done_s;
|
||||
@ -200,11 +217,17 @@ begin
|
||||
|
||||
when Done_s =>
|
||||
RemSft_v := to_integer(resize(r.HndlMaxSize, 3));
|
||||
v.RemWrTrigger := '0';
|
||||
v.RemWrLast := '0';
|
||||
if r.HndlMaxSize < r.RdBytes then
|
||||
v.RemWrBytes := std_logic_vector(resize(r.RdBytes - r.HndlMaxSize, v.RemWrBytes'length));
|
||||
v.RdBytes := r.HndlMaxSize;
|
||||
v.RdBytes := r.HndlMaxSize;
|
||||
v.RemWrTrigger := r.Trigger;
|
||||
v.RemWrLast := r.Last;
|
||||
v.HasLast(r.HndlStream) := r.Last;
|
||||
else
|
||||
v.RemWrBytes := (others => '0');
|
||||
v.HasLast(r.HndlStream) := '0';
|
||||
end if;
|
||||
v.RemData := v.DataSft(8*RemSft_v+63 downto 8*RemSft_v);
|
||||
v.State := Cmd_s;
|
||||
@ -219,7 +242,12 @@ begin
|
||||
v.Mem_CmdVld := '0';
|
||||
v.RspFifo_Vld := '1';
|
||||
v.RspFifo_Data.Size := std_logic_vector(r.RdBytes);
|
||||
v.RspFifo_Data.Trigger := r.Trigger;
|
||||
-- Only mark as trigger if all samples are completely written to memory (no remaining samples in REM RAM)
|
||||
if (unsigned(r.RemWrBytes) = 0) and (r.Trigger = '1') then
|
||||
v.RspFifo_Data.Trigger := '1';
|
||||
else
|
||||
v.RspFifo_Data.Trigger := '0';
|
||||
end if;
|
||||
v.RspFifo_Data.Stream := r.HndlStream;
|
||||
end if;
|
||||
when others => null;
|
||||
@ -235,6 +263,8 @@ begin
|
||||
Mem_CmdSize(r.RdBytes'range) <= std_logic_vector(r.RdBytes);
|
||||
Mem_CmdSize(Mem_CmdSize'high downto r.RdBytes'high+1) <= (others => '0');
|
||||
Mem_CmdVld <= r.Mem_CmdVld;
|
||||
DaqSm_HasLast <= r.HasLast;
|
||||
|
||||
|
||||
--------------------------------------------
|
||||
-- Sequential Process
|
||||
@ -251,6 +281,7 @@ begin
|
||||
r.State <= Idle_s;
|
||||
r.FirstDma <= (others => '1');
|
||||
r.Mem_CmdVld <= '0';
|
||||
r.HasLast <= (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
@ -327,7 +358,7 @@ begin
|
||||
i_remram : entity work.psi_common_sdp_ram_rbw
|
||||
generic map (
|
||||
Depth_g => Streams_g,
|
||||
Width_g => 3+64,
|
||||
Width_g => 1+1+3+64,
|
||||
IsAsync_g => false,
|
||||
RamStyle_g => "distributed"
|
||||
)
|
||||
@ -336,9 +367,13 @@ begin
|
||||
RdClk => Rst,
|
||||
WrAddr => r.StreamStdlv,
|
||||
Wr => r.RemWen,
|
||||
WrData(68) => r.RemWrLast,
|
||||
WrData(67) => r.RemWrTrigger,
|
||||
WrData(66 downto 64) => r.RemWrBytes,
|
||||
WrData(63 downto 0) => r.RemData,
|
||||
RdAddr => r.StreamStdlv,
|
||||
RdDAta(68) => Rem_Last,
|
||||
RdData(67) => Rem_Trigger,
|
||||
RdData(66 downto 64) => Rem_RdBytes,
|
||||
RdData(63 downto 0) => Rem_Data
|
||||
);
|
||||
|
@ -70,6 +70,7 @@ add_sources "../tb" {
|
||||
psi_ms_daq_daq_dma/psi_ms_daq_daq_dma_tb_case_data_full.vhd \
|
||||
psi_ms_daq_daq_dma/psi_ms_daq_daq_dma_tb_case_cmd_full.vhd \
|
||||
psi_ms_daq_daq_dma/psi_ms_daq_daq_dma_tb_case_aligned.vhd \
|
||||
psi_ms_daq_daq_dma/psi_ms_daq_daq_dma_tb_case_errors.vhd \
|
||||
psi_ms_daq_daq_dma/psi_ms_daq_daq_dma_tb.vhd \
|
||||
psi_ms_daq/psi_ms_daq_tb_pkg.vhd \
|
||||
psi_ms_daq/psi_ms_daq_tb_str0_pkg.vhd \
|
||||
|
@ -32,6 +32,7 @@ library work;
|
||||
use work.psi_ms_daq_daq_dma_tb_case_empty_timeout.all;
|
||||
use work.psi_ms_daq_daq_dma_tb_case_cmd_full.all;
|
||||
use work.psi_ms_daq_daq_dma_tb_case_data_full.all;
|
||||
use work.psi_ms_daq_daq_dma_tb_case_errors.all;
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Entity Declaration
|
||||
@ -70,6 +71,7 @@ architecture sim of psi_ms_daq_daq_dma_tb is
|
||||
signal DaqSm_Resp : DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : std_logic := '0';
|
||||
signal DaqSm_Resp_Rdy : std_logic := '0';
|
||||
signal DaqSm_HasLast : std_logic_vector(Streams_g-1 downto 0) := (others => '0');
|
||||
signal Inp_Vld : std_logic_vector(Streams_g-1 downto 0) := (others => '0');
|
||||
signal Inp_Rdy : std_logic_vector(Streams_g-1 downto 0) := (others => '0');
|
||||
signal Inp_Data : Input2Daq_Data_a(Streams_g-1 downto 0);
|
||||
@ -97,6 +99,7 @@ begin
|
||||
DaqSm_Resp => DaqSm_Resp,
|
||||
DaqSm_Resp_Vld => DaqSm_Resp_Vld,
|
||||
DaqSm_Resp_Rdy => DaqSm_Resp_Rdy,
|
||||
DaqSm_HasLast => DaqSm_HasLast,
|
||||
Inp_Vld => Inp_Vld,
|
||||
Inp_Rdy => Inp_Rdy,
|
||||
Inp_Data => Inp_Data,
|
||||
@ -135,6 +138,9 @@ begin
|
||||
-- data_full
|
||||
NextCase <= 6;
|
||||
wait until ProcessDone = AllProcessesDone_c;
|
||||
-- errors
|
||||
NextCase <= 7;
|
||||
wait until ProcessDone = AllProcessesDone_c;
|
||||
TbRunning <= false;
|
||||
wait;
|
||||
end process;
|
||||
@ -175,45 +181,51 @@ begin
|
||||
-- aligned
|
||||
wait until NextCase = 0;
|
||||
ProcessDone(TbProcNr_control_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_aligned.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Generics_c);
|
||||
work.psi_ms_daq_daq_dma_tb_case_aligned.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, DaqSm_HasLast, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_control_c) <= '1';
|
||||
-- unaligned
|
||||
wait until NextCase = 1;
|
||||
ProcessDone(TbProcNr_control_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_unaligned.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Generics_c);
|
||||
work.psi_ms_daq_daq_dma_tb_case_unaligned.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, DaqSm_HasLast, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_control_c) <= '1';
|
||||
-- no_data_read
|
||||
wait until NextCase = 2;
|
||||
ProcessDone(TbProcNr_control_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_no_data_read.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Generics_c);
|
||||
work.psi_ms_daq_daq_dma_tb_case_no_data_read.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, DaqSm_HasLast, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_control_c) <= '1';
|
||||
-- input_empty
|
||||
wait until NextCase = 3;
|
||||
ProcessDone(TbProcNr_control_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_input_empty.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Generics_c);
|
||||
work.psi_ms_daq_daq_dma_tb_case_input_empty.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, DaqSm_HasLast, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_control_c) <= '1';
|
||||
-- empty_timeout
|
||||
wait until NextCase = 4;
|
||||
ProcessDone(TbProcNr_control_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_empty_timeout.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Generics_c);
|
||||
work.psi_ms_daq_daq_dma_tb_case_empty_timeout.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, DaqSm_HasLast, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_control_c) <= '1';
|
||||
-- cmd_full
|
||||
wait until NextCase = 5;
|
||||
ProcessDone(TbProcNr_control_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_cmd_full.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Generics_c);
|
||||
work.psi_ms_daq_daq_dma_tb_case_cmd_full.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, DaqSm_HasLast, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_control_c) <= '1';
|
||||
-- data_full
|
||||
wait until NextCase = 6;
|
||||
ProcessDone(TbProcNr_control_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_data_full.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Generics_c);
|
||||
work.psi_ms_daq_daq_dma_tb_case_data_full.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, DaqSm_HasLast, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_control_c) <= '1';
|
||||
-- errors
|
||||
wait until NextCase = 7;
|
||||
ProcessDone(TbProcNr_control_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_errors.control(Clk, Rst, DaqSm_Cmd, DaqSm_Cmd_Vld, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, DaqSm_HasLast, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_control_c) <= '1';
|
||||
wait;
|
||||
end process;
|
||||
|
||||
@ -262,6 +274,12 @@ begin
|
||||
work.psi_ms_daq_daq_dma_tb_case_data_full.input(Clk, Inp_Vld, Inp_Rdy, Inp_Data, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_input_c) <= '1';
|
||||
-- errors
|
||||
wait until NextCase = 7;
|
||||
ProcessDone(TbProcNr_input_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_errors.input(Clk, Inp_Vld, Inp_Rdy, Inp_Data, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_input_c) <= '1';
|
||||
wait;
|
||||
end process;
|
||||
|
||||
@ -310,6 +328,12 @@ begin
|
||||
work.psi_ms_daq_daq_dma_tb_case_data_full.mem_cmd(Clk, Mem_CmdAddr, Mem_CmdSize, Mem_CmdVld, Mem_CmdRdy, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_mem_cmd_c) <= '1';
|
||||
-- errors
|
||||
wait until NextCase = 7;
|
||||
ProcessDone(TbProcNr_mem_cmd_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_errors.mem_cmd(Clk, Mem_CmdAddr, Mem_CmdSize, Mem_CmdVld, Mem_CmdRdy, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_mem_cmd_c) <= '1';
|
||||
wait;
|
||||
end process;
|
||||
|
||||
@ -358,6 +382,12 @@ begin
|
||||
work.psi_ms_daq_daq_dma_tb_case_data_full.mem_dat(Clk, Mem_DatData, Mem_DatVld, Mem_DatRdy, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_mem_dat_c) <= '1';
|
||||
-- errors
|
||||
wait until NextCase = 7;
|
||||
ProcessDone(TbProcNr_mem_dat_c) <= '0';
|
||||
work.psi_ms_daq_daq_dma_tb_case_errors.mem_dat(Clk, Mem_DatData, Mem_DatVld, Mem_DatRdy, Generics_c);
|
||||
wait for 1 ps;
|
||||
ProcessDone(TbProcNr_mem_dat_c) <= '1';
|
||||
wait;
|
||||
end process;
|
||||
|
||||
|
@ -32,6 +32,7 @@ package psi_ms_daq_daq_dma_tb_case_aligned is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure input (
|
||||
@ -70,6 +71,7 @@ package body psi_ms_daq_daq_dma_tb_case_aligned is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
InitCase(Clk, Rst);
|
||||
|
@ -32,6 +32,7 @@ package psi_ms_daq_daq_dma_tb_case_cmd_full is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure input (
|
||||
@ -70,6 +71,7 @@ package body psi_ms_daq_daq_dma_tb_case_cmd_full is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
InitCase(Clk, Rst);
|
||||
|
@ -32,6 +32,7 @@ package psi_ms_daq_daq_dma_tb_case_data_full is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure input (
|
||||
@ -74,6 +75,7 @@ package body psi_ms_daq_daq_dma_tb_case_data_full is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
InitCase(Clk, Rst);
|
||||
|
@ -32,6 +32,7 @@ package psi_ms_daq_daq_dma_tb_case_empty_timeout is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure input (
|
||||
@ -70,6 +71,7 @@ package body psi_ms_daq_daq_dma_tb_case_empty_timeout is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
InitCase(Clk, Rst);
|
||||
|
184
tb/psi_ms_daq_daq_dma/psi_ms_daq_daq_dma_tb_case_errors.vhd
Normal file
184
tb/psi_ms_daq_daq_dma/psi_ms_daq_daq_dma_tb_case_errors.vhd
Normal file
@ -0,0 +1,184 @@
|
||||
------------------------------------------------------------
|
||||
-- Libraries
|
||||
------------------------------------------------------------
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.psi_common_math_pkg.all;
|
||||
use work.psi_common_logic_pkg.all;
|
||||
use work.psi_common_array_pkg.all;
|
||||
use work.psi_ms_daq_pkg.all;
|
||||
|
||||
library work;
|
||||
use work.psi_ms_daq_daq_dma_tb_pkg.all;
|
||||
|
||||
library work;
|
||||
use work.psi_tb_txt_util.all;
|
||||
use work.psi_tb_compare_pkg.all;
|
||||
use work.psi_tb_activity_pkg.all;
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Package Header
|
||||
------------------------------------------------------------
|
||||
package psi_ms_daq_daq_dma_tb_case_errors is
|
||||
|
||||
procedure control (
|
||||
signal Clk : in std_logic;
|
||||
signal Rst : inout std_logic;
|
||||
signal DaqSm_Cmd : inout DaqSm2DaqDma_Cmd_t;
|
||||
signal DaqSm_Cmd_Vld : inout std_logic;
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure input (
|
||||
signal Clk : in std_logic;
|
||||
signal Inp_Vld : inout std_logic_vector;
|
||||
signal Inp_Rdy : in std_logic_vector;
|
||||
signal Inp_Data : inout Input2Daq_Data_a;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure mem_cmd (
|
||||
signal Clk : in std_logic;
|
||||
signal Mem_CmdAddr : in std_logic_vector;
|
||||
signal Mem_CmdSize : in std_logic_vector;
|
||||
signal Mem_CmdVld : in std_logic;
|
||||
signal Mem_CmdRdy : inout std_logic;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure mem_dat (
|
||||
signal Clk : in std_logic;
|
||||
signal Mem_DatData : in std_logic_vector;
|
||||
signal Mem_DatVld : in std_logic;
|
||||
signal Mem_DatRdy : inout std_logic;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
end package;
|
||||
|
||||
------------------------------------------------------------
|
||||
-- Package Body
|
||||
------------------------------------------------------------
|
||||
package body psi_ms_daq_daq_dma_tb_case_errors is
|
||||
procedure control (
|
||||
signal Clk : in std_logic;
|
||||
signal Rst : inout std_logic;
|
||||
signal DaqSm_Cmd : inout DaqSm2DaqDma_Cmd_t;
|
||||
signal DaqSm_Cmd_Vld : inout std_logic;
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
InitCase(Clk, Rst);
|
||||
print(">> -- Error cases from top-tb and HW --");
|
||||
|
||||
-- Trigger in remaining data
|
||||
wait for 1 us;
|
||||
print(">> Trigger in remaining data");
|
||||
InitCase(Clk, Rst);
|
||||
InitSubCase(0);
|
||||
ApplyCmd(2, 16#01230000#, 26, DaqSm_Cmd, DaqSm_Cmd_Vld, Clk);
|
||||
StdlCompare(0, DaqSm_HasLast(2), "HasLast high unexpectedly");
|
||||
CheckResp(2, 26, NoEnd_s, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Clk);
|
||||
StdlCompare(1, DaqSm_HasLast(2), "HasLast low after incomplete frame");
|
||||
ApplyCmd(2, 16#01231000#, 30, DaqSm_Cmd, DaqSm_Cmd_Vld, Clk);
|
||||
StdlCompare(1, DaqSm_HasLast(2), "HasLast low after completion command");
|
||||
CheckResp(2, 2, Trigger_s, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Clk);
|
||||
StdlCompare(0, DaqSm_HasLast(2), "HasLast high after completion response");
|
||||
ApplyCmd(2, 16#01232000#, 30, DaqSm_Cmd, DaqSm_Cmd_Vld, Clk);
|
||||
CheckResp(2, 30, NoEnd_s, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Clk);
|
||||
WaitAllProc(Clk);
|
||||
|
||||
-- Timeout in remaining data
|
||||
wait for 1 us;
|
||||
print(">> Timeout in remaining data");
|
||||
InitCase(Clk, Rst);
|
||||
InitSubCase(1);
|
||||
ApplyCmd(2, 16#01230000#, 26, DaqSm_Cmd, DaqSm_Cmd_Vld, Clk);
|
||||
StdlCompare(0, DaqSm_HasLast(2), "HasLast high unexpectedly");
|
||||
CheckResp(2, 26, NoEnd_s, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Clk);
|
||||
StdlCompare(1, DaqSm_HasLast(2), "HasLast low after incomplete frame");
|
||||
ApplyCmd(2, 16#01231000#, 30, DaqSm_Cmd, DaqSm_Cmd_Vld, Clk);
|
||||
StdlCompare(1, DaqSm_HasLast(2), "HasLast low after completion command");
|
||||
CheckResp(2, 2, Timeout_s, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Clk);
|
||||
StdlCompare(0, DaqSm_HasLast(2), "HasLast high after completion response");
|
||||
ApplyCmd(2, 16#01232000#, 30, DaqSm_Cmd, DaqSm_Cmd_Vld, Clk);
|
||||
CheckResp(2, 30, NoEnd_s, DaqSm_Resp, DaqSm_Resp_Vld, DaqSm_Resp_Rdy, Clk);
|
||||
WaitAllProc(Clk);
|
||||
|
||||
end procedure;
|
||||
|
||||
procedure input (
|
||||
signal Clk : in std_logic;
|
||||
signal Inp_Vld : inout std_logic_vector;
|
||||
signal Inp_Rdy : in std_logic_vector;
|
||||
signal Inp_Data : inout Input2Daq_Data_a;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
-- Trigger in remaining data
|
||||
WaitForCase(0, Clk);
|
||||
ApplyData(2, 28, Trigger_s, Inp_Vld, Inp_Rdy, Inp_Data, Clk);
|
||||
ApplyData(2, 30, NoEnd_s, Inp_Vld, Inp_Rdy, Inp_Data, Clk, 128);
|
||||
ProcDone_V(0) := '1';
|
||||
|
||||
-- Timeout in remaining data
|
||||
WaitForCase(1, Clk);
|
||||
ApplyData(2, 28, Timeout_s, Inp_Vld, Inp_Rdy, Inp_Data, Clk);
|
||||
ApplyData(2, 30, NoEnd_s, Inp_Vld, Inp_Rdy, Inp_Data, Clk, 128);
|
||||
ProcDone_V(0) := '1';
|
||||
|
||||
end procedure;
|
||||
|
||||
procedure mem_cmd (
|
||||
signal Clk : in std_logic;
|
||||
signal Mem_CmdAddr : in std_logic_vector;
|
||||
signal Mem_CmdSize : in std_logic_vector;
|
||||
signal Mem_CmdVld : in std_logic;
|
||||
signal Mem_CmdRdy : inout std_logic;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
-- Trigger in remaining data
|
||||
WaitForCase(0, Clk);
|
||||
CheckMemCmd( 16#01230000#, 26, 0, Mem_CmdAddr, Mem_CmdSize, Mem_CmdVld, Mem_CmdRdy, Clk);
|
||||
CheckMemCmd( 16#01231000#, 2, 0, Mem_CmdAddr, Mem_CmdSize, Mem_CmdVld, Mem_CmdRdy, Clk);
|
||||
CheckMemCmd( 16#01232000#, 30, 0, Mem_CmdAddr, Mem_CmdSize, Mem_CmdVld, Mem_CmdRdy, Clk);
|
||||
ProcDone_V(1) := '1';
|
||||
|
||||
-- Timeout in remaining data
|
||||
WaitForCase(1, Clk);
|
||||
CheckMemCmd( 16#01230000#, 26, 0, Mem_CmdAddr, Mem_CmdSize, Mem_CmdVld, Mem_CmdRdy, Clk);
|
||||
CheckMemCmd( 16#01231000#, 2, 0, Mem_CmdAddr, Mem_CmdSize, Mem_CmdVld, Mem_CmdRdy, Clk);
|
||||
CheckMemCmd( 16#01232000#, 30, 0, Mem_CmdAddr, Mem_CmdSize, Mem_CmdVld, Mem_CmdRdy, Clk);
|
||||
ProcDone_V(1) := '1';
|
||||
|
||||
end procedure;
|
||||
|
||||
procedure mem_dat (
|
||||
signal Clk : in std_logic;
|
||||
signal Mem_DatData : in std_logic_vector;
|
||||
signal Mem_DatVld : in std_logic;
|
||||
signal Mem_DatRdy : inout std_logic;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
-- Trigger in remaining data
|
||||
WaitForCase(0, Clk);
|
||||
CheckMemData(26, 0, Mem_DatData, Mem_DatVld, Mem_DatRdy, Clk, 0, "1.0");
|
||||
CheckMemData(2, 0, Mem_DatData, Mem_DatVld, Mem_DatRdy, Clk, 26, "1.1");
|
||||
CheckMemData(30, 0, Mem_DatData, Mem_DatVld, Mem_DatRdy, Clk, 128, "1.2");
|
||||
ProcDone_V(2) := '1';
|
||||
|
||||
-- Timeout in remaining data
|
||||
WaitForCase(1, Clk);
|
||||
CheckMemData(26, 0, Mem_DatData, Mem_DatVld, Mem_DatRdy, Clk, 0, "1.0");
|
||||
CheckMemData(2, 0, Mem_DatData, Mem_DatVld, Mem_DatRdy, Clk, 26, "1.1");
|
||||
CheckMemData(30, 0, Mem_DatData, Mem_DatVld, Mem_DatRdy, Clk, 128, "1.2");
|
||||
ProcDone_V(2) := '1';
|
||||
|
||||
end procedure;
|
||||
|
||||
end;
|
@ -32,6 +32,7 @@ package psi_ms_daq_daq_dma_tb_case_input_empty is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure input (
|
||||
@ -72,6 +73,7 @@ package body psi_ms_daq_daq_dma_tb_case_input_empty is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
InitCase(Clk, Rst);
|
||||
|
@ -32,6 +32,7 @@ package psi_ms_daq_daq_dma_tb_case_no_data_read is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure input (
|
||||
@ -72,6 +73,7 @@ package body psi_ms_daq_daq_dma_tb_case_no_data_read is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
InitCase(Clk, Rst);
|
||||
|
@ -32,6 +32,7 @@ package psi_ms_daq_daq_dma_tb_case_unaligned is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t);
|
||||
|
||||
procedure input (
|
||||
@ -70,6 +71,7 @@ package body psi_ms_daq_daq_dma_tb_case_unaligned is
|
||||
signal DaqSm_Resp : in DaqDma2DaqSm_Resp_t;
|
||||
signal DaqSm_Resp_Vld : in std_logic;
|
||||
signal DaqSm_Resp_Rdy : inout std_logic;
|
||||
signal DaqSm_HasLast : in std_logic_vector;
|
||||
constant Generics_c : Generics_t) is
|
||||
begin
|
||||
InitCase(Clk, Rst);
|
||||
|
Reference in New Issue
Block a user