# INEL 4206 - Microprocessors
# University of Puerto Rico Mayaguez
#
# Simulator of the Easy I processor studied in class
#
	.data	0x10000000	
etext:				# Easy I Text Segment
	.half	0x1800		# main:		AND	0
	.half	0x1C05		#		ADD	5
	.half	0x1C05		#		ADD	5
	.half	0x1C05		#		ADD	5
	.half	0x1C05		#		ADD	5
	.half	0x1C05		#		ADD	5
	.half   0x3C00		#		STOP
				# // Accumulator must hold 25
	.data	0x10010000	# Easy I Data Segment
edata:	.half   0x0
#	...
	.data	0x10020000	# Easy I Stack Segment
estack:
	.half	0x0
#	...
	.globl	main
	.text
#########################################################################
# Main									#
#########################################################################
main:
				# Initialize Easy I registers
	li	$s1, 0		# PC = 0
	li	$s3, 0		# AC = 0
	li	$s6, 0xFFFF	# SP = 0xFFFF
loop:
	jal	fetch
	jal	decode
	li	$t0, 0x000F	# End simulation if stop instruction found
	beq	$s2, $t0, end
#	...	
#	...			# procedures. May need to call fetchop
	bgt	$s0, $zero, nofetchop
	jal	fetchop
nofetchop:
#	...
#	...
#	...
	addiu	$s1, $s1, 2		# PC = PC + 2
	j	loop
end:
	jr	$ra
	
#########################################################################
# Fetch - Fills the instruction register wit the next instruction to be #
#         sumulated                                                     #
#########################################################################
fetch:
	la	$t0, etext
	addu	$t0, $t0, $s1
	lhu	$s0, 0($t0)
	jr	$ra

#########################################################################
# Decode -								#
#########################################################################
decode:
#	...
	jr	$ra
	
#########################################################################
# Add -									#
#########################################################################
fadd:
#	...
#	...
#	...
	jr	$ra

# Other procedures.
