diff --git a/hdl/combpm_protocol_electron.vhd b/hdl/combpm_protocol_electron.vhd index ee7c9b150153de2a174b16c5bec5e3d5b23e278c..521e0dcf276bd22e2db924b138c93d8a308ef954 100644 --- a/hdl/combpm_protocol_electron.vhd +++ b/hdl/combpm_protocol_electron.vhd @@ -3,41 +3,33 @@ library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; -use work.pkg_combpm_stream.all; +use work.pkg_bpmframe_stream.all; entity combpm_protocol_electron is port( - rst_n : in std_logic; - clk : in std_logic; - pps : in std_logic; + rst_n : in std_logic; -- Asynchronous active low reset. + clk : in std_logic; -- Clock synchronous to data input. + pps : in std_logic; -- One pulse per second. Used for frame rate estimation. - mc_time : in std_logic_vector(39 downto 0); + mc_time : in std_logic_vector(39 downto 0); -- Machine clock time for frame time stamping. -- GT interface - gt_datarx : in std_logic_vector(15 downto 0); - gt_interfaceready : in std_logic; + gt_datarx : in std_logic_vector(15 downto 0); -- Deserialized data. -- AXIS interface - m_axi_tid : out std_logic_vector(0 downto 0); - m_axi_tdest : out std_logic_vector(9 downto 0); - m_axi_tdata : out std_logic_vector(127 downto 0); - m_axi_tstrb : out std_logic_vector(15 downto 0); - m_axi_tkeep : out std_logic_vector(15 downto 0); - m_axi_tlast : out std_logic; - m_axi_tuser : out std_logic_vector(0 downto 0); - m_axi_tvalid : out std_logic; - m_axi_tready : in std_logic; + m_axis_m2s : out t_bpmframe_axis_m2s; + m_axis_s2m : in t_bpmframe_axis_s2m; -- warning: TREADY is ignored ! -- Status and control interface - soft_reset : in std_logic; - frame_seq_cnt : out std_logic_vector(15 downto 0); - frame_valid_cnt : out std_logic_vector(31 downto 0); - frame_invalid_cnt : out std_logic_vector(31 downto 0); - frame_valid_rate : out std_logic_vector(31 downto 0); - frame_invalid_rate : out std_logic_vector(31 downto 0); - cnt_seq_mismatch : out std_logic; - seq_discontinuity : out std_logic; - frame_error : out std_logic + soft_reset : in std_logic; -- Reset all counters. + frame_seq_cnt : out std_logic_vector(15 downto 0); -- Number of frame in last sequence. + frame_valid_cnt : out std_logic_vector(31 downto 0); -- Count of valid frames. + frame_invalid_cnt : out std_logic_vector(31 downto 0); -- Count of invalid frames. + frame_valid_rate : out std_logic_vector(31 downto 0); -- Valid frame rate. + frame_invalid_rate : out std_logic_vector(31 downto 0); -- Invalid frame rate. + cnt_seq_mismatch : out std_logic; -- Pulse for number of frame in sequence mismatch. + seq_discontinuity : out std_logic; -- Pulse for discontinuity in sequence number. + frame_error : out std_logic -- Pulse for frame error. ); end entity combpm_protocol_electron; @@ -91,6 +83,7 @@ architecture rtl of combpm_protocol_electron is signal rate_invalid_r : unsigned(31 downto 0); signal packet : t_combpm_axis_packet; + signal m_axi_tvalid : std_logic; begin @@ -135,8 +128,8 @@ begin '0'; -- Any and all flag - flag_all <= flag_sop and flag_eop and flag_dummy and flag_rsvd and flag_crc and gt_interfaceready; - flag_frame <= flag_sop and flag_eop and gt_interfaceready; + flag_all <= flag_sop and flag_eop and flag_dummy and flag_rsvd and flag_crc; + flag_frame <= flag_sop and flag_eop; ---------------------------- -- FRAME FIELD EXTRACTION -- @@ -242,13 +235,11 @@ begin -------------- -- AXIS OUT -- -------------- - -- Static data - m_axi_tstrb <= (others => '1'); - m_axi_tkeep <= (others => '1'); - m_axi_tid <= "0"; - m_axi_tuser <= "0"; - m_axi_tlast <= '1'; -- One transfer is One packet. - m_axi_tdata <= combpmpacket2slv(packet); + m_axis_m2s.tdest <= (others => '0'); + m_axis_m2s.tdata <= combpmpacket2slv(packet); + m_axis_m2s.tlast <= '1'; -- One transfer is One packet. + m_axis_m2s.tvalid <= m_axi_tvalid; + p_axis:process(clk, rst_n) begin diff --git a/hdl/pkg_combpm_stream.vhd b/hdl/pkg_bpmframe_stream.vhd similarity index 85% rename from hdl/pkg_combpm_stream.vhd rename to hdl/pkg_bpmframe_stream.vhd index 1a923b268f30c89414c4e1ee9360301c827ed796..5f8426a4d007a980cad417a3f6d6974d9b697b62 100644 --- a/hdl/pkg_combpm_stream.vhd +++ b/hdl/pkg_bpmframe_stream.vhd @@ -1,3 +1,10 @@ +-- Package BPMFRAME STREAM +-- this package describe the format of the AXI-Stream interface used by blocs of the module COMBPM. +-- +-- The usefull things are : +-- * Two record types for port interfaces: t_bpmframe_axis_m2s and t_bpmframe_axis_s2m. +-- * One record type for frame fields: t_bpmframe. +-- * Two functions to transform TDATA (std_logic_vector) to/from t_bpmframe: slv2bpmframe and bpmframe2slv. library ieee; use ieee.std_logic_1164.all; @@ -17,21 +24,12 @@ package pkg_bpmframe_stream is tdata : std_logic_vector(C_TDATA_W-1 downto 0); tlast : std_logic; tvalid : std_logic; - ---tid : std_logic_vector(0 downto 0); - --tuser : std_logic_vector(0 downto 0); - --tstrb : std_logic_vector(15 downto 0); - --tkeep : std_logic_vector(15 downto 0); end record t_bpmframe_axis_m2s; type t_bpmframe_axis_s2m is record tready : std_logic; end record t_bpmframe_axis_s2m; - subtype t_bpmframe_m_axis_out is t_bpmframe_axis_m2s; - subtype t_bpmframe_s_axis_in is t_bpmframe_axis_m2s; - subtype t_bpmframe_m_axis_in is t_bpmframe_axis_s2m; - subtype t_bpmframe_s_axis_out is t_bpmframe_axis_s2m; - ------------------------ -- AXIS STREAM PACKET -- ------------------------