-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcache_mapper_header.h
34 lines (32 loc) · 1.03 KB
/
cache_mapper_header.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
#ifndef cm
#define cm
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
class cache_mock
{
private:
long int desc; // 0 - Set_Associative, 1 - Direct Mapping, 2 - Associative
long int cache_size;
long int mem_size;
long int block_size;
long int set_size;
long int no_sets;
long int lru; //when lru=0, fifo is followed
vector<vector<long int>> container;
long int find_hierarchy_min(long int set);
long int find_hierarchy_max(long int set);
public:
cache_mock(long int, long int, long int, long int, long int = 1, long int = 0);
cache_mock();
void cache_mock_copy(cache_mock &);
void container_init(); // can be used to clear cache data too
void container_display(); //diplays cache mainframe
long int loader(long int); //when data is to be loaded to the processor
long int storer(long int); //when data is to be stored by the processor
long int refresh_dirty(); // refreshes all dirty_bits to 0
~cache_mock();
};
#endif