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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [monitor/] [monitor/] [common/] [mmu.h] - Blame information for rev 268

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

Line No. Rev Author Line
1 59 hellwig
/*
2
 * mmu.h -- memory and TLB access
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 180 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 59 hellwig
 
25 180 hellwig
 
26 59 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);
35
Half mmuReadHalf(Word vAddr);
36
Byte mmuReadByte(Word vAddr);
37
void mmuWriteWord(Word vAddr, Word data);
38
void mmuWriteHalf(Word vAddr, Half data);
39
void mmuWriteByte(Word vAddr, Byte data);
40
 
41
Word mmuGetIndex(void);
42
void mmuSetIndex(Word value);
43
Word mmuGetEntryHi(void);
44
void mmuSetEntryHi(Word value);
45
Word mmuGetEntryLo(void);
46 84 hellwig
void mmuSetEntryLo(Word value);
47
Word mmuGetBadAddr(void);
48
void mmuSetBadAddr(Word value);
49 180 hellwig
Word mmuGetBadAccs(void);
50
void mmuSetBadAccs(Word value);
51 59 hellwig
 
52
TLB_Entry mmuGetTLB(int index);
53
void mmuSetTLB(int index, TLB_Entry tlbEntry);
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.