-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcache.h
50 lines (37 loc) · 1.06 KB
/
cache.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef CACHE_H
#define CACHE_H
#include <systemc.h>
#include <iostream>
#define uint8_t unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
class Cache_Direct_mapped
{
private:
/**
Address :
[ 7:2 ] [ 1:0 ]
--------------------------------------------------------
| | |
| Tag | Index |
| | |
--------------------------------------------------------
Block :
[15] [14] [ 13:8 ] [ 7:0 ]
---------------------------------------------------------
| | | | |
| NC | Valid | Tag | DATA ( 1-Byte per word ) |
| | | | |
----------------------------------------------------------
**/
uint8_t *Address;
uint16_t *Block;
public:
void Cache_write( uint8_t addr, uint8_t data );
uint8_t Cache_fetch( uint8_t addr );
Cache_Direct_mapped( uint16_t *block );
int hit_cnt_core;
int access_cnt_core;
//~Cache_Direct_mapped();
};
#endif //CACHE_H