-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcache.h
63 lines (38 loc) · 850 Bytes
/
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
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// cache.h
// Cache_simulator1
//
// Created by Dheeraj Kumar Ramchandani on 04/06/20.
// Copyright © 2020 Dheeraj Kumar Ramchandani. All rights reserved.
//
#ifndef cache_h
#define cache_h
#include <stdio.h>
// basic structure for cache
typedef struct
{
unsigned int tag;
int min_block, max_block;
int valid, dirty, priority;
}Line;
typedef struct
{
int cachesize;
int block_size;
int cache_lines;
int associativity;
int replace_algo;
int write_policy;
}Cache;
// basic structure for a line of the cache
typedef struct {
Line* baseLine;
int size;
} Set;
// statistics about the use of the cache
typedef struct
{
int hits, misses, reads, writes;
} statistics;
int simulate( Cache *cache, const char *tracefile, statistics *stat );
#endif /* cache_h */