Project Description
This project involves the development of an interpreter for the assembly language of a virtual machine called CSU_VM. This virtual machine has the following features:
Memory Addressing
CSU_VM can address only 64 integer addresses. They are numbered from 0 – 63.
Registers
CSU_VM has 4 registers. They are numbered 0 – 3.
Operations
CSU_VM can perform the following operations:
Memory
LOAD [mem_address],[register] : Loads the content of [mem_address] into [register]. Example: let’s suppose that memory address 60 contains the number -3. Then LOAD 60, 3 puts the number -3 into the third register of the processor. Load only works from main memory to registers, not among registers
STOR [mem_address],[register] : Loads the content of a register into the memory address. For example let’s say that register 1 contains the number -25. STOR 55, 1 puts the number -25 into the memory address 55.
Arithmetic
ADD [register1],[register2] :Adds the [register2] + [register1] and stores the result in [register1]
SUB [register1],[register2] : Subtracts [register1] - [register2] and stores the result in [register1]
MUL [register1],[register2] : Multiplies [register1] * [register2] and stores the result in [register1]
DIV [register1],[register2]: Performs an integer division of [register1]/[register2] and saves the result on register1
MOD [register1],[register2]: Returns the modulus of dividing register1/register2 and saves the result on register1
Logic
CMP [register1], [register2], line_number: Checks if register1 is equals to register2 and if true, it jumps to the line_number specified.
GRT [register1], [register2], line_number: Checks if register1 is greater than register2 and if true, it jumps to the line_number specified.
LSS [register1], [register2], line_number: Checks if register1 is smaller than register2 and if true, it jumps to the line_number specified.
Other
STOP: Finishes the execution of a program.
How a program for CSU_VM looks like?
A program in CSU_VM starts by setting up the initial values for the main memory. If no value is set, it is assumed to be 0. Initially, the values stored in the registers are set to 0.
For example the following program calculates the sum of the numbers from 1 to 10, and stores the result of the sum in the memory address # 62. A line that starts with # denotes a comment and should not be interpreted as a statement (instruction).
# sets the memory address 0 to store the value 1. M stands for memory.
M:0=1,1=11
# All programs starts with an initial setup of values in memory such as the example shown above
0 LOAD 1,3
1 LOAD 0,2
2 ADD 1,2
3 ADD 0,1
4 LSS 1,3,2
5 STOR 62,1
6 STOP
After the program stops your program should create a text file named CSU_VM_success_[date_in_millisecons].txt and dump the following data
Hello,
I am coming from a strong core Java background and have fair knowledge in the requirement as I have graduated with bachelors in Electrical Engineering.
Looking forward to get in touch and start working on your project.
Thank You,
Rohan
Hello.
I work in area of applied mathematics. I write in Python/Java/C/C++/Haskell and MatLab.
Your project is interesting for me. I can handle it.
Write me, please.
Hope, I will be useful to you.
Regards.
I'm a professional Java developer with 4 years of work experience. I also got experience in programming language interpreters and virtual machines. I can finish the given project within the next 24 hours if assigned to me.