PROGRAM IN MATLAB FOR MULTIPLICATION OF TWO UNSIGNED INTEGER BINARY NUMBERS BY PARTIAL-PRODUCT METHOD (4BITS NUMBERS)
function lab2_coa
a=input('enter a:');
b=input('enter b:');
r=[0 0 0 0 0 0 0 0];
c=0;
for j=4:-1:1
if(b(1,j)==0)
continue;
end
for i=4:-1:1
sum=xor(xor(r(1,i+j),a(1,i)),c);
carry=or(and(r(1,i+j),a(1,i)),and(xor(r(1,i+j),a(1,i)),c));
c=carry;
r(1,i+j)=sum;
end
end
disp(r);
disp(c);
end
Saturday, January 20, 2018
Home »
MATLAB Programs - COA
» Computer Organisation & Architecture
0 comments:
Post a Comment