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

Subversion Repositories eco32

[/] [eco32/] [tags/] [eco32-0.24/] [sim/] [mmu.h] - Blame information for rev 211

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 hellwig
/*
2
 * mmu.h -- MMU simulation
3
 */
4
 
5
 
6
#ifndef _MMU_H_
7
#define _MMU_H_
8
 
9
 
10
#define TLB_SHFT        5               /* log2 of number of TLB entries */
11
#define TLB_SIZE        (1 << TLB_SHFT) /* total number of TLB entries */
12
#define TLB_MASK        (TLB_SIZE - 1)  /* mask for number of TLB entries */
13
#define TLB_FIXED       4               /* number of fixed TLB entries */
14
 
15
#define TLB_WRITE       (1 << 1)        /* write bit in EntryLo */
16
#define TLB_VALID       (1 << 0)        /* valid bit in EntryLo */
17
 
18 168 hellwig
#define MMU_ACCS_MASK   0x07            /* bits used in BadAccs */
19
#define MMU_ACCS_READ   0x00            /* access type = read */
20
#define MMU_ACCS_WRITE  0x04            /* access type = write */
21
#define MMU_ACCS_BYTE   0x00            /* access width = byte */
22
#define MMU_ACCS_HALF   0x01            /* access width = half */
23
#define MMU_ACCS_WORD   0x02            /* access width = word */
24 8 hellwig
 
25 168 hellwig
 
26 8 hellwig
typedef struct {
27
  Word page;            /* 20 high-order bits of virtual address */
28
  Word frame;           /* 20 high-order bits of physical address */
29
  Bool write;           /* must be true to allow writing to the page */
30
  Bool valid;           /* must be true for the entry to be valid */
31
} TLB_Entry;
32
 
33
 
34
Word mmuReadWord(Word vAddr, Bool userMode);
35
Half mmuReadHalf(Word vAddr, Bool userMode);
36
Byte mmuReadByte(Word vAddr, Bool userMode);
37
void mmuWriteWord(Word vAddr, Word data, Bool userMode);
38
void mmuWriteHalf(Word vAddr, Half data, Bool userMode);
39
void mmuWriteByte(Word vAddr, Byte data, Bool userMode);
40
 
41
Word mmuGetIndex(void);
42
void mmuSetIndex(Word value);
43
Word mmuGetEntryHi(void);
44
void mmuSetEntryHi(Word value);
45
Word mmuGetEntryLo(void);
46
void mmuSetEntryLo(Word value);
47
Word mmuGetBadAddr(void);
48
void mmuSetBadAddr(Word value);
49 168 hellwig
Word mmuGetBadAccs(void);
50
void mmuSetBadAccs(Word value);
51 8 hellwig
 
52
void mmuTbs(void);
53
void mmuTbwr(void);
54
void mmuTbri(void);
55
void mmuTbwi(void);
56
 
57
TLB_Entry mmuGetTLB(int index);
58
void mmuSetTLB(int index, TLB_Entry tlbEntry);
59
 
60
void mmuReset(void);
61
void mmuInit(void);
62
void mmuExit(void);
63
 
64
 
65
#endif /* _MMU_H_ */

powered by: WebSVN 2.1.0

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