OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [hwtests/] [memtest2/] [memtest2.s] - Rev 294

Go to most recent revision | Compare with Previous | Blame | View Log

;
; memtest2.s -- memory test
;
 
; $2 temporary
; $3 tbl address
; $4 mem address
; $5 tbl count
; $6 mem count
; $7 error
; $8 I/O base
; $9 value read
; $10 reference value
 
	.set	mem_base,0xC0000000
	.set	mem_size,1024*1024
	.set	io_base,0xF0300000
 
	;
	; write memory
	;
write:
	add	$4,$0,mem_base
	add	$6,$0,mem_size
	add	$3,$0,tbl
	add	$5,$0,257
wrloop:
	ldbu	$2,$3,0
	stb	$2,$4,0
	add	$3,$3,1
	sub	$5,$5,1
	bne	$5,$0,wrloop1
	add	$3,$0,tbl
	add	$5,$0,257
wrloop1:
	add	$4,$4,1
	sub	$6,$6,1
	bne	$6,$0,wrloop
	;
	; read memory
	;
read:
	add	$4,$0,mem_base
	add	$6,$0,mem_size
	add	$3,$0,tbl
	add	$5,$0,257
	add	$7,$0,0
rdloop:
	; always check byte
byte:
	ldbu	$9,$4,0
	ldbu	$10,$3,0
	beq	$9,$10,byteok
	add	$7,$0,1
byteok:
	; possibly check halfword
half:
	and	$2,$4,1
	bne	$2,$0,halfok
	ldhu	$9,$4,0
	ldbu	$10,$3,0
	jal	shft8
	ldbu	$2,$3,1
	or	$10,$10,$2
	beq	$9,$10,halfok
	add	$7,$0,1
halfok:
	; possibly check word
word:
	and	$2,$4,3
	bne	$2,$0,wordok
	ldw	$9,$4,0
	ldbu	$10,$3,0
	jal	shft8
	ldbu	$2,$3,1
	or	$10,$10,$2
	jal	shft8
	ldbu	$2,$3,2
	or	$10,$10,$2
	jal	shft8
	ldbu	$2,$3,3
	or	$10,$10,$2
	beq	$9,$10,wordok
	add	$7,$0,1
wordok:
	; next address
	add	$3,$3,1
	sub	$5,$5,1
	bne	$5,$0,rdloop1
	add	$3,$0,tbl
	add	$5,$0,257
rdloop1:
	add	$4,$4,1
	sub	$6,$6,1
	bne	$6,$0,rdloop
	;
	; show result
	;
	bne	$7,$0,error
ok:
	add	$7,$0,'.'
	jal	out
	j	halt
error:
	add	$7,$0,'?'
	jal	out
	j 	halt
	;
	; finally, halt
	;
halt:
	j	halt
 
shft8:
	add	$10,$10,$10
	add	$10,$10,$10
	add	$10,$10,$10
	add	$10,$10,$10
	add	$10,$10,$10
	add	$10,$10,$10
	add	$10,$10,$10
	add	$10,$10,$10
	jr	$31
 
out:
	add	$8,$0,io_base
out1:
	ldw	$9,$8,8
	and	$9,$9,1
	beq	$9,$0,out1
	stw	$7,$8,12
	jr	$31
 
tbl:
	.byte	0x45,0x23,0x98,0x48,0xDC,0x5C,0x94,0x58
	.byte	0x1F,0x7C,0x58,0xD7,0x41,0x1E,0xA9,0xE1
	.byte	0x00,0x62,0x08,0x27,0x23,0xE9,0xCD,0x43
	.byte	0x0F,0x25,0xF9,0x72,0xC2,0xD7,0xC4,0x07
	.byte	0xFB,0x5D,0x50,0xD7,0xBA,0xE4,0x30,0xD9
	.byte	0x61,0x89,0xB1,0xA3,0xA8,0x5A,0x84,0xA8
	.byte	0xBD,0x8C,0xD0,0xE0,0x76,0x9E,0x24,0x86
	.byte	0xC4,0x1D,0xF8,0x86,0xF5,0xBD,0x8D,0xF0
	.byte	0x1A,0xDD,0xC8,0xD4,0xC2,0xF8,0xAD,0x23
	.byte	0x82,0x5F,0xC6,0x2A,0xB9,0x4A,0xD3,0x77
	.byte	0xD7,0xA4,0x58,0x4E,0x42,0x7C,0xD4,0x06
	.byte	0x9A,0xCC,0x8D,0x8F,0x89,0x1B,0x7F,0xA4
	.byte	0xF9,0x48,0x78,0xBB,0x40,0x26,0xDE,0xC3
	.byte	0x85,0xA5,0xED,0x3F,0xF0,0xC1,0xB7,0xC7
	.byte	0x65,0x0F,0x15,0xA8,0x8C,0xE9,0xAF,0x26
	.byte	0xB6,0x3C,0xB6,0x40,0x57,0x35,0xE4,0x50
	.byte	0x7E,0x5D,0x0B,0xBF,0x84,0xEA,0x82,0x0A
	.byte	0x8F,0x70,0x4A,0x7F,0x31,0x02,0x47,0x96
	.byte	0x12,0x5D,0x3F,0x9E,0x47,0xEE,0xC5,0xFD
	.byte	0x2B,0x7B,0x3E,0x82,0xB1,0x23,0xD3,0x2F
	.byte	0x81,0xDF,0xEE,0x06,0xCA,0x70,0x11,0x59
	.byte	0xE0,0x5B,0xD9,0x11,0x5E,0x21,0xA8,0x70
	.byte	0x7E,0xE7,0x0E,0xC5,0xD6,0xD4,0xC3,0x01
	.byte	0x4F,0x01,0x84,0x01,0x24,0x57,0x30,0xA5
	.byte	0x37,0x1E,0xAC,0x01,0x8F,0xBD,0x5A,0x70
	.byte	0x18,0x34,0x82,0x77,0x55,0x2A,0xE7,0xD3
	.byte	0x12,0xF6,0x99,0xE8,0xCA,0x5C,0xEA,0x1A
	.byte	0x5D,0x6E,0x1B,0x82,0xC5,0x4B,0x28,0xFD
	.byte	0x6A,0xD4,0xFE,0xFA,0x91,0x59,0x6A,0xAA
	.byte	0x8D,0xEC,0x21,0xE3,0x17,0x09,0xB7,0x29
	.byte	0xFF,0x50,0x12,0xC9,0xAC,0xFC,0xE3,0x0A
	.byte	0x6B,0xFF,0x8D,0x31,0x4A,0xB5,0x2E,0xB5
	.byte	0x8A
augment:
	.byte	0x45,0x23,0x98
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.