Select Git revision
dp_stream_pkg.vhd
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
dp_stream_pkg.vhd 77.76 KiB
--------------------------------------------------------------------------------
--
-- Copyright (C) 2010
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--------------------------------------------------------------------------------
LIBRARY IEEE, common_lib;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.numeric_std.ALL;
USE common_lib.common_pkg.ALL;
PACKAGE dp_stream_pkg Is
------------------------------------------------------------------------------
-- General DP stream record defintion
------------------------------------------------------------------------------
-- Remarks:
-- * Choose smallest maximum SOSI slv lengths that fit all use cases, because unconstrained record fields slv is not allowed
-- * The large SOSI data field width of 256b has some disadvantages:
-- . about 10% extra simulation time and PC memory usage compared to 72b (measured using tb_unb_tse_board)
-- . a 256b number has 64 hex digits in the Wave window which is awkward because of the leading zeros when typically
-- only 32b are used, fortunately integer representation still works OK (except 0 which is shown as blank).
-- However the alternatives are not attractive, because they affect the implementation of the streaming
-- components that use the SOSI record. Alternatives are e.g.:
-- . define an extra long SOSI data field ldata[255:0] in addition to the existing data[71:0] field
-- . use the array of SOSI records to contain wider data, all with the same SOSI control field values
-- . define another similar SOSI record with data[255:0].
-- Therefore define data width as 256b, because the disadvantages are acceptable and the benefit is great, because all
-- streaming components can remain as they are.
-- * Added sync and bsn to SOSI to have timestamp information with the data
-- * Added re and im to SOSI to support complex data for DSP
-- * The sosi fields can be labeled in diffent groups: ctrl, info and data as shown in comment at the t_dp_sosi definition.
-- This grouping is useful for functions that operate on a t_dp_sosi signal.
-- * The info fields are valid at the sop or at the eop, but typically they hold their last active value to avoid unnessary
-- toggling and to ease viewing in the wave window.
CONSTANT c_dp_stream_bsn_w : NATURAL := 64; -- 64 is sufficient to count blocks of data for years
CONSTANT c_dp_stream_data_w : NATURAL := 768; -- 72 is sufficient for max word 8 * 9-bit. 576 supports half rate DDR4 bus data width. The current 768 is enough for wide single clock SLVs (e.g. headers)
CONSTANT c_dp_stream_dsp_data_w : NATURAL := 64; -- 64 is sufficient for DSP data, including complex power accumulates
CONSTANT c_dp_stream_empty_w : NATURAL := 16; -- 8 is sufficient for max 256 symbols per data word, still use 16 bit to be able to count c_dp_stream_data_w in bits
CONSTANT c_dp_stream_channel_w : NATURAL := 32; -- 32 is sufficient for several levels of hierarchy in mapping types of streams on to channels
CONSTANT c_dp_stream_error_w : NATURAL := 32; -- 32 is sufficient for several levels of hierarchy in mapping error numbers, e.g. 32 different one-hot encoded errors, bit [0] = 0 = OK
CONSTANT c_dp_stream_ok : NATURAL := 0; -- SOSI err field OK value
CONSTANT c_dp_stream_err : NATURAL := 1; -- SOSI err field error value /= OK
CONSTANT c_dp_stream_rl : NATURAL := 1; -- SISO default data path stream ready latency RL = 1
TYPE t_dp_siso IS RECORD -- Source In or Sink Out
ready : STD_LOGIC; -- fine cycle based flow control using ready latency RL >= 0
xon : STD_LOGIC; -- coarse typically block based flow control using xon/xoff
END RECORD;
TYPE t_dp_sosi IS RECORD -- Source Out or Sink In
sync : STD_LOGIC; -- ctrl