summaryrefslogtreecommitdiff
path: root/45/CH2/EX2.12/example_2_12.sce
blob: 276bbd6e27bd98a9aaea01037408410b18b95c94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//Example 2.12
clc
clear
a=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1];
b=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1];
c=[0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1];
d=[0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
for i=1:16 // finding Y and y1 for all possible inpt cases 
    x=bitand(a(i),b(i));
    y=bitand(c(i),d(i));
    r(i)=bitor(x,y);
    x1=bitcmp(x,1);
    y1=bitcmp(y,1);
    z=bitand(x1,y1);
    r1(i)=bitcmp(z,1);
end
disp('   Y    Y1');
for i = 1 : 16 // displaying result
        Y(i,1)=r(i);
        Y(i,2)=r1(i);
        end
disp(Y);
disp('Both are logically equivalent');