| 1 |
19 |
jeremybenn |
/* dmmu.h -- Data MMU header file
|
| 2 |
|
|
|
| 3 |
|
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
| 4 |
|
|
Copyright (C) 2008 Embecosm Limited
|
| 5 |
|
|
|
| 6 |
|
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
| 7 |
|
|
|
| 8 |
|
|
This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
|
| 9 |
|
|
|
| 10 |
|
|
This program is free software; you can redistribute it and/or modify it
|
| 11 |
|
|
under the terms of the GNU General Public License as published by the Free
|
| 12 |
|
|
Software Foundation; either version 3 of the License, or (at your option)
|
| 13 |
|
|
any later version.
|
| 14 |
|
|
|
| 15 |
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
| 16 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 17 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
| 18 |
|
|
more details.
|
| 19 |
|
|
|
| 20 |
|
|
You should have received a copy of the GNU General Public License along
|
| 21 |
|
|
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
| 22 |
|
|
|
| 23 |
|
|
/* This program is commented throughout in a fashion suitable for processing
|
| 24 |
|
|
with Doxygen. */
|
| 25 |
|
|
|
| 26 |
|
|
|
| 27 |
|
|
#ifndef DMMU__H
|
| 28 |
|
|
#define DMMU__H
|
| 29 |
|
|
|
| 30 |
|
|
/* Package includes */
|
| 31 |
|
|
#include "sim-config.h"
|
| 32 |
|
|
|
| 33 |
|
|
struct dmmu
|
| 34 |
|
|
{
|
| 35 |
|
|
int enabled; /* Whether DMMU is enabled */
|
| 36 |
|
|
int nways; /* Number of DTLB ways */
|
| 37 |
|
|
int nsets; /* Number of DTLB sets */
|
| 38 |
|
|
int pagesize; /* DTLB page size */
|
| 39 |
|
|
int pagesize_log2; /* DTLB page size (log2(pagesize)) */
|
| 40 |
|
|
oraddr_t page_offset_mask; /* Address mask to get page offset */
|
| 41 |
|
|
oraddr_t page_mask; /* Page number mask (diff. from vpn) */
|
| 42 |
|
|
oraddr_t vpn_mask; /* Address mask to get vpn */
|
| 43 |
|
|
int lru_reload; /* What to reload the lru value to */
|
| 44 |
|
|
oraddr_t set_mask; /* Mask to get set of an address */
|
| 45 |
|
|
int entrysize; /* DTLB entry size */
|
| 46 |
|
|
int ustates; /* number of DTLB usage states */
|
| 47 |
|
|
int missdelay; /* How much cycles does the miss cost */
|
| 48 |
|
|
int hitdelay; /* How much cycles does the hit cost */
|
| 49 |
|
|
};
|
| 50 |
|
|
|
| 51 |
|
|
#define DADDR_PAGE(addr) ((addr) & dmmu_state->page_mask)
|
| 52 |
|
|
|
| 53 |
|
|
/* FIXME: Remove the need for this global */
|
| 54 |
|
|
extern struct dmmu *dmmu_state;
|
| 55 |
|
|
|
| 56 |
|
|
/* Prototypes for external use */
|
| 57 |
|
|
extern oraddr_t dmmu_translate (oraddr_t virtaddr,
|
| 58 |
|
|
int write_access);
|
| 59 |
|
|
extern oraddr_t dmmu_simulate_tlb (oraddr_t virtaddr,
|
| 60 |
|
|
int write_access);
|
| 61 |
|
|
extern oraddr_t peek_into_dtlb (oraddr_t virtaddr,
|
| 62 |
|
|
int write_access,
|
| 63 |
|
|
int through_dc);
|
| 64 |
|
|
extern void reg_dmmu_sec ();
|
| 65 |
|
|
|
| 66 |
|
|
#endif /* DMMU__H */
|