OpenCores
URL https://opencores.org/ocsvn/encore/encore/trunk

Subversion Repositories encore

[/] [encore/] [trunk/] [fpmult/] [src/] [fp_generic.vhdl] - Diff between revs 4 and 6

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 4 Rev 6
Line 38... Line 38...
        return fp(31);
        return fp(31);
end function fp_sign;
end function fp_sign;
 
 
function fp_exp(fp:fp_type) return fp_exp_type is
function fp_exp(fp:fp_type) return fp_exp_type is
begin
begin
        return unsigned(fp(30 downto 23));
  return(resize((unsigned(fp) srl 23),8));
end function fp_exp;
end function fp_exp;
 
 
function fp_mantissa(fp:fp_type) return fp_mantissa_type is
function fp_mantissa(fp:fp_type) return fp_mantissa_type is
begin
begin
        return unsigned("1"&fp(22 downto 0));    -- Prepend implied '1' bit of IEEE-754 mantissa in order to return a 24 bit entity
        return(fp_mantissa_type("1"&fp(22 downto 0)));   -- Prepend implied '1' bit of IEEE-754 mantissa in order to return a 24 bit entity
end function fp_mantissa;
end function fp_mantissa;
 
 
 
function fp_exp_is_min(exp:fp_exp_type) return boolean is
 
begin
 
  return (exp=0);
 
end function fp_exp_is_min;
 
 
 
function fp_exp_is_max(exp:fp_exp_type) return boolean is
 
begin
 
  return (exp=255);
 
end function fp_exp_is_max;
 
 
function fp_is_normal(fp:fp_type) return boolean is
function fp_is_normal(fp:fp_type) return boolean is
        variable e:fp_exp_type;
        variable exp:fp_exp_type;
begin
begin
        e:=fp_exp(fp);
        exp:=fp_exp(fp);
 
 
        return (e/=(others=>'0')) and (e/=(others=>'1'));
  return not fp_exp_is_min(exp) and not fp_exp_is_max(exp);
end function fp_is_normal;
end function fp_is_normal;
 
 
function fp_is_zero(fp:fp_type) return boolean is
function fp_is_zero(fp:fp_type) return boolean is
begin
begin
        return (unsigned(fp_exp(fp))=0) and (unsigned(fp_mantissa(fp))=0);
        return (fp_exp(fp)=0) and (fp_mantissa(fp)=0);
end function fp_is_zero;
end function fp_is_zero;
 
 
function fp_is_subnormal(fp:fp_type) return boolean is
function fp_is_subnormal(fp:fp_type) return boolean is
begin
begin
        return (fp_exp(fp)=(others=>'0')) and (fp_mantissa(fp)/=(others=>'0'));
        return (fp_exp(fp)=0) and (fp_mantissa(fp)/=0);
end function fp_is_subnormal;
end function fp_is_subnormal;
 
 
function fp_is_infinite(fp:fp_type) return boolean is
function fp_is_infinite(fp:fp_type) return boolean is
begin
begin
        return (fp_exp(fp)=(others=>'1')) and (fp_mantissa(fp)=(others=>'0'));
        return (fp_exp_is_max(fp_exp(fp))) and (fp_mantissa(fp)=0);
end function fp_is_infinite;
end function fp_is_infinite;
 
 
function fp_is_nan(fp:fp_type) return boolean is
function fp_is_nan(fp:fp_type) return boolean is
begin
begin
        return (fp_exp(fp)=(others=>'1')) and (fp_mantissa(fp)/=(others=>'0'));
        return (fp_exp_is_max(fp_exp(fp))) and (fp_mantissa(fp)/=0);
end function fp_is_nan;
end function fp_is_nan;
 
 
function fp_is_signalling(fp:fp_type) return boolean is
function fp_is_signalling(fp:fp_type) return boolean is
begin
begin
        return fp_is_nan(fp) and fp_mantissa(fp)(22)='0';
        return fp_is_nan(fp) and fp_mantissa(fp)(22)='0';

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.