University of California Riverside
Department of Computer Science -- Embedded Systems

Instruction Set Simulator

Files:

simm.cc
simm.h
Makefile
Readme.txt
fib.txt    

Instructions:

Download all files and run make using the provided Makefile.
Run 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  ==> 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

* Note: For JZ instruction, the jump can be forward and backward, which means that the "relative" address can be positive for a forward jump and negative for a backward jump. The way the instruction handles negative values is using twos complement of the desired number.

For example :

    To jump forward 10 instructions ( PC = PC + 10 ) then the "relative" address will be "00001010"

    To jump backward 10 instructions ( PC = PC + (- 10 )) then the "relative" address will be "11110110"

A test file ( fib.txt ) is provided to demonstrate how the simulator works. The test file calculates the fibonacci number for 10.

The Instruction Code Simulator will work for the following set of Instructions:

MOV Rn, direct	=> 0000
MOV direct, Rn  => 0001
MOV @Rn, Rm     => 0010
MOV Rn, #immed  => 0011
ADD Rn, Rm      => 0100
SUB Rn, Rm      => 0101
JZ Rn, relative => 0110















