pilipovicn Posted September 14, 2022 Report Share Posted September 14, 2022 I receive an integer from an external API, that is actually a fixed point real value, disguised as int for transport compatibility. I need to convert the integer back into it's fixed point representation. I presume I can convert the int to sc_bv. Then, I would expect sc_fixed to have a constructor accepting a sc_bv, and specify the decimal point place through sc_fixed template. Looking through the source, It seem though that sc_fixed cannot be constructed from a sc_bv. The closest thing I see is the char* constructor (pass bits using sc_bv.to_string() ), but I'm pretty sure that converts a decimal string, not a binary string. In short, is there a simple enough way to convert the bits of an integer (in the form of sc_bv) into a real number (say, float) by specifying the fixed point location in the bit vector? Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.