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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [monitor/] [monitor/] [common/] [mmu.h] - Diff between revs 59 and 84

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 59 Rev 84
/*
/*
 * mmu.h -- memory and TLB access
 * mmu.h -- memory and TLB access
 */
 */
 
 
 
 
#ifndef _MMU_H_
#ifndef _MMU_H_
#define _MMU_H_
#define _MMU_H_
 
 
 
 
#define TLB_SHFT        5               /* log2 of number of TLB entries */
#define TLB_SHFT        5               /* log2 of number of TLB entries */
#define TLB_SIZE        (1 << TLB_SHFT) /* total number of TLB entries */
#define TLB_SIZE        (1 << TLB_SHFT) /* total number of TLB entries */
#define TLB_MASK        (TLB_SIZE - 1)  /* mask for number of TLB entries */
#define TLB_MASK        (TLB_SIZE - 1)  /* mask for number of TLB entries */
#define TLB_FIXED       4               /* number of fixed TLB entries */
#define TLB_FIXED       4               /* number of fixed TLB entries */
 
 
#define TLB_WRITE       (1 << 1)        /* write bit in EntryLo */
#define TLB_WRITE       (1 << 1)        /* write bit in EntryLo */
#define TLB_VALID       (1 << 0)        /* valid bit in EntryLo */
#define TLB_VALID       (1 << 0)        /* valid bit in EntryLo */
 
 
 
 
typedef struct {
typedef struct {
  Word page;            /* 20 high-order bits of virtual address */
  Word page;            /* 20 high-order bits of virtual address */
  Word frame;           /* 20 high-order bits of physical address */
  Word frame;           /* 20 high-order bits of physical address */
  Bool write;           /* must be true to allow writing to the page */
  Bool write;           /* must be true to allow writing to the page */
  Bool valid;           /* must be true for the entry to be valid */
  Bool valid;           /* must be true for the entry to be valid */
} TLB_Entry;
} TLB_Entry;
 
 
 
 
Word mmuReadWord(Word vAddr);
Word mmuReadWord(Word vAddr);
Half mmuReadHalf(Word vAddr);
Half mmuReadHalf(Word vAddr);
Byte mmuReadByte(Word vAddr);
Byte mmuReadByte(Word vAddr);
void mmuWriteWord(Word vAddr, Word data);
void mmuWriteWord(Word vAddr, Word data);
void mmuWriteHalf(Word vAddr, Half data);
void mmuWriteHalf(Word vAddr, Half data);
void mmuWriteByte(Word vAddr, Byte data);
void mmuWriteByte(Word vAddr, Byte data);
 
 
Word mmuGetIndex(void);
Word mmuGetIndex(void);
void mmuSetIndex(Word value);
void mmuSetIndex(Word value);
Word mmuGetEntryHi(void);
Word mmuGetEntryHi(void);
void mmuSetEntryHi(Word value);
void mmuSetEntryHi(Word value);
Word mmuGetEntryLo(void);
Word mmuGetEntryLo(void);
void mmuSetEntryLo(Word Value);
void mmuSetEntryLo(Word value);
 
Word mmuGetBadAddr(void);
 
void mmuSetBadAddr(Word value);
 
 
TLB_Entry mmuGetTLB(int index);
TLB_Entry mmuGetTLB(int index);
void mmuSetTLB(int index, TLB_Entry tlbEntry);
void mmuSetTLB(int index, TLB_Entry tlbEntry);
 
 
 
 
#endif /* _MMU_H_ */
#endif /* _MMU_H_ */
 
 

powered by: WebSVN 2.1.0

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