diff --git a/applications/apertif/designs/apertif_unb1_correlator/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/hdllib.cfg
index 2d646a210efbeb06b2845b74a5a434096f2b5ecf..10c6311498baa0d90d4c3a0d917037b04eb48ab3 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/hdllib.cfg
@@ -19,6 +19,7 @@ synth_files =
     src/vhdl/apertif_unb1_correlator_nodes.vhd
     
 test_bench_files =
+    tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb/vhdl/tb_node_apertif_unb1_correlator_processing.vhd
     tb/vhdl/tb_tb_node_apertif_unb1_correlator_processing.vhd
     tb/vhdl/tb_node_apertif_unb1_correlator_processing_output.vhd
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_bg_output/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_bg_output/hdllib.cfg
index 4a29a60786e292aee73cc2fe045300279a295d33..c31e77433af9c166c94f776b8e1f8a361c22cbc1 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_bg_output/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_bg_output/hdllib.cfg
@@ -21,6 +21,7 @@ synth_files =
     apertif_unb1_correlator_bg_output.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_bg_output.vhd
 
 [modelsim_project_file]
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_bm6_bg_ch320/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_bm6_bg_ch320/hdllib.cfg
index 806439cdd0c5fdfec27c243c275b0147e9d50ab4..efd25e0e42ab050cf5469351383a5989489d0496 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_bm6_bg_ch320/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_bm6_bg_ch320/hdllib.cfg
@@ -22,6 +22,7 @@ synth_files =
     apertif_unb1_correlator_bm6_bg_ch320.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_bm6_bg_ch320.vhd
 
 regression_test_vhdl = 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_filter/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_filter/hdllib.cfg
index 304a34612470e10f228cb2e708641ef852ddb470..3e96cb814b0253889fbadc44918c57dc076769da 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_filter/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_filter/hdllib.cfg
@@ -20,6 +20,7 @@ synth_files =
     apertif_unb1_correlator_filter.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_filter.vhd
 
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full/hdllib.cfg
index 0f85331bd1d93d9268998777358659b56f6dc0b7..426025ce8fe60f13c4bbb8965346da589e6c2589 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full/hdllib.cfg
@@ -22,6 +22,7 @@ synth_files =
     apertif_unb1_correlator_full.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_full.vhd
 
 regression_test_vhdl = 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bg/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bg/hdllib.cfg
index 1e743143abf26c7f01c70da91b594e2154fabe97..1facc23cf0ad939929509506d94abfc76ea21635 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bg/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bg/hdllib.cfg
@@ -21,6 +21,7 @@ synth_files =
     apertif_unb1_correlator_full_bg.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_full_bg.vhd
 
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bg_int/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bg_int/hdllib.cfg
index 61a4d7673c2d64aa97bfa07c2f9f3567ad83b3dd..16e50736e41ecb6936c28e90657934ea895df003 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bg_int/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bg_int/hdllib.cfg
@@ -21,6 +21,7 @@ synth_files =
     apertif_unb1_correlator_full_bg_int.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_full_bg_int.vhd
 
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bm6/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bm6/hdllib.cfg
index 5a667513ff7c75edfa5401d080d2c1e1c651573c..ba1e1747cfcb1e64352f44f9857efe793a6e4b52 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bm6/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_bm6/hdllib.cfg
@@ -22,6 +22,7 @@ synth_files =
     apertif_unb1_correlator_full_bm6.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_full_bm6.vhd
 
 regression_test_vhdl = 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_no_fft/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_no_fft/hdllib.cfg
index 44cad6d3fc2dc891d9bd80dd050d51e04233e6ad..0b0a61c3d9150eb2961747ff796f34fbbfe7c22e 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_no_fft/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_full_no_fft/hdllib.cfg
@@ -21,6 +21,7 @@ synth_files =
     apertif_unb1_correlator_full_no_fft.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_full_no_fft.vhd
     ../../tb/vhdl/tb_node_apertif_unb1_correlator_input.vhd
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite/hdllib.cfg
index 87a535846a9777756753ab20e960ede8b4ff0e92..32121fefe7f6b933e3f9a13e3b20b5f4a6e37d8c 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite/hdllib.cfg
@@ -20,7 +20,8 @@ synth_files =
     ../../src/vhdl/apertif_unb1_correlator_nodes.vhd
     apertif_unb1_correlator_lite.vhd
     
-test_bench_files = 
+test_bench_files =
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_lite.vhd
 
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite_bg/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite_bg/hdllib.cfg
index d11f9dbbd4c62416324c5bf7dc567a9500af808f..fb889dd1b43e6ac6bd794950e8e8bf8f2ca8f5fe 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite_bg/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite_bg/hdllib.cfg
@@ -21,6 +21,7 @@ synth_files =
     apertif_unb1_correlator_lite_bg.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_lite_bg.vhd
     ../../tb/vhdl/tb_apertif_unb1_correlator_output_framer.vhd
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite_bg_8/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite_bg_8/hdllib.cfg
index 54b22bdb88c9008e84ca2595a7b4e836c9501a5b..9f8ea85c6f6c67a97303056b2c745993d8965ab6 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite_bg_8/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_lite_bg_8/hdllib.cfg
@@ -21,6 +21,7 @@ synth_files =
     apertif_unb1_correlator_lite_bg_8.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_lite_bg_8.vhd
     ../../tb/vhdl/tb_apertif_unb1_correlator_output_framer.vhd
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_mesh_distr_ref/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_mesh_distr_ref/hdllib.cfg
index 75ce449384c976902aad42d0e7bad9fe4df9efde..12c138b203e07dd7472ffcb893ca3057a83a0316 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_mesh_distr_ref/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_mesh_distr_ref/hdllib.cfg
@@ -21,6 +21,7 @@ synth_files =
     apertif_unb1_correlator_mesh_distr_ref.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_mesh_distr_ref.vhd
 
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_mesh_ref/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_mesh_ref/hdllib.cfg
index c3ecbc46f345d225032ca6fdad798644b438a1c2..00961fcddda53eecced8ee04301f641c9d891692 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_mesh_ref/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_mesh_ref/hdllib.cfg
@@ -21,6 +21,7 @@ synth_files =
     apertif_unb1_correlator_mesh_ref.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_mesh_ref.vhd
 
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_rx_only/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_rx_only/hdllib.cfg
index dfc183f19b91d3b930f30e60439ce6fc4216da12..91ddfd39b7e3cbd7633b7cf13bd429b5aa54730b 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_rx_only/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_rx_only/hdllib.cfg
@@ -21,6 +21,7 @@ synth_files =
     apertif_unb1_correlator_rx_only.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
 
 
 [modelsim_project_file]
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_simple/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_simple/hdllib.cfg
index 786352ee01edb486f43fa5ed649b69cba2b8be08..98da1d308ed3eafe409b3811373a831597bffe9e 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_simple/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/apertif_unb1_correlator_simple/hdllib.cfg
@@ -20,6 +20,7 @@ synth_files =
     apertif_unb1_correlator_simple.vhd
     
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_apertif_unb1_correlator_simple.vhd
 
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/revisions/sim_apertif_unb1_correlator_nodes/hdllib.cfg b/applications/apertif/designs/apertif_unb1_correlator/revisions/sim_apertif_unb1_correlator_nodes/hdllib.cfg
index 67fd660b122935d7d60f9a388f5f9c236b361367..d6685629b4c9c7936d0952f5c9dbe0e0ce93fb0c 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/revisions/sim_apertif_unb1_correlator_nodes/hdllib.cfg
+++ b/applications/apertif/designs/apertif_unb1_correlator/revisions/sim_apertif_unb1_correlator_nodes/hdllib.cfg
@@ -17,6 +17,7 @@ synth_files =
     ../../src/vhdl/node_apertif_unb1_correlator_output.vhd
    
 test_bench_files = 
+    ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd
     tb_node_apertif_unb1_correlator_input.vhd
 
 
diff --git a/applications/apertif/designs/apertif_unb1_correlator/src/python/gen_beamlet_lookup.py b/applications/apertif/designs/apertif_unb1_correlator/src/python/gen_beamlet_lookup.py
index 1ffdbb9be0ba926ceecc8c94f1e3147cb05ea8db..67c0865f9221fe8d90051bd83a1ac30d8078f164 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/src/python/gen_beamlet_lookup.py
+++ b/applications/apertif/designs/apertif_unb1_correlator/src/python/gen_beamlet_lookup.py
@@ -2,8 +2,20 @@
 # . Daniel van der Schuur
 # Purpose:
 # . Print beamlet mappings of Imaging vs. Time domain (ARTS SC4, SC3).
-# . Generate the corresponding lookup table as VHDL code.
+# . Generate 2 VHDL files:
+#   1) ARTS -> Imaging lookup table (ROM entity) used in correlator output
+#      . beamlet_loopup.vhd with entity 'beamlet_lookup'
+#   2) Inverse Imaging -> ARTS lookup function used for verification
+#      . tb_beamlet_lookup_pkg.vhd with function 'beamlet_lookip_inverse'
+# Remarks:
+# . Any changes in the beamlet mapping and/or reordering should be done in the
+#   first Numpy stage below only. No need to change the VHDL generation 
+#   stages.
 
+###############################################################################
+# Generate and print the Imaging vs. Time domain beamlet mappings and lookup
+# table between the two
+###############################################################################
 import numpy as np
 np.set_printoptions(linewidth=250)
 
@@ -24,13 +36,16 @@ for cb in range(5): t[:,30+cb] = range(513+cb*48,513+cb*48+48,2) # CB 30..34: be
 for cb in range(5): t[:,35+cb] = range(769+cb*48,769+cb*48+48,2) # CB 35..39: beamlets 769,771,..,1007
 print t
 
-print 'Generating VHDL file with lookup table [time domain beamlet] -> [imaging beamlet]: ../vhdl/beamlet_lookup.vhd'
-
 lookup_list = []
 for bt,bi in zip(np.nditer(t), np.nditer(i)):
     lookup_list.append((int(bt),int(bi)))
 lookup_list.sort(key=lambda tup: tup[0]) # Sort the list so we get incrementing addresses (beamlet_in)
 
+###############################################################################
+# Generate the Time domain -> Imaging lookup table as a VHDL entity
+###############################################################################
+print 'Generating VHDL file with lookup table [time domain beamlet] -> [imaging beamlet]: ../vhdl/beamlet_lookup.vhd'
+
 head = """LIBRARY ieee;
 USE ieee.std_logic_1164.all;
 
@@ -69,3 +84,50 @@ with open('../vhdl/beamlet_lookup.vhd', 'w') as f:
     f.write(tail)
 f.close()
 
+###############################################################################
+# Generate the inverse Imaging -> Time domain lookup table as a VHDL function
+###############################################################################
+print 'Generating inverse VHDL function with lookup table [imaging beamlet] -> [time domain beamlet]: ../../tb/vhdl/tb_beamlet_lookup_pkg.vhd'
+
+head = """LIBRARY IEEE, common_lib;
+USE IEEE.STD_LOGIC_1164.ALL;
+USE common_lib.common_pkg.ALL;
+USE common_lib.common_str_pkg.ALL;
+
+-- This file was generated by ../python/gen_beamlet_lookup.py
+
+PACKAGE tb_beamlet_lookup_pkg IS
+
+  FUNCTION beamlet_lookup_inverse(beamlet_in : NATURAL) RETURN NATURAL;
+
+END tb_beamlet_lookup_pkg;
+
+PACKAGE BODY tb_beamlet_lookup_pkg IS
+
+  FUNCTION beamlet_lookup_inverse(beamlet_in : NATURAL) RETURN NATURAL IS
+    VARIABLE v_beamlet_in_slv  : STD_LOGIC_VECTOR(15 DOWNTO 0) := TO_UVEC(beamlet_in, 16);
+    VARIABLE v_beamlet_in_lsb  : NATURAL := TO_UINT(v_beamlet_in_slv( 9 DOWNTO  0));
+    VARIABLE v_beamlet_in_msb  : NATURAL := TO_UINT(v_beamlet_in_slv(15 DOWNTO 10) & "0000000000");
+    VARIABLE v_beamlet_out_msb : NATURAL := v_beamlet_in_msb;
+    VARIABLE v_beamlet_out_lsb : NATURAL;
+  BEGIN
+    CASE v_beamlet_in_lsb IS
+"""
+
+tail = """      WHEN OTHERS => REPORT "Unknown beamlet_in: " & int_to_str(beamlet_in) SEVERITY FAILURE;
+    END CASE;
+    RETURN v_beamlet_out_msb + v_beamlet_out_lsb;
+  END;
+END tb_beamlet_lookup_pkg;
+"""
+
+with open('../../tb/vhdl/tb_beamlet_lookup_pkg.vhd', 'w') as f:
+    f.write(head)
+    for beamlet_mapping in lookup_list:
+        beamlet_in  = str(beamlet_mapping[1])
+        beamlet_out = str(beamlet_mapping[0])
+        line = '      WHEN '+beamlet_in+' => v_beamlet_out_lsb := '+beamlet_out+';\n'
+        f.write(line)
+    f.write(tail)
+f.close()
+
diff --git a/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_apertif_unb1_correlator_nodes.vhd b/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_apertif_unb1_correlator_nodes.vhd
index e113814ca5de3a596c15c7177cfa75bc1828c27f..854ca722e7286ff35479858373d35b2af2651921 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_apertif_unb1_correlator_nodes.vhd
+++ b/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_apertif_unb1_correlator_nodes.vhd
@@ -54,6 +54,7 @@ USE common_lib.tb_common_pkg.ALL;
 USE work.apertif_unb1_correlator_pkg.ALL;
 USE fft_lib.fft_pkg.ALL;
 USE wpfb_lib.wpfb_pkg.ALL;
+USE work.tb_beamlet_lookup_pkg.ALL;
 
 ENTITY tb_apertif_unb1_correlator_nodes IS
   GENERIC (
@@ -456,9 +457,9 @@ BEGIN
         -- . channel
         mmf_mm_bus_rd(c_mm_file_ram_diag_data_buffer_output, v_addr + 12, rd_data_db, tb_clk);
         v_rd_channel := TO_UINT(rd_data_db(31 DOWNTO 16));
-        ASSERT v_rd_beamlet = v_exp_beamlet AND v_rd_channel = v_exp_channel REPORT "Wrong beamlet, channel index in packet header: " &
+        ASSERT beamlet_lookup_inverse(v_rd_beamlet) = v_exp_beamlet AND v_rd_channel = v_exp_channel REPORT "Wrong beamlet, channel index in packet header: " &
                "(" & int_to_str(v_exp_beamlet) & ", " & int_to_str(v_exp_channel) & ") /= " &
-               "(" & int_to_str(v_rd_beamlet) & ", " & int_to_str(v_rd_channel) & ")" SEVERITY ERROR;
+               "(" & int_to_str(beamlet_lookup_inverse(v_rd_beamlet)) & ", " & int_to_str(v_rd_channel) & ")" SEVERITY ERROR;
 
         -- . timestamp (= bsn)
         mmf_mm_bus_rd(c_mm_file_ram_diag_data_buffer_output, v_addr + 13, rd_data_db, tb_clk);
diff --git a/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_beamlet_lookup_pkg.vhd b/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_beamlet_lookup_pkg.vhd
new file mode 100644
index 0000000000000000000000000000000000000000..1f0cdab47432a913296d505b9d12a863713cc92a
--- /dev/null
+++ b/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_beamlet_lookup_pkg.vhd
@@ -0,0 +1,988 @@
+LIBRARY IEEE, common_lib;
+USE IEEE.STD_LOGIC_1164.ALL;
+USE common_lib.common_pkg.ALL;
+USE common_lib.common_str_pkg.ALL;
+
+-- This file was generated by ../python/gen_beamlet_lookup.py
+
+PACKAGE tb_beamlet_lookup_pkg IS
+
+  FUNCTION beamlet_lookup_inverse(beamlet_in : NATURAL) RETURN NATURAL;
+
+END tb_beamlet_lookup_pkg;
+
+PACKAGE BODY tb_beamlet_lookup_pkg IS
+
+  FUNCTION beamlet_lookup_inverse(beamlet_in : NATURAL) RETURN NATURAL IS
+    VARIABLE v_beamlet_in_slv  : STD_LOGIC_VECTOR(15 DOWNTO 0) := TO_UVEC(beamlet_in, 16);
+    VARIABLE v_beamlet_in_lsb  : NATURAL := TO_UINT(v_beamlet_in_slv( 9 DOWNTO  0));
+    VARIABLE v_beamlet_in_msb  : NATURAL := TO_UINT(v_beamlet_in_slv(15 DOWNTO 10) & "0000000000");
+    VARIABLE v_beamlet_out_msb : NATURAL := v_beamlet_in_msb;
+    VARIABLE v_beamlet_out_lsb : NATURAL;
+  BEGIN
+    CASE v_beamlet_in_lsb IS
+      WHEN 0 => v_beamlet_out_lsb := 0;
+      WHEN 20 => v_beamlet_out_lsb := 1;
+      WHEN 40 => v_beamlet_out_lsb := 2;
+      WHEN 60 => v_beamlet_out_lsb := 3;
+      WHEN 80 => v_beamlet_out_lsb := 4;
+      WHEN 100 => v_beamlet_out_lsb := 5;
+      WHEN 120 => v_beamlet_out_lsb := 6;
+      WHEN 140 => v_beamlet_out_lsb := 7;
+      WHEN 160 => v_beamlet_out_lsb := 8;
+      WHEN 180 => v_beamlet_out_lsb := 9;
+      WHEN 200 => v_beamlet_out_lsb := 10;
+      WHEN 220 => v_beamlet_out_lsb := 11;
+      WHEN 256 => v_beamlet_out_lsb := 12;
+      WHEN 276 => v_beamlet_out_lsb := 13;
+      WHEN 296 => v_beamlet_out_lsb := 14;
+      WHEN 316 => v_beamlet_out_lsb := 15;
+      WHEN 336 => v_beamlet_out_lsb := 16;
+      WHEN 356 => v_beamlet_out_lsb := 17;
+      WHEN 376 => v_beamlet_out_lsb := 18;
+      WHEN 396 => v_beamlet_out_lsb := 19;
+      WHEN 416 => v_beamlet_out_lsb := 20;
+      WHEN 436 => v_beamlet_out_lsb := 21;
+      WHEN 456 => v_beamlet_out_lsb := 22;
+      WHEN 476 => v_beamlet_out_lsb := 23;
+      WHEN 512 => v_beamlet_out_lsb := 24;
+      WHEN 532 => v_beamlet_out_lsb := 25;
+      WHEN 552 => v_beamlet_out_lsb := 26;
+      WHEN 572 => v_beamlet_out_lsb := 27;
+      WHEN 592 => v_beamlet_out_lsb := 28;
+      WHEN 612 => v_beamlet_out_lsb := 29;
+      WHEN 632 => v_beamlet_out_lsb := 30;
+      WHEN 652 => v_beamlet_out_lsb := 31;
+      WHEN 672 => v_beamlet_out_lsb := 32;
+      WHEN 692 => v_beamlet_out_lsb := 33;
+      WHEN 712 => v_beamlet_out_lsb := 34;
+      WHEN 732 => v_beamlet_out_lsb := 35;
+      WHEN 768 => v_beamlet_out_lsb := 36;
+      WHEN 788 => v_beamlet_out_lsb := 37;
+      WHEN 808 => v_beamlet_out_lsb := 38;
+      WHEN 828 => v_beamlet_out_lsb := 39;
+      WHEN 848 => v_beamlet_out_lsb := 40;
+      WHEN 868 => v_beamlet_out_lsb := 41;
+      WHEN 888 => v_beamlet_out_lsb := 42;
+      WHEN 908 => v_beamlet_out_lsb := 43;
+      WHEN 928 => v_beamlet_out_lsb := 44;
+      WHEN 948 => v_beamlet_out_lsb := 45;
+      WHEN 968 => v_beamlet_out_lsb := 46;
+      WHEN 988 => v_beamlet_out_lsb := 47;
+      WHEN 1 => v_beamlet_out_lsb := 48;
+      WHEN 21 => v_beamlet_out_lsb := 49;
+      WHEN 41 => v_beamlet_out_lsb := 50;
+      WHEN 61 => v_beamlet_out_lsb := 51;
+      WHEN 81 => v_beamlet_out_lsb := 52;
+      WHEN 101 => v_beamlet_out_lsb := 53;
+      WHEN 121 => v_beamlet_out_lsb := 54;
+      WHEN 141 => v_beamlet_out_lsb := 55;
+      WHEN 161 => v_beamlet_out_lsb := 56;
+      WHEN 181 => v_beamlet_out_lsb := 57;
+      WHEN 201 => v_beamlet_out_lsb := 58;
+      WHEN 221 => v_beamlet_out_lsb := 59;
+      WHEN 257 => v_beamlet_out_lsb := 60;
+      WHEN 277 => v_beamlet_out_lsb := 61;
+      WHEN 297 => v_beamlet_out_lsb := 62;
+      WHEN 317 => v_beamlet_out_lsb := 63;
+      WHEN 337 => v_beamlet_out_lsb := 64;
+      WHEN 357 => v_beamlet_out_lsb := 65;
+      WHEN 377 => v_beamlet_out_lsb := 66;
+      WHEN 397 => v_beamlet_out_lsb := 67;
+      WHEN 417 => v_beamlet_out_lsb := 68;
+      WHEN 437 => v_beamlet_out_lsb := 69;
+      WHEN 457 => v_beamlet_out_lsb := 70;
+      WHEN 477 => v_beamlet_out_lsb := 71;
+      WHEN 513 => v_beamlet_out_lsb := 72;
+      WHEN 533 => v_beamlet_out_lsb := 73;
+      WHEN 553 => v_beamlet_out_lsb := 74;
+      WHEN 573 => v_beamlet_out_lsb := 75;
+      WHEN 593 => v_beamlet_out_lsb := 76;
+      WHEN 613 => v_beamlet_out_lsb := 77;
+      WHEN 633 => v_beamlet_out_lsb := 78;
+      WHEN 653 => v_beamlet_out_lsb := 79;
+      WHEN 673 => v_beamlet_out_lsb := 80;
+      WHEN 693 => v_beamlet_out_lsb := 81;
+      WHEN 713 => v_beamlet_out_lsb := 82;
+      WHEN 733 => v_beamlet_out_lsb := 83;
+      WHEN 769 => v_beamlet_out_lsb := 84;
+      WHEN 789 => v_beamlet_out_lsb := 85;
+      WHEN 809 => v_beamlet_out_lsb := 86;
+      WHEN 829 => v_beamlet_out_lsb := 87;
+      WHEN 849 => v_beamlet_out_lsb := 88;
+      WHEN 869 => v_beamlet_out_lsb := 89;
+      WHEN 889 => v_beamlet_out_lsb := 90;
+      WHEN 909 => v_beamlet_out_lsb := 91;
+      WHEN 929 => v_beamlet_out_lsb := 92;
+      WHEN 949 => v_beamlet_out_lsb := 93;
+      WHEN 969 => v_beamlet_out_lsb := 94;
+      WHEN 989 => v_beamlet_out_lsb := 95;
+      WHEN 2 => v_beamlet_out_lsb := 96;
+      WHEN 22 => v_beamlet_out_lsb := 97;
+      WHEN 42 => v_beamlet_out_lsb := 98;
+      WHEN 62 => v_beamlet_out_lsb := 99;
+      WHEN 82 => v_beamlet_out_lsb := 100;
+      WHEN 102 => v_beamlet_out_lsb := 101;
+      WHEN 122 => v_beamlet_out_lsb := 102;
+      WHEN 142 => v_beamlet_out_lsb := 103;
+      WHEN 162 => v_beamlet_out_lsb := 104;
+      WHEN 182 => v_beamlet_out_lsb := 105;
+      WHEN 202 => v_beamlet_out_lsb := 106;
+      WHEN 222 => v_beamlet_out_lsb := 107;
+      WHEN 258 => v_beamlet_out_lsb := 108;
+      WHEN 278 => v_beamlet_out_lsb := 109;
+      WHEN 298 => v_beamlet_out_lsb := 110;
+      WHEN 318 => v_beamlet_out_lsb := 111;
+      WHEN 338 => v_beamlet_out_lsb := 112;
+      WHEN 358 => v_beamlet_out_lsb := 113;
+      WHEN 378 => v_beamlet_out_lsb := 114;
+      WHEN 398 => v_beamlet_out_lsb := 115;
+      WHEN 418 => v_beamlet_out_lsb := 116;
+      WHEN 438 => v_beamlet_out_lsb := 117;
+      WHEN 458 => v_beamlet_out_lsb := 118;
+      WHEN 478 => v_beamlet_out_lsb := 119;
+      WHEN 514 => v_beamlet_out_lsb := 120;
+      WHEN 534 => v_beamlet_out_lsb := 121;
+      WHEN 554 => v_beamlet_out_lsb := 122;
+      WHEN 574 => v_beamlet_out_lsb := 123;
+      WHEN 594 => v_beamlet_out_lsb := 124;
+      WHEN 614 => v_beamlet_out_lsb := 125;
+      WHEN 634 => v_beamlet_out_lsb := 126;
+      WHEN 654 => v_beamlet_out_lsb := 127;
+      WHEN 674 => v_beamlet_out_lsb := 128;
+      WHEN 694 => v_beamlet_out_lsb := 129;
+      WHEN 714 => v_beamlet_out_lsb := 130;
+      WHEN 734 => v_beamlet_out_lsb := 131;
+      WHEN 770 => v_beamlet_out_lsb := 132;
+      WHEN 790 => v_beamlet_out_lsb := 133;
+      WHEN 810 => v_beamlet_out_lsb := 134;
+      WHEN 830 => v_beamlet_out_lsb := 135;
+      WHEN 850 => v_beamlet_out_lsb := 136;
+      WHEN 870 => v_beamlet_out_lsb := 137;
+      WHEN 890 => v_beamlet_out_lsb := 138;
+      WHEN 910 => v_beamlet_out_lsb := 139;
+      WHEN 930 => v_beamlet_out_lsb := 140;
+      WHEN 950 => v_beamlet_out_lsb := 141;
+      WHEN 970 => v_beamlet_out_lsb := 142;
+      WHEN 990 => v_beamlet_out_lsb := 143;
+      WHEN 3 => v_beamlet_out_lsb := 144;
+      WHEN 23 => v_beamlet_out_lsb := 145;
+      WHEN 43 => v_beamlet_out_lsb := 146;
+      WHEN 63 => v_beamlet_out_lsb := 147;
+      WHEN 83 => v_beamlet_out_lsb := 148;
+      WHEN 103 => v_beamlet_out_lsb := 149;
+      WHEN 123 => v_beamlet_out_lsb := 150;
+      WHEN 143 => v_beamlet_out_lsb := 151;
+      WHEN 163 => v_beamlet_out_lsb := 152;
+      WHEN 183 => v_beamlet_out_lsb := 153;
+      WHEN 203 => v_beamlet_out_lsb := 154;
+      WHEN 223 => v_beamlet_out_lsb := 155;
+      WHEN 259 => v_beamlet_out_lsb := 156;
+      WHEN 279 => v_beamlet_out_lsb := 157;
+      WHEN 299 => v_beamlet_out_lsb := 158;
+      WHEN 319 => v_beamlet_out_lsb := 159;
+      WHEN 339 => v_beamlet_out_lsb := 160;
+      WHEN 359 => v_beamlet_out_lsb := 161;
+      WHEN 379 => v_beamlet_out_lsb := 162;
+      WHEN 399 => v_beamlet_out_lsb := 163;
+      WHEN 419 => v_beamlet_out_lsb := 164;
+      WHEN 439 => v_beamlet_out_lsb := 165;
+      WHEN 459 => v_beamlet_out_lsb := 166;
+      WHEN 479 => v_beamlet_out_lsb := 167;
+      WHEN 515 => v_beamlet_out_lsb := 168;
+      WHEN 535 => v_beamlet_out_lsb := 169;
+      WHEN 555 => v_beamlet_out_lsb := 170;
+      WHEN 575 => v_beamlet_out_lsb := 171;
+      WHEN 595 => v_beamlet_out_lsb := 172;
+      WHEN 615 => v_beamlet_out_lsb := 173;
+      WHEN 635 => v_beamlet_out_lsb := 174;
+      WHEN 655 => v_beamlet_out_lsb := 175;
+      WHEN 675 => v_beamlet_out_lsb := 176;
+      WHEN 695 => v_beamlet_out_lsb := 177;
+      WHEN 715 => v_beamlet_out_lsb := 178;
+      WHEN 735 => v_beamlet_out_lsb := 179;
+      WHEN 771 => v_beamlet_out_lsb := 180;
+      WHEN 791 => v_beamlet_out_lsb := 181;
+      WHEN 811 => v_beamlet_out_lsb := 182;
+      WHEN 831 => v_beamlet_out_lsb := 183;
+      WHEN 851 => v_beamlet_out_lsb := 184;
+      WHEN 871 => v_beamlet_out_lsb := 185;
+      WHEN 891 => v_beamlet_out_lsb := 186;
+      WHEN 911 => v_beamlet_out_lsb := 187;
+      WHEN 931 => v_beamlet_out_lsb := 188;
+      WHEN 951 => v_beamlet_out_lsb := 189;
+      WHEN 971 => v_beamlet_out_lsb := 190;
+      WHEN 991 => v_beamlet_out_lsb := 191;
+      WHEN 4 => v_beamlet_out_lsb := 192;
+      WHEN 24 => v_beamlet_out_lsb := 193;
+      WHEN 44 => v_beamlet_out_lsb := 194;
+      WHEN 64 => v_beamlet_out_lsb := 195;
+      WHEN 84 => v_beamlet_out_lsb := 196;
+      WHEN 104 => v_beamlet_out_lsb := 197;
+      WHEN 124 => v_beamlet_out_lsb := 198;
+      WHEN 144 => v_beamlet_out_lsb := 199;
+      WHEN 164 => v_beamlet_out_lsb := 200;
+      WHEN 184 => v_beamlet_out_lsb := 201;
+      WHEN 204 => v_beamlet_out_lsb := 202;
+      WHEN 224 => v_beamlet_out_lsb := 203;
+      WHEN 260 => v_beamlet_out_lsb := 204;
+      WHEN 280 => v_beamlet_out_lsb := 205;
+      WHEN 300 => v_beamlet_out_lsb := 206;
+      WHEN 320 => v_beamlet_out_lsb := 207;
+      WHEN 340 => v_beamlet_out_lsb := 208;
+      WHEN 360 => v_beamlet_out_lsb := 209;
+      WHEN 380 => v_beamlet_out_lsb := 210;
+      WHEN 400 => v_beamlet_out_lsb := 211;
+      WHEN 420 => v_beamlet_out_lsb := 212;
+      WHEN 440 => v_beamlet_out_lsb := 213;
+      WHEN 460 => v_beamlet_out_lsb := 214;
+      WHEN 480 => v_beamlet_out_lsb := 215;
+      WHEN 516 => v_beamlet_out_lsb := 216;
+      WHEN 536 => v_beamlet_out_lsb := 217;
+      WHEN 556 => v_beamlet_out_lsb := 218;
+      WHEN 576 => v_beamlet_out_lsb := 219;
+      WHEN 596 => v_beamlet_out_lsb := 220;
+      WHEN 616 => v_beamlet_out_lsb := 221;
+      WHEN 636 => v_beamlet_out_lsb := 222;
+      WHEN 656 => v_beamlet_out_lsb := 223;
+      WHEN 676 => v_beamlet_out_lsb := 224;
+      WHEN 696 => v_beamlet_out_lsb := 225;
+      WHEN 716 => v_beamlet_out_lsb := 226;
+      WHEN 736 => v_beamlet_out_lsb := 227;
+      WHEN 772 => v_beamlet_out_lsb := 228;
+      WHEN 792 => v_beamlet_out_lsb := 229;
+      WHEN 812 => v_beamlet_out_lsb := 230;
+      WHEN 832 => v_beamlet_out_lsb := 231;
+      WHEN 852 => v_beamlet_out_lsb := 232;
+      WHEN 872 => v_beamlet_out_lsb := 233;
+      WHEN 892 => v_beamlet_out_lsb := 234;
+      WHEN 912 => v_beamlet_out_lsb := 235;
+      WHEN 932 => v_beamlet_out_lsb := 236;
+      WHEN 952 => v_beamlet_out_lsb := 237;
+      WHEN 972 => v_beamlet_out_lsb := 238;
+      WHEN 992 => v_beamlet_out_lsb := 239;
+      WHEN 5 => v_beamlet_out_lsb := 256;
+      WHEN 25 => v_beamlet_out_lsb := 257;
+      WHEN 45 => v_beamlet_out_lsb := 258;
+      WHEN 65 => v_beamlet_out_lsb := 259;
+      WHEN 85 => v_beamlet_out_lsb := 260;
+      WHEN 105 => v_beamlet_out_lsb := 261;
+      WHEN 125 => v_beamlet_out_lsb := 262;
+      WHEN 145 => v_beamlet_out_lsb := 263;
+      WHEN 165 => v_beamlet_out_lsb := 264;
+      WHEN 185 => v_beamlet_out_lsb := 265;
+      WHEN 205 => v_beamlet_out_lsb := 266;
+      WHEN 225 => v_beamlet_out_lsb := 267;
+      WHEN 261 => v_beamlet_out_lsb := 268;
+      WHEN 281 => v_beamlet_out_lsb := 269;
+      WHEN 301 => v_beamlet_out_lsb := 270;
+      WHEN 321 => v_beamlet_out_lsb := 271;
+      WHEN 341 => v_beamlet_out_lsb := 272;
+      WHEN 361 => v_beamlet_out_lsb := 273;
+      WHEN 381 => v_beamlet_out_lsb := 274;
+      WHEN 401 => v_beamlet_out_lsb := 275;
+      WHEN 421 => v_beamlet_out_lsb := 276;
+      WHEN 441 => v_beamlet_out_lsb := 277;
+      WHEN 461 => v_beamlet_out_lsb := 278;
+      WHEN 481 => v_beamlet_out_lsb := 279;
+      WHEN 517 => v_beamlet_out_lsb := 280;
+      WHEN 537 => v_beamlet_out_lsb := 281;
+      WHEN 557 => v_beamlet_out_lsb := 282;
+      WHEN 577 => v_beamlet_out_lsb := 283;
+      WHEN 597 => v_beamlet_out_lsb := 284;
+      WHEN 617 => v_beamlet_out_lsb := 285;
+      WHEN 637 => v_beamlet_out_lsb := 286;
+      WHEN 657 => v_beamlet_out_lsb := 287;
+      WHEN 677 => v_beamlet_out_lsb := 288;
+      WHEN 697 => v_beamlet_out_lsb := 289;
+      WHEN 717 => v_beamlet_out_lsb := 290;
+      WHEN 737 => v_beamlet_out_lsb := 291;
+      WHEN 773 => v_beamlet_out_lsb := 292;
+      WHEN 793 => v_beamlet_out_lsb := 293;
+      WHEN 813 => v_beamlet_out_lsb := 294;
+      WHEN 833 => v_beamlet_out_lsb := 295;
+      WHEN 853 => v_beamlet_out_lsb := 296;
+      WHEN 873 => v_beamlet_out_lsb := 297;
+      WHEN 893 => v_beamlet_out_lsb := 298;
+      WHEN 913 => v_beamlet_out_lsb := 299;
+      WHEN 933 => v_beamlet_out_lsb := 300;
+      WHEN 953 => v_beamlet_out_lsb := 301;
+      WHEN 973 => v_beamlet_out_lsb := 302;
+      WHEN 993 => v_beamlet_out_lsb := 303;
+      WHEN 6 => v_beamlet_out_lsb := 304;
+      WHEN 26 => v_beamlet_out_lsb := 305;
+      WHEN 46 => v_beamlet_out_lsb := 306;
+      WHEN 66 => v_beamlet_out_lsb := 307;
+      WHEN 86 => v_beamlet_out_lsb := 308;
+      WHEN 106 => v_beamlet_out_lsb := 309;
+      WHEN 126 => v_beamlet_out_lsb := 310;
+      WHEN 146 => v_beamlet_out_lsb := 311;
+      WHEN 166 => v_beamlet_out_lsb := 312;
+      WHEN 186 => v_beamlet_out_lsb := 313;
+      WHEN 206 => v_beamlet_out_lsb := 314;
+      WHEN 226 => v_beamlet_out_lsb := 315;
+      WHEN 262 => v_beamlet_out_lsb := 316;
+      WHEN 282 => v_beamlet_out_lsb := 317;
+      WHEN 302 => v_beamlet_out_lsb := 318;
+      WHEN 322 => v_beamlet_out_lsb := 319;
+      WHEN 342 => v_beamlet_out_lsb := 320;
+      WHEN 362 => v_beamlet_out_lsb := 321;
+      WHEN 382 => v_beamlet_out_lsb := 322;
+      WHEN 402 => v_beamlet_out_lsb := 323;
+      WHEN 422 => v_beamlet_out_lsb := 324;
+      WHEN 442 => v_beamlet_out_lsb := 325;
+      WHEN 462 => v_beamlet_out_lsb := 326;
+      WHEN 482 => v_beamlet_out_lsb := 327;
+      WHEN 518 => v_beamlet_out_lsb := 328;
+      WHEN 538 => v_beamlet_out_lsb := 329;
+      WHEN 558 => v_beamlet_out_lsb := 330;
+      WHEN 578 => v_beamlet_out_lsb := 331;
+      WHEN 598 => v_beamlet_out_lsb := 332;
+      WHEN 618 => v_beamlet_out_lsb := 333;
+      WHEN 638 => v_beamlet_out_lsb := 334;
+      WHEN 658 => v_beamlet_out_lsb := 335;
+      WHEN 678 => v_beamlet_out_lsb := 336;
+      WHEN 698 => v_beamlet_out_lsb := 337;
+      WHEN 718 => v_beamlet_out_lsb := 338;
+      WHEN 738 => v_beamlet_out_lsb := 339;
+      WHEN 774 => v_beamlet_out_lsb := 340;
+      WHEN 794 => v_beamlet_out_lsb := 341;
+      WHEN 814 => v_beamlet_out_lsb := 342;
+      WHEN 834 => v_beamlet_out_lsb := 343;
+      WHEN 854 => v_beamlet_out_lsb := 344;
+      WHEN 874 => v_beamlet_out_lsb := 345;
+      WHEN 894 => v_beamlet_out_lsb := 346;
+      WHEN 914 => v_beamlet_out_lsb := 347;
+      WHEN 934 => v_beamlet_out_lsb := 348;
+      WHEN 954 => v_beamlet_out_lsb := 349;
+      WHEN 974 => v_beamlet_out_lsb := 350;
+      WHEN 994 => v_beamlet_out_lsb := 351;
+      WHEN 7 => v_beamlet_out_lsb := 352;
+      WHEN 27 => v_beamlet_out_lsb := 353;
+      WHEN 47 => v_beamlet_out_lsb := 354;
+      WHEN 67 => v_beamlet_out_lsb := 355;
+      WHEN 87 => v_beamlet_out_lsb := 356;
+      WHEN 107 => v_beamlet_out_lsb := 357;
+      WHEN 127 => v_beamlet_out_lsb := 358;
+      WHEN 147 => v_beamlet_out_lsb := 359;
+      WHEN 167 => v_beamlet_out_lsb := 360;
+      WHEN 187 => v_beamlet_out_lsb := 361;
+      WHEN 207 => v_beamlet_out_lsb := 362;
+      WHEN 227 => v_beamlet_out_lsb := 363;
+      WHEN 263 => v_beamlet_out_lsb := 364;
+      WHEN 283 => v_beamlet_out_lsb := 365;
+      WHEN 303 => v_beamlet_out_lsb := 366;
+      WHEN 323 => v_beamlet_out_lsb := 367;
+      WHEN 343 => v_beamlet_out_lsb := 368;
+      WHEN 363 => v_beamlet_out_lsb := 369;
+      WHEN 383 => v_beamlet_out_lsb := 370;
+      WHEN 403 => v_beamlet_out_lsb := 371;
+      WHEN 423 => v_beamlet_out_lsb := 372;
+      WHEN 443 => v_beamlet_out_lsb := 373;
+      WHEN 463 => v_beamlet_out_lsb := 374;
+      WHEN 483 => v_beamlet_out_lsb := 375;
+      WHEN 519 => v_beamlet_out_lsb := 376;
+      WHEN 539 => v_beamlet_out_lsb := 377;
+      WHEN 559 => v_beamlet_out_lsb := 378;
+      WHEN 579 => v_beamlet_out_lsb := 379;
+      WHEN 599 => v_beamlet_out_lsb := 380;
+      WHEN 619 => v_beamlet_out_lsb := 381;
+      WHEN 639 => v_beamlet_out_lsb := 382;
+      WHEN 659 => v_beamlet_out_lsb := 383;
+      WHEN 679 => v_beamlet_out_lsb := 384;
+      WHEN 699 => v_beamlet_out_lsb := 385;
+      WHEN 719 => v_beamlet_out_lsb := 386;
+      WHEN 739 => v_beamlet_out_lsb := 387;
+      WHEN 775 => v_beamlet_out_lsb := 388;
+      WHEN 795 => v_beamlet_out_lsb := 389;
+      WHEN 815 => v_beamlet_out_lsb := 390;
+      WHEN 835 => v_beamlet_out_lsb := 391;
+      WHEN 855 => v_beamlet_out_lsb := 392;
+      WHEN 875 => v_beamlet_out_lsb := 393;
+      WHEN 895 => v_beamlet_out_lsb := 394;
+      WHEN 915 => v_beamlet_out_lsb := 395;
+      WHEN 935 => v_beamlet_out_lsb := 396;
+      WHEN 955 => v_beamlet_out_lsb := 397;
+      WHEN 975 => v_beamlet_out_lsb := 398;
+      WHEN 995 => v_beamlet_out_lsb := 399;
+      WHEN 8 => v_beamlet_out_lsb := 400;
+      WHEN 28 => v_beamlet_out_lsb := 401;
+      WHEN 48 => v_beamlet_out_lsb := 402;
+      WHEN 68 => v_beamlet_out_lsb := 403;
+      WHEN 88 => v_beamlet_out_lsb := 404;
+      WHEN 108 => v_beamlet_out_lsb := 405;
+      WHEN 128 => v_beamlet_out_lsb := 406;
+      WHEN 148 => v_beamlet_out_lsb := 407;
+      WHEN 168 => v_beamlet_out_lsb := 408;
+      WHEN 188 => v_beamlet_out_lsb := 409;
+      WHEN 208 => v_beamlet_out_lsb := 410;
+      WHEN 228 => v_beamlet_out_lsb := 411;
+      WHEN 264 => v_beamlet_out_lsb := 412;
+      WHEN 284 => v_beamlet_out_lsb := 413;
+      WHEN 304 => v_beamlet_out_lsb := 414;
+      WHEN 324 => v_beamlet_out_lsb := 415;
+      WHEN 344 => v_beamlet_out_lsb := 416;
+      WHEN 364 => v_beamlet_out_lsb := 417;
+      WHEN 384 => v_beamlet_out_lsb := 418;
+      WHEN 404 => v_beamlet_out_lsb := 419;
+      WHEN 424 => v_beamlet_out_lsb := 420;
+      WHEN 444 => v_beamlet_out_lsb := 421;
+      WHEN 464 => v_beamlet_out_lsb := 422;
+      WHEN 484 => v_beamlet_out_lsb := 423;
+      WHEN 520 => v_beamlet_out_lsb := 424;
+      WHEN 540 => v_beamlet_out_lsb := 425;
+      WHEN 560 => v_beamlet_out_lsb := 426;
+      WHEN 580 => v_beamlet_out_lsb := 427;
+      WHEN 600 => v_beamlet_out_lsb := 428;
+      WHEN 620 => v_beamlet_out_lsb := 429;
+      WHEN 640 => v_beamlet_out_lsb := 430;
+      WHEN 660 => v_beamlet_out_lsb := 431;
+      WHEN 680 => v_beamlet_out_lsb := 432;
+      WHEN 700 => v_beamlet_out_lsb := 433;
+      WHEN 720 => v_beamlet_out_lsb := 434;
+      WHEN 740 => v_beamlet_out_lsb := 435;
+      WHEN 776 => v_beamlet_out_lsb := 436;
+      WHEN 796 => v_beamlet_out_lsb := 437;
+      WHEN 816 => v_beamlet_out_lsb := 438;
+      WHEN 836 => v_beamlet_out_lsb := 439;
+      WHEN 856 => v_beamlet_out_lsb := 440;
+      WHEN 876 => v_beamlet_out_lsb := 441;
+      WHEN 896 => v_beamlet_out_lsb := 442;
+      WHEN 916 => v_beamlet_out_lsb := 443;
+      WHEN 936 => v_beamlet_out_lsb := 444;
+      WHEN 956 => v_beamlet_out_lsb := 445;
+      WHEN 976 => v_beamlet_out_lsb := 446;
+      WHEN 996 => v_beamlet_out_lsb := 447;
+      WHEN 9 => v_beamlet_out_lsb := 448;
+      WHEN 29 => v_beamlet_out_lsb := 449;
+      WHEN 49 => v_beamlet_out_lsb := 450;
+      WHEN 69 => v_beamlet_out_lsb := 451;
+      WHEN 89 => v_beamlet_out_lsb := 452;
+      WHEN 109 => v_beamlet_out_lsb := 453;
+      WHEN 129 => v_beamlet_out_lsb := 454;
+      WHEN 149 => v_beamlet_out_lsb := 455;
+      WHEN 169 => v_beamlet_out_lsb := 456;
+      WHEN 189 => v_beamlet_out_lsb := 457;
+      WHEN 209 => v_beamlet_out_lsb := 458;
+      WHEN 229 => v_beamlet_out_lsb := 459;
+      WHEN 265 => v_beamlet_out_lsb := 460;
+      WHEN 285 => v_beamlet_out_lsb := 461;
+      WHEN 305 => v_beamlet_out_lsb := 462;
+      WHEN 325 => v_beamlet_out_lsb := 463;
+      WHEN 345 => v_beamlet_out_lsb := 464;
+      WHEN 365 => v_beamlet_out_lsb := 465;
+      WHEN 385 => v_beamlet_out_lsb := 466;
+      WHEN 405 => v_beamlet_out_lsb := 467;
+      WHEN 425 => v_beamlet_out_lsb := 468;
+      WHEN 445 => v_beamlet_out_lsb := 469;
+      WHEN 465 => v_beamlet_out_lsb := 470;
+      WHEN 485 => v_beamlet_out_lsb := 471;
+      WHEN 521 => v_beamlet_out_lsb := 472;
+      WHEN 541 => v_beamlet_out_lsb := 473;
+      WHEN 561 => v_beamlet_out_lsb := 474;
+      WHEN 581 => v_beamlet_out_lsb := 475;
+      WHEN 601 => v_beamlet_out_lsb := 476;
+      WHEN 621 => v_beamlet_out_lsb := 477;
+      WHEN 641 => v_beamlet_out_lsb := 478;
+      WHEN 661 => v_beamlet_out_lsb := 479;
+      WHEN 681 => v_beamlet_out_lsb := 480;
+      WHEN 701 => v_beamlet_out_lsb := 481;
+      WHEN 721 => v_beamlet_out_lsb := 482;
+      WHEN 741 => v_beamlet_out_lsb := 483;
+      WHEN 777 => v_beamlet_out_lsb := 484;
+      WHEN 797 => v_beamlet_out_lsb := 485;
+      WHEN 817 => v_beamlet_out_lsb := 486;
+      WHEN 837 => v_beamlet_out_lsb := 487;
+      WHEN 857 => v_beamlet_out_lsb := 488;
+      WHEN 877 => v_beamlet_out_lsb := 489;
+      WHEN 897 => v_beamlet_out_lsb := 490;
+      WHEN 917 => v_beamlet_out_lsb := 491;
+      WHEN 937 => v_beamlet_out_lsb := 492;
+      WHEN 957 => v_beamlet_out_lsb := 493;
+      WHEN 977 => v_beamlet_out_lsb := 494;
+      WHEN 997 => v_beamlet_out_lsb := 495;
+      WHEN 10 => v_beamlet_out_lsb := 512;
+      WHEN 30 => v_beamlet_out_lsb := 513;
+      WHEN 50 => v_beamlet_out_lsb := 514;
+      WHEN 70 => v_beamlet_out_lsb := 515;
+      WHEN 90 => v_beamlet_out_lsb := 516;
+      WHEN 110 => v_beamlet_out_lsb := 517;
+      WHEN 130 => v_beamlet_out_lsb := 518;
+      WHEN 150 => v_beamlet_out_lsb := 519;
+      WHEN 170 => v_beamlet_out_lsb := 520;
+      WHEN 190 => v_beamlet_out_lsb := 521;
+      WHEN 210 => v_beamlet_out_lsb := 522;
+      WHEN 230 => v_beamlet_out_lsb := 523;
+      WHEN 266 => v_beamlet_out_lsb := 524;
+      WHEN 286 => v_beamlet_out_lsb := 525;
+      WHEN 306 => v_beamlet_out_lsb := 526;
+      WHEN 326 => v_beamlet_out_lsb := 527;
+      WHEN 346 => v_beamlet_out_lsb := 528;
+      WHEN 366 => v_beamlet_out_lsb := 529;
+      WHEN 386 => v_beamlet_out_lsb := 530;
+      WHEN 406 => v_beamlet_out_lsb := 531;
+      WHEN 426 => v_beamlet_out_lsb := 532;
+      WHEN 446 => v_beamlet_out_lsb := 533;
+      WHEN 466 => v_beamlet_out_lsb := 534;
+      WHEN 486 => v_beamlet_out_lsb := 535;
+      WHEN 522 => v_beamlet_out_lsb := 536;
+      WHEN 542 => v_beamlet_out_lsb := 537;
+      WHEN 562 => v_beamlet_out_lsb := 538;
+      WHEN 582 => v_beamlet_out_lsb := 539;
+      WHEN 602 => v_beamlet_out_lsb := 540;
+      WHEN 622 => v_beamlet_out_lsb := 541;
+      WHEN 642 => v_beamlet_out_lsb := 542;
+      WHEN 662 => v_beamlet_out_lsb := 543;
+      WHEN 682 => v_beamlet_out_lsb := 544;
+      WHEN 702 => v_beamlet_out_lsb := 545;
+      WHEN 722 => v_beamlet_out_lsb := 546;
+      WHEN 742 => v_beamlet_out_lsb := 547;
+      WHEN 778 => v_beamlet_out_lsb := 548;
+      WHEN 798 => v_beamlet_out_lsb := 549;
+      WHEN 818 => v_beamlet_out_lsb := 550;
+      WHEN 838 => v_beamlet_out_lsb := 551;
+      WHEN 858 => v_beamlet_out_lsb := 552;
+      WHEN 878 => v_beamlet_out_lsb := 553;
+      WHEN 898 => v_beamlet_out_lsb := 554;
+      WHEN 918 => v_beamlet_out_lsb := 555;
+      WHEN 938 => v_beamlet_out_lsb := 556;
+      WHEN 958 => v_beamlet_out_lsb := 557;
+      WHEN 978 => v_beamlet_out_lsb := 558;
+      WHEN 998 => v_beamlet_out_lsb := 559;
+      WHEN 11 => v_beamlet_out_lsb := 560;
+      WHEN 31 => v_beamlet_out_lsb := 561;
+      WHEN 51 => v_beamlet_out_lsb := 562;
+      WHEN 71 => v_beamlet_out_lsb := 563;
+      WHEN 91 => v_beamlet_out_lsb := 564;
+      WHEN 111 => v_beamlet_out_lsb := 565;
+      WHEN 131 => v_beamlet_out_lsb := 566;
+      WHEN 151 => v_beamlet_out_lsb := 567;
+      WHEN 171 => v_beamlet_out_lsb := 568;
+      WHEN 191 => v_beamlet_out_lsb := 569;
+      WHEN 211 => v_beamlet_out_lsb := 570;
+      WHEN 231 => v_beamlet_out_lsb := 571;
+      WHEN 267 => v_beamlet_out_lsb := 572;
+      WHEN 287 => v_beamlet_out_lsb := 573;
+      WHEN 307 => v_beamlet_out_lsb := 574;
+      WHEN 327 => v_beamlet_out_lsb := 575;
+      WHEN 347 => v_beamlet_out_lsb := 576;
+      WHEN 367 => v_beamlet_out_lsb := 577;
+      WHEN 387 => v_beamlet_out_lsb := 578;
+      WHEN 407 => v_beamlet_out_lsb := 579;
+      WHEN 427 => v_beamlet_out_lsb := 580;
+      WHEN 447 => v_beamlet_out_lsb := 581;
+      WHEN 467 => v_beamlet_out_lsb := 582;
+      WHEN 487 => v_beamlet_out_lsb := 583;
+      WHEN 523 => v_beamlet_out_lsb := 584;
+      WHEN 543 => v_beamlet_out_lsb := 585;
+      WHEN 563 => v_beamlet_out_lsb := 586;
+      WHEN 583 => v_beamlet_out_lsb := 587;
+      WHEN 603 => v_beamlet_out_lsb := 588;
+      WHEN 623 => v_beamlet_out_lsb := 589;
+      WHEN 643 => v_beamlet_out_lsb := 590;
+      WHEN 663 => v_beamlet_out_lsb := 591;
+      WHEN 683 => v_beamlet_out_lsb := 592;
+      WHEN 703 => v_beamlet_out_lsb := 593;
+      WHEN 723 => v_beamlet_out_lsb := 594;
+      WHEN 743 => v_beamlet_out_lsb := 595;
+      WHEN 779 => v_beamlet_out_lsb := 596;
+      WHEN 799 => v_beamlet_out_lsb := 597;
+      WHEN 819 => v_beamlet_out_lsb := 598;
+      WHEN 839 => v_beamlet_out_lsb := 599;
+      WHEN 859 => v_beamlet_out_lsb := 600;
+      WHEN 879 => v_beamlet_out_lsb := 601;
+      WHEN 899 => v_beamlet_out_lsb := 602;
+      WHEN 919 => v_beamlet_out_lsb := 603;
+      WHEN 939 => v_beamlet_out_lsb := 604;
+      WHEN 959 => v_beamlet_out_lsb := 605;
+      WHEN 979 => v_beamlet_out_lsb := 606;
+      WHEN 999 => v_beamlet_out_lsb := 607;
+      WHEN 12 => v_beamlet_out_lsb := 608;
+      WHEN 32 => v_beamlet_out_lsb := 609;
+      WHEN 52 => v_beamlet_out_lsb := 610;
+      WHEN 72 => v_beamlet_out_lsb := 611;
+      WHEN 92 => v_beamlet_out_lsb := 612;
+      WHEN 112 => v_beamlet_out_lsb := 613;
+      WHEN 132 => v_beamlet_out_lsb := 614;
+      WHEN 152 => v_beamlet_out_lsb := 615;
+      WHEN 172 => v_beamlet_out_lsb := 616;
+      WHEN 192 => v_beamlet_out_lsb := 617;
+      WHEN 212 => v_beamlet_out_lsb := 618;
+      WHEN 232 => v_beamlet_out_lsb := 619;
+      WHEN 268 => v_beamlet_out_lsb := 620;
+      WHEN 288 => v_beamlet_out_lsb := 621;
+      WHEN 308 => v_beamlet_out_lsb := 622;
+      WHEN 328 => v_beamlet_out_lsb := 623;
+      WHEN 348 => v_beamlet_out_lsb := 624;
+      WHEN 368 => v_beamlet_out_lsb := 625;
+      WHEN 388 => v_beamlet_out_lsb := 626;
+      WHEN 408 => v_beamlet_out_lsb := 627;
+      WHEN 428 => v_beamlet_out_lsb := 628;
+      WHEN 448 => v_beamlet_out_lsb := 629;
+      WHEN 468 => v_beamlet_out_lsb := 630;
+      WHEN 488 => v_beamlet_out_lsb := 631;
+      WHEN 524 => v_beamlet_out_lsb := 632;
+      WHEN 544 => v_beamlet_out_lsb := 633;
+      WHEN 564 => v_beamlet_out_lsb := 634;
+      WHEN 584 => v_beamlet_out_lsb := 635;
+      WHEN 604 => v_beamlet_out_lsb := 636;
+      WHEN 624 => v_beamlet_out_lsb := 637;
+      WHEN 644 => v_beamlet_out_lsb := 638;
+      WHEN 664 => v_beamlet_out_lsb := 639;
+      WHEN 684 => v_beamlet_out_lsb := 640;
+      WHEN 704 => v_beamlet_out_lsb := 641;
+      WHEN 724 => v_beamlet_out_lsb := 642;
+      WHEN 744 => v_beamlet_out_lsb := 643;
+      WHEN 780 => v_beamlet_out_lsb := 644;
+      WHEN 800 => v_beamlet_out_lsb := 645;
+      WHEN 820 => v_beamlet_out_lsb := 646;
+      WHEN 840 => v_beamlet_out_lsb := 647;
+      WHEN 860 => v_beamlet_out_lsb := 648;
+      WHEN 880 => v_beamlet_out_lsb := 649;
+      WHEN 900 => v_beamlet_out_lsb := 650;
+      WHEN 920 => v_beamlet_out_lsb := 651;
+      WHEN 940 => v_beamlet_out_lsb := 652;
+      WHEN 960 => v_beamlet_out_lsb := 653;
+      WHEN 980 => v_beamlet_out_lsb := 654;
+      WHEN 1000 => v_beamlet_out_lsb := 655;
+      WHEN 13 => v_beamlet_out_lsb := 656;
+      WHEN 33 => v_beamlet_out_lsb := 657;
+      WHEN 53 => v_beamlet_out_lsb := 658;
+      WHEN 73 => v_beamlet_out_lsb := 659;
+      WHEN 93 => v_beamlet_out_lsb := 660;
+      WHEN 113 => v_beamlet_out_lsb := 661;
+      WHEN 133 => v_beamlet_out_lsb := 662;
+      WHEN 153 => v_beamlet_out_lsb := 663;
+      WHEN 173 => v_beamlet_out_lsb := 664;
+      WHEN 193 => v_beamlet_out_lsb := 665;
+      WHEN 213 => v_beamlet_out_lsb := 666;
+      WHEN 233 => v_beamlet_out_lsb := 667;
+      WHEN 269 => v_beamlet_out_lsb := 668;
+      WHEN 289 => v_beamlet_out_lsb := 669;
+      WHEN 309 => v_beamlet_out_lsb := 670;
+      WHEN 329 => v_beamlet_out_lsb := 671;
+      WHEN 349 => v_beamlet_out_lsb := 672;
+      WHEN 369 => v_beamlet_out_lsb := 673;
+      WHEN 389 => v_beamlet_out_lsb := 674;
+      WHEN 409 => v_beamlet_out_lsb := 675;
+      WHEN 429 => v_beamlet_out_lsb := 676;
+      WHEN 449 => v_beamlet_out_lsb := 677;
+      WHEN 469 => v_beamlet_out_lsb := 678;
+      WHEN 489 => v_beamlet_out_lsb := 679;
+      WHEN 525 => v_beamlet_out_lsb := 680;
+      WHEN 545 => v_beamlet_out_lsb := 681;
+      WHEN 565 => v_beamlet_out_lsb := 682;
+      WHEN 585 => v_beamlet_out_lsb := 683;
+      WHEN 605 => v_beamlet_out_lsb := 684;
+      WHEN 625 => v_beamlet_out_lsb := 685;
+      WHEN 645 => v_beamlet_out_lsb := 686;
+      WHEN 665 => v_beamlet_out_lsb := 687;
+      WHEN 685 => v_beamlet_out_lsb := 688;
+      WHEN 705 => v_beamlet_out_lsb := 689;
+      WHEN 725 => v_beamlet_out_lsb := 690;
+      WHEN 745 => v_beamlet_out_lsb := 691;
+      WHEN 781 => v_beamlet_out_lsb := 692;
+      WHEN 801 => v_beamlet_out_lsb := 693;
+      WHEN 821 => v_beamlet_out_lsb := 694;
+      WHEN 841 => v_beamlet_out_lsb := 695;
+      WHEN 861 => v_beamlet_out_lsb := 696;
+      WHEN 881 => v_beamlet_out_lsb := 697;
+      WHEN 901 => v_beamlet_out_lsb := 698;
+      WHEN 921 => v_beamlet_out_lsb := 699;
+      WHEN 941 => v_beamlet_out_lsb := 700;
+      WHEN 961 => v_beamlet_out_lsb := 701;
+      WHEN 981 => v_beamlet_out_lsb := 702;
+      WHEN 1001 => v_beamlet_out_lsb := 703;
+      WHEN 14 => v_beamlet_out_lsb := 704;
+      WHEN 34 => v_beamlet_out_lsb := 705;
+      WHEN 54 => v_beamlet_out_lsb := 706;
+      WHEN 74 => v_beamlet_out_lsb := 707;
+      WHEN 94 => v_beamlet_out_lsb := 708;
+      WHEN 114 => v_beamlet_out_lsb := 709;
+      WHEN 134 => v_beamlet_out_lsb := 710;
+      WHEN 154 => v_beamlet_out_lsb := 711;
+      WHEN 174 => v_beamlet_out_lsb := 712;
+      WHEN 194 => v_beamlet_out_lsb := 713;
+      WHEN 214 => v_beamlet_out_lsb := 714;
+      WHEN 234 => v_beamlet_out_lsb := 715;
+      WHEN 270 => v_beamlet_out_lsb := 716;
+      WHEN 290 => v_beamlet_out_lsb := 717;
+      WHEN 310 => v_beamlet_out_lsb := 718;
+      WHEN 330 => v_beamlet_out_lsb := 719;
+      WHEN 350 => v_beamlet_out_lsb := 720;
+      WHEN 370 => v_beamlet_out_lsb := 721;
+      WHEN 390 => v_beamlet_out_lsb := 722;
+      WHEN 410 => v_beamlet_out_lsb := 723;
+      WHEN 430 => v_beamlet_out_lsb := 724;
+      WHEN 450 => v_beamlet_out_lsb := 725;
+      WHEN 470 => v_beamlet_out_lsb := 726;
+      WHEN 490 => v_beamlet_out_lsb := 727;
+      WHEN 526 => v_beamlet_out_lsb := 728;
+      WHEN 546 => v_beamlet_out_lsb := 729;
+      WHEN 566 => v_beamlet_out_lsb := 730;
+      WHEN 586 => v_beamlet_out_lsb := 731;
+      WHEN 606 => v_beamlet_out_lsb := 732;
+      WHEN 626 => v_beamlet_out_lsb := 733;
+      WHEN 646 => v_beamlet_out_lsb := 734;
+      WHEN 666 => v_beamlet_out_lsb := 735;
+      WHEN 686 => v_beamlet_out_lsb := 736;
+      WHEN 706 => v_beamlet_out_lsb := 737;
+      WHEN 726 => v_beamlet_out_lsb := 738;
+      WHEN 746 => v_beamlet_out_lsb := 739;
+      WHEN 782 => v_beamlet_out_lsb := 740;
+      WHEN 802 => v_beamlet_out_lsb := 741;
+      WHEN 822 => v_beamlet_out_lsb := 742;
+      WHEN 842 => v_beamlet_out_lsb := 743;
+      WHEN 862 => v_beamlet_out_lsb := 744;
+      WHEN 882 => v_beamlet_out_lsb := 745;
+      WHEN 902 => v_beamlet_out_lsb := 746;
+      WHEN 922 => v_beamlet_out_lsb := 747;
+      WHEN 942 => v_beamlet_out_lsb := 748;
+      WHEN 962 => v_beamlet_out_lsb := 749;
+      WHEN 982 => v_beamlet_out_lsb := 750;
+      WHEN 1002 => v_beamlet_out_lsb := 751;
+      WHEN 15 => v_beamlet_out_lsb := 768;
+      WHEN 35 => v_beamlet_out_lsb := 769;
+      WHEN 55 => v_beamlet_out_lsb := 770;
+      WHEN 75 => v_beamlet_out_lsb := 771;
+      WHEN 95 => v_beamlet_out_lsb := 772;
+      WHEN 115 => v_beamlet_out_lsb := 773;
+      WHEN 135 => v_beamlet_out_lsb := 774;
+      WHEN 155 => v_beamlet_out_lsb := 775;
+      WHEN 175 => v_beamlet_out_lsb := 776;
+      WHEN 195 => v_beamlet_out_lsb := 777;
+      WHEN 215 => v_beamlet_out_lsb := 778;
+      WHEN 235 => v_beamlet_out_lsb := 779;
+      WHEN 271 => v_beamlet_out_lsb := 780;
+      WHEN 291 => v_beamlet_out_lsb := 781;
+      WHEN 311 => v_beamlet_out_lsb := 782;
+      WHEN 331 => v_beamlet_out_lsb := 783;
+      WHEN 351 => v_beamlet_out_lsb := 784;
+      WHEN 371 => v_beamlet_out_lsb := 785;
+      WHEN 391 => v_beamlet_out_lsb := 786;
+      WHEN 411 => v_beamlet_out_lsb := 787;
+      WHEN 431 => v_beamlet_out_lsb := 788;
+      WHEN 451 => v_beamlet_out_lsb := 789;
+      WHEN 471 => v_beamlet_out_lsb := 790;
+      WHEN 491 => v_beamlet_out_lsb := 791;
+      WHEN 527 => v_beamlet_out_lsb := 792;
+      WHEN 547 => v_beamlet_out_lsb := 793;
+      WHEN 567 => v_beamlet_out_lsb := 794;
+      WHEN 587 => v_beamlet_out_lsb := 795;
+      WHEN 607 => v_beamlet_out_lsb := 796;
+      WHEN 627 => v_beamlet_out_lsb := 797;
+      WHEN 647 => v_beamlet_out_lsb := 798;
+      WHEN 667 => v_beamlet_out_lsb := 799;
+      WHEN 687 => v_beamlet_out_lsb := 800;
+      WHEN 707 => v_beamlet_out_lsb := 801;
+      WHEN 727 => v_beamlet_out_lsb := 802;
+      WHEN 747 => v_beamlet_out_lsb := 803;
+      WHEN 783 => v_beamlet_out_lsb := 804;
+      WHEN 803 => v_beamlet_out_lsb := 805;
+      WHEN 823 => v_beamlet_out_lsb := 806;
+      WHEN 843 => v_beamlet_out_lsb := 807;
+      WHEN 863 => v_beamlet_out_lsb := 808;
+      WHEN 883 => v_beamlet_out_lsb := 809;
+      WHEN 903 => v_beamlet_out_lsb := 810;
+      WHEN 923 => v_beamlet_out_lsb := 811;
+      WHEN 943 => v_beamlet_out_lsb := 812;
+      WHEN 963 => v_beamlet_out_lsb := 813;
+      WHEN 983 => v_beamlet_out_lsb := 814;
+      WHEN 1003 => v_beamlet_out_lsb := 815;
+      WHEN 16 => v_beamlet_out_lsb := 816;
+      WHEN 36 => v_beamlet_out_lsb := 817;
+      WHEN 56 => v_beamlet_out_lsb := 818;
+      WHEN 76 => v_beamlet_out_lsb := 819;
+      WHEN 96 => v_beamlet_out_lsb := 820;
+      WHEN 116 => v_beamlet_out_lsb := 821;
+      WHEN 136 => v_beamlet_out_lsb := 822;
+      WHEN 156 => v_beamlet_out_lsb := 823;
+      WHEN 176 => v_beamlet_out_lsb := 824;
+      WHEN 196 => v_beamlet_out_lsb := 825;
+      WHEN 216 => v_beamlet_out_lsb := 826;
+      WHEN 236 => v_beamlet_out_lsb := 827;
+      WHEN 272 => v_beamlet_out_lsb := 828;
+      WHEN 292 => v_beamlet_out_lsb := 829;
+      WHEN 312 => v_beamlet_out_lsb := 830;
+      WHEN 332 => v_beamlet_out_lsb := 831;
+      WHEN 352 => v_beamlet_out_lsb := 832;
+      WHEN 372 => v_beamlet_out_lsb := 833;
+      WHEN 392 => v_beamlet_out_lsb := 834;
+      WHEN 412 => v_beamlet_out_lsb := 835;
+      WHEN 432 => v_beamlet_out_lsb := 836;
+      WHEN 452 => v_beamlet_out_lsb := 837;
+      WHEN 472 => v_beamlet_out_lsb := 838;
+      WHEN 492 => v_beamlet_out_lsb := 839;
+      WHEN 528 => v_beamlet_out_lsb := 840;
+      WHEN 548 => v_beamlet_out_lsb := 841;
+      WHEN 568 => v_beamlet_out_lsb := 842;
+      WHEN 588 => v_beamlet_out_lsb := 843;
+      WHEN 608 => v_beamlet_out_lsb := 844;
+      WHEN 628 => v_beamlet_out_lsb := 845;
+      WHEN 648 => v_beamlet_out_lsb := 846;
+      WHEN 668 => v_beamlet_out_lsb := 847;
+      WHEN 688 => v_beamlet_out_lsb := 848;
+      WHEN 708 => v_beamlet_out_lsb := 849;
+      WHEN 728 => v_beamlet_out_lsb := 850;
+      WHEN 748 => v_beamlet_out_lsb := 851;
+      WHEN 784 => v_beamlet_out_lsb := 852;
+      WHEN 804 => v_beamlet_out_lsb := 853;
+      WHEN 824 => v_beamlet_out_lsb := 854;
+      WHEN 844 => v_beamlet_out_lsb := 855;
+      WHEN 864 => v_beamlet_out_lsb := 856;
+      WHEN 884 => v_beamlet_out_lsb := 857;
+      WHEN 904 => v_beamlet_out_lsb := 858;
+      WHEN 924 => v_beamlet_out_lsb := 859;
+      WHEN 944 => v_beamlet_out_lsb := 860;
+      WHEN 964 => v_beamlet_out_lsb := 861;
+      WHEN 984 => v_beamlet_out_lsb := 862;
+      WHEN 1004 => v_beamlet_out_lsb := 863;
+      WHEN 17 => v_beamlet_out_lsb := 864;
+      WHEN 37 => v_beamlet_out_lsb := 865;
+      WHEN 57 => v_beamlet_out_lsb := 866;
+      WHEN 77 => v_beamlet_out_lsb := 867;
+      WHEN 97 => v_beamlet_out_lsb := 868;
+      WHEN 117 => v_beamlet_out_lsb := 869;
+      WHEN 137 => v_beamlet_out_lsb := 870;
+      WHEN 157 => v_beamlet_out_lsb := 871;
+      WHEN 177 => v_beamlet_out_lsb := 872;
+      WHEN 197 => v_beamlet_out_lsb := 873;
+      WHEN 217 => v_beamlet_out_lsb := 874;
+      WHEN 237 => v_beamlet_out_lsb := 875;
+      WHEN 273 => v_beamlet_out_lsb := 876;
+      WHEN 293 => v_beamlet_out_lsb := 877;
+      WHEN 313 => v_beamlet_out_lsb := 878;
+      WHEN 333 => v_beamlet_out_lsb := 879;
+      WHEN 353 => v_beamlet_out_lsb := 880;
+      WHEN 373 => v_beamlet_out_lsb := 881;
+      WHEN 393 => v_beamlet_out_lsb := 882;
+      WHEN 413 => v_beamlet_out_lsb := 883;
+      WHEN 433 => v_beamlet_out_lsb := 884;
+      WHEN 453 => v_beamlet_out_lsb := 885;
+      WHEN 473 => v_beamlet_out_lsb := 886;
+      WHEN 493 => v_beamlet_out_lsb := 887;
+      WHEN 529 => v_beamlet_out_lsb := 888;
+      WHEN 549 => v_beamlet_out_lsb := 889;
+      WHEN 569 => v_beamlet_out_lsb := 890;
+      WHEN 589 => v_beamlet_out_lsb := 891;
+      WHEN 609 => v_beamlet_out_lsb := 892;
+      WHEN 629 => v_beamlet_out_lsb := 893;
+      WHEN 649 => v_beamlet_out_lsb := 894;
+      WHEN 669 => v_beamlet_out_lsb := 895;
+      WHEN 689 => v_beamlet_out_lsb := 896;
+      WHEN 709 => v_beamlet_out_lsb := 897;
+      WHEN 729 => v_beamlet_out_lsb := 898;
+      WHEN 749 => v_beamlet_out_lsb := 899;
+      WHEN 785 => v_beamlet_out_lsb := 900;
+      WHEN 805 => v_beamlet_out_lsb := 901;
+      WHEN 825 => v_beamlet_out_lsb := 902;
+      WHEN 845 => v_beamlet_out_lsb := 903;
+      WHEN 865 => v_beamlet_out_lsb := 904;
+      WHEN 885 => v_beamlet_out_lsb := 905;
+      WHEN 905 => v_beamlet_out_lsb := 906;
+      WHEN 925 => v_beamlet_out_lsb := 907;
+      WHEN 945 => v_beamlet_out_lsb := 908;
+      WHEN 965 => v_beamlet_out_lsb := 909;
+      WHEN 985 => v_beamlet_out_lsb := 910;
+      WHEN 1005 => v_beamlet_out_lsb := 911;
+      WHEN 18 => v_beamlet_out_lsb := 912;
+      WHEN 38 => v_beamlet_out_lsb := 913;
+      WHEN 58 => v_beamlet_out_lsb := 914;
+      WHEN 78 => v_beamlet_out_lsb := 915;
+      WHEN 98 => v_beamlet_out_lsb := 916;
+      WHEN 118 => v_beamlet_out_lsb := 917;
+      WHEN 138 => v_beamlet_out_lsb := 918;
+      WHEN 158 => v_beamlet_out_lsb := 919;
+      WHEN 178 => v_beamlet_out_lsb := 920;
+      WHEN 198 => v_beamlet_out_lsb := 921;
+      WHEN 218 => v_beamlet_out_lsb := 922;
+      WHEN 238 => v_beamlet_out_lsb := 923;
+      WHEN 274 => v_beamlet_out_lsb := 924;
+      WHEN 294 => v_beamlet_out_lsb := 925;
+      WHEN 314 => v_beamlet_out_lsb := 926;
+      WHEN 334 => v_beamlet_out_lsb := 927;
+      WHEN 354 => v_beamlet_out_lsb := 928;
+      WHEN 374 => v_beamlet_out_lsb := 929;
+      WHEN 394 => v_beamlet_out_lsb := 930;
+      WHEN 414 => v_beamlet_out_lsb := 931;
+      WHEN 434 => v_beamlet_out_lsb := 932;
+      WHEN 454 => v_beamlet_out_lsb := 933;
+      WHEN 474 => v_beamlet_out_lsb := 934;
+      WHEN 494 => v_beamlet_out_lsb := 935;
+      WHEN 530 => v_beamlet_out_lsb := 936;
+      WHEN 550 => v_beamlet_out_lsb := 937;
+      WHEN 570 => v_beamlet_out_lsb := 938;
+      WHEN 590 => v_beamlet_out_lsb := 939;
+      WHEN 610 => v_beamlet_out_lsb := 940;
+      WHEN 630 => v_beamlet_out_lsb := 941;
+      WHEN 650 => v_beamlet_out_lsb := 942;
+      WHEN 670 => v_beamlet_out_lsb := 943;
+      WHEN 690 => v_beamlet_out_lsb := 944;
+      WHEN 710 => v_beamlet_out_lsb := 945;
+      WHEN 730 => v_beamlet_out_lsb := 946;
+      WHEN 750 => v_beamlet_out_lsb := 947;
+      WHEN 786 => v_beamlet_out_lsb := 948;
+      WHEN 806 => v_beamlet_out_lsb := 949;
+      WHEN 826 => v_beamlet_out_lsb := 950;
+      WHEN 846 => v_beamlet_out_lsb := 951;
+      WHEN 866 => v_beamlet_out_lsb := 952;
+      WHEN 886 => v_beamlet_out_lsb := 953;
+      WHEN 906 => v_beamlet_out_lsb := 954;
+      WHEN 926 => v_beamlet_out_lsb := 955;
+      WHEN 946 => v_beamlet_out_lsb := 956;
+      WHEN 966 => v_beamlet_out_lsb := 957;
+      WHEN 986 => v_beamlet_out_lsb := 958;
+      WHEN 1006 => v_beamlet_out_lsb := 959;
+      WHEN 19 => v_beamlet_out_lsb := 960;
+      WHEN 39 => v_beamlet_out_lsb := 961;
+      WHEN 59 => v_beamlet_out_lsb := 962;
+      WHEN 79 => v_beamlet_out_lsb := 963;
+      WHEN 99 => v_beamlet_out_lsb := 964;
+      WHEN 119 => v_beamlet_out_lsb := 965;
+      WHEN 139 => v_beamlet_out_lsb := 966;
+      WHEN 159 => v_beamlet_out_lsb := 967;
+      WHEN 179 => v_beamlet_out_lsb := 968;
+      WHEN 199 => v_beamlet_out_lsb := 969;
+      WHEN 219 => v_beamlet_out_lsb := 970;
+      WHEN 239 => v_beamlet_out_lsb := 971;
+      WHEN 275 => v_beamlet_out_lsb := 972;
+      WHEN 295 => v_beamlet_out_lsb := 973;
+      WHEN 315 => v_beamlet_out_lsb := 974;
+      WHEN 335 => v_beamlet_out_lsb := 975;
+      WHEN 355 => v_beamlet_out_lsb := 976;
+      WHEN 375 => v_beamlet_out_lsb := 977;
+      WHEN 395 => v_beamlet_out_lsb := 978;
+      WHEN 415 => v_beamlet_out_lsb := 979;
+      WHEN 435 => v_beamlet_out_lsb := 980;
+      WHEN 455 => v_beamlet_out_lsb := 981;
+      WHEN 475 => v_beamlet_out_lsb := 982;
+      WHEN 495 => v_beamlet_out_lsb := 983;
+      WHEN 531 => v_beamlet_out_lsb := 984;
+      WHEN 551 => v_beamlet_out_lsb := 985;
+      WHEN 571 => v_beamlet_out_lsb := 986;
+      WHEN 591 => v_beamlet_out_lsb := 987;
+      WHEN 611 => v_beamlet_out_lsb := 988;
+      WHEN 631 => v_beamlet_out_lsb := 989;
+      WHEN 651 => v_beamlet_out_lsb := 990;
+      WHEN 671 => v_beamlet_out_lsb := 991;
+      WHEN 691 => v_beamlet_out_lsb := 992;
+      WHEN 711 => v_beamlet_out_lsb := 993;
+      WHEN 731 => v_beamlet_out_lsb := 994;
+      WHEN 751 => v_beamlet_out_lsb := 995;
+      WHEN 787 => v_beamlet_out_lsb := 996;
+      WHEN 807 => v_beamlet_out_lsb := 997;
+      WHEN 827 => v_beamlet_out_lsb := 998;
+      WHEN 847 => v_beamlet_out_lsb := 999;
+      WHEN 867 => v_beamlet_out_lsb := 1000;
+      WHEN 887 => v_beamlet_out_lsb := 1001;
+      WHEN 907 => v_beamlet_out_lsb := 1002;
+      WHEN 927 => v_beamlet_out_lsb := 1003;
+      WHEN 947 => v_beamlet_out_lsb := 1004;
+      WHEN 967 => v_beamlet_out_lsb := 1005;
+      WHEN 987 => v_beamlet_out_lsb := 1006;
+      WHEN 1007 => v_beamlet_out_lsb := 1007;
+      WHEN OTHERS => REPORT "Unknown beamlet_in: " & int_to_str(beamlet_in) SEVERITY FAILURE;
+    END CASE;
+    RETURN v_beamlet_out_msb + v_beamlet_out_lsb;
+  END;
+END tb_beamlet_lookup_pkg;
diff --git a/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_node_apertif_unb1_correlator_processing_output.vhd b/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_node_apertif_unb1_correlator_processing_output.vhd
index e4b654de319e6ea02e6cda8cfe5c56ae67853505..b2affdeb7e8176c95c05542a2741e0b273062a0b 100644
--- a/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_node_apertif_unb1_correlator_processing_output.vhd
+++ b/applications/apertif/designs/apertif_unb1_correlator/tb/vhdl/tb_node_apertif_unb1_correlator_processing_output.vhd
@@ -335,7 +335,7 @@ USE diag_lib.diag_pkg.ALL;
 USE fft_lib.fft_pkg.ALL;
 USE wpfb_lib.wpfb_pkg.ALL;
 USE work.apertif_unb1_correlator_pkg.ALL;
-
+USE work.tb_beamlet_lookup_pkg.ALL;
 
 ENTITY tb_node_apertif_unb1_correlator_processing_output IS
   GENERIC (
@@ -1079,9 +1079,9 @@ BEGIN
         proc_mem_mm_bus_rd(v_addr + 12, mm_clk, ram_diag_data_buffer_output_miso, ram_diag_data_buffer_output_mosi);
         proc_mem_mm_bus_rd_latency(c_mem_reg_rd_latency, mm_clk);
         v_rd_channel := TO_UINT(ram_diag_data_buffer_output_miso.rddata(31 DOWNTO 16));
-        ASSERT v_rd_beamlet = v_exp_beamlet AND v_rd_channel = v_exp_channel REPORT "Wrong beamlet, channel index in packet header: " &
+        ASSERT beamlet_lookup_inverse(v_rd_beamlet) = v_exp_beamlet AND v_rd_channel = v_exp_channel REPORT "Wrong beamlet, channel index in packet header: " &
                "(" & int_to_str(v_exp_beamlet) & ", " & int_to_str(v_exp_channel) & ") /= " &
-               "(" & int_to_str(v_rd_beamlet) & ", " & int_to_str(v_rd_channel) & ")" SEVERITY ERROR;
+               "(" & int_to_str(beamlet_lookup_inverse(v_rd_beamlet)) & ", " & int_to_str(v_rd_channel) & ")" SEVERITY ERROR;
 
         -- . timestamp (= bsn)
         proc_mem_mm_bus_rd(v_addr + 13, mm_clk, ram_diag_data_buffer_output_miso, ram_diag_data_buffer_output_mosi);