السلام عليكم و رحمة الله
Today - الحمد لله - we delivered our architecture project, after 2 sleepless nights and 3 awake-less days ..
The project was divided to 3 main parts:
- making an Assembler
- making an Emulator
- modifying the given computer design to support interrupts.
Since our group members are only 3, each one of us got a part. My part, which I enjoyed a lot, was the Assembler, it had 2 main tasks to achive:
- produce machine code for the given assembly code.
- handle some syntax/compile-time errors. (or we may call it "Assemble-Time" :D)
Assembler's design was as follows:
1. a 'Scanner' class to scan the editor's text box and parse its lines, returns object of type 'ParsedLine'.
2. this parsed line is sent to 'FirstPass' class that does the First Pass operations (generating Address Symbol Tables, code & data tables with offsets, detect some syntax errors, ...)
3. then 'SecondPass' operates on tables generated by 'FirstPass', translates to machine code, detects some instructions' errors, and returns 'MemoryEntry' objects.
The best part was parsing the code lines and producing line tokens. We used C# RegEx classes. Other parts were just applying what was mentioned in the book and project document . This was so boring.
For the errors to handle, I handled 9/10 basic errors:
Invalid Label, Invalid pseudo instruction, Undefined operand, Unknown instruction, Memory reference out of range, Invalid value, Invalid no. of operands, Operand-instruction mismatch, label double definition.
Plus 8 other additional errors, and we got 8 bonus marks for that :)
Testing levels were 3 for the emulator, we passed level 3 and 2 successfully, level 1 test cases were full of mistakes, so the doctor asked us to run level 1 of yesterday and we passed it successfully too الحمد لله. To test the assembler we had 1 input assembly-code file to produce 1 machine-code file that should match with the correct machine code, and they were identical الحمد لله .
Then we were asked to modify both Assembler & emulator to support additional memory reference instruction, it was easy and we made it successfully.
My overall rating for the project is 7/10. I don't know why I'm not completely satisfied of it, but next projects I'll try to do better ان شاء الله.
At the end, I came up with a conclusion: "I love Architecture" :D I wouldn't have done such an interesting project if I didn't study it!
The project was divided to 3 main parts:
- making an Assembler
- making an Emulator
- modifying the given computer design to support interrupts.
Since our group members are only 3, each one of us got a part. My part, which I enjoyed a lot, was the Assembler, it had 2 main tasks to achive:
- produce machine code for the given assembly code.
- handle some syntax/compile-time errors. (or we may call it "Assemble-Time" :D)
Assembler's design was as follows:
1. a 'Scanner' class to scan the editor's text box and parse its lines, returns object of type 'ParsedLine'.
2. this parsed line is sent to 'FirstPass' class that does the First Pass operations (generating Address Symbol Tables, code & data tables with offsets, detect some syntax errors, ...)
3. then 'SecondPass' operates on tables generated by 'FirstPass', translates to machine code, detects some instructions' errors, and returns 'MemoryEntry' objects.
The best part was parsing the code lines and producing line tokens. We used C# RegEx classes. Other parts were just applying what was mentioned in the book and project document . This was so boring.
For the errors to handle, I handled 9/10 basic errors:
Invalid Label, Invalid pseudo instruction, Undefined operand, Unknown instruction, Memory reference out of range, Invalid value, Invalid no. of operands, Operand-instruction mismatch, label double definition.
Plus 8 other additional errors, and we got 8 bonus marks for that :)
Testing levels were 3 for the emulator, we passed level 3 and 2 successfully, level 1 test cases were full of mistakes, so the doctor asked us to run level 1 of yesterday and we passed it successfully too الحمد لله. To test the assembler we had 1 input assembly-code file to produce 1 machine-code file that should match with the correct machine code, and they were identical الحمد لله .
Then we were asked to modify both Assembler & emulator to support additional memory reference instruction, it was easy and we made it successfully.
My overall rating for the project is 7/10. I don't know why I'm not completely satisfied of it, but next projects I'll try to do better ان شاء الله.
At the end, I came up with a conclusion: "I love Architecture" :D I wouldn't have done such an interesting project if I didn't study it!