Sign in

username:

password:



Not a member?

Search Comp.Arch.FPGA



Search tips

fpga by Keywords

Altera | ASIC | CPLD | Cyclone | DCM | DDR | DSP | Ethernet | ISE | JTAG | Linux | LVDS | Microblaze | ML310 | Modelsim | NIOS | OPB | PCI | Quartus | RocketIO | SDRAM | Spartan | Spartan3 | SRAM | Stratix | Verilog | VHDL | Virtex | Virtex-4 | Virtex-II | Xilinx | XST


Ads

See Also

DSPEmbedded SystemsElectronics

Comp.Arch.FPGA | Binary integer to ASCII string in HDL?

There are 4 messages in this thread.

You are currently looking at messages 0 to 4.

Binary integer to ASCII string in HDL? - John Speth - 2010-06-25 12:19:00

I need to do some fast (<5 usec) conversions
of binary integer to ASCII 
string in HDL (NIOS, FPGA, etc) - basically a fast substitute for 
sprintf(s,"%d",n);

Does anyone know if:

1. It's practical to make an effort to do it in HDL or will it be an endless 
rats hole?
2. Is there an IP vendor that can sell it to me?

If neither, can anyone offer any suggestion on which direction to proceed?

Thanks, JJS



--- news://freenews.netfront.net/ - complaints: n...@netfront.net ---
______________________________
Join the blogging team on FPGARelated.com and earn rewards! Details Here.



Re: Binary integer to ASCII string in HDL? - Uwe Bonnes - 2010-06-25 12:43:00

John Speth <j...@yahoo.com> wrote:
> I need to do some fast (<5 usec) conversions of binary integer to ASCII 
> string in HDL (NIOS, FPGA, etc) - basically a fast substitute for 
> sprintf(s,"%d",n);

> Does anyone know if:

> 1. It's practical to make an effort to do it in HDL or will it 
> be an endless rats hole?
> 2. Is there an IP vendor that can sell it to me?

> If neither, can anyone offer any suggestion on which direction
> to proceed?

Look for binary_to_bcd.v on opencores.

I used it successfull for some design.
-- 
Uwe Bonnes                b...@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
______________________________
Join the blogging team on FPGARelated.com and earn rewards! Details Here.

Re: Binary integer to ASCII string in HDL? - Brian Drummond - 2010-06-25 17:44:00

On Fri, 25 Jun 2010 09:19:06 -0700, "John
Speth" <j...@yahoo.com> wrote:

>I need to do some fast (<5 usec) conversions of binary integer to ASCII 
>string in HDL (NIOS, FPGA, etc) - basically a fast substitute for 
>sprintf(s,"%d",n);
>
>Does anyone know if:
>
>1. It's practical to make an effort to do it in HDL or will it be an endless 
>rats hole?

%x would be utterly trivial and damn fast; you'd probably meet 5 ns (not us) in
Virtex-5 (10ns in Spartan) provided you hold string "s" in registers. One clock
cycle and you're done.

%d reduces to bcd decoding, or successive division by 10 (which may be easiest
as multiplication by a reciprocal). A reasonable goal would be one digit per
clock cycle, so approx 10x slower than the above. Not very difficult.

If n is restricted (say, 16 or fewer bits) there will be simpler approaches.

>2. Is there an IP vendor that can sell it to me?
It's too trivial for any IP vendor though you may find something free on
opencores.org.

- Brian


Re: Binary integer to ASCII string in HDL? - John Speth - 2010-06-30 16:45:00

>I need to do some fast (<5 usec)
conversions of binary integer to ASCII 
>string in HDL (NIOS, FPGA, etc) - basically a fast substitute for 
>sprintf(s,"%d",n);

Thanks for suggesting binary_to_bcd.v from OpenCores.  It's exactly what I 
needed and it worked right out of the box.  Using it, I met my speed target.

JJS



--- news://freenews.netfront.net/ - complaints: n...@netfront.net ---