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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [sim/] [mmu.h] - Blame information for rev 17

Go to most recent revision | 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
 
19
typedef struct {
20
  Word page;            /* 20 high-order bits of virtual address */
21
  Word frame;           /* 20 high-order bits of physical address */
22
  Bool write;           /* must be true to allow writing to the page */
23
  Bool valid;           /* must be true for the entry to be valid */
24
} TLB_Entry;
25
 
26
 
27
Word mmuReadWord(Word vAddr, Bool userMode);
28
Half mmuReadHalf(Word vAddr, Bool userMode);
29
Byte mmuReadByte(Word vAddr, Bool userMode);
30
void mmuWriteWord(Word vAddr, Word data, Bool userMode);
31
void mmuWriteHalf(Word vAddr, Half data, Bool userMode);
32
void mmuWriteByte(Word vAddr, Byte data, Bool userMode);
33
 
34
Word mmuGetIndex(void);
35
void mmuSetIndex(Word value);
36
Word mmuGetEntryHi(void);
37
void mmuSetEntryHi(Word value);
38
Word mmuGetEntryLo(void);
39
void mmuSetEntryLo(Word value);
40
Word mmuGetBadAddr(void);
41
void mmuSetBadAddr(Word value);
42
 
43
void mmuTbs(void);
44
void mmuTbwr(void);
45
void mmuTbri(void);
46
void mmuTbwi(void);
47
 
48
TLB_Entry mmuGetTLB(int index);
49
void mmuSetTLB(int index, TLB_Entry tlbEntry);
50
 
51
void mmuReset(void);
52
void mmuInit(void);
53
void mmuExit(void);
54
 
55
 
56
#endif /* _MMU_H_ */

powered by: WebSVN 2.1.0

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