-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpu.script
More file actions
174 lines (173 loc) · 3.68 KB
/
cpu.script
File metadata and controls
174 lines (173 loc) · 3.68 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
Script started on Wed 16 Nov 2016 10:26:31 AM MST
]0;elijah@elijah-VirtualBox: ~/113/lab9[01;32melijah@elijah-VirtualBox[00m:[01;34m~/113/lab9[00m$ make main
gcc -g -Wall -c operations.c
\gcc -g -Wall -c print.c
gcc -g -Wall -c registry.c
gcc -g -Wall -c init.c
gcc -g -Wall init.o main.c operations.o registry.o print.o -o calculator
]0;elijah@elijah-VirtualBox: ~/113/lab9[01;32melijah@elijah-VirtualBox[00m:[01;34m~/113/lab9[00m$ \[K./calculator
Enter the word size: 68
Error in word size, must be between 1 and 64, please try again
Enter the word size: -1
Error in word size, must be between 1 and 64, please try again
Enter the word size: 1
Unsigned values [y/N]: 4
Enter binary expression: 11 + 0
Error in input, first entry bigger than the word size
Error in first half of input
Enter binary expression: 1 + 0
1
+
0
-
1
flags
OF: 0
CF: 0
SF: 1
PF: 0
ZF: 0
Decimal 1
Do you want to continue [Y/n] y
Enter the word size: 64
Unsigned values [y/N]: y
Enter binary expression: 11111 + 0101110101
0000000000000000000000000000000000000000000000000000000000011111
+
0000000000000000000000000000000000000000000000000000000101110101
----------------------------------------------------------------
0000000000000000000000000000000000000000000000000000000110010100
flags
OF: 0
CF: 0
SF: 0
PF: 1
ZF: 0
Unsigned Decimal 404
Do you want to continue [Y/n] y
Enter the word size: 5
Unsigned values [y/N]:
Enter binary expression: 10111 - 11
10111
+
11101
-----
10100
flags
OF: 0
CF: 1
SF: 1
PF: 1
ZF: 0
Decimal -12
Do you want to continue [Y/n]
Enter the word size: 5
Unsigned values [y/N]: y
Enter binary expression: 10111 - 11
10111
+
11101
-----
10100
flags
OF: 0
CF: 1
SF: 1
PF: 1
ZF: 0
Unsigned Decimal 20
Do you want to continue [Y/n] y
Enter the word size: 5
Unsigned values [y/N]:
Enter binary expression: 10123241 - 1
error in input, please enter a binary expression
Enter binary expression: 1011
Invalid entry, no operation in expression
Enter binary expression: 1011 t 1
Invalid entry, no operation in expression
Enter binary expression: 1234 t 1
Invalid entry, no operation in expression
Enter binary expression: 1234 + 1
error in input, please enter a binary expression
Enter binary expression: 111 | 01
00111
|
00001
-----
00111
flags
OF: 0
CF: 0
SF: 0
PF: 0
ZF: 0
Decimal 7
Do you want to continue [Y/n] y
Enter the word size: 5
Unsigned values [y/N]: 01
Enter binary expression: 01101 & 10011
01101
&
10011
-----
00001
flags
OF: 0
CF: 0
SF: 0
PF: 0
ZF: 0
Decimal 1
Do you want to continue [Y/n] y
Enter the word size: 5
Unsigned values [y/N]:
Enter binary expression: 01101 ^ 10011
01101
^
10011
-----
11110
flags
OF: 0
CF: 0
SF: 1
PF: 1
ZF: 0
Decimal -2
Do you want to continue [Y/n] y
Enter the word size: 64
Unsigned values [y/N]:
Enter binary expression: 11111 + 11111111111111
0000000000000000000000000000000000000000000000000000000000011111
+
0000000000000000000000000000000000000000000000000011111111111111
----------------------------------------------------------------
0000000000000000000000000000000000000000000000000100000000011110
flags
OF: 0
CF: 0
SF: 0
PF: 0
ZF: 0
Decimal 16414
Do you want to continue [Y/n] y
Enter the word size: 64
Unsigned values [y/N]:
Enter binary expression: 11111 - 1111111111111
0000000000000000000000000000000000000000000000000000000000011111
+
1111111111111111111111111111111111111111111111111110000000000001
----------------------------------------------------------------
1111111111111111111111111111111111111111111111111110000000100000
flags
OF: 0
CF: 0
SF: 1
PF: 1
ZF: 0
Decimal -8160
Do you want to continue [Y/n] n
Exiting
]0;elijah@elijah-VirtualBox: ~/113/lab9[01;32melijah@elijah-VirtualBox[00m:[01;34m~/113/lab9[00m$ exit
exit
Script done on Wed 16 Nov 2016 10:32:07 AM MST