diff options
Diffstat (limited to '3827/CH4/EX4.4/EX4_4.sce')
-rw-r--r-- | 3827/CH4/EX4.4/EX4_4.sce | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/3827/CH4/EX4.4/EX4_4.sce b/3827/CH4/EX4.4/EX4_4.sce new file mode 100644 index 000000000..863c0dc60 --- /dev/null +++ b/3827/CH4/EX4.4/EX4_4.sce @@ -0,0 +1,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)')
|