URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 63 |
Rev 462 |
Line 29... |
Line 29... |
#ifndef MEM_CACHE__H
|
#ifndef MEM_CACHE__H
|
#define MEM_CACHE__H
|
#define MEM_CACHE__H
|
|
|
#include <stdint.h>
|
#include <stdint.h>
|
|
|
|
|
//! Module for cacheing memory accesses by the debug unit
|
//! Module for cacheing memory accesses by the debug unit
|
|
|
//! Memory reads and writes through the Debug Unit via JTAG are time
|
//! Memory reads and writes through the Debug Unit via JTAG are time
|
//! consuming - of the order of 1000 CPU clock cycles. However when the
|
//! consuming - of the order of 1000 CPU clock cycles. However when the
|
//! processor is stalled the values cannot change, other than through the
|
//! processor is stalled the values cannot change, other than through the
|
Line 44... |
Line 43... |
//! a closed hash table.
|
//! a closed hash table.
|
|
|
//! In the event of a clash on write, the old value is replaced by the new
|
//! In the event of a clash on write, the old value is replaced by the new
|
//! value.
|
//! value.
|
|
|
class MemCache
|
class MemCache {
|
{
|
|
public:
|
public:
|
|
|
// Constructor and destructor
|
// Constructor and destructor
|
MemCache (int _tableSize = 1009);
|
MemCache (int _tableSize = 1009);
|
~MemCache ();
|
~MemCache ();
|
|
|
// Functions
|
// Functions
|
void clear ();
|
void clear ();
|
void write (uint32_t addr,
|
void write(uint32_t addr, uint32_t value);
|
uint32_t value);
|
bool read(uint32_t addr, uint32_t & value);
|
bool read (uint32_t addr,
|
|
uint32_t &value);
|
|
|
|
private:
|
private:
|
|
|
//! The size of the hash table. A prime number is a good choice.
|
//! The size of the hash table. A prime number is a good choice.
|
int tableSize;
|
int tableSize;
|
Line 70... |
Line 66... |
// allowing unambiguous clearing by use of memset for efficiency.
|
// allowing unambiguous clearing by use of memset for efficiency.
|
bool *tabIsValid;
|
bool *tabIsValid;
|
uint32_t *tabKeyAddr;
|
uint32_t *tabKeyAddr;
|
uint32_t *tabValue;
|
uint32_t *tabValue;
|
|
|
|
|
}; // MemCache ()
|
}; // MemCache ()
|
|
|
#endif // MEM_CACHE__H
|
#endif // MEM_CACHE__H
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.