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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [orp/] [orp_soc/] [sw.old/] [mmu/] [dmmu.S] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 782 lampret
/* Basic instruction set test */
2
#include "../support/spr_defs.h"
3
 
4
.global _main
5
.global _buserr_except
6
.global _dpf_except
7
.global _ipf_except
8
.global _lpint_except
9
.global _align_except
10
.global _illegal_except
11
.global _hpint_except
12
.global _dtlbmiss_except
13
.global _itlbmiss_except
14
.global _range_except
15
.global _syscall_except
16
.global _res1_except
17
.global _trap_except
18
.global _res2_except
19
 
20
_buserr_except:
21
_ipf_except:
22
_lpint_except:
23
_align_except:
24
_illegal_except:
25
_hpint_except:
26
_itlbmiss_except:
27
_range_except:
28
_syscall_except:
29
_res1_except:
30
_trap_except:
31
_res2_except:
32
        l.nop
33
        l.ori   r3,r0,0xeeee
34
        l.jal   _report
35
        l.nop
36
        l.jal   _exit
37
        l.nop
38
 
39
_dpf_except:
40
        l.addi  r14,r0,64
41
        l.movhi r5,hi(0x80000000|SPR_DTLBMR_V)
42
        l.ori   r5,r5,lo(0x80000000|SPR_DTLBMR_V)
43
        l.mtspr r0,r5,SPR_DTLBMR_BASE(0)
44
        l.movhi r5,hi(0x80100000|SPR_DTLBTR_SWE|SPR_DTLBTR_SRE)
45
        l.ori   r5,r5,lo(0x80100000|SPR_DTLBTR_SWE|SPR_DTLBTR_SRE)
46
        l.mtspr r0,r5,SPR_DTLBTR_BASE(0)
47
        l.rfe
48
        l.nop
49
 
50
_dtlbmiss_except:
51
        // Valid entry, but no load/store access
52
        l.addi  r13,r0,128
53
        l.movhi r5,hi(0x80000000|SPR_DTLBMR_V)
54
        l.ori   r5,r5,lo(0x80000000|SPR_DTLBMR_V)
55
        l.mtspr r0,r5,SPR_DTLBMR_BASE(0)
56
        l.ori   r5,r0,0
57
        l.mtspr r0,r5,SPR_DTLBTR_BASE(0)
58
        l.rfe
59
        l.nop
60
 
61
//
62
// r4, r5       - used by exception handlers
63
// r7, r8       - used by main for setting TLB
64
// r10          - data pointer to magic words
65
// r11          - accumulator of magic words
66
// r12          - for loading/storing magic words
67
// r13, r14     - used ONLY by exception handlers for magic words
68
 
69
_main:
70
        l.nop
71
        l.addi  r11,r0,1
72
        l.addi  r12,r0,1024
73
        l.movhi r10,hi(0x80100000)
74
        l.ori   r10,r10,lo(0x80100000)
75
        l.sw    0(r10),r12
76
        l.addi  r12,r0,1
77
        l.movhi r10,hi(0x80000000)
78
        l.ori   r10,r10,lo(0x80000000)
79
        l.sw    0(r10),r12
80
 
81
        // Invalidate entry
82
        l.movhi r7,hi(0x80010000)
83
        l.mtspr r0,r7,SPR_DTLBMR_BASE(0)
84
        l.ori   r7,r0,0
85
        l.mtspr r0,r7,SPR_DTLBTR_BASE(0)
86
 
87
        // Enable DMMU
88
        l.ori   r8,r0,SPR_SR_DME
89
        l.mfspr r7,r0,SPR_SR
90
        l.or    r7,r7,r8
91
        l.mtspr r0,r7,SPR_SR
92
 
93
        // Invoke DTLB miss and DPF exceptions
94
        l.sw    32(r10),r7
95
 
96
        // Magic word read
97
        l.add   r12,r0,r0
98
        l.lwz   r12,0(r10)
99
        l.add   r11,r11,r12
100
        l.add   r11,r11,r13
101
        l.add   r11,r11,r14
102
 
103
        // Set cache inhibit (CI) bit
104
        l.movhi r5,hi(0x80100000|SPR_DTLBTR_SWE|SPR_DTLBTR_SRE)
105
        l.ori   r5,r5,lo(0x80100000|SPR_DTLBTR_SWE|SPR_DTLBTR_SRE)
106
        l.mtspr r0,r5,SPR_DTLBTR_BASE(0)
107
 
108
        // Read from external memory (must be checked manually)
109
        l.lwz   r12,32(r10)
110
 
111
        // Exit
112
        l.nop
113
        l.movhi r12,hi(0xdeadda6c)
114
        l.ori   r12,r12,lo(0xdeadda6c)
115
        l.xor   r3,r11,r12
116
        l.jal   _report
117
        l.nop
118
        l.jal   _exit
119
        l.nop
120
        l.nop
121
 

powered by: WebSVN 2.1.0

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