0

If i use one std_logic_vector (31 downto 0) as input of my entity. Exists any form of using this 32 bits (IEEE Format) to convert them to ASCII form ?

I have 3.14:

input  ----> 0100 0000 0100 1000 1111 0101 1100 0011 (in IEEE 32 bits form)
output <---- 0011 0011 0010 1110 0011 0001 0011 0100 
               3    3    2    E    3    1    3    4
                \__/      \__/      \__/      \__/
                  3         .         1         4    (in ASCII form)

The number 3.14 is only a example. May be is any number in 32 bits used as input of my entity.

  • How is "332E3134" a valid representation of "3.14" in BCD? How do you expect the exponent to be represented? How do you expect the sign to be represented? – zennehoy Oct 07 '13 at 15:51
  • Or do you mean ASCII rather than BCD form? (BCD means representing each decimal digit using 4 bits) How/where do you want to display your output? How do you want to represent very large or very small numbers (0.0000001, 10000000)? Should all numbers be output with the same width? – zennehoy Oct 07 '13 at 15:58
  • Sorry. ASCII form. Between 000.000 and 999.999 – Antônio Vieira Oct 07 '13 at 16:14
  • Do you really mean ASCII form..? ASCII means that you'll need to decode the number before you use it. Ascii digits live from 0x30-0x39. Check out an ASCII table here: http://www.asciitable.com/ Is that really what you mean? – Russell Oct 07 '13 at 18:51
  • And I will @Russell. I want receive an 32 bit number in IEEE 754 format and to decode in one of 104 bits number(13 numbers of 8 bits). Each number contain 8 bits of the ASCII value of digit. To do this i need first know how to receive a 32 bits number (the float) and extract each digit to do the convertion. – Antônio Vieira Oct 07 '13 at 22:12
  • 1
    This sounds very much like something an embedded processor (CPU) would normally do. Are you sure you need to solve this using custom hardware? A hardware implementation of what is basically a printf will not be easy. – zennehoy Oct 08 '13 at 07:10
  • How fast do you need to do it? (Also, 31 downto 1 is a weird looking vector, do you mean 31 downto 0?) – Martin Thompson Oct 08 '13 at 09:36
  • @MartinThompson I want only write the behavior code. Not be will synthetized. Very Thanks for reply and edit. Sorry the vector is (31 downto 0). – Antônio Vieira Oct 08 '13 at 18:12
  • @AntônioVieira - can you explain more *why* you want to do this? – Martin Thompson Oct 09 '13 at 12:04
  • @MartinThompson It was a challenge proposed. is not a real problem. Since I'm not solving this way, I'll try to create a ROM with stored values ​​that I desire (-999.999 to 999.999) – Antônio Vieira Oct 09 '13 at 22:45

0 Answers0