Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

making a code more simple

0 views
Skip to first unread message

rekz

unread,
Apr 22, 2010, 11:44:43 AM4/22/10
to
Is there a way so I can directly assign Result to take only the 32 LSB
of the resulting Reg1 * Reg2 without having to utilize the mul reg?
As this gives a warning when synthesizing

input signed[31:0] Reg1;
input signed[31:0] Reg2;
output[31:0] Result;

reg signed[31:0] Result;
reg[63:0] mul;

mul = Reg1 * Reg2;
Result = mul[31:0];

John_H

unread,
Apr 22, 2010, 6:30:13 PM4/22/10
to

How about:

Result = (Reg1 * Reg2) & 32'hffffffff;

But are you sure you want the LSbits? If you instead want the MSbits,
perhaps:

Result = (Reg1 * Reg2) >>> 31;

But you should double-check for proper alignment of the signed
multiply result compared to your expectation.

rekz

unread,
Apr 22, 2010, 7:45:30 PM4/22/10
to

If I just do:

Result = (Reg1 * Reg2)

would that give me the 32 bits of the resulting multiplication?

John_H

unread,
Apr 23, 2010, 6:22:46 AM4/23/10
to

That would just give you the least-significant 32 bits of your
multiplication. If that's what you want, you're golden.

0 new messages