From c0e5e4983b2824b90619f855965ad4d7361e503e Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Tue, 26 Oct 2021 16:58:17 +0200
Subject: [PATCH] Added tb_tb_resize.vhd.

---
 libraries/base/common/hdllib.cfg              |  3 +-
 .../base/common/tb/vhdl/tb_tb_resize.vhd      | 49 +++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 libraries/base/common/tb/vhdl/tb_tb_resize.vhd

diff --git a/libraries/base/common/hdllib.cfg b/libraries/base/common/hdllib.cfg
index 6e815027bc..507266e0ec 100644
--- a/libraries/base/common/hdllib.cfg
+++ b/libraries/base/common/hdllib.cfg
@@ -196,6 +196,7 @@ test_bench_files =
     tb/vhdl/tb_delta_cycle_demo.vhd
     tb/vhdl/tb_mms_common_variable_delay.vhd
     
+    tb/vhdl/tb_tb_resize.vhd
     tb/vhdl/tb_tb_common_add_sub.vhd
     tb/vhdl/tb_tb_common_adder_tree.vhd
     tb/vhdl/tb_tb_common_fanout_tree.vhd
@@ -218,7 +219,7 @@ regression_test_vhdl =
     tb/vhdl/tb_common_shiftreg.vhd
     tb/vhdl/tb_common_transpose_symbol.vhd
     tb/vhdl/tb_common_variable_delay.vhd
-    tb/vhdl/tb_resize.vhd
+    tb/vhdl/tb_tb_resize.vhd
     #tb/vhdl/tb_round.vhd           -- has no self verification yet
     tb/vhdl/tb_requantize.vhd
     tb/vhdl/tb_common_to_sreal.vhd
diff --git a/libraries/base/common/tb/vhdl/tb_tb_resize.vhd b/libraries/base/common/tb/vhdl/tb_tb_resize.vhd
new file mode 100644
index 0000000000..a76d06bcd1
--- /dev/null
+++ b/libraries/base/common/tb/vhdl/tb_tb_resize.vhd
@@ -0,0 +1,49 @@
+-- --------------------------------------------------------------------------
+-- 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 okt 2021
+-- Purpose: Multi tb for common_resize.vhd and RESIZE_NUM() in common_pkg.vhd
+
+LIBRARY IEEE;
+USE IEEE.std_logic_1164.ALL;
+
+ENTITY tb_tb_resize IS
+END tb_tb_resize;
+
+ARCHITECTURE tb OF tb_tb_resize IS
+  SIGNAL tb_end : STD_LOGIC := '0';  -- declare tb_end to avoid 'No objects found' error on 'when -label tb_end'
+BEGIN
+  -- -- Supported for RESIZE_NUM() and common_resize.vhd
+  -- g_in_dat_w        : NATURAL := 5;
+  -- g_out_dat_w       : NATURAL := 3;
+  -- -- Only supported for common_resize.vhd
+  -- g_clip            : BOOLEAN := TRUE;
+  -- g_clip_symmetric  : BOOLEAN := TRUE;
+
+  u_wrap_extend_w       : ENTITY work.tb_resize GENERIC MAP (3, 5, FALSE, FALSE);
+  u_wrap_keep_w         : ENTITY work.tb_resize GENERIC MAP (5, 5, FALSE, FALSE);
+  u_wrap_reduce_w       : ENTITY work.tb_resize GENERIC MAP (5, 3, FALSE, FALSE);
+
+  u_clip_extend_w       : ENTITY work.tb_resize GENERIC MAP (3, 5, TRUE, FALSE);
+  u_clip_keep_w         : ENTITY work.tb_resize GENERIC MAP (5, 5, TRUE, FALSE);
+  u_clip_reduce_w       : ENTITY work.tb_resize GENERIC MAP (5, 3, TRUE, FALSE);
+
+  u_clip_sym_extend_w   : ENTITY work.tb_resize GENERIC MAP (3, 5, TRUE, TRUE);
+  u_clip_sym_keep_w     : ENTITY work.tb_resize GENERIC MAP (5, 5, TRUE, TRUE);
+  u_clip_sym_reduce_w   : ENTITY work.tb_resize GENERIC MAP (5, 3, TRUE, TRUE);
+END tb;
-- 
GitLab