diff --git a/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_remote.vhd b/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_remote.vhd index b969c5050b2e374b1a0d2fdff662bb06f57ad304..f6a29ba4816f3501c0db188b72f80299cd4920f0 100644 --- a/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_remote.vhd +++ b/applications/lofar2/libraries/sdp/src/vhdl/sdp_beamformer_remote.vhd @@ -71,6 +71,9 @@ architecture str of sdp_beamformer_remote is constant c_fifo_size : natural := 2**ceil_log2((c_block_size * 9) / 16); -- 9/16 = 36/64, 1 block of -- 64 bit words rounded to the next power of 2 = 1024. + constant c_bsn_latency_max : natural := 2; -- max 2 blocks latency per node in chain + constant c_bsn_latency_first_node : natural := 2; + signal chain_node_index : natural range 0 to c_sdp_N_pn_max - 1 := 0; -- c_sdp_P_sum = 2 streams, 1 for local, 1 for remote @@ -147,8 +150,8 @@ begin generic map( -- for dp_bsn_align_v2 g_nof_streams => c_sdp_P_sum, - g_bsn_latency_max => 2, -- max 2 blocks latency - g_use_aligner_at_first_node => true, + g_bsn_latency_max => c_bsn_latency_max, + g_bsn_latency_first_node => c_bsn_latency_first_node, g_nof_aligners_max => g_nof_aligners_max, g_block_size => c_block_size, g_data_w => c_data_w, diff --git a/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd b/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd index 4653c6ccba90e1083091ce29bee84b230375fab6..d4242feaebc959a9d0e792e2416a2f3cb1ec3c88 100644 --- a/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd +++ b/libraries/base/dp/src/vhdl/dp_bsn_align_v2.vhd @@ -40,7 +40,7 @@ -- maximum latency. The c_buffer_nof_blocks has to a power of two to ease -- the control of the circular buffer. The lowest bits of the input block -- sequence number (BSN) are used as write block index into the circular --- buffer. The g_use_aligner_at_first_node can be useful to reduce the +-- buffer. The g_bsn_latency_first_node can be useful to reduce the -- required circular buffer size just enough, such that the next power of two -- is only a feq blocks larger, instead of almost a factor two larger. This -- then may save a significant amount of block RAM. @@ -73,13 +73,13 @@ -- g_nof_aligners_max should equal the number of nodes for -- chain_node_index range. The g_nof_aligners_max is the number of -- nodes in the chain including the first node. --- . g_use_aligner_at_first_node: when true use g_bsn_latency_max at first --- node as well, else use c_bsn_latency_first_node = 0 for immediate +-- . g_bsn_latency_first_node: typically <= g_bsn_latency_max of the other +-- nodes in a chain. Use g_bsn_latency_first_node = 0 for immediate -- output from first node in a chain of nodes. Only used when --- g_nof_aligners_max > 1. The g_use_aligner_at_first_node setting only +-- g_nof_aligners_max > 1. The g_bsn_latency_first_node setting only -- affects the latency along the chain, and therefore the required -- size of the circular buffer. If the circular buffer is large enough --- anyway, then the g_use_aligner_at_first_node setting is don't care, +-- anyway, then the g_bsn_latency_first_node setting is don't care, -- assuming that a little extra latency is don't care. -- -- Inputs: @@ -116,7 +116,7 @@ entity dp_bsn_align_v2 is generic ( g_nof_streams : natural := 2; -- >= 2, number of input and output streams g_bsn_latency_max : natural := 2; - g_use_aligner_at_first_node : boolean := true; + g_bsn_latency_first_node : natural := 2; -- default use same as g_bsn_latency_max g_nof_aligners_max : positive := 16; g_block_size : natural := 1024; -- > 1, g_block_size=1 is not supported g_bsn_w : natural := c_dp_stream_bsn_w; -- number of bits in sosi BSN @@ -153,12 +153,10 @@ entity dp_bsn_align_v2 is end dp_bsn_align_v2; architecture rtl of dp_bsn_align_v2 is - constant c_bsn_latency_first_node : natural := sel_a_b(g_use_aligner_at_first_node, g_bsn_latency_max, 0); - -- Circular buffer per stream, size is next power of 2 that fits constant c_buffer_nof_blocks : natural := sel_a_b(g_nof_aligners_max = 1, true_log_pow2(1 + g_bsn_latency_max), - true_log_pow2(1 + g_bsn_latency_max * (g_nof_aligners_max - 1) + c_bsn_latency_first_node)); + true_log_pow2(1 + g_bsn_latency_max * (g_nof_aligners_max - 1) + g_bsn_latency_first_node)); constant c_ram_size : natural := c_buffer_nof_blocks * g_block_size; constant c_ram_buf : t_c_mem := (latency => 1, @@ -355,7 +353,7 @@ begin if g_nof_aligners_max = 1 then v.rd_blk_pointer := v.wr_blk_pointer - g_bsn_latency_max; else - v.rd_blk_pointer := v.wr_blk_pointer - g_bsn_latency_max * chain_node_index - c_bsn_latency_first_node; + v.rd_blk_pointer := v.wr_blk_pointer - g_bsn_latency_max * chain_node_index - g_bsn_latency_first_node; end if; if v.rd_blk_pointer < 0 then v.rd_blk_pointer := v.rd_blk_pointer + c_buffer_nof_blocks; diff --git a/libraries/base/dp/src/vhdl/mmp_dp_bsn_align_v2.vhd b/libraries/base/dp/src/vhdl/mmp_dp_bsn_align_v2.vhd index 8159e1975563675b9ce940cc16f49a3262e264a0..d7803fb866b75af0a44f18595e8934a5db1b11b5 100644 --- a/libraries/base/dp/src/vhdl/mmp_dp_bsn_align_v2.vhd +++ b/libraries/base/dp/src/vhdl/mmp_dp_bsn_align_v2.vhd @@ -44,9 +44,9 @@ use work.dp_stream_pkg.all; entity mmp_dp_bsn_align_v2 is generic ( -- for dp_bsn_align_v2 - g_nof_streams : natural; -- number of input and output streams - g_bsn_latency_max : natural; -- Maximum travel latency of a remote block in number of block periods - g_use_aligner_at_first_node : boolean := true; + g_nof_streams : natural := 2; -- number of input and output streams + g_bsn_latency_max : natural := 2; -- Maximum travel latency of a remote block in number of block periods + g_bsn_latency_first_node : natural := 2; -- default use same as g_bsn_latency_max g_nof_aligners_max : natural := 1; -- 1 when only align at last node, -- > 1 when align at every intermediate node g_block_size : natural := 32; -- > 1, g_block_size=1 is not supported @@ -222,7 +222,7 @@ begin generic map ( g_nof_streams => g_nof_streams, g_bsn_latency_max => g_bsn_latency_max, - g_use_aligner_at_first_node => g_use_aligner_at_first_node, + g_bsn_latency_first_node => g_bsn_latency_first_node, g_nof_aligners_max => g_nof_aligners_max, g_block_size => g_block_size, g_bsn_w => g_bsn_w, diff --git a/libraries/base/dp/tb/vhdl/tb_dp_bsn_align_v2.vhd b/libraries/base/dp/tb/vhdl/tb_dp_bsn_align_v2.vhd index de380eb9a93944d9dc1f036262457eb9adb0e038..fbe08de291163f2d1febfa3cb41a9310f381b717 100644 --- a/libraries/base/dp/tb/vhdl/tb_dp_bsn_align_v2.vhd +++ b/libraries/base/dp/tb/vhdl/tb_dp_bsn_align_v2.vhd @@ -85,7 +85,8 @@ entity tb_dp_bsn_align_v2 is generic ( -- DUT g_nof_streams : natural := 2; -- number of input and output streams - g_bsn_latency_max : natural := 1; -- Maximum travel latency of a remote block in number of block periods T_blk + g_bsn_latency_max : natural := 1; -- Maximum travel latency of a remote block in number of block periods + g_bsn_latency_first_node : natural := 1; g_nof_aligners_max : positive := 1; -- 1 when only align at last node, > 1 when align at every intermediate node g_block_size : natural := 11; -- > 1, g_block_size=1 is not supported g_block_period : natural := 20; -- >= g_block_size, = g_block_size + c_gap_size @@ -504,7 +505,7 @@ begin generic map ( g_nof_streams => g_nof_streams, g_bsn_latency_max => g_bsn_latency_max, - g_use_aligner_at_first_node => c_use_aligner_at_first_node, + g_bsn_latency_first_node => g_bsn_latency_first_node, g_nof_aligners_max => c_nof_aligners_max, g_block_size => g_block_size, g_bsn_w => g_bsn_w, @@ -557,6 +558,7 @@ begin generic map ( g_nof_streams => g_nof_streams, g_bsn_latency_max => g_bsn_latency_max, + g_bsn_latency_first_node => g_bsn_latency_first_node, g_nof_aligners_max => c_nof_aligners_max, g_block_size => g_block_size, g_bsn_w => g_bsn_w, diff --git a/libraries/base/dp/tb/vhdl/tb_mmp_dp_bsn_align_v2.vhd b/libraries/base/dp/tb/vhdl/tb_mmp_dp_bsn_align_v2.vhd index 6360636150cfd1447aab750ddc3109df80ffb2e8..79f281d6e3b7c08fa3f913d698379b7d3620e966 100644 --- a/libraries/base/dp/tb/vhdl/tb_mmp_dp_bsn_align_v2.vhd +++ b/libraries/base/dp/tb/vhdl/tb_mmp_dp_bsn_align_v2.vhd @@ -63,6 +63,7 @@ architecture tb of tb_mmp_dp_bsn_align_v2 is -- . for dp_bsn_align_v2 constant c_nof_streams : natural := 5; constant c_bsn_latency_max : natural := 1; + constant c_bsn_latency_first_node : natural := c_bsn_latency_max; constant c_nof_aligners_max : positive := 1; -- fixed in this tb constant c_block_size : natural := 11; constant c_block_period : natural := 11; @@ -429,6 +430,7 @@ begin generic map ( g_nof_streams => c_nof_streams, g_bsn_latency_max => c_bsn_latency_max, + g_bsn_latency_first_node => c_bsn_latency_first_node, g_nof_aligners_max => c_nof_aligners_max, g_block_size => c_block_size, g_bsn_w => c_bsn_w, diff --git a/libraries/base/dp/tb/vhdl/tb_tb_dp_bsn_align_v2.vhd b/libraries/base/dp/tb/vhdl/tb_tb_dp_bsn_align_v2.vhd index d1ac6698b74d433a03b75d037ee651dafc42690b..31076e6e0ea274f4056684d4779c62db406e7aa9 100644 --- a/libraries/base/dp/tb/vhdl/tb_tb_dp_bsn_align_v2.vhd +++ b/libraries/base/dp/tb/vhdl/tb_tb_dp_bsn_align_v2.vhd @@ -40,6 +40,7 @@ begin -- -- DUT -- g_nof_streams : NATURAL := 2; -- number of input and output streams -- g_bsn_latency_max : NATURAL := 1; -- Maximum travel latency of a remote block in number of block periods T_blk + -- g_bsn_latency_first_node : natural := 1; -- g_nof_aligners_max : NATURAL := 1; -- 1 when only align at last node, > 1 when align at every intermediate node -- g_block_size : NATURAL := 11; -- > 1, g_block_size=1 is not supported -- g_block_period : NATURAL := 20; -- >= g_block_size, = g_block_size + c_gap_size @@ -61,25 +62,25 @@ begin -- g_tb_nof_restart : NATURAL := 1; -- number of times to restart the input stimuli -- g_tb_nof_blocks : NATURAL := 10 -- number of input blocks per restart - u_mm_output : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, true, 0, 0, 1, 0, 2, c_nof_blk); - u_mm_output_pow2 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 16, c_period, 32, 16, 17, 0, 0, 0, 3, true, 0, 0, 1, 0, 2, c_nof_blk); -- g_block_size = 2**4 = 16 - u_mm_output_large_bsn : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3000, true, 0, 0, 1, 0, 2, c_nof_blk); -- test where bsn * g_block_size > 2^10 to test address resizing - u_mm_output_single : entity work.tb_dp_bsn_align_v2 generic map (1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, true, 0, 0, 1, 0, 2, c_nof_blk); - u_dp_output : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_dp_output_pow2 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 16, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); -- g_block_size = 2**4 = 16 - u_dp_output_large_bsn : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3000, false, 0, 0, 1, 0, 2, c_nof_blk); -- test where bsn * g_block_size > 2^10 to test address resizing - u_dp_output_single : entity work.tb_dp_bsn_align_v2 generic map (1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_dp_output_p1 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 1, 1, 1, 0, 2, c_nof_blk); - u_bsn_lat_max_2 : entity work.tb_dp_bsn_align_v2 generic map (2, 2, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_bsn_lat_max_3 : entity work.tb_dp_bsn_align_v2 generic map (2, 3, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_p1_rd2 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 1, 0, 2, 0, 2, c_nof_blk); - u_zero_gap : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, c_block, c_block, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_zero_gap_p1_rd2 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, c_block, c_block, 32, 16, 17, 0, 0, 0, 3, false, 1, 1, 2, 0, 2, c_nof_blk); - u_stream_disable : entity work.tb_dp_bsn_align_v2 generic map (3, 1, 1, c_block, c_period, 32, 16, 17, 2, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_stream_lost : entity work.tb_dp_bsn_align_v2 generic map (3, 1, 1, c_block, c_period, 32, 16, 17, 0, 2, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_stream_disable_lost : entity work.tb_dp_bsn_align_v2 generic map (4, 1, 1, c_block, c_period, 32, 16, 17, 1, 2, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_bsn_lost : entity work.tb_dp_bsn_align_v2 generic map (3, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 10, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_diff_delay : entity work.tb_dp_bsn_align_v2 generic map (3, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, -1, 2, c_nof_blk); - u_nof_aligners : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 8, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); - u_nof_aligners_diff_delay : entity work.tb_dp_bsn_align_v2 generic map (4, 1, 3, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, -1, 2, c_nof_blk); + u_mm_output : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, true, 0, 0, 1, 0, 2, c_nof_blk); + u_mm_output_pow2 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, 16, c_period, 32, 16, 17, 0, 0, 0, 3, true, 0, 0, 1, 0, 2, c_nof_blk); -- g_block_size = 2**4 = 16 + u_mm_output_large_bsn : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3000, true, 0, 0, 1, 0, 2, c_nof_blk); -- test where bsn * g_block_size > 2^10 to test address resizing + u_mm_output_single : entity work.tb_dp_bsn_align_v2 generic map (1, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, true, 0, 0, 1, 0, 2, c_nof_blk); + u_dp_output : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_dp_output_pow2 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, 16, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); -- g_block_size = 2**4 = 16 + u_dp_output_large_bsn : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3000, false, 0, 0, 1, 0, 2, c_nof_blk); -- test where bsn * g_block_size > 2^10 to test address resizing + u_dp_output_single : entity work.tb_dp_bsn_align_v2 generic map (1, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_dp_output_p1 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 1, 1, 1, 0, 2, c_nof_blk); + u_bsn_lat_max_2 : entity work.tb_dp_bsn_align_v2 generic map (2, 2, 2, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_bsn_lat_max_3 : entity work.tb_dp_bsn_align_v2 generic map (2, 3, 3, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_p1_rd2 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 1, 0, 2, 0, 2, c_nof_blk); + u_zero_gap : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, c_block, c_block, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_zero_gap_p1_rd2 : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 1, c_block, c_block, 32, 16, 17, 0, 0, 0, 3, false, 1, 1, 2, 0, 2, c_nof_blk); + u_stream_disable : entity work.tb_dp_bsn_align_v2 generic map (3, 1, 1, 1, c_block, c_period, 32, 16, 17, 2, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_stream_lost : entity work.tb_dp_bsn_align_v2 generic map (3, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 2, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_stream_disable_lost : entity work.tb_dp_bsn_align_v2 generic map (4, 1, 1, 1, c_block, c_period, 32, 16, 17, 1, 2, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_bsn_lost : entity work.tb_dp_bsn_align_v2 generic map (3, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 10, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_diff_delay : entity work.tb_dp_bsn_align_v2 generic map (3, 1, 1, 1, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, -1, 2, c_nof_blk); + u_nof_aligners : entity work.tb_dp_bsn_align_v2 generic map (2, 1, 1, 8, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, 0, 2, c_nof_blk); + u_nof_aligners_diff_delay : entity work.tb_dp_bsn_align_v2 generic map (4, 1, 1, 3, c_block, c_period, 32, 16, 17, 0, 0, 0, 3, false, 0, 0, 1, -1, 2, c_nof_blk); end tb;