diff --git a/libraries/base/common/src/vhdl/common_pkg.vhd b/libraries/base/common/src/vhdl/common_pkg.vhd index b9c99ada42440cd53ed0ebecde38510bf152ff1d..089a9a669d63b5f440f283181d6d6365e511eaa0 100644 --- a/libraries/base/common/src/vhdl/common_pkg.vhd +++ b/libraries/base/common/src/vhdl/common_pkg.vhd @@ -403,6 +403,13 @@ PACKAGE common_pkg IS FUNCTION nat_arr_to_concat_slv(nat_arr: t_natural_arr; nof_elements: NATURAL) RETURN STD_LOGIC_VECTOR; + -- Function to create the lookup_table + FUNCTION func_create_look_up_table_cos(N : POSITIVE; W : POSITIVE) RETURN t_nat_integer_arr; + FUNCTION func_create_look_up_table_sin(N : POSITIVE; W : POSITIVE) RETURN t_nat_integer_arr; + + -- Function to sum all values in the lookup table, to determine the DC value + FUNCTION func_sum_look_up_table(table : t_nat_integer_arr) RETURN INTEGER; + ------------------------------------------------------------------------------ -- Component specific functions ------------------------------------------------------------------------------ @@ -2059,6 +2066,35 @@ PACKAGE BODY common_pkg IS END LOOP; RETURN v_concat_slv; END; + + + FUNCTION func_create_look_up_table_cos(N : POSITIVE; W : POSITIVE) RETURN t_nat_integer_arr IS + VARIABLE table : t_nat_integer_arr(N-1 DOWNTO 0); + BEGIN + FOR I IN 0 TO N-1 LOOP + table(I) := INTEGER(ROUND(REAL(2**(W-1)-1)*COS(2.0*MATH_PI*REAL(I)/REAL(N)))); + END LOOP; + RETURN table; + END; + + FUNCTION func_create_look_up_table_sin(N : POSITIVE; W : POSITIVE) RETURN t_nat_integer_arr IS + VARIABLE table : t_nat_integer_arr(N-1 DOWNTO 0); + BEGIN + FOR I IN 0 TO N-1 LOOP + table(I) := INTEGER(ROUND(REAL(2**(W-1)-1)*SIN(2.0*MATH_PI*REAL(I)/REAL(N)))); + END LOOP; + RETURN table; + END; + + FUNCTION func_sum_look_up_table(table : t_nat_integer_arr) RETURN INTEGER IS + VARIABLE dc : INTEGER := 0; + BEGIN + FOR I IN table'RANGE LOOP + dc := dc + table(I); + END LOOP; + RETURN dc; + END; + ------------------------------------------------------------------------------ -- common_fifo_* diff --git a/libraries/dsp/fringe_stop/hdllib.cfg b/libraries/dsp/fringe_stop/hdllib.cfg index 23c5e0df675d8696e6afabf4cb51bb51d476987c..71d8a8468533b9c9033d5c07f2567df7d06dfec8 100644 --- a/libraries/dsp/fringe_stop/hdllib.cfg +++ b/libraries/dsp/fringe_stop/hdllib.cfg @@ -5,7 +5,6 @@ hdl_lib_uses_sim = hdl_lib_technology = synth_files = - src/vhdl/fringe_stop_pkg.vhd src/vhdl/fringe_stop_unit.vhd test_bench_files = diff --git a/libraries/dsp/fringe_stop/src/vhdl/fringe_stop_pkg.vhd b/libraries/dsp/fringe_stop/src/vhdl/fringe_stop_pkg.vhd deleted file mode 100644 index acff06f14679ccc5a239285da3ee5f5ec43f18d8..0000000000000000000000000000000000000000 --- a/libraries/dsp/fringe_stop/src/vhdl/fringe_stop_pkg.vhd +++ /dev/null @@ -1,71 +0,0 @@ -------------------------------------------------------------------------------- --- --- Copyright (C) 2014 --- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/> --- JIVE (Joint Institute for VLBI in Europe) <http://www.jive.nl/> --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands --- --- This program is free software: you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation, either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see <http://www.gnu.org/licenses/>. --- -------------------------------------------------------------------------------- - -LIBRARY IEEE, common_lib; -USE IEEE.STD_LOGIC_1164.ALL; -USE IEEE.MATH_REAL.ALL; -USE common_lib.common_pkg.ALL; - -PACKAGE fringe_stop_pkg IS - - -- Function to create the lookup_table - FUNCTION func_create_look_up_table_cos(N : POSITIVE; W : POSITIVE) RETURN t_nat_integer_arr; - FUNCTION func_create_look_up_table_sin(N : POSITIVE; W : POSITIVE) RETURN t_nat_integer_arr; - - -- Function to sum all values in the lookup table, to determine the DC value - FUNCTION func_sum_look_up_table(table : t_nat_integer_arr) RETURN INTEGER; - -END fringe_stop_pkg; - -PACKAGE BODY fringe_stop_pkg IS - - FUNCTION func_create_look_up_table_cos(N : POSITIVE; W : POSITIVE) RETURN t_nat_integer_arr IS - VARIABLE table : t_nat_integer_arr(N-1 DOWNTO 0); - BEGIN - FOR I IN 0 TO N-1 LOOP - table(I) := INTEGER(ROUND(REAL(2**(W-1)-1)*COS(2.0*MATH_PI*REAL(I)/REAL(N)))); - END LOOP; - RETURN table; - END; - - FUNCTION func_create_look_up_table_sin(N : POSITIVE; W : POSITIVE) RETURN t_nat_integer_arr IS - VARIABLE table : t_nat_integer_arr(N-1 DOWNTO 0); - BEGIN - FOR I IN 0 TO N-1 LOOP - table(I) := INTEGER(ROUND(REAL(2**(W-1)-1)*SIN(2.0*MATH_PI*REAL(I)/REAL(N)))); - END LOOP; - RETURN table; - END; - - FUNCTION func_sum_look_up_table(table : t_nat_integer_arr) RETURN INTEGER IS - VARIABLE dc : INTEGER := 0; - BEGIN - FOR I IN table'RANGE LOOP - dc := dc + table(I); - END LOOP; - RETURN dc; - END; - -END fringe_stop_pkg; - - - diff --git a/libraries/dsp/fringe_stop/src/vhdl/fringe_stop_unit.vhd b/libraries/dsp/fringe_stop/src/vhdl/fringe_stop_unit.vhd index 46af6b67a72d6f00db7e0f8208024585b5c7d2bf..9fab8cc04d7058fefd0223c504797747363755b8 100644 --- a/libraries/dsp/fringe_stop/src/vhdl/fringe_stop_unit.vhd +++ b/libraries/dsp/fringe_stop/src/vhdl/fringe_stop_unit.vhd @@ -29,7 +29,6 @@ USE common_lib.common_pkg.ALL; USE common_lib.common_mem_pkg.ALL; USE technology_lib.technology_select_pkg.ALL; USE dp_lib.dp_stream_pkg.ALL; -USE work.fringe_stop_pkg.ALL; ENTITY fringe_stop_unit IS diff --git a/libraries/dsp/fringe_stop/tb/vhdl/tb_fringe_stop_unit.vhd b/libraries/dsp/fringe_stop/tb/vhdl/tb_fringe_stop_unit.vhd index 7c538e156f0df73f3f2c5fefc64b354ef829f629..8b4a0f62d3677ad72470b299ffa509e0cf3bb693 100644 --- a/libraries/dsp/fringe_stop/tb/vhdl/tb_fringe_stop_unit.vhd +++ b/libraries/dsp/fringe_stop/tb/vhdl/tb_fringe_stop_unit.vhd @@ -42,7 +42,6 @@ USE mm_lib.mm_file_unb_pkg.ALL; USE mm_lib.mm_file_pkg.ALL; USE dp_lib.dp_stream_pkg.ALL; USE diag_lib.diag_pkg.ALL; -USE work.fringe_stop_pkg.ALL; ENTITY tb_fringe_stop_unit IS diff --git a/libraries/dsp/fringe_stop/tb/vhdl/tb_mmf_fringe_stop_unit.vhd b/libraries/dsp/fringe_stop/tb/vhdl/tb_mmf_fringe_stop_unit.vhd index bb6462a9b7a125ed9d84301c65adb948a76b2489..11903f0d75fd4e78c66987a5a540425480b0d2e5 100644 --- a/libraries/dsp/fringe_stop/tb/vhdl/tb_mmf_fringe_stop_unit.vhd +++ b/libraries/dsp/fringe_stop/tb/vhdl/tb_mmf_fringe_stop_unit.vhd @@ -67,7 +67,6 @@ USE technology_lib.technology_select_pkg.ALL; USE mm_lib.mm_file_unb_pkg.ALL; USE mm_lib.mm_file_pkg.ALL; USE dp_lib.dp_stream_pkg.ALL; -USE work.fringe_stop_pkg.ALL; ENTITY tb_mmf_fringe_stop_unit IS diff --git a/libraries/dsp/fringe_stop/tb/vhdl/tb_tb_fringe_stop_unit.vhd b/libraries/dsp/fringe_stop/tb/vhdl/tb_tb_fringe_stop_unit.vhd index 25b04aee3c6406ff2d587d110b9c0cc829927a9f..b9597b72f8bb472079d9736f68312a3b4a281b8e 100644 --- a/libraries/dsp/fringe_stop/tb/vhdl/tb_tb_fringe_stop_unit.vhd +++ b/libraries/dsp/fringe_stop/tb/vhdl/tb_tb_fringe_stop_unit.vhd @@ -31,19 +31,6 @@ LIBRARY IEEE, common_lib, technology_lib, mm_lib, diag_lib, dp_lib; USE IEEE.std_logic_1164.ALL; -USE IEEE.numeric_std.ALL; -USE common_lib.common_pkg.ALL; -USE common_lib.common_mem_pkg.ALL; -USE common_lib.common_str_pkg.ALL; -USE common_lib.tb_common_pkg.ALL; -USE common_lib.tb_common_mem_pkg.ALL; -USE technology_lib.technology_select_pkg.ALL; -USE mm_lib.mm_file_unb_pkg.ALL; -USE mm_lib.mm_file_pkg.ALL; -USE dp_lib.dp_stream_pkg.ALL; -USE diag_lib.diag_pkg.ALL; -USE work.fringe_stop_pkg.ALL; - ENTITY tb_tb_fringe_stop_unit IS END tb_tb_fringe_stop_unit;