Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

decimal to floating point conversion

Status
Not open for further replies.

shreeharshakg

Newbie level 4
Joined
Nov 24, 2009
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
mangalore
Activity points
1,333
Hi,
sir, i want to convert a decimal number ( eg : 0.256, -0.984, -1.25,..) to binary. can anybody please help me, how could this be done in VHDL.

thanking you,

sincerely,
shree
 

The question isn't clear. If you intend to convert a real constant to an IEEE float format, the IEEE float_pkg has a to_float function.
Apart of all limitations of the float_pkg in generation of synthesizable code, ith should be at least good for compile time calulations.
But I guess, you're actually asking about ways to process float data in VHDL, which would be a more complex topic.
 

Hi,
sir, i want to convert a decimal number , say -2.673, 0.985, ... to 8 bit floating point. with the first bit as MSB to denote the sign of the number , then next 3 bits for the exponent and the last 4 bits for mantissa.

eg : 2.625

2 = 10 in binary

0.625 × 2 = 1.25
0.25 × 2 = 0.5
0.5 × 2 = 1.0

So 0.625 = 0.101, and 2.625 = 10.101.

Exponent: 1 + 3 = 4 = 100 in binary ; 3 is bias .

The result is 0 100 0101 .

can you please help me how can this be implemented in VHDL .
 

hi shree....
i am also searching for the same solution..........
if u got the solution then please help me....
i have a block diagram as shown in below
please give me solution to convert real number in to binary in xilinx
find the dig in attachment
regards....
rajput
 

Attachments

  • Untitled.png
    Untitled.png
    6.2 KB · Views: 139
Last edited:

you should using the floating point blocks provided by xilinx. They have an integer to floating point conversion tool.
 

thanks tricky for u r quick reply,
i know the coding to do the add,sub, mul in fixed & floating point,
but i want my i/p is decimal(not binary 01010) it is like: 11.15 or 5.5 and o/p is also decimal.
is that possible
 

Hi Gyrajput,

Here in FPGA, we can dealing with binary values only, means if you want to give the 11.15 or 5.5 analog values as input to the FPGA, you must convert the values to digital, means in terms 0's and 1's.
after the ADC you can do the required operations and at the end you need to go with DAC (digital to Analog Conversion), for get back the analog value.
 

thanks Shibin,
is there any solution of problem,
as i shown in block diagram.

thanks n regards
grajput
 

How you are supplying these 11.15 or 5.5 analog values? means is there any signal generator or output of some analog operation or something?
First you need to convert the analog value to Digital before feeding to the FPGA, depends upon the precision of your ADC, you can define the number of bits used to represents the integer and the decimal parts.

Then you can feed the integer and decimal values in digital form into the FPGA, then do the operations separately for integer and decimal part and at the end you need to have a DAC to convert back the digital form to corresponding integer and decimal form.
 
ok now it's clear that xiline and FPGA work only on digital number only.....
thanks Shibin,
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top