[SOLVED] modular adder vhdl code

Status
Not open for further replies.

mamarezax

Newbie level 1
Joined
Jun 27, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
i need vhdl code of a modular adder.
for example an adder that calculated with following method

a and b are n-bit
m is n bit number.
m= 2^n-1
s is n bit number.
(a+b)mod m =s
solve this for n=4
example:
a= 1101
b=1001
m=1111
s=0110

our design must be have only on n bit adder (4 bit adder for example)
many thanx my friends
 

post the code you have done so far.
 

(a+b)mod m =s
solve this for n=4
example:
a= 1101
b=1001
m=1111
s=0110

Something is wrong with the example:

a=1101 = 13
b=1001 = 9
m=1111 = 15
s=0110 = 6

(a+b) mod m = (13+9) mod 15 = 22 mod 15 = 7
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…