From c952d4893fd520c5c0738810bd3f2006a29e9dff Mon Sep 17 00:00:00 2001 From: Eric Kooistra <kooistra@astron.nl> Date: Thu, 16 Sep 2021 08:31:35 +0200 Subject: [PATCH] Corrected use of g_bsn_w < c_dp_stream_bsn_w = 64. --- libraries/base/dp/hdllib.cfg | 7 +- .../base/dp/src/vhdl/dp_bsn_align_v2.vhd | 2 +- .../base/dp/tb/vhdl/tb_dp_bsn_align_v2.vhd | 2 +- .../base/dp/tb/vhdl/tb_tb_dp_bsn_align_v2.vhd | 66 +++++++++++++++++++ 4 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 libraries/base/dp/tb/vhdl/tb_tb_dp_bsn_align_v2.vhd diff --git a/libraries/base/dp/hdllib.cfg b/libraries/base/dp/hdllib.cfg index feea37ef59..a969ee0025 100644 --- a/libraries/base/dp/hdllib.cfg +++ b/libraries/base/dp/hdllib.cfg @@ -298,7 +298,7 @@ test_bench_files = tb/vhdl/tb_tb_dp_block_from_mm.vhd tb/vhdl/tb_tb_dp_block_validate_channel.vhd tb/vhdl/tb_tb_dp_bsn_align.vhd - #src/vhdl/tb_tb_dp_bsn_align_v2.vhd + tb/vhdl/tb_tb_dp_bsn_align_v2.vhd tb/vhdl/tb_tb_dp_bsn_source_v2.vhd tb/vhdl/tb_tb_dp_bsn_sync_scheduler.vhd tb/vhdl/tb_tb_dp_concat.vhd @@ -355,6 +355,7 @@ regression_test_vhdl = tb/vhdl/tb_dp_latency_adapter.vhd tb/vhdl/tb_dp_shiftreg.vhd tb/vhdl/tb_dp_bsn_source.vhd + tb/vhdl/tb_mmp_dp_bsn_align_v2.vhd tb/vhdl/tb_mms_dp_bsn_source.vhd tb/vhdl/tb_mms_dp_bsn_source_v2.vhd tb/vhdl/tb_mmp_dp_bsn_sync_scheduler.vhd @@ -368,9 +369,7 @@ regression_test_vhdl = tb/vhdl/tb_tb_dp_block_gen_valid_arr.vhd tb/vhdl/tb_tb_dp_block_from_mm.vhd tb/vhdl/tb_tb_dp_block_validate_channel.vhd - tb/vhdl/tb_tb_dp_bsn_align.vhd - #tb/vhdl/tb_tb_dp_bsn_align_v2.vhd - tb/vhdl/tb_mmp_dp_bsn_align_v2.vhd + tb/vhdl/tb_tb_dp_bsn_align_v2.vhd tb/vhdl/tb_tb_dp_bsn_source_v2.vhd tb/vhdl/tb_tb_dp_bsn_sync_scheduler.vhd tb/vhdl/tb_tb_dp_concat.vhd diff --git a/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd b/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd index a82e866ed5..93503fa074 100644 --- a/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd +++ b/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd @@ -236,7 +236,7 @@ BEGIN v.mm_sosi.valid := '1'; -- . pass on timestamp information v.mm_sosi.sync := v.sync_arr(v.rd_pointer); - v.mm_sosi.bsn := v.bsn_arr(v.rd_pointer); + v.mm_sosi.bsn := RESIZE_DP_BSN(v.bsn_arr(v.rd_pointer)); -- . pass on filled flags for enabled streams via channel field, and -- determine whether the ouput has to insert filler data v.mm_sosi.channel := (OTHERS=>'0'); diff --git a/libraries/base/dp/tb/vhdl/tb_dp_bsn_align_v2.vhd b/libraries/base/dp/tb/vhdl/tb_dp_bsn_align_v2.vhd index d490525aa1..07a8dc2366 100644 --- a/libraries/base/dp/tb/vhdl/tb_dp_bsn_align_v2.vhd +++ b/libraries/base/dp/tb/vhdl/tb_dp_bsn_align_v2.vhd @@ -488,7 +488,7 @@ BEGIN -- hold mm_sosi.sync, bsn IF mm_sosi.sop = '1' THEN v.sync := mm_sosi.sync; - v.bsn := mm_sosi.bsn; + v.bsn := mm_sosi.bsn(g_bsn_w-1 DOWNTO 0); END IF; -- apply mm_sosi.sync, bsn at sop to all streams in out_sosi_arr diff --git a/libraries/base/dp/tb/vhdl/tb_tb_dp_bsn_align_v2.vhd b/libraries/base/dp/tb/vhdl/tb_tb_dp_bsn_align_v2.vhd new file mode 100644 index 0000000000..bfc16dfa09 --- /dev/null +++ b/libraries/base/dp/tb/vhdl/tb_tb_dp_bsn_align_v2.vhd @@ -0,0 +1,66 @@ +-- -------------------------------------------------------------------------- +-- Copyright 2021 +-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> +-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- -------------------------------------------------------------------------- +-- +-- Author: E. Kooistra, 15 sept 2021 +-- Purpose: Regression multi tb for dp_bsn_align_v2 +-- Description: +-- Usage: +-- > as 3 +-- > run -all + +LIBRARY IEEE; +USE IEEE.std_logic_1164.ALL; +USE work.tb_dp_pkg.ALL; + + +ENTITY tb_tb_dp_bsn_align_v2 IS +END tb_tb_dp_bsn_align_v2; + + +ARCHITECTURE tb OF tb_tb_dp_bsn_align_v2 IS + + CONSTANT c_block_size : NATURAL := 11; + CONSTANT c_diff_delay : NATURAL := 20; + CONSTANT c_diff_bsn : NATURAL := 3; -- g_diff_bsn = g_bsn_latency can just be aligned + CONSTANT c_bsn_latency_max : NATURAL := 1; + CONSTANT c_nof_repeat : NATURAL := 100; -- for constant active stream control using 1 is sufficient, use > 1 to verify longer with random stimuli + + SIGNAL tb_end : STD_LOGIC := '0'; -- declare tb_end to avoid 'No objects found' error on 'when -label tb_end' +BEGIN + + -- -- DUT + -- g_nof_streams : NATURAL := 2; -- number of input and output streams + -- g_bsn_latency_max : NATURAL := 1; -- Maximum travel latency of a remote block in number of block periods T_blk + -- g_bsn_latency_use_node_index : BOOLEAN := FALSE; -- FALSE for align at end node, TRUE for align at every intermediate node + -- g_block_size : NATURAL := 11; -- > 1, g_block_size=1 is not supported + -- g_bsn_w : NATURAL := c_dp_stream_bsn_w; -- number of bits in sosi BSN + -- g_data_w : NATURAL := 16; -- number of bits in sosi data + -- g_filler_value : INTEGER := 0; -- output sosi data value for missing input blocks + -- g_use_mm_output : BOOLEAN := FALSE; -- output via MM or via streaming DP + -- g_pipeline_input : NATURAL := 1; -- >= 0, choose 0 for wires, choose 1 to ease timing closure + -- g_rd_latency : NATURAL := 2; -- 1 or 2, choose 2 to ease timing closure + -- + -- -- TB + -- g_diff_delay : NATURAL := 0; + -- g_diff_bsn : NATURAL := 0; -- g_diff_bsn = g_bsn_latency_max can just be aligned + -- g_nof_repeat : NATURAL := 100 -- for constant active stream control using 1 is sufficient, use > 1 to verify longer with random stimuli + + u_mm_output : ENTITY work.tb_dp_bsn_align_v2 GENERIC MAP (2, c_bsn_latency_max, FALSE, 11, 32, 16, 0, TRUE, 0, 1, 0, 9, c_nof_repeat); + u_dp_output : ENTITY work.tb_dp_bsn_align_v2 GENERIC MAP (2, c_bsn_latency_max, FALSE, 11, 32, 16, 0, FALSE, 0, 1, 0, 9, c_nof_repeat); + +END tb; -- GitLab