iterative multiplier in vhdl

Status
Not open for further replies.

eeStud

Member level 1
Joined
Feb 17, 2011
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,527
Hi all,
i am trying to write an iterative multiplexer and having some trouble in getting started,
in this exercise i need to use an adder (with no consideration for the carry).
and use a register i have write as a component .
and a counter.
so here is a few question i hope will help me:
1. Suppose i have A and B numbers. should i save them in registers, and run a loop B times (using the counter) and every iteration add A <= A+A ?
 

In general, that is never the best way to go. It is easier to do in the same way you would do it by hand. eg:
23 * 12 = 23*10 + 23*2 = 230 + 46 = 276
1010 * 1100 = 1010*1000 + 1010*100 + 1010*0 + 1010*0 = 1010000 + 101000 = 1111000
in a loop, a = 1010, b = 1100, s = 0 (output), n = 0 (index)
s = s + a * 2^n if b == 1
so:
s=0. n=0. b(0) = 0. result -- s = 0
s=0. n=1. b(1) = 0. result -- s = 0
s=0. n=2. b(2) = 1. result -- s = 1010*2^2 = 101000
s=101000. n = 3. b(3) = 1. result -- s = 1111000

thus the multiplication runs much faster -- the number of iterations scales with the width of a (or b).
 

and do i have to use the counter for this implementation?
 

and if the numbers are in two's complement?
 

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