From 3c2bbdf0ed0b4520b0e6771a70873d378abcfd18 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Mon, 27 Feb 2023 15:10:16 +0100
Subject: [PATCH] Add tb_tb_lofar2_unb2c_sdp_station_fsub.vhd

---
 .../lofar2_unb2c_sdp_station_fsub/hdllib.cfg  |  3 +-
 .../tb_tb_lofar2_unb2c_sdp_station_fsub.vhd   | 75 +++++++++++++++++++
 2 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_tb_lofar2_unb2c_sdp_station_fsub.vhd

diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/hdllib.cfg b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/hdllib.cfg
index 0f8db465e9..2936b36941 100644
--- a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/hdllib.cfg
+++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/hdllib.cfg
@@ -10,10 +10,11 @@ hdl_lib_technology = ip_arria10_e2sg
 test_bench_files = 
     tb_lofar2_unb2c_sdp_station_fsub.vhd
     tb_lofar2_unb2c_sdp_station_fsub_sst_offload.vhd
+    tb_tb_lofar2_unb2c_sdp_station_fsub.vhd
 
 regression_test_vhdl =
-    tb_lofar2_unb2c_sdp_station_fsub.vhd
     tb_lofar2_unb2c_sdp_station_fsub_sst_offload.vhd
+    tb_tb_lofar2_unb2c_sdp_station_fsub.vhd
 
 
 [modelsim_project_file]
diff --git a/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_tb_lofar2_unb2c_sdp_station_fsub.vhd b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_tb_lofar2_unb2c_sdp_station_fsub.vhd
new file mode 100644
index 0000000000..652ee7709d
--- /dev/null
+++ b/applications/lofar2/designs/lofar2_unb2c_sdp_station/revisions/lofar2_unb2c_sdp_station_fsub/tb_tb_lofar2_unb2c_sdp_station_fsub.vhd
@@ -0,0 +1,75 @@
+-- --------------------------------------------------------------------------
+-- 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, 26 feb 2023
+-- Purpose: Regression multi tb for tb_lofar2_unb2c_sdp_station_fsub
+-- Description:
+--   The multi tb only has one instance, so the tb_tb is more a wrapper to
+--   ensure that always the same tb generics are used in the regression test.
+--   This allows modifying the generics in the tb.
+-- Usage:
+-- > as 4
+-- > run -all
+
+LIBRARY IEEE, lofar2_sdp_lib;
+USE IEEE.std_logic_1164.ALL;
+USE lofar2_sdp_lib.sdp_pkg.ALL;
+
+
+ENTITY tb_tb_lofar2_unb2c_sdp_station_fsub IS
+END tb_tb_lofar2_unb2c_sdp_station_fsub;
+
+
+ARCHITECTURE tb OF tb_tb_lofar2_unb2c_sdp_station_fsub IS
+
+  SIGNAL tb_end : STD_LOGIC := '0';  -- declare tb_end to avoid 'No objects found' error on 'when -label tb_end'
+
+BEGIN
+
+-- Commented to save sim time in regression test
+--  u_fsub_only_co : ENTITY work.tb_lofar2_unb2c_sdp_station_fsub
+--  GENERIC MAP (
+--    g_sp                            => 3,     -- signal path index in range(S_pn = 12) of co-polarization
+--    g_co_wg_ampl                    => 0.5,   -- WG normalized amplitude, use same WG settings for both polarizations (g_sp and c_cross_sp)
+--    g_cross_wg_ampl                 => 0.4,   -- WG normalized amplitude, use same WG settings for both polarizations (g_sp and c_cross_sp)
+--    g_cross_wg_phase                => 90.0,  -- WG phase in degrees for cross-sp, relative to co-sp
+--    g_subband                       => 102,   -- select subband at index 102 = 102/1024 * 200MHz = 19.921875 MHz
+--    g_co_subband_weight_gain        => 1.0,   -- subband weight normalized gain, for co-polarization in g_sp
+--    g_co_subband_weight_phase       => 30.0,  -- subband weight phase rotation in degrees, for co-polarization in g_sp
+--    g_use_cross_weight              => FALSE,
+--    g_sp_cross_subband_weight_gain  => 0.5,   -- subband weight normalized gain, for cross polarization of g_sp
+--    g_sp_cross_subband_weight_phase => -10.0, -- subband weight phase rotation in degrees, for cross polarization of g_sp
+--    g_read_all_SST                  => TRUE   -- when FALSE only read SST for g_subband, to save sim time
+--  );
+
+  u_fsub_use_cross : ENTITY work.tb_lofar2_unb2c_sdp_station_fsub
+  GENERIC MAP (
+    g_sp                            => 3,     -- signal path index in range(S_pn = 12) of co-polarization
+    g_co_wg_ampl                    => 0.5,   -- WG normalized amplitude, use same WG settings for both polarizations (g_sp and c_cross_sp)
+    g_cross_wg_ampl                 => 0.4,   -- WG normalized amplitude, use same WG settings for both polarizations (g_sp and c_cross_sp)
+    g_cross_wg_phase                => 90.0,  -- WG phase in degrees for cross-sp, relative to co-sp
+    g_subband                       => 102,   -- select subband at index 102 = 102/1024 * 200MHz = 19.921875 MHz
+    g_co_subband_weight_gain        => 1.0,   -- subband weight normalized gain, for co-polarization in g_sp
+    g_co_subband_weight_phase       => 30.0,  -- subband weight phase rotation in degrees, for co-polarization in g_sp
+    g_use_cross_weight              => TRUE,
+    g_sp_cross_subband_weight_gain  => 0.5,   -- subband weight normalized gain, for cross polarization of g_sp
+    g_sp_cross_subband_weight_phase => -10.0, -- subband weight phase rotation in degrees, for cross polarization of g_sp
+    g_read_all_SST                  => TRUE   -- when FALSE only read SST for g_subband, to save sim time
+  );
+
+END tb;
-- 
GitLab