/* -------------------------------------------------------------------- -- -- -- Copyright©2002 by the Institute of Electrical and Electronics Engineers, Inc. -- Three Park Avenue -- New York, NY 10016-5997, USA -- All rights reserved. -- -- This document is an unapproved draft of a proposed IEEE Standard. As such, -- this document is subject to change. USE AT YOUR OWN RISK! Because this -- is an unapproved draft, this document must not be utilized for any -- conformance/compliance purposes. Permission is hereby granted for IEEE -- Standards Committee participants to reproduce this document for purposes -- of IEEE standardization activities only. Prior to submitting this document -- to another standards development organization for standardization -- activities, permission must first be obtained from the Manager, Standards -- Licensing and Contracts, IEEE Standards Activities Department. Other -- entities seeking permission to reproduce this document, in whole or in -- part, must obtain permission from the Manager, Standards Licensing and -- Contracts, IEEE Standard Activities Department. -- -- IEEE Standards Activities Department -- Standards Licensing and Contracts -- 445 Hoes Lane, P.O. Box 1331 -- Piscataway, NJ 08855-1331, USA -- -- Title : fphdl64_real_functions.inc < IEEE std # 1076.3 > -- -- Developers: VHDL Synthesis working group, PAR 1076.3 -- -- Purpose : Functions for real based 64 bit floating point -- -- Limitation: -- -- -------------------------------------------------------------------- -- Last Modified $Date: 2003-01-23 12:35:07-05 $ -- $Id: fphdl64_real_functions.inc,v 1.2 2003-01-23 12:35:07-05 bishop Exp $ -- $Log: fphdl64_real_functions.inc,v $ -- Revision 1.2 2003-01-23 12:35:07-05 bishop -- fixed a few bugs -- -- Revision 1.1 2003-01-15 09:50:54-05 bishop -- Initial revision -- -- -------------------------------------------------------------------- */ // by Kurt Baty `include "fphdl64_real_functions_base.inc" function [63:0] abs; // absolute number input [63:0] arg; abs = absolute(arg); endfunction // abs function [63:0] neg; // unary negative input [63:0] arg; neg = negative(arg); endfunction // neg function [63:0] add; // addition (l + r) input [63:0] l, r; add = addition(l,r); endfunction // add function [2*64-1:0] add_c; // complex add input [63:0] l_r, l_i, r_r, r_i; add_c = complex_add(l_r, l_i, r_r, r_i); endfunction // add_c function [63:0] sub; // subtraction (l - r) input [63:0] l, r; sub = subtract(l,r); endfunction // sub function [2*64-1:0] sub_c; // complex subtraction input [63:0] l_r, l_i, r_r, r_i; sub_c = complex_subtract(l_r, l_i, r_r, r_i); endfunction // sub_c function [63:0] mult; // multiplation (l * r) input [63:0] l, r; mult = multiply(l,r); endfunction // mult function [2*64-1:0] mult_c; // complex multiplicaiton input [63:0] l_r, l_i, r_r, r_i; mult_c = complex_multiply(l_r, l_i, r_r, r_i); endfunction // mult_c function [63:0] div; // division (l / r) input [63:0] l, r; div = divide(l,r); endfunction // div function [2*64-1:0] div_c; // complex division input [63:0] l_r, l_i, r_r, r_i; div_c = complex_divide(l_r, l_i, r_r, r_i); endfunction // div_c function [63:0] rem; // remainder input [63:0] l, r; rem = remainder(l,r); endfunction // rem function [63:0] sqrt; // square root input [63:0] arg; sqrt = square_root(arg); endfunction // sqrt function [63:0] log; // log input [31:0] base; // integer input [63:0] arg; log = logarithm(base, arg); endfunction // log function [63:0] ln; // ln input [63:0] arg; ln = natural_log(arg); endfunction // ln function [63:0] pow_fp; // l**r, where l and r are fp64 input [63:0] l, r; pow_fp = power_of_fp(l,r); endfunction // pow_fp function [63:0] pow; // l**r, where l is fp64 and r is integer input [63:0] l; input [31:0] r; // integer pow = power_of(l,r); endfunction // pow function [63:0] e; // the constant e input nothing; e = e64(nothing); endfunction // e function [63:0] pi; // the constant pi input nothing; pi = pi64(nothing); endfunction // pi function [63:0] sin; // sin input [63:0] arg; sin = sine(arg); endfunction // sin function [63:0] cos; // cos input [63:0] arg; cos = cosine(arg); endfunction // cos function [63:0] tan; // tan input [63:0] arg; tan = tangent(arg); endfunction // tan function [63:0] arcsin; // arcsin input [63:0] arg; arcsin = arc_sine(arg); endfunction // arcsin function [63:0] arccos; // arccos input [63:0] arg; arccos = arc_cosine(arg); endfunction // arccos function [63:0] arctan; // arctan input [63:0] arg; arctan = arc_tangent(arg); endfunction // arctan function equ; // = input [63:0] l, r; equ = equal(l,r); endfunction // equ function not_equ; // != input [63:0] l, r; not_equ = not_equal(l,r); endfunction // not_equ function gteq; // >= input [63:0] l, r; gteq = greater_than_or_equal(l,r); endfunction // gteq function lteq; // <= input [63:0] l, r; lteq = less_than_or_equal(l,r); endfunction // lteq function gt; // > input [63:0] l, r; gt = greater_than(l,r); endfunction // gt function lt; // < input [63:0] l, r; lt = less_than(l,r); endfunction // lt function [63:0] integer_to_fp64; // integer input, fp64 output input [31:0] arg; // integer integer_to_fp64 = integer_to_fp64_func(arg); endfunction // integer_to_fp64 /* function [63:0] real_to_fp64; // real input, fp64 output input [63:0] arg; // Verilog real number endfunction // real_to_fp64 use: assign res = $realtobits(arg); */ function [63:0] fp64_to_integer; // fp64 to integer input [63:0] arg; // floating point fp64_to_integer = fp64_to_integer_func(arg); endfunction // fp64_to_integer /* function [63:0] fp64_to_real; // fp64 to real input [63:0] arg; // floating point endfunction // fp64_to_real use: assign res = $bitstoreal(arg); */ function [63:0] Copysign; // copies sign of x to y input [63:0] x, y; Copysign = 0; // Copysign = Copysign_func(x,y); endfunction // Copysign function [63:0] Scalb; // multiplies y by 2**n (where n is an integer) input [63:0] y; input [31:0] n; // integer Scalb = 0; // Scalb = Scale_by(y,n); endfunction // Scalb function [63:0] Logb; // returns the log (base 2) of arg input [63:0] arg; Logb = 0; // Logb = logb2(arg); endfunction // Logb function [63:0] Nextafter; // Gives you the next logical number after x input [63:0] x, y; Nextafter = 0; // Nextafter = Nextafter_func(x,y); endfunction // Nextafter function Finite; // returns "1" if x is not infinity. input [63:0] x; Finite = 0; // Finite = Finite_func(x); endfunction // Finite function Isnan; // returns "1" is x in any type of NAN input [63:0] x; Isnan = 0; // Isnan = Isnan_func(x); endfunction // Isnan function Unordered; // returns "1" if x or y is a NAN. input [63:0] x, y; Unordered = 0; // Unordered = Unordered_func(x,y); endfunction // Unordered