multiplication circuit by using only sumators - Page 1
Forum section: electronics / projects

author: spini
author_rank: Newbie
timestamp: January 24, 2021, 09:57:23 pm
content: Hi,how can I make for example a circuit which multiply a number by 10, only by using (built-in) sumators and simple logical gates? (I'm using cedar logic soft)Thanks.

author: MK14
author_rank: Super Contributor
timestamp: January 24, 2021, 10:04:28 pm
content: Quote from: spini on January 24, 2021, 09:57:23 pmIt might be a homework question, so I will give a hint, rather than a full answer.If X is some number.What is (X shifted to the left 3 bits) plus (using adders) (X shifted left just one bit) ?Example:1717 = 10001 in binarySo 10001000 <shifted left 3 bits, so had 000 appended to it> + 100010 <shifted 1 bit>1000100000100010 + in binary10101010 = binary= 170

author: spini
author_rank: Newbie
timestamp: January 24, 2021, 10:27:15 pm
content: Thanks for response,how did U know that it must be shifted in this example (multiplication by 10) to the left 3 bits + shifted 1 bit?I get it how to make circuit by Ur explanation but, I don't understand how did U invent it

author: MK14
author_rank: Super Contributor
timestamp: January 24, 2021, 10:31:09 pm
content: Quote from: spini on January 24, 2021, 10:27:15 pmThere was some FPGA discussions on here, a while ago. It used that method, as a very high speed way of multiplying by 10.If I am misremembering that, then it would have been something like programming in C, where that method was used, to speed up the program, as multiplication, tends to be a little bit slow. Especially on very old processors.

author: JohnnyMalaria
author_rank: Super Contributor
timestamp: January 24, 2021, 10:33:28 pm
content: Think how you do it in decimal:e.g., 23 x 7 = [(2 x 10) x 7] + [3 x 7]Multiplying by 10 in decimal is equivalent to multiplying by 2 in binary - which is just a shift.And in binary, multiplication is easily done with adders. So, in the binary case, the above can be achieved with just adders and shifters.Search for "binary multiplier gate implementation"

author: Nominal Animal
author_rank: Super Contributor
timestamp: January 24, 2021, 10:57:17 pm
content: Do you knowlong multiplication? Binary multiplication works exactly like that.If you want to multiply by some constantC, convertCto binary representation. Ignore all zeros in the binary representation. The ones represent the shifts (of the other multiplicand) you need to sum together.For example, considerC= 6 = 1102= 4 + 2. To multiply any numberXbyC=6 we do6X= (4 + 2)X= 4X+ 2X= (X<< 2) + (X<< 1)Just remember that 1<<0=20=1, 1<<1=21=2, 1<<2=22=4, 1<<3=23=8, 1<<4=24=16, 1<<5=25=32, and so on.

author: ledtester
author_rank: Super Contributor
timestamp: January 24, 2021, 11:19:48 pm
content: And don't forget the trick of implementing division with multiplication:https://ridiculousfish.com/blog/posts/labor-of-division-episode-i.htmlSo now you can implement division by a constant with just adders.

author: rstofer
author_rank: Super Contributor
timestamp: January 25, 2021, 02:23:57 am
content: 23= 8 so when we shift right 3 places we are multiplying by 8 so shift X left 3 places21= 2 so when we shift left 1 place we are multiplying by 2 sp shift X left 1 placeFinally, 8 times X plus 2 times X => 10 times X

author: rstofer
author_rank: Super Contributor
timestamp: January 25, 2021, 02:31:14 am
content: If we can't use shifts but only adders, we need a couple of temporary values, call them A + BA = X + X -> A := 2XB = A + A -> B := 4Xans = (B + B) + A -> ans := 4X + 4X + 2X := 10X

author: gnuarm
author_rank: Super Contributor
timestamp: January 25, 2021, 03:08:02 am
content: Quote from: rstofer on January 25, 2021, 02:31:14 amIt would be a very odd situation where you could not use a shift. But then I think in terms of hardware where shifting is just a matter of how you connect things.