Re: Please review my float package

Discussion in 'VHDL' started by Mike Treseler, Aug 15, 2003.

  1. Jerker Hammarberg (DST) wrote:

    > I put together a generic floating point package that performs addition,
    > subtraction, multiplication and comparison. Contrary fphdl
    > (www.eda.org/fphdl), it is synthesizable with Xilinx XST - that's why
    > I made my own. Anyway, I present it here in the hope that anyone may
    > wants to look through it for
    > * possible optimizations, particularly for implementation size,
    > * language misuse or simplifications,
    > * bugs,
    > * or actually, any possible improvements.


    Consider:

    1. A simple testbench with an assertion for each function.
    2. numeric_std:

    -- use ieee.std_logic_arith.all;
    use ieee.numeric_std.all;

    m := "01" & shift_left((m(size-3 downto 0))
    to_integer(to_unsigned(leftshift,EXPSIZE)));

    -- m := "01" & shl(m(size-3 downto 0),
    -- conv_unsigned(leftshift, EXPSIZE));

    -- rsres := shr(rsarg1, rsarg2);
    rsres := shift_right(rsarg1, to_integer(rsarg2));

    -- return conv_std_logic_vector(result, TOTALSIZE);
    return std_logic_vector(result);


    -- return conv_std_logic_vector(result, TOTALSIZE);
    return std_logic_vector(result);



    -- Mike Treseler
     
    Mike Treseler, Aug 15, 2003
    #1
    1. Advertising

  2. missed a comma \

    m := "01" & shift_left((m(size-3 downto 0)) ,
    to_integer(to_unsigned(leftshift,EXPSIZE))) ;

    -- Mike Treseler
     
    Mike Treseler, Aug 15, 2003
    #2
    1. Advertising

  3. "Jerker Hammarberg (DST)" wrote:
    >
    > > 2. numeric_std:

    >
    > This is interesting... what is the difference between numeric_std and
    > std_logic_arith? I can see the former is slightly more readable. Is it also
    > more efficient?


    I don't know for sure about efficiency but I doubt there is any
    appreciable difference since efficiency is determined primarily by the
    tool, not the package, unless you have optimization turned off.

    The most important difference is that numeric_std is an IEEE standard
    while std_logic_arith actually has several different (and incompatible)
    versions, depending on whose tool you're using. If you want your code to
    be portable, use numeric_std.
    --
    Tim Hubberstey, P.Eng. . . . . . Hardware/Software Consulting Engineer
    Marmot Engineering . . . . . . . VHDL, ASICs, FPGAs, embedded systems
    Vancouver, BC, Canada . . . . . . . . . . . http://www.marmot-eng.com
     
    Tim Hubberstey, Aug 18, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy
    Replies:
    7
    Views:
    6,332
    Roedy Green
    May 10, 2004
  2. KK
    Replies:
    2
    Views:
    728
    Big Brian
    Oct 14, 2003
  3. bd
    Replies:
    0
    Views:
    673
  4. www
    Replies:
    51
    Views:
    1,519
  5. Carsten Fuchs
    Replies:
    45
    Views:
    1,660
    James Kanze
    Oct 8, 2009
Loading...

Share This Page