File: exc001.u

package info (click to toggle)
alliance 5.0-20120515-6
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 70,324 kB
  • ctags: 39,977
  • sloc: ansic: 350,299; vhdl: 34,227; yacc: 27,122; sh: 12,416; cpp: 9,478; makefile: 7,057; lex: 3,684
file content (61 lines) | stat: -rw-r--r-- 1,764 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

;  ###----------------------------------------------------------------###
;  # file	: exc001.u						#
;  # date	: Mar 26 1996						#
;  # descr.	: functional test for mips				#
;  ###----------------------------------------------------------------###

	;  ###--------------------------------------------------------###
	;  #   exceptions :						#
	;  #     - data address miss alignment (when storing a word)	#
	;  ###--------------------------------------------------------###

adr		.equ	0x40000050
data		.equ	0x9043ad6b		; data

		.org	0x00400000
		.start	init

init:
		loadi	r31, back_from_exception
		loadi	r1 , adr		; word's address in r1
		loadi	r2 , data		; data in r2
		loadi	r3 , data		; same data in r3
		loadi	r4 , data ^ 0xffffffff	; complemented data in r4

	;  ###--------------------------------------------------------###
	;  #   store the word to initialize the memory location		#
	;  ###--------------------------------------------------------###

		sw	r2, 0 (r1 )
		sw	r2, 4 (r1 )

	;  ###--------------------------------------------------------###
	;  #   store word at a miss aligned address			#
	;  ###--------------------------------------------------------###

		sw	r4, 1 (r1 ) 			; EXCEPTION (alignment)

	;  ###--------------------------------------------------------###
	;  #   after returning from exception, read the memory location #
	;  # and check that the faulty store word has not modified the	#
	;  # memory							#
	;  ###--------------------------------------------------------###

back_from_exception:
		lw	r5 , 0 (r1 )
		bne	r5,r3, bad
		nop
		lw	r5 , 4 (r1 )
		bne	r5,r3, bad
		nop
		j	good
		nop

		.org	0x004000d0
good:		j	good
		nop
bad:		j	bad
		nop
		.end