diff options
author | Tristan Gingold | 2014-10-14 06:19:33 +0200 |
---|---|---|
committer | Tristan Gingold | 2014-10-14 06:19:33 +0200 |
commit | 0e199cbea1070c016d29348cd659b9e6ca688afb (patch) | |
tree | 169e2c21b5e84998f03c2de76feed3e61cea503c /libraries | |
parent | 68d26922e31aad3cb34dd3b7689bcec75ad70fcb (diff) | |
download | ghdl-0e199cbea1070c016d29348cd659b9e6ca688afb.tar.gz ghdl-0e199cbea1070c016d29348cd659b9e6ca688afb.tar.bz2 ghdl-0e199cbea1070c016d29348cd659b9e6ca688afb.zip |
Initial support for package header and package instantiation.
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/Makefile.inc | 12 | ||||
-rw-r--r-- | libraries/ieee2008/fixed_generic_pkg-body.vhdl | 20 |
2 files changed, 17 insertions, 15 deletions
diff --git a/libraries/Makefile.inc b/libraries/Makefile.inc index 5695068..ab29cfb 100644 --- a/libraries/Makefile.inc +++ b/libraries/Makefile.inc @@ -53,16 +53,12 @@ ieee2008/math_real.vhdl ieee2008/math_real-body.vhdl \ ieee2008/math_complex.vhdl ieee2008/math_complex-body.vhdl \ ieee2008/numeric_bit.vhdl ieee2008/numeric_bit-body.vhdl \ ieee2008/numeric_bit_unsigned.vhdl ieee2008/numeric_bit_unsigned-body.vhdl \ -ieee2008/numeric_std.vhdl \ -ieee2008/numeric_std-body.vhdl \ +ieee2008/numeric_std.vhdl ieee2008/numeric_std-body.vhdl \ ieee2008/numeric_std_unsigned.vhdl ieee2008/numeric_std_unsigned-body.vhdl \ ieee2008/fixed_float_types.vhdl \ -ieee2008/fixed_generic_pkg.vhdl \ -ieee2008/fixed_generic_pkg-body.vhdl -# ieee2008/fixed_pkg.vhdl \ -#ieee2008/float_generic_pkg.vhdl -#ieee2008/float_generic_pkg-body.vhdl -# +ieee2008/fixed_generic_pkg.vhdl ieee2008/fixed_generic_pkg-body.vhdl \ +ieee2008/fixed_pkg.vhdl +#ieee2008/float_generic_pkg.vhdl ieee2008/float_generic_pkg-body.vhdl \ #ieee2008/float_pkg.vhdl STD87_BSRCS := $(STD_SRCS:.vhdl=.v87) diff --git a/libraries/ieee2008/fixed_generic_pkg-body.vhdl b/libraries/ieee2008/fixed_generic_pkg-body.vhdl index 24842a9..361b4c7 100644 --- a/libraries/ieee2008/fixed_generic_pkg-body.vhdl +++ b/libraries/ieee2008/fixed_generic_pkg-body.vhdl @@ -292,12 +292,13 @@ package body fixed_generic_pkg is arg : UNRESOLVED_ufixed) -- fixed point vector return STD_ULOGIC_VECTOR is - variable result : STD_ULOGIC_VECTOR (arg'length-1 downto 0); + subtype result_subtype is STD_ULOGIC_VECTOR (arg'length-1 downto 0); + variable result : result_subtype; begin if arg'length < 1 then return NSLV; end if; - result := STD_ULOGIC_VECTOR (arg); + result := result_subtype (arg); return result; end function to_sulv; @@ -305,12 +306,15 @@ package body fixed_generic_pkg is arg : UNRESOLVED_sfixed) -- fixed point vector return STD_ULOGIC_VECTOR is - variable result : STD_ULOGIC_VECTOR (arg'length-1 downto 0); + subtype result_subtype is STD_ULOGIC_VECTOR (arg'length-1 downto 0); + variable result : result_subtype; + --variable result : STD_ULOGIC_VECTOR (arg'length-1 downto 0); begin if arg'length < 1 then return NSLV; end if; - result := STD_ULOGIC_VECTOR (arg); + --result := STD_ULOGIC_VECTOR (arg); + result := result_subtype (arg); return result; end function to_sulv; @@ -723,9 +727,10 @@ package body fixed_generic_pkg is is variable result : UNRESOLVED_ufixed (minimum(l'high, r'high) downto mine(l'low, r'low)); + constant rlow : integer := mins(r'low, r'low); variable lresize : UNRESOLVED_ufixed (maximum(l'high, r'low) downto - mins(r'low, r'low)-guard_bits); - variable rresize : UNRESOLVED_ufixed (r'high downto r'low-guard_bits); + rlow-guard_bits); + variable rresize : UNRESOLVED_ufixed (r'high downto rlow-guard_bits); variable dresult : UNRESOLVED_ufixed (rresize'range); variable lslv : UNRESOLVED_UNSIGNED (lresize'length-1 downto 0); variable rslv : UNRESOLVED_UNSIGNED (rresize'length-1 downto 0); @@ -5014,7 +5019,8 @@ package body fixed_generic_pkg is variable c : CHARACTER; begin while L /= null and L.all'length /= 0 loop - if (L.all(1) = ' ' or L.all(1) = NBSP or L.all(1) = HT) then + c := l (l'left); + if (c = ' ' or c = NBSP or c = HT) then read (l, c, readOk); else exit; |