From 2a3cf224f6dadf3e11c3b103e3d9398e9462b02e Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Tue, 25 Oct 2016 07:05:48 +0000
Subject: [PATCH] Use func_wpfb_maximum_sop_latency() to set dp_fifo_info size.

---
 libraries/dsp/wpfb/src/vhdl/wpfb_unit_dev.vhd | 25 ++++++++++++++-----
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/libraries/dsp/wpfb/src/vhdl/wpfb_unit_dev.vhd b/libraries/dsp/wpfb/src/vhdl/wpfb_unit_dev.vhd
index 6e2d8b4d86..7b08f2040f 100644
--- a/libraries/dsp/wpfb/src/vhdl/wpfb_unit_dev.vhd
+++ b/libraries/dsp/wpfb/src/vhdl/wpfb_unit_dev.vhd
@@ -369,7 +369,14 @@ end entity wpfb_unit_dev;
 
 architecture str of wpfb_unit_dev is
 
-  constant c_nof_stats       : natural := 2**g_wpfb.nof_chan * g_wpfb.nof_points/g_wpfb.wb_factor;
+  constant c_nof_channels          : natural := 2**g_wpfb.nof_chan;
+  
+  constant c_nof_data_per_block    : natural := c_nof_channels * g_wpfb.nof_points;
+  constant c_nof_valid_per_block   : natural := c_nof_data_per_block / g_wpfb.wb_factor;
+  
+  constant c_nof_stats             : natural := c_nof_valid_per_block;
+  
+  constant c_maximum_sop_latency   : natural := func_wpfb_maximum_sop_latency(g_wpfb);
 
   constant c_fil_ppf         : t_fil_ppf := (g_wpfb.wb_factor,
                                              g_wpfb.nof_chan,
@@ -403,8 +410,6 @@ architecture str of wpfb_unit_dev is
   constant c_bg_data_file_index_arr : t_nat_natural_arr := array_init(0, 4, 1);
   constant c_bg_data_file_prefix    : string  := "UNUSED";
 
-  constant c_output_frame_size      : natural := c_nof_stats;   
-
   signal ram_st_sst_mosi_arr : t_mem_mosi_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0);
   signal ram_st_sst_miso_arr : t_mem_miso_arr(g_wpfb.nof_wb_streams*g_wpfb.wb_factor-1 downto 0) := (others => c_mem_miso_rst);
 
@@ -601,7 +606,7 @@ begin
     u_dp_block_gen : entity dp_lib.dp_block_gen
     generic map (
       g_use_src_in       => FALSE,
-      g_nof_data         => c_output_frame_size,
+      g_nof_data         => c_nof_valid_per_block,
       g_preserve_sync    => FALSE,
       g_preserve_bsn     => FALSE
     )
@@ -616,8 +621,16 @@ begin
     -- Add sync and BSN 
     u_dp_fifo_info : entity dp_lib.dp_fifo_info
     generic map (
-      g_use_sync => TRUE,
-      g_use_bsn  => TRUE
+      g_use_sync    => TRUE,
+      g_use_bsn     => TRUE,
+      g_use_channel => FALSE,
+      g_use_empty   => FALSE,
+      g_use_error   => FALSE,
+      g_bsn_w       => c_dp_stream_bsn_w,
+      g_empty_w     => c_dp_stream_empty_w,
+      g_channel_w   => c_dp_stream_channel_w,
+      g_error_w     => c_dp_stream_error_w,
+      g_fifo_size   => c_maximum_sop_latency
     )
     port map (
       rst          => dp_rst,
-- 
GitLab