1 |
62 |
lampret |
/* dmmu.h -- Data MMU header file
|
2 |
6 |
lampret |
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
3 |
|
|
|
4 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
(at your option) any later version.
|
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful,
|
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with this program; if not, write to the Free Software
|
18 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
19 |
1718 |
nogj |
|
20 |
|
|
/* FIXME: Move to dmmu.c once the dust settles */
|
21 |
|
|
struct dmmu {
|
22 |
|
|
int enabled; /* Whether DMMU is enabled */
|
23 |
|
|
int nways; /* Number of DTLB ways */
|
24 |
|
|
int nsets; /* Number of DTLB sets */
|
25 |
|
|
int pagesize; /* DTLB page size */
|
26 |
|
|
int pagesize_log2; /* DTLB page size (log2(pagesize)) */
|
27 |
|
|
oraddr_t page_offset_mask; /* Address mask to get page offset */
|
28 |
|
|
oraddr_t page_mask; /* Page number mask (diff. from vpn) */
|
29 |
|
|
oraddr_t vpn_mask; /* Address mask to get vpn */
|
30 |
|
|
int lru_reload; /* What to reload the lru value to */
|
31 |
|
|
oraddr_t set_mask; /* Mask to get set of an address */
|
32 |
|
|
int entrysize; /* DTLB entry size */
|
33 |
|
|
int ustates; /* number of DTLB usage states */
|
34 |
|
|
int missdelay; /* How much cycles does the miss cost */
|
35 |
|
|
int hitdelay; /* How much cycles does the hit cost */
|
36 |
|
|
};
|
37 |
|
|
#define DADDR_PAGE(addr) ((addr) & dmmu_state->page_mask)
|
38 |
|
|
/* FIXME: Remove the need for this global */
|
39 |
|
|
extern struct dmmu *dmmu_state;
|
40 |
|
|
|
41 |
1350 |
nogj |
oraddr_t dmmu_translate(oraddr_t virtaddr, int write_access);
|
42 |
|
|
oraddr_t dmmu_simulate_tlb(oraddr_t virtaddr, int write_access);
|
43 |
|
|
oraddr_t peek_into_dtlb(oraddr_t virtaddr, int write_access, int through_dc);
|