mats+.s 897 Bytes
/************************************************************************
  This RSP program implements the improved Modified Algorithmic Test
  Sequence (MATS) memory test procedure for DMEM with wired-OR
  construction.
 ************************************************************************/

	.base 0x04001000

	nor	$31, $0,  $0

	ori	$30, $0,  1
	ori	$1,  $0,  0x0FF8
Step1:	sw	$0,  0 ($1)
	bgtz	$1,  Step1
	addi	$1,  $1,  0xFFFC

	ori	$30, $0,  2
	ori	$1,  $0,  0x0FFC
	sw	$31, 0 ($1)

	ori	$1,  $0,  0x0FF8
Step2:	lw	$2,  0 ($1)
	sw	$31, 0 ($1)
	bne	$2,  $0,  Fail
	nop
	bgtz	$1,  Step2
	addi	$1,  $1,  0xFFFC

	ori	$30, $0,  3
	ori	$1,  $0,  0x0FFC
Step3:	lw	$3,  0 ($1)
	sw	$0,  0 ($1)
	bne	$3,  $31, Fail
	addi	$1,  $1,  0xFFFC
	bgtz	$1,  Step3
	nop

	lw	$3,  0 ($1)
	bne	$3,  $31, Fail
	ori	$1,  $0,  0x0FFC
	lw	$2,  0 ($1)
	bne	$2,  $0,  Fail
	nop

	ori	$1,  $0,  0xFEED
Fail:	break