diff --git a/lib/radio/cordic/sim/tb_cordic_pipe_top.fdo b/lib/radio/cordic/sim/tb_cordic_pipe_top.fdo index 51e71ac..562789d 100644 --- a/lib/radio/cordic/sim/tb_cordic_pipe_top.fdo +++ b/lib/radio/cordic/sim/tb_cordic_pipe_top.fdo @@ -1,5 +1,7 @@ +vmap ieee_proposed ../../../../Common/sim/ieee_proposed + vlib work -vcom -explicit -93 "../../../fixed/fixed_pkg_c.vhd" +vcom -explicit -93 "../../../fixed/fixed_util_pkg.vhd" vcom -explicit -93 "../../../PCK_FIO-2002.7/PCK_FIO_1993.vhd" vcom -explicit -93 "../../../PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd" vcom -explicit -93 "../src/cordic_pkg.vhd" diff --git a/lib/radio/cordic/sim/tb_cordic_top.fdo b/lib/radio/cordic/sim/tb_cordic_top.fdo index be5864c..1cb5c84 100644 --- a/lib/radio/cordic/sim/tb_cordic_top.fdo +++ b/lib/radio/cordic/sim/tb_cordic_top.fdo @@ -1,5 +1,7 @@ +vmap ieee_proposed ../../../../Common/sim/ieee_proposed + vlib work -vcom -explicit -93 "../../../fixed/fixed_pkg_c.vhd" +vcom -explicit -93 "../../../fixed/fixed_util_pkg.vhd" vcom -explicit -93 "../../../PCK_FIO-2002.7/PCK_FIO_1993.vhd" vcom -explicit -93 "../../../PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd" vcom -explicit -93 "../src/cordic_pkg.vhd" diff --git a/lib/radio/cordic/src/cordic_pipe_post.vhd b/lib/radio/cordic/src/cordic_pipe_post.vhd index 9cf9c79..c1203cc 100644 --- a/lib/radio/cordic/src/cordic_pipe_post.vhd +++ b/lib/radio/cordic/src/cordic_pipe_post.vhd @@ -20,7 +20,12 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; USE ieee.numeric_std.ALL; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; use work.fixed_util_pkg.all; use work.cordic_pkg.all; @@ -58,8 +63,8 @@ end cordic_pipe_post; architecture Behavioral of cordic_pipe_post is -constant gain_x : sfixed := to_sfixed(gain_tbl(nstages), shi(nbits_x, nbits_x_frac), slo(nbits_x, nbits_x_frac), false, true); -constant gain_y : sfixed := to_sfixed(gain_tbl(nstages), shi(nbits_y, nbits_y_frac), slo(nbits_y, nbits_y_frac), false, true); +constant gain_x : sfixed := to_sfixed(gain_tbl(nstages), sproto(nbits_x, nbits_x_frac), fixed_wrap, fixed_round); +constant gain_y : sfixed := to_sfixed(gain_tbl(nstages), sproto(nbits_y, nbits_y_frac), fixed_wrap, fixed_round); ------------------------------------------------------------ begin diff --git a/lib/radio/cordic/src/cordic_pipe_pre.vhd b/lib/radio/cordic/src/cordic_pipe_pre.vhd index ae90b84..ae03c5e 100644 --- a/lib/radio/cordic/src/cordic_pipe_pre.vhd +++ b/lib/radio/cordic/src/cordic_pipe_pre.vhd @@ -20,7 +20,12 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; USE ieee.numeric_std.ALL; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; use work.fixed_util_pkg.all; use work.cordic_pkg.all; @@ -58,8 +63,8 @@ end cordic_pipe_pre; architecture Behavioral of cordic_pipe_pre is -constant pi_sfix : sfixed := to_sfixed(z_range, sproto(nbits_z, nbits_z_frac), false, true); -constant pi2_sfix : sfixed := to_sfixed(z_range/2.0, sproto(nbits_z, nbits_z_frac), false, true); +constant pi_sfix : sfixed := to_sfixed(z_range, sproto(nbits_z, nbits_z_frac), fixed_wrap, fixed_round); +constant pi2_sfix : sfixed := to_sfixed(z_range/2.0, sproto(nbits_z, nbits_z_frac), fixed_wrap, fixed_round); ------------------------------------------------------------ begin diff --git a/lib/radio/cordic/src/cordic_pipe_stage.vhd b/lib/radio/cordic/src/cordic_pipe_stage.vhd index 300a729..0428f8a 100644 --- a/lib/radio/cordic/src/cordic_pipe_stage.vhd +++ b/lib/radio/cordic/src/cordic_pipe_stage.vhd @@ -20,7 +20,12 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; USE ieee.numeric_std.ALL; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; use work.fixed_util_pkg.all; use work.cordic_pkg.all; @@ -59,7 +64,7 @@ end cordic_pipe_stage; architecture Behavioral of cordic_pipe_stage is -constant coeff : sfixed := to_sfixed(arctan_tbl(stage_num)*z_range, shi(nbits_z, nbits_z_frac), slo(nbits_z, nbits_z_frac), false, true); +constant coeff : sfixed := to_sfixed(arctan_tbl(stage_num)*z_range, sproto(nbits_z, nbits_z_frac), fixed_wrap, fixed_round); begin diff --git a/lib/radio/cordic/src/cordic_pipe_top.vhd b/lib/radio/cordic/src/cordic_pipe_top.vhd index d9a9475..e4b73f8 100644 --- a/lib/radio/cordic/src/cordic_pipe_top.vhd +++ b/lib/radio/cordic/src/cordic_pipe_top.vhd @@ -21,7 +21,12 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.MATH_REAL.ALL; USE ieee.numeric_std.ALL; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; use work.fixed_util_pkg.all; use work.cordic_pkg.all; diff --git a/lib/radio/cordic/src/cordic_pkg.vhd b/lib/radio/cordic/src/cordic_pkg.vhd index 7adfe84..8dbd116 100644 --- a/lib/radio/cordic/src/cordic_pkg.vhd +++ b/lib/radio/cordic/src/cordic_pkg.vhd @@ -2,7 +2,12 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use ieee.numeric_std.all; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; use work.fixed_util_pkg.all; package cordic_pkg is @@ -14,10 +19,10 @@ package cordic_pkg is type gain_corr_mode_t is (gain_mode_disabled, gain_mode_unity); -- Global set arithmetic rounding mode - constant cordic_round_mode : boolean := true; + constant cordic_round_mode : fixed_round_style_type := fixed_round; -- Global set arithmetic saturating mode - constant cordic_saturate_mode : boolean := false; + constant cordic_saturate_mode : fixed_overflow_style_type := fixed_wrap; constant max_iteration : integer := 80; diff --git a/lib/radio/cordic/src/cordic_rom.vhd b/lib/radio/cordic/src/cordic_rom.vhd index 7836bcf..9af2ac8 100644 --- a/lib/radio/cordic/src/cordic_rom.vhd +++ b/lib/radio/cordic/src/cordic_rom.vhd @@ -21,8 +21,12 @@ library IEEE; USE ieee.std_logic_1164.ALL; USE ieee.numeric_std.ALL; +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + library work; -use work.fixed_pkg.all; +use work.fixed_util_pkg.all; use work.cordic_pkg.all; ---- Uncomment the following library declaration if instantiating @@ -49,13 +53,13 @@ subtype word_t is sfixed(sproto(nbits, nbits_frac)'high downto sproto(nbits, nbi type rom_t is array (natural range <>) of word_t; ------------------------------------------------------------------------------- -function rom_gen(nstages : integer; round_mode : boolean) return rom_t is +function rom_gen(nstages : integer; round_mode : fixed_round_style_type) return rom_t is variable rom : rom_t (0 to nstages-1); variable word : word_t; begin for i in 0 to nstages-1 loop - word := to_sfixed(arctan_tbl(i), word, false, round_mode); + word := to_sfixed(arctan_tbl(i)*pi, word, fixed_wrap, round_mode); rom(i) := word; end loop; diff --git a/lib/radio/cordic/src/cordic_stage.vhd b/lib/radio/cordic/src/cordic_stage.vhd index 6cb8364..26953ce 100644 --- a/lib/radio/cordic/src/cordic_stage.vhd +++ b/lib/radio/cordic/src/cordic_stage.vhd @@ -20,7 +20,13 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; USE ieee.numeric_std.ALL; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; +use work.fixed_util_pkg.all; use work.cordic_pkg.all; ---- Uncomment the following library declaration if instantiating diff --git a/lib/radio/cordic/src/cordic_stage_post.vhd b/lib/radio/cordic/src/cordic_stage_post.vhd index 6cdda73..a17c665 100644 --- a/lib/radio/cordic/src/cordic_stage_post.vhd +++ b/lib/radio/cordic/src/cordic_stage_post.vhd @@ -20,7 +20,13 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; USE ieee.numeric_std.ALL; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; +use work.fixed_util_pkg.all; use work.cordic_pkg.all; ---- Uncomment the following library declaration if instantiating @@ -254,15 +260,15 @@ begin when cordic_mode_rotate => - xyz_out.x <= resize(xyz_in.x * to_sfixed(gain_tbl(nbits_out-1), xyz_in.x), xyz_out.x'left, xyz_out.x'right, cordic_round_mode, cordic_saturate_mode); - xyz_out.y <= resize(xyz_in.y * to_sfixed(gain_tbl(nbits_out-1), xyz_in.y), xyz_out.y'left, xyz_out.y'right, cordic_round_mode, cordic_saturate_mode); - xyz_out.z <= resize(xyz_in.z, xyz_out.z'left, xyz_out.z'right, cordic_round_mode, cordic_saturate_mode); + xyz_out.x <= resize(xyz_in.x * to_sfixed(gain_tbl(nbits_out-1), xyz_in.x), xyz_out.x'left, xyz_out.x'right, cordic_saturate_mode, cordic_round_mode); + xyz_out.y <= resize(xyz_in.y * to_sfixed(gain_tbl(nbits_out-1), xyz_in.y), xyz_out.y'left, xyz_out.y'right, cordic_saturate_mode, cordic_round_mode); + xyz_out.z <= resize(xyz_in.z, xyz_out.z'left, xyz_out.z'right, cordic_saturate_mode, cordic_round_mode); when cordic_mode_vector => - xyz_out.x <= resize(xyz_in.x * to_sfixed(gain_tbl(nbits_out-1), xyz_in.x), xyz_out.x'left, xyz_out.x'right, cordic_round_mode, cordic_saturate_mode); - xyz_out.y <= resize(xyz_in.y, xyz_out.y'left, xyz_out.y'right, cordic_round_mode, cordic_saturate_mode); - xyz_out.z <= resize(xyz_in.z, xyz_out.z'left, xyz_out.z'right, cordic_round_mode, cordic_saturate_mode); + xyz_out.x <= resize(xyz_in.x * to_sfixed(gain_tbl(nbits_out-1), xyz_in.x), xyz_out.x'left, xyz_out.x'right, cordic_saturate_mode, cordic_round_mode); + xyz_out.y <= resize(xyz_in.y, xyz_out.y'left, xyz_out.y'right, cordic_saturate_mode, cordic_round_mode); + xyz_out.z <= resize(xyz_in.z, xyz_out.z'left, xyz_out.z'right, cordic_saturate_mode, cordic_round_mode); when others => null; diff --git a/lib/radio/cordic/src/cordic_stage_pre.vhd b/lib/radio/cordic/src/cordic_stage_pre.vhd index 31bc966..0e9f82a 100644 --- a/lib/radio/cordic/src/cordic_stage_pre.vhd +++ b/lib/radio/cordic/src/cordic_stage_pre.vhd @@ -20,7 +20,13 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; USE ieee.numeric_std.ALL; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; +use work.fixed_util_pkg.all; use work.cordic_pkg.all; ---- Uncomment the following library declaration if instantiating diff --git a/lib/radio/cordic/src/cordic_top.vhd b/lib/radio/cordic/src/cordic_top.vhd index f56f754..8f41847 100644 --- a/lib/radio/cordic/src/cordic_top.vhd +++ b/lib/radio/cordic/src/cordic_top.vhd @@ -21,7 +21,13 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.MATH_REAL.ALL; USE ieee.numeric_std.ALL; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; +use work.fixed_util_pkg.all; use work.cordic_pkg.all; ---- Uncomment the following library declaration if instantiating diff --git a/lib/radio/cordic/src/tb_cordic_pipe_top.vhd b/lib/radio/cordic/src/tb_cordic_pipe_top.vhd index 1ee1174..c88dd33 100644 --- a/lib/radio/cordic/src/tb_cordic_pipe_top.vhd +++ b/lib/radio/cordic/src/tb_cordic_pipe_top.vhd @@ -148,8 +148,12 @@ use IEEE.MATH_REAL.ALL; USE ieee.numeric_std.ALL; use std.textio.all; -- Imports the standard textio package. +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + library work; -use work.fixed_pkg.all; +use work.fixed_util_pkg.all; use work.cordic_pkg.all; use work.PCK_FIO.all; @@ -346,9 +350,9 @@ BEGIN argz := -pi/4.0; wait until rising_edge(clk); - xin <= to_sfixed(argx, xin, false, true); - yin <= to_sfixed(argy, yin, false, true); - zin <= to_sfixed(argz, zin, false, true); + xin <= to_sfixed(argx, xin, fixed_wrap, fixed_round); + yin <= to_sfixed(argy, yin, fixed_wrap, fixed_round); + zin <= to_sfixed(argz, zin, fixed_wrap, fixed_round); vld_in <= '1'; wait until rising_edge(clk); @@ -377,9 +381,9 @@ BEGIN argz := pi/2.0; wait until rising_edge(clk); - xin <= to_sfixed(argx, xin, false, true); - yin <= to_sfixed(argy, yin, false, true); - zin <= to_sfixed(argz, zin, false, true); + xin <= to_sfixed(argx, xin, fixed_wrap, fixed_round); + yin <= to_sfixed(argy, yin, fixed_wrap, fixed_round); + zin <= to_sfixed(argz, zin, fixed_wrap, fixed_round); vld_in <= '1'; wait until rising_edge(clk); @@ -408,9 +412,9 @@ BEGIN argz := pi/2.0; wait until rising_edge(clk); - xin <= to_sfixed(argx, xin, false, true); - yin <= to_sfixed(argy, yin, false, true); - zin <= to_sfixed(argz, zin, false, true); + xin <= to_sfixed(argx, xin, fixed_wrap, fixed_round); + yin <= to_sfixed(argy, yin, fixed_wrap, fixed_round); + zin <= to_sfixed(argz, zin, fixed_wrap, fixed_round); vld_in <= '1'; wait until rising_edge(clk); @@ -439,9 +443,9 @@ BEGIN argz := -pi/4.0; wait until rising_edge(clk); - xin <= to_sfixed(argx, xin, false, true); - yin <= to_sfixed(argy, yin, false, true); - zin <= to_sfixed(argz, zin, false, true); + xin <= to_sfixed(argx, xin, fixed_wrap, fixed_round); + yin <= to_sfixed(argy, yin, fixed_wrap, fixed_round); + zin <= to_sfixed(argz, zin, fixed_wrap, fixed_round); vld_in <= '1'; wait until rising_edge(clk); @@ -470,9 +474,9 @@ BEGIN argz := 0.0; wait until rising_edge(clk); - xin <= to_sfixed(argx, xin, false, true); - yin <= to_sfixed(argy, yin, false, true); - zin <= to_sfixed(argz, zin, false, true); + xin <= to_sfixed(argx, xin, fixed_wrap, fixed_round); + yin <= to_sfixed(argy, yin, fixed_wrap, fixed_round); + zin <= to_sfixed(argz, zin, fixed_wrap, fixed_round); vld_in <= '1'; wait until rising_edge(clk); @@ -501,9 +505,9 @@ BEGIN argz := 0.0; wait until rising_edge(clk); - xin <= to_sfixed(argx, xin, false, true); - yin <= to_sfixed(argy, yin, false, true); - zin <= to_sfixed(argz, zin, false, true); + xin <= to_sfixed(argx, xin, fixed_wrap, fixed_round); + yin <= to_sfixed(argy, yin, fixed_wrap, fixed_round); + zin <= to_sfixed(argz, zin, fixed_wrap, fixed_round); vld_in <= '1'; wait until rising_edge(clk); @@ -531,9 +535,9 @@ BEGIN argz := 0.0; wait until rising_edge(clk); - xin <= to_sfixed(argx, xin, false, true); - yin <= to_sfixed(argy, yin, false, true); - zin <= to_sfixed(argz, zin, false, true); + xin <= to_sfixed(argx, xin, fixed_wrap, fixed_round); + yin <= to_sfixed(argy, yin, fixed_wrap, fixed_round); + zin <= to_sfixed(argz, zin, fixed_wrap, fixed_round); vld_in <= '1'; wait until rising_edge(clk); @@ -562,9 +566,9 @@ BEGIN argz := 0.0; wait until rising_edge(clk); - xin <= to_sfixed(argx, xin, false, true); - yin <= to_sfixed(argy, yin, false, true); - zin <= to_sfixed(argz, zin, false, true); + xin <= to_sfixed(argx, xin, fixed_wrap, fixed_round); + yin <= to_sfixed(argy, yin, fixed_wrap, fixed_round); + zin <= to_sfixed(argz, zin, fixed_wrap, fixed_round); vld_in <= '1'; wait until rising_edge(clk); @@ -597,7 +601,7 @@ BEGIN for i in 0 to num_steps_per_cycle-1 loop xin <= to_sfixed(1.0, xin); yin <= to_sfixed(0.0, yin); - zin <= to_sfixed(phi, zin, false, true); + zin <= to_sfixed(phi, zin, fixed_wrap, fixed_round); vld_in <= '1'; wait until rising_edge(clk); diff --git a/lib/radio/cordic/src/tb_cordic_top.vhd b/lib/radio/cordic/src/tb_cordic_top.vhd index 9136b52..ff75043 100644 --- a/lib/radio/cordic/src/tb_cordic_top.vhd +++ b/lib/radio/cordic/src/tb_cordic_top.vhd @@ -148,8 +148,12 @@ use IEEE.MATH_REAL.ALL; USE ieee.numeric_std.ALL; use std.textio.all; -- Imports the standard textio package. +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + library work; -use work.fixed_pkg.all; +use work.fixed_util_pkg.all; use work.cordic_pkg.all; use work.PCK_FIO.all; @@ -591,7 +595,7 @@ BEGIN for i in 0 to num_steps_per_cycle-1 loop xin <= one_sfix; yin <= zero_sfix; - zin <= to_sfixed(phi, zin, false, true); + zin <= to_sfixed(phi, zin, fixed_wrap, fixed_round); wait until rising_edge(clk) and ready = '1'; ce <= '1'; diff --git a/lib/radio/nco/src/mix_cordic.vhd b/lib/radio/nco/src/mix_cordic.vhd index 133136b..ad002a0 100644 --- a/lib/radio/nco/src/mix_cordic.vhd +++ b/lib/radio/nco/src/mix_cordic.vhd @@ -21,7 +21,12 @@ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.MATH_REAL.ALL; USE ieee.numeric_std.ALL; -use work.fixed_pkg.all; + +library ieee_proposed; +use ieee_proposed.math_utility_pkg.all; +use ieee_proposed.fixed_pkg.all; + +library work; use work.fixed_util_pkg.all; use work.cordic_pkg.all;