Instruction Set Simulator
The Instruction Set Simulator will work for the following set of Instructions:
Instruction |
First byte |
Second byte |
MOV Rn, direct |
0000 Rn |
direct |
MOV direct, Rn |
0001 Rn |
direct |
MOV @Rn, Rm |
0010 Rn |
Rm |
MOV Rn, #immed |
0011 Rn |
immediate |
ADD Rn, Rm |
0100 Rn |
Rm |
SUB Rn, Rm |
0101 Rn |
Rm |
JZ Rn, relative |
0110 Rn |
relative |
Files:
- simm.cc
- simm.h
- Makefile
- Readme.txt
- fib.txt
Instructions:
Download all files and run make using the provided Makefile.
Run the simulator by typing at the command line: simm < input file >
Notes:
- The < input file > should be a text file containing the binary
representations of the Instruction Set and their arguments. Example:
Assume Rn = 1 and direct = 1,
MOV Rn, direct -- must be: 0000000100000001
- Each instruction must be in a separate line.
- The first eight characters represent the first byte: MOV Rn
The second eight characters represent the second byte: direct
- If the second byte represents Rm ( register address ) then the first 4
characters will contain the information, example:
Rm = 3, then second byte = 00110000
- A test file ( fib.txt ) is provided to demonstrate how the simulator
works. The test file calculates the fibonacci number for 10.