-
BRONES Romain authored
Packet Filter * Address width for memory is now a generic * This width is a parameter for generation of xilinx ips * fix for synthesis COMBPM * use package for COMBPM packet package COMBPM * new constant for zero packet
BRONES Romain authoredPacket Filter * Address width for memory is now a generic * This width is a parameter for generation of xilinx ips * fix for synthesis COMBPM * use package for COMBPM packet package COMBPM * new constant for zero packet
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
pkg_combpm_stream.vhd 2.91 KiB
library ieee;
use ieee.std_logic_1164.all;
package pkg_combpm_stream is
----------------------
-- MACRO PARAMETERS --
----------------------
constant C_TDEST_W : natural := 7;
constant C_TDATA_W : natural := 128;
---------------------------------
-- AXIS MASTER/SLAVE INTERFACE --
---------------------------------
type t_combpm_axis_m2s is record
tdest : std_logic_vector(C_TDEST_W-1 downto 0);
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_combpm_axis_m2s;
type t_combpm_axis_s2m is record
tready : std_logic;
end record t_combpm_axis_s2m;
subtype t_combpm_m_axis_out is t_combpm_axis_m2s;
subtype t_combpm_s_axis_in is t_combpm_axis_m2s;
subtype t_combpm_m_axis_in is t_combpm_axis_s2m;
subtype t_combpm_s_axis_out is t_combpm_axis_s2m;
------------------------
-- AXIS STREAM PACKET --
------------------------
type t_combpm_axis_packet is record
pos_x : std_logic_vector(31 downto 0);
pos_y : std_logic_vector(31 downto 0);
bpm_id : std_logic_vector(15 downto 0);
mc_timestamp : std_logic_vector(39 downto 0);
fa_seq : std_logic_vector(7 downto 0);
end record t_combpm_axis_packet;
constant C_PACKET_ZERO : t_combpm_axis_packet := (
pos_x => (others => '0'),
pos_y => (others => '0'),
bpm_id => (others => '0'),
mc_timestamp => (others => '0'),
fa_seq => (others => '0')
);
function slv2combpmpacket(
signal tdata : std_logic_vector(C_TDATA_W-1 downto 0)
)
return t_combpm_axis_packet;
function combpmpacket2slv(
signal packet : t_combpm_axis_packet
)
return std_logic_vector;
end package;
package body pkg_combpm_stream is
function slv2combpmpacket(
signal tdata : std_logic_vector(C_TDATA_W-1 downto 0)
)
return t_combpm_axis_packet is
variable packet : t_combpm_axis_packet;
begin
packet.pos_x := tdata(31 downto 0);
packet.pos_y := tdata(63 downto 32);
packet.bpm_id := tdata(79 downto 64);
packet.mc_timestamp := tdata(119 downto 80);
packet.fa_seq := tdata(127 downto 120);
return packet;
end function;
function combpmpacket2slv(
signal packet : t_combpm_axis_packet
)
return std_logic_vector is
begin
return packet.fa_seq & packet.mc_timestamp & packet.bpm_id & packet.pos_y & packet.pos_x;
end function;
end package body;