Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nayefc committed Mar 1, 2013
0 parents commit e79800c
Show file tree
Hide file tree
Showing 7 changed files with 1,167 additions and 0 deletions.
601 changes: 601 additions & 0 deletions .cproject

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Simulator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/Simulator/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
31 changes: 31 additions & 0 deletions add.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# The following program initializes an array of 10 elements and computes
# a running sum of all elements in the array. The program prints the sum
# of all the entries in the array.

.text
add $t0, $zero, $zero # i = 0
add $t4, $zero, $zero # initialize the sum to zero
add $t5, $zero, $zero # initialize temporary register to zero

la $a0, array # load address of array
la $a1, array_size # load address of array_size
lw $a1, 0($a1) # load value of array_size variable

loop:
sll $t1, $t0, 2 # t1 = (i * 4)
add $t2, $a0, $t1 # t2 contains address of array[i]
sw $t0, 0($t2) # array[i] = i

addi $t0, $t0, 1 # i = i+1
add $t4, $t4, $t0 # sum($t4) = ($t4 + array[i])

slt $t3, $t0, $a1 # $t3 = ( i < array_size)
bne $t3, $zero, loop # if ( i < array_size ) then loop

add $t5, $a0, $zero # save contents of $a0 in temporary reg $t5
nop # done.

.data
array: .word 0:10 # array of 10 words
array_size: .word 10 # size of array
message: .asciiz "The sum of numbers in array is: "
36 changes: 36 additions & 0 deletions mipsInstructionMap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
*
* mipsInstructionMap.h
*
* Defines instructions as a hex value for comparison
*
* author: Nayef Copty
* date: 11/11/11
*
*/

// R-Type Instructions
#define RTYPEOP 0x0
#define ADD 0x20
#define SUB 0x22
#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
Loading

0 comments on commit e79800c

Please sign in to comment.