- uses ieee_proposed.fixed_pkg
git-svn-id: http://moon:8086/svn/vhdl/trunk@170 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user