From: John Speth on
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: news(a)netfront.net ---
From: Uwe Bonnes on
John Speth <johnspeth(a)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 bon(a)elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
From: Brian Drummond on
On Fri, 25 Jun 2010 09:19:06 -0700, "John Speth" <johnspeth(a)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

From: John Speth on
>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: news(a)netfront.net ---