From 628342b0c35bb8bc5da89280be76a96e27c9b89f Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Wed, 20 Apr 2022 11:25:06 +0200
Subject: [PATCH] Use c_lsb_round_even = FALSE, because golden reference data
 is for round half away from zero.

---
 libraries/base/common/tb/vhdl/tb_requantize.vhd | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libraries/base/common/tb/vhdl/tb_requantize.vhd b/libraries/base/common/tb/vhdl/tb_requantize.vhd
index 9f4ca004fa..f7317d92b3 100644
--- a/libraries/base/common/tb/vhdl/tb_requantize.vhd
+++ b/libraries/base/common/tb/vhdl/tb_requantize.vhd
@@ -34,6 +34,7 @@ USE work.common_pkg.ALL;
 --   . c_out_dat_w          = 3
 --   . c_lsb_w              = 2
 --   . c_lsb_round_clip     = TRUE
+--   . c_lsb_round_even     = FALSE
 --   . c_msb_clip_symmetric = TRUE
 -- . Observe reg_dat with respect to the out_s_*_*.dat and out_u_*_*.dat
 -- . Try also c_lsb_round_clip=FALSE
@@ -55,6 +56,7 @@ ARCHITECTURE tb OF tb_requantize IS
   CONSTANT c_out_dat_w           : NATURAL := 3;
   CONSTANT c_lsb_w               : NATURAL := 2;
   CONSTANT c_lsb_round_clip      : BOOLEAN := TRUE; --FALSE;
+  CONSTANT c_lsb_round_even      : BOOLEAN := FALSE;  -- golden reference data is for round half away from zero
   CONSTANT c_msb_clip_symmetric  : BOOLEAN := TRUE; --FALSE;
   
   -- Stimuli
@@ -158,6 +160,7 @@ BEGIN
     g_lsb_w               => c_lsb_w,
     g_lsb_round           => TRUE,
     g_lsb_round_clip      => c_lsb_round_clip,
+    g_lsb_round_even      => c_lsb_round_even,
     g_msb_clip            => TRUE,
     g_msb_clip_symmetric  => c_msb_clip_symmetric,
     g_pipeline_remove_lsb => g_pipeline_remove_lsb,
@@ -178,6 +181,7 @@ BEGIN
     g_lsb_w               => c_lsb_w,
     g_lsb_round           => TRUE,
     g_lsb_round_clip      => c_lsb_round_clip,
+    g_lsb_round_even      => c_lsb_round_even,
     g_msb_clip            => FALSE,
     g_msb_clip_symmetric  => c_msb_clip_symmetric,
     g_pipeline_remove_lsb => g_pipeline_remove_lsb,
@@ -198,6 +202,7 @@ BEGIN
     g_lsb_w               => c_lsb_w,
     g_lsb_round           => FALSE,
     g_lsb_round_clip      => c_lsb_round_clip,
+    g_lsb_round_even      => c_lsb_round_even,
     g_msb_clip            => TRUE,
     g_msb_clip_symmetric  => c_msb_clip_symmetric,
     g_pipeline_remove_lsb => g_pipeline_remove_lsb,
@@ -218,6 +223,7 @@ BEGIN
     g_lsb_w               => c_lsb_w,
     g_lsb_round           => FALSE,
     g_lsb_round_clip      => c_lsb_round_clip,
+    g_lsb_round_even      => c_lsb_round_even,
     g_msb_clip            => FALSE,
     g_msb_clip_symmetric  => c_msb_clip_symmetric,
     g_pipeline_remove_lsb => g_pipeline_remove_lsb,
@@ -239,6 +245,7 @@ BEGIN
     g_lsb_w               => c_lsb_w,
     g_lsb_round           => TRUE,
     g_lsb_round_clip      => c_lsb_round_clip,
+    g_lsb_round_even      => c_lsb_round_even,
     g_msb_clip            => TRUE,
     g_msb_clip_symmetric  => c_msb_clip_symmetric,
     g_pipeline_remove_lsb => g_pipeline_remove_lsb,
@@ -259,6 +266,7 @@ BEGIN
     g_lsb_w               => c_lsb_w,
     g_lsb_round           => TRUE,
     g_lsb_round_clip      => c_lsb_round_clip,
+    g_lsb_round_even      => c_lsb_round_even,
     g_msb_clip            => FALSE,
     g_msb_clip_symmetric  => c_msb_clip_symmetric,
     g_pipeline_remove_lsb => g_pipeline_remove_lsb,
@@ -279,6 +287,7 @@ BEGIN
     g_lsb_w               => c_lsb_w,
     g_lsb_round           => FALSE,
     g_lsb_round_clip      => c_lsb_round_clip,
+    g_lsb_round_even      => c_lsb_round_even,
     g_msb_clip            => TRUE,
     g_msb_clip_symmetric  => c_msb_clip_symmetric,
     g_pipeline_remove_lsb => g_pipeline_remove_lsb,
@@ -299,6 +308,7 @@ BEGIN
     g_lsb_w               => c_lsb_w,
     g_lsb_round           => FALSE,
     g_lsb_round_clip      => c_lsb_round_clip,
+    g_lsb_round_even      => c_lsb_round_even,
     g_msb_clip            => FALSE,
     g_msb_clip_symmetric  => c_msb_clip_symmetric,
     g_pipeline_remove_lsb => g_pipeline_remove_lsb,
-- 
GitLab