complex generate usage in multiplier

A

Ahmad

Hi all,

I am trying to build a multiply by constant multiplier (using
shifts & additions/subtractions). The multiplier is to be a generic
vector 1 to 15.

Basically I should enter "101Z00000000000", this should infer I need
one adder & one subtractor. The 'Z' means -1 in canonical form.

The for loop should parse that vector & for the the first 2 ones
generate an adder, & for the next Z generate a subtractor and so one.
I can manage the port mapping (hopefully), I just hope someone can
guide me with this form of 'generate'.

BTW, can I use variables with generate?? I want to keep track of
whether or not the current bit is one of the first 2 bits, but
couldn't :(

Any help is highly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top