FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > FPGA

FPGA comp.arch.fpga newsgroup (usenet)

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-02-2009, 05:16 PM
Bond
Guest
 
Posts: n/a
Default the reach of VHDL

hi all
as far a today as far as today i think that variables ,operators like
'/','*'
are unsynthesizable and have
avoided their use. but if they are to be avoided how can we implement
complex algorithms using VHDL. Should all the complex algorithms be
left for
microblaze? i wanted to create a hardware module which would process
the
data from accelerometer but i have to use the
formula A=(t1/t2-50)/12.5. can a hardware module process this kind of
formula or it should be left for microblaze. so please clear me about
the
reach and extent of VHDL. where the role of VHDL ends and where the
role of
microblaze comes into action.
thank you
prashanta

Reply With Quote
  #2 (permalink)  
Old 06-02-2009, 05:54 PM
glen herrmannsfeldt
Guest
 
Posts: n/a
Default Re: the reach of VHDL

doug <[email protected]> wrote:

< Bond wrote:

<> as far a today as far as today i think that variables,
<> operators like '/','*' are unsynthesizable and have
<> avoided their use. but if they are to be avoided how can
<> we implement complex algorithms using VHDL.

<> Should all the complex algorithms be left for microblaze?
<> i wanted to create a hardware module which would process the
<> data from accelerometer but i have to use the
<> formula A=(t1/t2-50)/12.5. can a hardware module process this
<> kind of formula or it should be left for microblaze.
(snip)

< You are thinking in terms of software. VHDL is a hardware description
< language where you build hardware. You certainly can build hardware
< to do multiply and divide but you need to understand what you are doing.
< If you want to do programming, do software. If you want to do hardware
< design, you have to do hardware design. They are different.

If microblaze is fast enough, then it should probably be done
that way. Though many now will synthesize multiply, especially
on FPGAs with hardware multipliers, and likely also divide by
constants, divide by a variable is less likely.

If you write verilog like you were working with a box of TTL
chips. (Well, maybe 74HCT by now.) then you won't get too lost.

You are doing hardware design, and one thing that has to be
designed is a divider. How fast does it need to be? How many
stages of pipelining? How many quotient bits? Those all need to be
known, and the synthesizer is unlikely to figure them out from a /
operator. If you want a pipelined multiplier, you usually have
to write that out, too. (Though many systems will have generators
for special logic block that will do it given the appropriate
parameters.)

< Whether it is worth the effort to do the math in hardware is dependent
< on what else you are doing. If there is to be a microblaze in the
< system, it is less work to just do the math there. If the only reason
< to exist for the microblaze is to do the math, it is probably easier
< to do it in hardware.

Especially how fast it needs to be.

-- glen
Reply With Quote
  #3 (permalink)  
Old 06-02-2009, 06:23 PM
Jonathan Bromley
Guest
 
Posts: n/a
Default Re: the reach of VHDL

On Tue, 2 Jun 2009 08:16:45 -0700 (PDT), Bond wrote:

> as far a today as far as today i think that variables ,operators like
>'/','*'
> are unsynthesizable


Nonsense. Variables and * are fine for synthesis, as long as
you understand that * will create rather large hardware in
devices that don't have on-chip multipliers. Using variables
for synthesis is a well-established technique that's been
discussed here and on comp.lang.vhdl many times before.

>i have to use the formula A=(t1/t2-50)/12.5


As others have asked, the key question is:
how often (how fast) do you need to do this?

For many of these sensor signal conditioning problems,
you may find that the input values have interesting
properties that can make the calculations easier if
you are sufficiently ingenious. Tell us more.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
[email protected]
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Reply With Quote
  #4 (permalink)  
Old 06-02-2009, 06:38 PM
doug
Guest
 
Posts: n/a
Default Re: the reach of VHDL



Bond wrote:

> hi all
> as far a today as far as today i think that variables ,operators like
> '/','*'
> are unsynthesizable and have
> avoided their use. but if they are to be avoided how can we implement
> complex algorithms using VHDL. Should all the complex algorithms be
> left for
> microblaze? i wanted to create a hardware module which would process
> the
> data from accelerometer but i have to use the
> formula A=(t1/t2-50)/12.5. can a hardware module process this kind of
> formula or it should be left for microblaze. so please clear me about
> the
> reach and extent of VHDL. where the role of VHDL ends and where the
> role of
> microblaze comes into action.
> thank you
> prashanta
>

You are thinking in terms of software. VHDL is a hardware description
language where you build hardware. You certainly can build hardware
to do multiply and divide but you need to understand what you are doing.
If you want to do programming, do software. If you want to do hardware
design, you have to do hardware design. They are different.

Whether it is worth the effort to do the math in hardware is dependent
on what else you are doing. If there is to be a microblaze in the
system, it is less work to just do the math there. If the only reason
to exist for the microblaze is to do the math, it is probably easier
to do it in hardware.
Reply With Quote
  #5 (permalink)  
Old 06-04-2009, 03:22 AM
whygee
Guest
 
Posts: n/a
Default Re: the reach of VHDL

Hi,

Bond wrote:
> I have to use the
> formula A=(t1/t2-50)/12.5. can a hardware module process this kind of
> formula or it should be left for microblaze.


the formula is not perfectly clear but I can infer a few things from past readings,
particularly from the ever inspiring DSP litterature.

The "/12.5" is clearly coming from a power of two, just do the maths :
*1 /1
*2 /(1/2)=/0.5
*4 /(1/4)=/0.25
*8 /(1/8)=/0.125
so if you divide by 0.125, you multiply by 8
Since you divide by 12.5, you actually use another 100x factor.

now : when you multiply by 8, you add 3 LSB (you add no information, these LSB remain zeroed).
For the 100x factor, you can "scale" the whole algorithm with this factor.
That is : the 100x multiply is only done by a display interface (just move the decimal point
when you printf() it).

This means that you don't need to perform the /12.5 division at all in VHDL.
Also, look at Digital Signal Processing sites and books, because
this domain uses a lot of "fixed point" binary representation
(you clearly don't need floating point numbers here !)

Now, the "-50" term is unclear.
It is either the data that was sampled 50ms ago, or a "magic constant"...

This kind of division may be handled with a multi-cycle Newton-Raphson technique,
which uses multiplies and add/sub operators.

Or you can use a simple 1-bit-per-cycle divider if speed allows it, and space is constrained
(probably the best solution).

BTW, beware of the obvious case of x/0...

> prashanta

yg

--
http://ygdes.com / http://yasep.org
Reply With Quote
  #6 (permalink)  
Old 06-04-2009, 06:06 PM
Bond
Guest
 
Posts: n/a
Default Re: the reach of VHDL

On Jun 3, 6:22*pm, whygee <[email protected]> wrote:
> Hi,
>
> Bond wrote:
> > I have to use the
> > formula A=(t1/t2-50)/12.5. can a hardware module process this kind of
> > formula or it should be left for microblaze.

>
> the formula is not perfectly clear but I can infer a few things from pastreadings,
> particularly from the ever inspiring DSP litterature.
>
> The "/12.5" is clearly coming from a power of two, just do the maths :
> * * **1 * * */1
> * * **2 * * */(1/2)=/0.5
> * * **4 * * */(1/4)=/0.25
> * * **8 * * */(1/8)=/0.125
> so if you divide by 0.125, you multiply by 8
> Since you divide by 12.5, you actually use another 100x factor.
>
> now : when you multiply by 8, you add 3 LSB (you add no information, these LSB remain zeroed).
> For the 100x factor, you can "scale" the whole algorithm with this factor..
> That is : the 100x multiply is only done by a display interface (just move the decimal point
> * when you printf() it).
>
> This means that you don't need to perform the /12.5 division at all in VHDL.
> Also, look at Digital Signal Processing sites and books, because
> this domain uses a lot of "fixed point" binary representation
> (you clearly don't need floating point numbers here !)

thank you for giving such a wonderful trick but still i think i have
to design a multiplier which i will definitely try.

>
> Now, the "-50" term is unclear.

actully the term 't1/t2' is duty cycle and we subtract 50 from the
value of the duty cycle. so it is a constant.
> It is either the data that was sampled 50ms ago, or a "magic constant"...
>
> This kind of division may be handled with a multi-cycle Newton-Raphson technique,
> which uses multiplies and add/sub operators.
>

could you please give some hints on implementing this technique. it
would be great if you clearify me the algorithm as you did in the case
of division by12.5.
> Or you can use a simple 1-bit-per-cycle divider if speed allows it, and space is constrained
> (probably the best solution).
>

i didnt get this as well so once again it would be great if you
clerified me with algorithm.
> BTW, beware of the obvious case of x/0...
>


> > prashanta

>
> yg
>
> --http://ygdes.com/http://yasep.org

thank you prashanta

Reply With Quote
  #7 (permalink)  
Old 06-04-2009, 07:54 PM
MikeWhy
Guest
 
Posts: n/a
Default Re: the reach of VHDL

"Bond" <[email protected]> wrote in message
news:[email protected]m...
On Jun 3, 6:22 pm, whygee <[email protected]> wrote:
>
> Bond wrote:
> > I have to use the
> > formula A=(t1/t2-50)/12.5. can a hardware module process this kind of
> > formula or it should be left for microblaze.

>
> Now, the "-50" term is unclear.


actully the term 't1/t2' is duty cycle and we subtract 50 from the
value of the duty cycle. so it is a constant.

==============
It's probably duty cycle expressed as a percentage. "-50" normalizes it to
50% duty cycle. "/12.5" says to take 1/8 of that value, and express the
result as a ratio rather than a percentage. You're all the way home without
complex calculations if you can have duty ratio supplied as a N/256 fraction
(or some other power of 2 fraction) rather than a percentage, and can accept
the result similarly expressed.

As homework problems go, this one is pretty cheesy, and all who helped are
guilty of depriving you of your education. Consider the above a willful and
spiteful tax on your future earning potential.


Reply With Quote
  #8 (permalink)  
Old 06-04-2009, 09:49 PM
whygee
Guest
 
Posts: n/a
Default Re: the reach of VHDL

MikeWhy wrote:
> As homework problems go, this one is pretty cheesy, and all who helped
> are guilty of depriving you of your education. Consider the above a
> willful and spiteful tax on your future earning potential.

Sorry mike, I couldn't resist...
Maybe I did too much DSP, or too little lately...
old cravings resurface, you know...
yg
--
http://ygdes.com / http://yasep.org
Reply With Quote
  #9 (permalink)  
Old 06-04-2009, 11:49 PM
MikeWhy
Guest
 
Posts: n/a
Default Re: the reach of VHDL

"whygee" <[email protected]> wrote in message
news:[email protected]
> MikeWhy wrote:
>> As homework problems go, this one is pretty cheesy, and all who helped
>> are guilty of depriving you of your education. Consider the above a
>> willful and spiteful tax on your future earning potential.

> Sorry mike, I couldn't resist...
> Maybe I did too much DSP, or too little lately...
> old cravings resurface, you know...
> yg


Nah. It's great that that you took the time to help. I wrote poorly. I meant
he was cheating himself out of an education by asking for *too* much help.


Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL Packages, Coding Styles for Arithmetic Operations and VHDL-200xAdditions Amal VHDL 0 12-03-2008 03:41 PM
VHDL Packages, Coding Styles for Arithmetic Operations and VHDL-200xAdditions Amal FPGA 0 12-03-2008 03:41 PM
[Nios II] How fast the cpu in Nios II can reach in the Cycone ? lexluthor FPGA 3 09-13-2007 03:00 AM
multiD-vhdl: Multi Dimensional Arrays (allowing generics on each dimension) for VHDL (including ports) [email protected] VHDL 2 03-21-2006 05:05 PM
Getting started VHDL, VHDL for Dummies, Easy Steps for FPGA experiments Kutaj Vamor FPGA 4 10-03-2005 12:46 AM


All times are GMT +1. The time now is 01:15 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved