May 4, 2012 #1 M 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
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
May 4, 2012 #2 T TrickyDicky Advanced Member level 7 Joined Jun 7, 2010 Messages 7,110 Helped 2,081 Reputation 4,181 Reaction score 2,048 Trophy points 1,393 Activity points 39,769 post the code you have done so far.
May 5, 2012 #3 S std_match Advanced Member level 4 Joined Jul 9, 2010 Messages 1,304 Helped 463 Reputation 926 Reaction score 448 Trophy points 1,363 Location Sweden Activity points 10,172 mamarezax said: (a+b)mod m =s solve this for n=4 example: a= 1101 b=1001 m=1111 s=0110 Click to expand... 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
mamarezax said: (a+b)mod m =s solve this for n=4 example: a= 1101 b=1001 m=1111 s=0110 Click to expand... 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