1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
//EX4_4: Adder to add two 2-bit binary numbers and produce 3-bit sum
//clears the screen
clc
//clears already existing variables
clear
disp(' A | B | C | D | X | Y | Z |')
disp('----------------------------')
disp(' 0 | 0 | 0 | 0 | 0 | 0 | 0 |')
disp(' 0 | 0 | 0 | 1 | 0 | 0 | 1 |')
disp(' 0 | 0 | 1 | 0 | 0 | 1 | 0 |')
disp(' 0 | 0 | 1 | 1 | 0 | 1 | 1 |')
disp(' 0 | 1 | 0 | 0 | 0 | 0 | 1 |')
disp(' 0 | 1 | 0 | 1 | 0 | 1 | 0 |')
disp(' 0 | 1 | 1 | 0 | 0 | 1 | 1 |')
disp(' 0 | 1 | 1 | 1 | 1 | 0 | 0 |')
disp(' 1 | 0 | 0 | 0 | 0 | 1 | 0 |')
disp(' 1 | 0 | 0 | 1 | 0 | 1 | 1 |')
disp(' 1 | 0 | 1 | 0 | 1 | 0 | 0 |')
disp(' 1 | 0 | 1 | 1 | 1 | 0 | 1 |')
disp(' 1 | 1 | 0 | 0 | 0 | 1 | 1 |')
disp(' 1 | 1 | 0 | 1 | 1 | 0 | 0 |')
disp(' 1 | 1 | 1 | 0 | 1 | 0 | 1 |')
disp(' 1 | 1 | 1 | 1 | 1 | 1 | 0 |')
disp('X(A,B,C,D) = Σm(7, 10, 11, 13, 14, 15)')
disp('Y(A,B,C,D) = Σm(2, 3, 5, 6, 8, 9, 12, 15)')
disp('Z(A,B,C,D) = Σm(1, 3, 4, 6, 9, 11, 12, 14)')
|