- uses ieee_proposed.fixed_pkg

git-svn-id: http://moon:8086/svn/vhdl/trunk@177 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2008-12-30 19:37:56 +00:00
parent dc63b8df76
commit 18641b8411
13 changed files with 75 additions and 48 deletions
+4 -1
View File
@@ -1,5 +1,8 @@
vmap ieee_proposed ../../../Common/sim/ieee_proposed
vlib work
vcom -explicit -93 "../../../lib/fixed/fixed_pkg_c.vhd"
vcom -explicit -93 "../../../lib/misc/utils_pkg.vhd"
vcom -explicit -93 "../../../lib/fixed/fixed_util_pkg.vhd"
vcom -explicit -93 "../../../lib/PCK_FIO-2002.7/PCK_FIO_1993.vhd"
vcom -explicit -93 "../../../lib/PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd"
vcom -explicit -93 "../src/filter_pkg.vhd"
+4 -1
View File
@@ -1,5 +1,8 @@
vmap ieee_proposed ../../../Common/sim/ieee_proposed
vlib work
vcom -explicit -93 "../../../lib/fixed/fixed_pkg_c.vhd"
vcom -explicit -93 "../../../lib/misc/utils_pkg.vhd"
vcom -explicit -93 "../../../lib/fixed/fixed_util_pkg.vhd"
vcom -explicit -93 "../../../lib/PCK_FIO-2002.7/PCK_FIO_1993.vhd"
vcom -explicit -93 "../../../lib/PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd"
vcom -explicit -93 "../src/filter_pkg.vhd"
+4 -1
View File
@@ -1,5 +1,8 @@
vmap ieee_proposed ../../../Common/sim/ieee_proposed
vlib work
vcom -explicit -93 "../../../lib/fixed/fixed_pkg_c.vhd"
vcom -explicit -93 "../../../lib/misc/utils_pkg.vhd"
vcom -explicit -93 "../../../lib/fixed/fixed_util_pkg.vhd"
vcom -explicit -93 "../../../lib/PCK_FIO-2002.7/PCK_FIO_1993.vhd"
vcom -explicit -93 "../../../lib/PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd"
vcom -explicit -93 "../src/filter_pkg.vhd"
-8
View File
@@ -22,7 +22,6 @@ package filter_pkg is
function FilterMean (x : real_array_t) return real;
function FilterScale (x : real_array_t; scale : real) return real_array_t;
function FilterTestCoef (N : positive) return real_array_t;
function NextPowerOfTwo(x : real) return natural;
end; -- package filter_pkg;
@@ -216,12 +215,5 @@ package body filter_pkg is
end FilterMean;
-------------------------------------------------------------------------------
function NextPowerOfTwo(x : real) return natural is
begin
return integer(ceil(log2(x)));
end NextPowerOfTwo;
-------------------------------------------------------------------------------
end; -- package filter_pkg;
+9 -3
View File
@@ -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.fir_stage_pkg.all;
use work.fir_iterative_pkg.all;
@@ -121,7 +127,7 @@ architecture Behavioral of fir_iterative is
begin
h_addr_out <= to_unsigned(h_addr, h_addr_bits);
x_stage <= resize(xmem_dout, x_stage, false, false);
x_stage <= resize(xmem_dout, x_stage, fixed_wrap, fixed_truncate);
----------------------------------------
process (clk)
@@ -144,7 +150,7 @@ begin
if srst = '1' then
y_dout <= to_sfixed(0, sproto(nbits_out, nbits_out_frac));
elsif y_reg_valid = '1' then
y_dout <= resize(y_out_reg, sproto(nbits_out, nbits_out_frac), rounding, saturating);
y_dout <= resize(y_out_reg, sproto(nbits_out, nbits_out_frac), fixed_wrap, fixed_round);
y_dout_valid <= '1';
end if;
end if;
+9 -2
View File
@@ -3,7 +3,14 @@ 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.utils_pkg.all;
use work.fixed_util_pkg.all;
use work.filter_pkg.all;
-------------------------------------------------------------------------------
@@ -22,7 +29,7 @@ package body fir_iterative_pkg is
function taps_nbits(ntaps : integer; mode : fir_iterative_mode_t) return integer is
variable res : integer;
begin
res := NextPowerOfTwo(real(ntaps_addr(ntaps, mode)));
res := integer(NextPowerOfTwo(real(ntaps_addr(ntaps, mode))));
return res;
end taps_nbits;
+8 -1
View File
@@ -21,7 +21,14 @@ 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.utils_pkg.all;
use work.fixed_util_pkg.all;
use work.fir_stage_pkg.all;
use work.fir_parallel_pkg.all;
+8 -1
View File
@@ -2,7 +2,14 @@
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.utils_pkg.all;
use work.fixed_util_pkg.all;
use work.filter_pkg.all;
use work.fir_stage_pkg.all;
+9 -2
View File
@@ -21,7 +21,14 @@ 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.utils_pkg.all;
use work.fixed_util_pkg.all;
use work.fir_stage_pkg.all;
---- Uncomment the following library declaration if instantiating
@@ -132,7 +139,7 @@ begin
proc_out_reg: process(srst, clk, p_valid, prod, yin)
variable yout : sfixed(sproto(nbits_out, nbits_out_frac)'high downto sproto(nbits_out, nbits_out_frac)'low);
begin
yout := resize(yin + prod, yout, rounding, saturating);
yout := resize(yin + prod, yout, fixed_wrap, fixed_truncate);
-- if rising_edge(clk) then
-- if srst = '1' or y_out_clr = '1' then
-- y_out <= to_sfixed(0, yout);
+4 -24
View File
@@ -2,37 +2,17 @@
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;
package fir_stage_pkg is
type fir_stage_mode_t is (transposed, systolic);
-------------------------------------------------------------
-- Constructor helpers
-- Use: variable v8u6 : ufixed_t(ufixed(8,6)'range);
function uproto (nbits : integer; nbits_frac : integer) return ufixed;
-- Use: variable v8s6 : sfixed_t(sfixed(8,6)'range);
function sproto (nbits : integer; nbits_frac : integer) return sfixed;
end; -- package fir_stage_pkg;
package body fir_stage_pkg is
-------------------------------------------------------------
-- Constuctor helpers
function uproto (nbits : integer; nbits_frac : integer) return ufixed is
constant result : ufixed (nbits-nbits_frac-1 downto -nbits_frac) := (others => '0');
begin
return result(nbits-nbits_frac-1 downto -nbits_frac);
end uproto;
-------------------------------------------------------------
function sproto (nbits : integer; nbits_frac : integer) return sfixed is
constant result : sfixed (nbits-nbits_frac downto -nbits_frac+1) := (others => '0');
begin
return result(nbits-nbits_frac downto -nbits_frac+1);
end sproto;
end; -- package fir_stage_pkg;
+5 -1
View File
@@ -17,8 +17,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.filter_pkg.all;
use work.fir_stage_pkg.all;
use work.fir_iterative_pkg.all;
+5 -1
View File
@@ -17,8 +17,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.fir_stage_pkg.all;
use work.fir_parallel_pkg.all;
use work.filter_pkg.all;
+6 -2
View File
@@ -17,8 +17,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.fir_stage_pkg.all;
use work.filter_pkg.all;
@@ -101,7 +105,7 @@ ARCHITECTURE behavior OF tb_fir_stage IS
variable res : stages_t(x_real'range);
begin
for i in x_real'range loop
res(i) := to_sfixed(x_real(i), res(i), true, true);
res(i) := to_sfixed(x_real(i), res(i), fixed_wrap, fixed_round);
end loop;
return res;