--- /dev/null
+-- this is an apl, connecting the old trigger bus to the new system
+
+
+LIBRARY IEEE;
+USE IEEE.STD_LOGIC_1164.ALL;
+USE IEEE.STD_LOGIC_ARITH.ALL;
+USE IEEE.STD_LOGIC_UNSIGNED.ALL;
+
+use work.trb_net_std.all;
+
+
+entity trb_net_old_to_new is
+ generic (TRIGGER_LEVEL : integer := 1); -- either 1 or 2
+
+ port(
+ -- Misc
+ CLK : in std_logic;
+ RESET : in std_logic;
+ CLK_EN : in std_logic;
+
+ -- APL Transmitter port
+ APL_DATA_OUT: out STD_LOGIC_VECTOR (47 downto 0); -- Data word "application to network"
+ APL_WRITE_OUT: out STD_LOGIC; -- Data word is valid and should be transmitted
+ APL_FIFO_FULL_IN: in STD_LOGIC; -- Stop transfer, the fifo is full
+ APL_SHORT_TRANSFER_OUT: out STD_LOGIC; --
+ APL_DTYPE_OUT: out STD_LOGIC_VECTOR (3 downto 0); -- see NewTriggerBusNetworkDescr
+ APL_ERROR_PATTERN_OUT: out STD_LOGIC_VECTOR (31 downto 0); -- see NewTriggerBusNetworkDescr
+ APL_SEND_OUT: out STD_LOGIC; -- Release sending of the data
+ APL_TARGET_ADDRESS_OUT: out STD_LOGIC_VECTOR (15 downto 0); -- Address of
+ -- the target (only for active APIs)
+
+ -- Receiver port
+ APL_DATA_IN: in STD_LOGIC_VECTOR (47 downto 0); -- Data word "network to application"
+ APL_TYP_IN: in STD_LOGIC_VECTOR (2 downto 0); -- Which kind of data word: DAT, HDR or TRM
+ APL_DATAREADY_IN: in STD_LOGIC; -- Data word is valid and might be read out
+ APL_READ_OUT: out STD_LOGIC; -- Read data word
+
+ -- APL Control port
+ APL_RUN_IN: in STD_LOGIC; -- Data transfer is running
+ APL_SEQNR_IN: in STD_LOGIC_VECTOR (7 downto 0),
+
+ -- the OLD trigger bus
+ OLD_T: in STD_LOGIC; -- trigger signal
+ -- used to strobe the trigger code
+ OLD_TS: in STD_LOGIC; -- trigger strobe
+-- used to strobe the trigger tag and further
+-- trigger data nibbles (e.g. trigger priority)
+
+ OLD_TD: in STD_LOGIC_VECTOR (3 downto 0); -- trigger data lines
+-- transmit the trigger data nibbles
+ OLD_TB: out STD_LOGIC; -- trigger busy
+-- wired-or signal, that indicates busy state of one or more DTUs
+ OLD_TE: out STD_LOGIC; -- trigger error
+-- wired-or signal, that indicates error state of one or more DTUs
+--Ts0..1 trigger spare lines
+--free for future purposes
+--not connected because useless
+
+
+ );
+END trb_net_old_to_new;
+
+architecture trb_net_old_to_new_arch of trb_net_old_to_new is
+
+ -- reconstruct the LVL1 or LVL2 trigger
+ -- for LVL1: Ignore the BEGRUN and ENDRUN triggers
+ -- (please use the generic to check if we have LVL1 or 2)
+
+ -- compare to the SEQNR, do not forget the offset by one for LVL1
+ -- if a tigger tag mismatch occures, raise the error line
+
+ -- feel free to add debug registers
+
+end trb_net_old_to_new_arch;