-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache-sim.h
More file actions
51 lines (47 loc) · 1.15 KB
/
cache-sim.h
File metadata and controls
51 lines (47 loc) · 1.15 KB
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
/*
* =====================================================================================
*
* Filename: cache-sim.h
*
* Description: Cache Simulator
*
* Version: 1.1
* Created: 04/22/2019 00:02:20
* Revision: 1.1 – 12/20/2021
* Version 1.1 expands the basic cache simulation infrastructure
* developed in version 1.0 to include support for an L2 cache,
* along with various other improvements and cleanup.
* Compiler: gcc
*
* Author: Gregory Giovannini (Student), gregory.giovannini@rutgers.edu
* Organization: Rutgers University
*
* =====================================================================================
*/
typedef struct line Line;
struct line
{
int valid;
unsigned long long int tag;
unsigned long int block;
unsigned long int usage;
};
typedef struct set Set;
struct set
{
int numItems;
Line *lines;
};
typedef struct cache Cache;
struct cache
{
Set *sets;
int size;
int blockSize;
int associativity;
int nSets;
};
int hash(unsigned long long int n, int size)
{
return n % size;
}