Re: [myhdl-list] Floating point
Brought to you by:
jandecaluwe
|
From: Günter D. <dan...@we...> - 2009-02-10 20:47:37
|
Sami Al Dalahmah wrote: > Hi Guenter, > Basically I'm testing serial to parallel block, it simply streams arrays. It > worked fine with integers arrays, but didn't work with floating point > arrays, because like you said intbv() deals with integers inherently. What I > am after here is to find a short cut instead of writing a quantizer (like > you said scale, round and truncate), i.e. is there any ready module that can > quantize a floating point array, I tried the bin() function but it doesn't > recognize floating points, it treats them as integers. > Hmm, I am still trying to put your approach into a box. If you have floating point numbers and use the Python build in floating point type, that means you don't care about conversion to synthesizable HDL. So just for simulation you would need to apply some scaling if the numbers are not scaled appropriately yet and then can use the Python build in round() function to do the rounding. Guenter |