NI Labs

cancel
Showing results for 
Search instead for 
Did you mean: 

Welcome to NI Fixed-Point Math Library

Ellens,
Thank you for yor reply.  This does make sense to me.  Attached is my vi (Labview 8.5.1) I use to find mantissa and exponent.  Maybe you can make some suggestions to improve my VI.

David
0 Kudos
Message 21 of 23
(6,793 Views)
Hi David,
 
Your VI looks good to me. The VI is straightforward and the result is correct. I only did a little changes listed below:
 
1. For FPGA VIs, I strongly recommend using the Timed Loop instead of the While or For Loop if possible. That doesn't impact the resulting values and the number of iterations keeps the same. But the Timed Loop can ensure that each loop iteration consumes exactly one clock cycle (of the hardware timing source and is normally 40M Hz). While the While and For Loop may use at least 4 cycles more than the Timed Loop in each iteration, depending on the content in the loop. However, there're many functions that cannot be placed inside the Timed Loop. (You can find the restrictions in the on-line help or manual files). But your VI can still use the Timed Loop without any problem.
 
2. The VI can run endlessly if the input value is zero. I added a comparison in the loop and stopped the iteration when all input bits were checked.
 
3. The output type has the same fractional word length as the Input (i.e.16-bit). I just want to remind you that if you want to keep all precision of the Input, you'll need to make the output word length equal to the (Input's fractional word length + Input's integer word length - 1 = Input's word length - 1). In order not to lose the LSBs of the Input during right shift, you also need to lengthen the fractional word length of the Input by (Input's integer word length - 1) bit before processing it in the loop. Anyway, it's also ok  for your current VI if you don't care about the lost LSBs of the input.
 
Besides, could you tell me why you use a signed type for the Input (I20.4 in your VI)? Since zero and negative values cannot produce a reasonable result in FXP Natural Logarithm, I think an unsigned input might be better to avoid some undefined results.
 
Please let me know if anything else I can help.
 
-Ellen


帖子被Ellens在04-30-2008 04:51 AM时编辑过了
Message 22 of 23
(6,768 Views)

Hi all,

 

I'm just posting a note to let everyone know that we released the Fixed-Point Math Library (now called the High Throughput Math Functions) in the LV 2009 FPGA Module.

 

Detailed information about the functions is available here.

 

More information about what's new in the LV 2009 FPGA Module is available here.

 

Thanks!

 

-Ryan Pollack

Senior Technical Writer

LabVIEW R&D

Message Edited by [NI]_RyanP on 08-12-2009 02:50 PM
0 Kudos
Message 23 of 23
(5,770 Views)