From d8a01438ce92c0e6f54a369b36636748f9671ac7 Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Wed, 23 Jan 2019 14:04:25 +0000
Subject: [PATCH] Support readback of last BF weight write in bf_unit.vhd and
 verified it in Wave window using tb_bf_unit.vhd/py.

---
 libraries/dsp/bf/tb/python/tc_bf_unit.py | 4 +++-
 libraries/dsp/bf/tb/vhdl/tb_bf_unit.vhd  | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libraries/dsp/bf/tb/python/tc_bf_unit.py b/libraries/dsp/bf/tb/python/tc_bf_unit.py
index f8e571b8ac..a51330be89 100644
--- a/libraries/dsp/bf/tb/python/tc_bf_unit.py
+++ b/libraries/dsp/bf/tb/python/tc_bf_unit.py
@@ -144,7 +144,8 @@ c_gen_hex_files      = True   # Use True to create hex files for BG, BF weights
 
 # When following constants are set to False, be sure there are .hex files!!! 
 c_write_bg           = False  # When set to True the waveform will be written to the block generator over the MM bus. When False this will be skipped.
-c_write_bf_weights   = False  # When set to True the weights will be written via the MM bus. When False this will be skipped. 
+c_write_bf_weights   = True  # When set to True the weights will be written via the MM bus. When False this will be skipped. 
+c_write_bf_weights   = False
 c_write_bf_ss_wide   = False  # When set to True the setting for ss_wide will be written via the MM bus. When False this will be skipped. 
 
 # Create access object for nodes
@@ -327,6 +328,7 @@ if __name__ == "__main__":
     if c_write_bf_weights:
         for i in range(c_nof_signal_paths): 
             bf.write_weights(generated_weights[i], i) 
+            bf.read_weight(i, weightNr=0)
             
     ################################################################################
     ##
diff --git a/libraries/dsp/bf/tb/vhdl/tb_bf_unit.vhd b/libraries/dsp/bf/tb/vhdl/tb_bf_unit.vhd
index b3a4d35443..2531a8979d 100644
--- a/libraries/dsp/bf/tb/vhdl/tb_bf_unit.vhd
+++ b/libraries/dsp/bf/tb/vhdl/tb_bf_unit.vhd
@@ -251,7 +251,9 @@ BEGIN
   GENERIC MAP (
     g_bf                    => c_bf,
     g_bf_weights_file_name  => g_bf_weights_file_name,
-    g_ss_wide_file_prefix   => g_ss_wide_file_prefix  
+    g_ss_wide_file_prefix   => g_ss_wide_file_prefix,
+    g_weights_write_only    => FALSE
+    --g_weights_write_only    => TRUE
   )
   PORT MAP (
     -- System
-- 
GitLab