# multiplication without using * operator in verilog

Status
Not open for further replies.

#### senthilos

##### Newbie level 6 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

#### Syswip 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

#### amraldo 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

#### rca 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.

#### senthilos

##### Newbie level 6 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?

#### Syswip 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.

#### DigitalLogician

##### Member level 2 Here is a multiplier circuit: Teahlab.

Status
Not open for further replies.