forked from omk12001/cse4302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
.
- Loading branch information
Omer Khan
authored and
Omer Khan
committed
Sep 10, 2020
1 parent
f082e2a
commit de35b91
Showing
17 changed files
with
891 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
HEADERS = simulator.h | ||
|
||
default: simulator | ||
|
||
simulator.o: simulator.c $(HEADERS) | ||
gcc -c simulator.c -o simulator.o -ggdb -std=c99 | ||
|
||
simulator: simulator.o | ||
gcc simulator.o -o simulator -ggdb -std=c99 | ||
|
||
clean: | ||
-rm -f simulator.o | ||
-rm -f simulator | ||
-rm -f pipe_trace.txt *.out mdump.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
MIPS Simulator | ||
============== | ||
|
||
A simulator for the MIPS like Instruction Set, that translates machine code created from the assembler, and then executes the machine instructions. Each instruction goes through a Fetch, Decode, Execute, Memory and Writeback stage of processing. | ||
|
||
# Build | ||
$ make | ||
|
||
# RUN add.out assembler output file | ||
$ ./simulator add.out | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* | ||
* mipsInstructionMap.h | ||
* | ||
* Defines instructions as a hex value for comparison | ||
* | ||
* Modified by Omer Khan | ||
* | ||
*/ | ||
|
||
// R-Type Instructions | ||
#define RTYPEOP 0x0 | ||
#define ADD 0x20 | ||
#define SUB 0x21 | ||
#define AND 0x24 | ||
#define OR 0x25 | ||
#define SLL 0x0 | ||
#define SLT 0x2A | ||
#define SRL 0x2 | ||
#define JR 0x8 | ||
|
||
// I-Type Instructions | ||
#define LW 0x23 | ||
#define SW 0x2B | ||
#define ANDI 0xC | ||
#define ORI 0xD | ||
#define LUI 0xF | ||
#define BEQ 0x4 | ||
#define BNE 0x5 | ||
#define SLTI 0xA | ||
#define ADDI 0x8 | ||
|
||
// J-Type Instructions | ||
#define J 0x2 | ||
#define JAL 0x3 |
Oops, something went wrong.