From 803afaf488ca03ae9231e3cc4092aed3b07b7e31 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Wed, 26 Oct 2022 11:54:52 +0200
Subject: [PATCH] Try different BG block lengths to verify nof octets in last
 word.

---
 libraries/io/eth/tb/vhdl/tb_tb_eth_tester.vhd | 38 ++++++++++++-------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/libraries/io/eth/tb/vhdl/tb_tb_eth_tester.vhd b/libraries/io/eth/tb/vhdl/tb_tb_eth_tester.vhd
index 536929bfed..4c004f2ac0 100644
--- a/libraries/io/eth/tb/vhdl/tb_tb_eth_tester.vhd
+++ b/libraries/io/eth/tb/vhdl/tb_tb_eth_tester.vhd
@@ -1,6 +1,6 @@
 -------------------------------------------------------------------------------
 --
--- Copyright 2020
+-- Copyright 2022
 -- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
 -- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
 --
@@ -40,26 +40,38 @@ ARCHITECTURE tb OF tb_tb_eth_tester IS
   CONSTANT c_bg_ctrl_rst      : t_diag_block_gen_integer := func_diag_bg_ctrl_slv_to_integer(c_diag_block_gen_rst);
   CONSTANT c_bg_ctrl_first    : t_diag_block_gen_integer := ('1', '1', 50, 8, 100, 0, 30, 0);  -- for first stream
   CONSTANT c_bg_ctrl_others   : t_diag_block_gen_integer := ('1', '1', 30, 8, 10, 0, 30, 0);   -- for other streams
+  CONSTANT c_bg_ctrl_len_0    : t_diag_block_gen_integer := ('1', '1', 80, 8, 100, 0, 30, 0);  -- nof octets
+  CONSTANT c_bg_ctrl_len_1    : t_diag_block_gen_integer := ('1', '1', 81, 8, 100, 0, 30, 0);  -- nof octets
+  CONSTANT c_bg_ctrl_len_2    : t_diag_block_gen_integer := ('1', '1', 82, 8, 100, 0, 30, 0);  -- nof octets
+  CONSTANT c_bg_ctrl_len_3    : t_diag_block_gen_integer := ('1', '1', 83, 8, 100, 0, 30, 0);  -- nof octets
 
-  SIGNAL   tb_end       : STD_LOGIC := '0';  -- declare tb_end to avoid 'No objects found' error on 'when -label tb_end'
+  SIGNAL tb_end       : STD_LOGIC := '0';  -- declare tb_end to avoid 'No objects found' error on 'when -label tb_end'
   
 BEGIN
 
---  g_tb_index         : STRING := "";
+--  g_tb_index         : NATURAL := 0;  -- use to incremental delay logging from tb instances in tb_tb
+--  g_tb_str           : STRING := "";  -- use to distinguish logging from tb instances in tb_tb
 --  g_nof_streams      : NATURAL := 2;
 --
---  -- sl:  enable
---  -- sl:  enable_sync
---  -- nat: samples_per_packet
---  -- nat: blocks_per_sync
---  -- nat: gapsize
---  -- nat: mem_low_adrs
---  -- nat: mem_high_adrs
---  -- nat: bsn_init
+--  -- t_diag_block_gen_integer =
+--  --   sl:  enable
+--  --   sl:  enable_sync
+--  --   nat: samples_per_packet
+--  --   nat: blocks_per_sync
+--  --   nat: gapsize
+--  --   nat: mem_low_adrs
+--  --   nat: mem_high_adrs
+--  --   nat: bsn_init
 --  g_bg_ctrl_first    : t_diag_block_gen_integer := ('1', '1', 50, 8, 100, 0, 30, 0);  -- for first stream
 --  g_bg_ctrl_others   : t_diag_block_gen_integer := ('1', '1', 30, 8, 10, 0, 30, 0)   -- for other streams
 
-  u_one_stream        : ENTITY work.tb_eth_tester GENERIC MAP ("tb_one: ", 1, c_bg_ctrl_first, c_bg_ctrl_rst);
-  u_multiple_streams  : ENTITY work.tb_eth_tester GENERIC MAP ("tb_multiple: ", 3, c_bg_ctrl_first, c_bg_ctrl_others);
+  u_one_stream        : ENTITY work.tb_eth_tester GENERIC MAP (0, "tb_one_stream: ", 1, c_bg_ctrl_first, c_bg_ctrl_rst);
+  u_multiple_streams  : ENTITY work.tb_eth_tester GENERIC MAP (1, "tb_multiple_streams: ", 3, c_bg_ctrl_first, c_bg_ctrl_others);
+
+  -- Try different BG block lengths to verify nof octets in last word
+  u_bg_len_0          : ENTITY work.tb_eth_tester GENERIC MAP (10, "tb_bg_len_0: ", 1, c_bg_ctrl_len_0, c_bg_ctrl_rst);
+  u_bg_len_1          : ENTITY work.tb_eth_tester GENERIC MAP (11, "tb_bg_len_1: ", 1, c_bg_ctrl_len_1, c_bg_ctrl_rst);
+  u_bg_len_2          : ENTITY work.tb_eth_tester GENERIC MAP (12, "tb_bg_len_2: ", 1, c_bg_ctrl_len_2, c_bg_ctrl_rst);
+  u_bg_len_3          : ENTITY work.tb_eth_tester GENERIC MAP (13, "tb_bg_len_3: ", 1, c_bg_ctrl_len_3, c_bg_ctrl_rst);
 
 END tb;
-- 
GitLab