multiplication without using * operator in verilog

Status
Not open for further replies.

senthilos

Newbie level 6
Joined
Feb 25, 2010
Messages
12
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Raleigh, NC, USA
Activity points
1,360
Hi,

I got an interview question yesterday on multiplying a 10 bit number with a constant. Ex: a[9:0] * 24. The interviewer was expecting a answer without using the straightforward * operator. Can anyone throw me more light on how to do this multiplication without using * operator?

Thanks
Senthil
 

1. sum = 0;
for(int i = 0; i < 24; i++) sum += a;

2. a * 24 = a * (8 + 16) = a* 8 + a * 16 = (a << 3) + (a << 4);

3. Design mult circuit using ANDs and XORs.

Bests,
Tiksan
 

Analyzing the multiplicand into additions of multiples of 2 numbers.
Shifting and summing would be fine.
For example X * 3 is the same as X << 1 + X
--
Amr Ali
 

the first question is why not using a "*" with a constant? The synthesis tools are enought intelligent to simplify the combinaison.

The 2 proposition of Syswip-Tiksan seems to be the more efficient.
 

Syswip and amraldo,

Your solutions seem quite different. Thanks!
What do you mean by design circuit using ANDs and XORs? You mean to draw the entire multiplier circuit using logic gates?
 

the first question is why not using a "*" with a constant? The synthesis tools are enought intelligent to simplify the combination.

Because it is only for interview.

What do you mean by design circuit using ANDs and XORs? You mean to draw the entire multiplier circuit using logic gates?

Yes I mean to design entire multiplier circuit using logic gates.
You can use school book method.
 

Here is a multiplier circuit: **broken link removed**.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…