I am trying to convert a number I get from a keyboard to the IEEE-753 standard using VHDL or a logic implementation, I don't want the complete answer only a guide about how I should encourage this.
I read a keyboard and store in memory every digit from the entire and decimal part and the user also has the option to enter the exponent which is also saved in another memory position.
I read in this website about how to convert a decimal number to the IEEE standard. Suppose now that I have a number represented in scientific notation, for example:
22.523 x 10^20
I read this number in BCD from my memory so I need to convert it to binary to then process it, my idea is:
- Convert entire part to binary.
- Take binary entire part and multiply by 10 times indicated by the exponent in this case, 22 x 10^20.
- Convert decimal part to binary.
- Take binary decimal part and multiply by 10 times indicated by the [exponent]-[number of decimal digits] in this case, 523 x 10^17.
- Add the two binary numbers.
So now I have my number in binary and I can apply the method indicated in the website.
To represent this number I will need two registers, one for every part of the number the first one will need:
log2(22 x 10^20) bits which is 71 bits and the second part will need
log2(523 x 10^17) bits which is 66 bits so I will need 71+66 = 137 bits to store the result and then convert it to IEEE-753.
Is this normal? Is any other way to do it? Or is it accomplished on this way?