This is the project done by Group No. A25. It includes a fully functional assembler and a simulator that work for floating point numbers as well. We also have implemented 5 bonus functions, the opcodes/functionalities of which are mentioned below:-
-
Instruction :- swap
Opcode :- 10011
Syntax :- swap reg1 reg2
Type :- C
Semantics :- Swaps values of reg1 and reg2 -
Instruction :- ceil
Opcode :- 10101
Syntax :- ceil reg1 reg2
Type :- C
Semantics :- Takes the value of reg2 and computes its ceil into reg1 (reg2 has to be a float) -
Instruction :- floor
Opcode :- 10110
Syntax :- floor reg1 reg2
Type :- C
Semantics :- Takes the value of reg2 and computes its floor into reg1 (reg2 has to be a float) -
Instruction :- rot
Opcode :- 10100
Syntax :- rot reg1 $Imm
Type :- B
Semantics :- Takes the value in reg1 and rotates it rightwards -
Instruction :- rand
Opcode :- 10111
Syntax :- rand reg1 reg2 reg3
Type :- A
Semantics :- Finds a random integer between reg2 and reg3(both included), where reg2 <= reg3 and places it in reg1
Some Notes for the TAs for Assembler:-
-
The code returns special error messages for a couple of errors that we thought might be there in the test cases apart from those given in the project document file. Any other error is called a 'General Syntax Error.'
-
We assumed that we had to print ony one error and not all the errors that are possible as it was explicitly mentioned to do so in the project documents.
Notes for Simulator:-
-
We assumed that the floats occupied a continuous range rather than a discrete one.
-
We assumed overflow to be when value goes above 16 bits and not 7 bits.
Notes for Bonus:-
The test case1 and test case2 won't pass during automted testing as they involve a randomizer function which obviously during computation, will return a different value each time.