![]() |
|
|
|||||||
![]() |
VHDL - Re: Please review my float package |
|
|
Thread Tools | Search this Thread |
|
|
#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 |
|
|
|
|
#2 |
|
Posts: n/a
|
missed a comma \
m := "01" & shift_left((m(size-3 downto 0)) , to_integer(to_unsigned(leftshift,EXPSIZE))) ; -- Mike Treseler Mike Treseler |
|
|
|
#3 |
|
Posts: n/a
|
"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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| TheDigitalReview: DO YOU BELIEVE IN MIRACLES? - DVD REVIEW | Mike McGee | DVD Video | 0 | 02-09-2004 08:15 PM |
| TheDigitalReview: WILLIAM GIBSON: NO MAPS FOR THESE TERRITORIES - DVD REVIEW | Mike McGee | DVD Video | 0 | 12-08-2003 02:02 AM |
| TheDigitalReview: BABE SPECIAL EDITION - DVD REVIEW (User Review) | Mike McGee | DVD Video | 0 | 12-04-2003 04:52 AM |
| TheDigitalReview: HUD - DVD REVIEW | Mike McGee | DVD Video | 0 | 11-22-2003 10:34 AM |
| TheDigitalReview: THE JAMIE KENNEDY EXPERIMENT - COMPLETE FIRST SEASON - DVD REVIEW | Mike McGee | DVD Video | 0 | 11-21-2003 12:07 PM |