-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClaims.txt
130 lines (97 loc) · 4.5 KB
/
Claims.txt
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
/*****************************************************************************
TITLE: Claims
AUTHOR: 2101CS56
Declaration of Authorship
This txt file, claims.txt, is part of the mini project of CS209/CS210 at the
department of Computer Science and Engg, IIT Patna .
*****************************************************************************/
Files:
==========
*All the files I submitted, asm.c and emu.c and claims.txt, have my name and student id at the start, along with a declaration of authorship.
The evidence for Assembler including the output files from the 5 test examples has also been uploaded. They are test1(3 output files), test2(3 output files), memcpy(3 output files) , triangle(3 output files). All the test files have been tested and work properly. As for the evidence for the emulator is uploaded
with two output files, memcpy.txt and triangle.txt.
*Both of my c programs did not show any errors and warnings when i compiled it with
gcc -std=c89 -pedantic and gcc -std=c89 -pedantic -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes standard or equilvalent ....or gcc ... or g++
*Two programs are compatible with gcc asm.c -o asm and gcc emu.c -o emu.
=============================
Program format and structure:
=============================
1. The assembler:
* with two data structures to store respectively labels and mnemonic table with expected operands.
* uses a single routine for both passes.
* detects label errs.
* consistent and sensible formatting with sensible program structure.
* sensible variable, function & type names with explanatory comments.
* advanced listing file.
* assembles test programs.
* cannot implements and demonstrates the instruction SET.
2. The emulator ( if you are submitting) :
* with three data structures to store respectively memory, mnemonic table with expected operands.
* loads object file,
* by giving the instructions like "-before/-after" , the program can produce memory dump before/after execution.
* by giving the instruction like "-trace", the program prints the result of program executed.
=============================
Testing:
=============================
1. The assembler:
I have tested 4/ five examples shown as bellow. The errors only occurred in the file test2.asm and
the program immediately stopped on the second pass.
The others were tested without any errors detected and produced three output files, listing file,
error log file and machine readable object file, for each example.
After comparing the listing files and object file of memcpy.asm , memcpy.l, triangle.l memcpy.o
with the implemented result given on the assignment, both of them show no difference
from those provided( if there is different that is fine too)
1)
#Input: asm test1.asm
#Output:
a. test1.l
b. test1.log (without any error messages)
c. test1.o
2)
#Input:asm test2.asm
#Output:
a. test2.l
b. test2.log (with error messages shown as below but also in log file)
c. test2.o
error messages:
Error @Line:4 Duplicate label definition
Error @Line:5 "nonesuch" is not yet defined
Error @Line:6 Badly formatted number - 08ge
Error @Line:7 Expected an operand
Error @Line:9 Badly formatted number - 5,
Error @Line:9 Extra operand
Error @Line:10 Bogous label name
Error @Line:11 Bogus mnemonic
Error @Line:12 Bogus mnemonic
4)
#Input:asm memcpy.asm
#Output:
a. memcpy.l
b. memcpy.log (without any error messages)
c. memcpy.o
5)
#Input:asm triangle.asm
#Output:
a. triangle.l
b. triangle.log (without any error messages)
c. triangle.o
2. The emulator:
I have tested three examples shown as bellow. The errors only occurred in the file test3.o and
the program immediately stopped with an error message on the screen.
The others were tested without any errors detected and produced execution data both on the screen and
output text file for each example according to the usage instruction.
I have also added the functionality to pass multiple operations while emulation like -trace -before -disc etc can be passed simultaneously.
After running the bin file given, the trace data are the same as
the implemented result from my own program.
1)
#Input:emu -trace memcpy.asm
#Output: memcpy.txt (trace) and memcpy_dump.txt
2)
#Input: emu -trace triangle.asm
#Output: triangle.txt(trace) and triangle_dump.txt
3)
#Input: emu -disc -trace -before -after bubble.o
#Output: output_bubble.txt(disc and trace) and bubble_dump.txt
4)
#Input: emu -after Sum_Of_First_Natural_Numbers.o
#Output: sum_dump.txt